project: auto-select imported files

This commit is contained in:
itsmattkc
2022-07-26 11:39:35 -07:00
parent f6dc3c7fcc
commit 15a67bc12a
8 changed files with 50 additions and 5 deletions
+2
View File
@@ -586,6 +586,8 @@ void Core::ImportTaskComplete(Task* task)
}
undo_stack_.pushIfHasChildren(command);
main_window_->SelectFootage(import_task->GetImportedFootage());
}
bool Core::ConfirmImageSequence(const QString& filename)
+15
View File
@@ -73,6 +73,21 @@ bool Folder::ChildExistsWithName(const QString &s) const
return ChildExistsWithNameInternal(this, s);
}
bool Folder::HasChildRecursive(Node *child) const
{
for (Node *i : item_children_) {
if (i == child) {
return true;
} else if (Folder *f = dynamic_cast<Folder*>(i)) {
if (f->HasChildRecursive(child)) {
return true;
}
}
}
return false;
}
int Folder::index_of_child_in_array(Node *item) const
{
int index_of_item = item_children_.indexOf(item);
+2
View File
@@ -65,6 +65,8 @@ public:
bool ChildExistsWithName(const QString& s) const;
bool HasChildRecursive(Node *child) const;
int item_child_count() const
{
return item_children_.size();
+2 -2
View File
@@ -52,9 +52,9 @@ public:
ProjectViewModel* model() const;
bool SelectItem(Node *n)
bool SelectItem(Node *n, bool deselect_all_first = true)
{
return explorer_->SelectItem(n);
return explorer_->SelectItem(n, deselect_all_first);
}
virtual void SelectAll() override;
@@ -653,9 +653,11 @@ void ProjectExplorer::DeleteSelected()
}
}
bool ProjectExplorer::SelectItem(Node *n)
bool ProjectExplorer::SelectItem(Node *n, bool deselect_all_first)
{
DeselectAll();
if (deselect_all_first) {
DeselectAll();
}
QModelIndex index = model_.CreateIndexFromItem(n);
+1 -1
View File
@@ -85,7 +85,7 @@ public:
void DeleteSelected();
bool SelectItem(Node *n);
bool SelectItem(Node *n, bool deselect_all_first = true);
public slots:
void set_view_type(ProjectToolbar::ViewType type);
+20
View File
@@ -410,6 +410,16 @@ void MainWindow::SetApplicationProgressValue(int value)
#endif
}
void MainWindow::SelectFootage(const QVector<Footage *> &e)
{
for (ProjectPanel *p : project_panels_) {
SelectFootageForProjectPanel(e, p);
}
for (ProjectPanel *p : folder_panels_) {
SelectFootageForProjectPanel(e, p);
}
}
void MainWindow::closeEvent(QCloseEvent *e)
{
// Try to close all projects (this will return false if the user chooses not to close)
@@ -759,6 +769,16 @@ void MainWindow::UpdateNodePanelContextFromTimelinePanel(TimelinePanel *panel)
param_panel_->SetContexts(context);
}
void MainWindow::SelectFootageForProjectPanel(const QVector<Footage *> &e, ProjectPanel *p)
{
p->DeselectAll();
for (Footage *f : e) {
if (p->get_root()->HasChildRecursive(f)) {
p->SelectItem(f, false);
}
}
}
void MainWindow::FocusedPanelChanged(PanelWidget *panel)
{
// Update audio monitor panel
+4
View File
@@ -92,6 +92,8 @@ public:
*/
void SetApplicationProgressValue(int value);
void SelectFootage(const QVector<Footage*> &e);
public slots:
void ProjectOpen(Project *p);
@@ -142,6 +144,8 @@ private:
void UpdateNodePanelContextFromTimelinePanel(TimelinePanel *panel);
void SelectFootageForProjectPanel(const QVector<Footage*> &e, ProjectPanel *p);
QByteArray premaximized_state_;
// Standard panels