diff --git a/app/widget/timelinewidget/tool/import.cpp b/app/widget/timelinewidget/tool/import.cpp
index 3064feedf..9a1c4b483 100644
--- a/app/widget/timelinewidget/tool/import.cpp
+++ b/app/widget/timelinewidget/tool/import.cpp
@@ -37,6 +37,7 @@
#include "project/item/sequence/sequence.h"
#include "widget/nodeview/nodeviewundo.h"
#include "window/mainwindow/mainwindow.h"
+#include "window/mainwindow/mainwindowundo.h"
namespace olive {
@@ -472,14 +473,14 @@ void ImportTool::DropGhosts(bool insert)
}
}
+ if (open_sequence) {
+ command->add_child(new OpenSequenceCommand(open_sequence));
+ }
+
Core::instance()->undo_stack()->pushIfHasChildren(command);
parent()->ClearGhosts();
dragged_footage_.clear();
-
- if (open_sequence) {
- Core::instance()->main_window()->OpenSequence(open_sequence);
- }
}
ImportTool::DraggedFootage ImportTool::FootageToDraggedFootage(Footage *f)
diff --git a/app/window/mainwindow/CMakeLists.txt b/app/window/mainwindow/CMakeLists.txt
index 5b36cc883..84058306b 100644
--- a/app/window/mainwindow/CMakeLists.txt
+++ b/app/window/mainwindow/CMakeLists.txt
@@ -24,5 +24,7 @@ set(OLIVE_SOURCES
window/mainwindow/mainwindow.cpp
window/mainwindow/mainwindowlayoutinfo.h
window/mainwindow/mainwindowlayoutinfo.cpp
+ window/mainwindow/mainwindowundo.h
+ window/mainwindow/mainwindowundo.cpp
PARENT_SCOPE
)
diff --git a/app/window/mainwindow/mainwindowundo.cpp b/app/window/mainwindow/mainwindowundo.cpp
new file mode 100644
index 000000000..54d4d592c
--- /dev/null
+++ b/app/window/mainwindow/mainwindowundo.cpp
@@ -0,0 +1,38 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2020 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
+#include "mainwindowundo.h"
+
+#include "core.h"
+#include "window/mainwindow/mainwindow.h"
+
+namespace olive {
+
+void OpenSequenceCommand::redo()
+{
+ Core::instance()->main_window()->OpenSequence(sequence_);
+}
+
+void OpenSequenceCommand::undo()
+{
+ Core::instance()->main_window()->CloseSequence(sequence_);
+}
+
+}
diff --git a/app/window/mainwindow/mainwindowundo.h b/app/window/mainwindow/mainwindowundo.h
new file mode 100644
index 000000000..27ea85736
--- /dev/null
+++ b/app/window/mainwindow/mainwindowundo.h
@@ -0,0 +1,48 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2020 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
+#ifndef MAINWINDOWUNDO_H
+#define MAINWINDOWUNDO_H
+
+#include "project/item/sequence/sequence.h"
+
+namespace olive {
+
+class OpenSequenceCommand : public UndoCommand
+{
+public:
+ OpenSequenceCommand(Sequence* sequence) :
+ sequence_(sequence)
+ {}
+
+ virtual void redo() override;
+
+ virtual void undo() override;
+
+ virtual Project* GetRelevantProject() const override {return nullptr;}
+
+private:
+ Sequence* sequence_;
+
+};
+
+}
+
+#endif // MAINWINDOWUNDO_H