projectexplorer/mainwindow: close sequence if it's open before deleting it
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "dialog/footageproperties/footageproperties.h"
|
||||
#include "dialog/sequence/sequence.h"
|
||||
#include "widget/menu/menu.h"
|
||||
#include "window/mainwindow/mainwindow.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
@@ -422,6 +423,15 @@ void ProjectExplorer::DeleteSelected()
|
||||
foreach (Item* item, selected) {
|
||||
ItemPtr item_ptr = item->get_shared_ptr();
|
||||
|
||||
// If this is a sequence, close it
|
||||
if (item_ptr->type() == Item::kSequence) {
|
||||
Sequence* s = static_cast<Sequence*>(item_ptr.get());
|
||||
|
||||
if (Core::instance()->main_window()->IsSequenceOpen(s)) {
|
||||
Core::instance()->main_window()->CloseSequence(s);
|
||||
}
|
||||
}
|
||||
|
||||
new ProjectViewModel::RemoveItemCommand(&model_, item_ptr, command);
|
||||
}
|
||||
|
||||
|
||||
@@ -160,6 +160,17 @@ void MainWindow::CloseSequence(Sequence *sequence)
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::IsSequenceOpen(Sequence *sequence) const
|
||||
{
|
||||
foreach (TimelinePanel* tp, timeline_panels_) {
|
||||
if (tp->GetConnectedViewer() == sequence->viewer_output()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
void MainWindow::SetTaskbarButtonState(TBPFLAG flags)
|
||||
{
|
||||
|
||||
@@ -57,6 +57,8 @@ public:
|
||||
|
||||
void CloseSequence(Sequence* sequence);
|
||||
|
||||
bool IsSequenceOpen(Sequence* sequence) const;
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
void SetTaskbarButtonState(TBPFLAG flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user