fixed reveal in project

This commit is contained in:
itsmattkc
2018-12-24 23:33:23 +11:00
parent abff5da67b
commit 06ca2bdfcd
3 changed files with 9 additions and 8 deletions
+6 -6
View File
@@ -726,23 +726,25 @@ Media* Project::get_selected_folder() {
return NULL;
}
bool Project::reveal_media(void *media, QModelIndex parent) {
bool Project::reveal_media(Media *media, QModelIndex parent) {
for (int i=0;i<project_model.rowCount(parent);i++) {
const QModelIndex& item = project_model.index(i, 0, parent);
Media* m = project_model.getItem(item);
if (m->get_type() == MEDIA_TYPE_FOLDER) {
if (reveal_media(media, item)) return true;
} else if (m->to_object() == media) {
} else if (m == media) {
// expand all folders leading to this media
QModelIndex hierarchy = item.parent();
QModelIndex sorted_index = sorter->mapFromSource(item);
QModelIndex hierarchy = sorted_index.parent();
while (hierarchy.isValid()) {
tree_view->setExpanded(hierarchy, true);
hierarchy = hierarchy.parent();
}
// select item
tree_view->selectionModel()->select(item, QItemSelectionModel::Select);
tree_view->selectionModel()->select(sorted_index, QItemSelectionModel::Select);
return true;
}
@@ -1075,11 +1077,9 @@ void Project::clear_recent_projects() {
void Project::set_icon_view_size(int s) {
icon_view->setIconSize(QSize(s, s));
// icon_view->setGridSize(QSize(s, s));
}
void Project::set_up_dir_enabled() {
dout << icon_view->rootIndex().isValid();
directory_up->setEnabled(icon_view->rootIndex().isValid());
}
+1 -1
View File
@@ -54,7 +54,7 @@ public:
void process_file_list(QStringList& files, bool recursive = false, Media* replace = NULL, Media *parent = NULL);
void replace_media(Media* item, QString filename);
Media *get_selected_folder();
bool reveal_media(void* media, QModelIndex parent = QModelIndex());
bool reveal_media(Media *media, QModelIndex parent = QModelIndex());
void add_recent_project(QString url);
void new_project();
+2 -1
View File
@@ -19,6 +19,7 @@ class TimelineAction;
class QScrollBar;
class SetSelectionsCommand;
class QPainter;
class Media;
bool same_sign(int a, int b);
void draw_waveform(Clip* clip, FootageStream* ms, long media_length, QPainter* p, const QRect& clip_rect, int waveform_start, int waveform_limit, double zoom);
@@ -65,7 +66,7 @@ private:
// used for "right click ripple"
long rc_ripple_min;
long rc_ripple_max;
void* rc_reveal_media;
Media* rc_reveal_media;
QTimer tooltip_timer;
int tooltip_clip;