project: auto-select imported files
This commit is contained in:
@@ -586,6 +586,8 @@ void Core::ImportTaskComplete(Task* task)
|
|||||||
}
|
}
|
||||||
|
|
||||||
undo_stack_.pushIfHasChildren(command);
|
undo_stack_.pushIfHasChildren(command);
|
||||||
|
|
||||||
|
main_window_->SelectFootage(import_task->GetImportedFootage());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Core::ConfirmImageSequence(const QString& filename)
|
bool Core::ConfirmImageSequence(const QString& filename)
|
||||||
|
|||||||
@@ -73,6 +73,21 @@ bool Folder::ChildExistsWithName(const QString &s) const
|
|||||||
return ChildExistsWithNameInternal(this, s);
|
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 Folder::index_of_child_in_array(Node *item) const
|
||||||
{
|
{
|
||||||
int index_of_item = item_children_.indexOf(item);
|
int index_of_item = item_children_.indexOf(item);
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ public:
|
|||||||
|
|
||||||
bool ChildExistsWithName(const QString& s) const;
|
bool ChildExistsWithName(const QString& s) const;
|
||||||
|
|
||||||
|
bool HasChildRecursive(Node *child) const;
|
||||||
|
|
||||||
int item_child_count() const
|
int item_child_count() const
|
||||||
{
|
{
|
||||||
return item_children_.size();
|
return item_children_.size();
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ public:
|
|||||||
|
|
||||||
ProjectViewModel* model() const;
|
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;
|
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);
|
QModelIndex index = model_.CreateIndexFromItem(n);
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public:
|
|||||||
|
|
||||||
void DeleteSelected();
|
void DeleteSelected();
|
||||||
|
|
||||||
bool SelectItem(Node *n);
|
bool SelectItem(Node *n, bool deselect_all_first = true);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void set_view_type(ProjectToolbar::ViewType type);
|
void set_view_type(ProjectToolbar::ViewType type);
|
||||||
|
|||||||
@@ -410,6 +410,16 @@ void MainWindow::SetApplicationProgressValue(int value)
|
|||||||
#endif
|
#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)
|
void MainWindow::closeEvent(QCloseEvent *e)
|
||||||
{
|
{
|
||||||
// Try to close all projects (this will return false if the user chooses not to close)
|
// 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);
|
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)
|
void MainWindow::FocusedPanelChanged(PanelWidget *panel)
|
||||||
{
|
{
|
||||||
// Update audio monitor panel
|
// Update audio monitor panel
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetApplicationProgressValue(int value);
|
void SetApplicationProgressValue(int value);
|
||||||
|
|
||||||
|
void SelectFootage(const QVector<Footage*> &e);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ProjectOpen(Project *p);
|
void ProjectOpen(Project *p);
|
||||||
|
|
||||||
@@ -142,6 +144,8 @@ private:
|
|||||||
|
|
||||||
void UpdateNodePanelContextFromTimelinePanel(TimelinePanel *panel);
|
void UpdateNodePanelContextFromTimelinePanel(TimelinePanel *panel);
|
||||||
|
|
||||||
|
void SelectFootageForProjectPanel(const QVector<Footage*> &e, ProjectPanel *p);
|
||||||
|
|
||||||
QByteArray premaximized_state_;
|
QByteArray premaximized_state_;
|
||||||
|
|
||||||
// Standard panels
|
// Standard panels
|
||||||
|
|||||||
Reference in New Issue
Block a user