add opening sequence to the import undo command

This commit is contained in:
itsmattkc
2021-01-29 18:11:01 +11:00
parent b748b1142b
commit 29eccf8e84
4 changed files with 93 additions and 4 deletions
+5 -4
View File
@@ -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)
+2
View File
@@ -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
)
+38
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#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_);
}
}
+48
View File
@@ -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 <http://www.gnu.org/licenses/>.
***/
#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