fix line endings
This commit is contained in:
+60
-60
@@ -1,60 +1,60 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 "comboaction.h"
|
||||
|
||||
ComboAction::ComboAction() {}
|
||||
|
||||
ComboAction::~ComboAction() {
|
||||
for (int i=0;i<commands.size();i++) {
|
||||
delete commands.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::undo() {
|
||||
for (int i=commands.size()-1;i>=0;i--) {
|
||||
commands.at(i)->undo();
|
||||
}
|
||||
for (int i=0;i<post_commands.size();i++) {
|
||||
post_commands.at(i)->undo();
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::redo() {
|
||||
for (int i=0;i<commands.size();i++) {
|
||||
commands.at(i)->redo();
|
||||
}
|
||||
for (int i=0;i<post_commands.size();i++) {
|
||||
post_commands.at(i)->redo();
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::append(QUndoCommand* u) {
|
||||
commands.append(u);
|
||||
}
|
||||
|
||||
void ComboAction::appendPost(QUndoCommand* u) {
|
||||
post_commands.append(u);
|
||||
}
|
||||
|
||||
bool ComboAction::hasActions()
|
||||
{
|
||||
return commands.size() > 0;
|
||||
}
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 "comboaction.h"
|
||||
|
||||
ComboAction::ComboAction() {}
|
||||
|
||||
ComboAction::~ComboAction() {
|
||||
for (int i=0;i<commands.size();i++) {
|
||||
delete commands.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::undo() {
|
||||
for (int i=commands.size()-1;i>=0;i--) {
|
||||
commands.at(i)->undo();
|
||||
}
|
||||
for (int i=0;i<post_commands.size();i++) {
|
||||
post_commands.at(i)->undo();
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::redo() {
|
||||
for (int i=0;i<commands.size();i++) {
|
||||
commands.at(i)->redo();
|
||||
}
|
||||
for (int i=0;i<post_commands.size();i++) {
|
||||
post_commands.at(i)->redo();
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::append(QUndoCommand* u) {
|
||||
commands.append(u);
|
||||
}
|
||||
|
||||
void ComboAction::appendPost(QUndoCommand* u) {
|
||||
post_commands.append(u);
|
||||
}
|
||||
|
||||
bool ComboAction::hasActions()
|
||||
{
|
||||
return commands.size() > 0;
|
||||
}
|
||||
|
||||
+116
-116
@@ -1,116 +1,116 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 COMBOACTION_H
|
||||
#define COMBOACTION_H
|
||||
|
||||
#include <QUndoCommand>
|
||||
#include <QVector>
|
||||
|
||||
/**
|
||||
* @brief The ComboAction class
|
||||
*
|
||||
* The Undo/Redo system works by stacking an action that knows how to "do" and also "undo" itself. As Olive is
|
||||
* a very complex program, there are many actions that can in one "user action". For example, moving a clip over
|
||||
* another will delete the clip under it, which is at least two actions that need to be undone if the user clicks
|
||||
* undo, however the user only (knowingly) did one thing and would find it confusing if this one user action required
|
||||
* to undos to complete undo.
|
||||
*
|
||||
* To address this, ComboAction is an undo action that simply compiles several possible actions into one, doing them
|
||||
* all on every redo, and undoing them all on every undo.
|
||||
*/
|
||||
class ComboAction : public QUndoCommand {
|
||||
public:
|
||||
/**
|
||||
* @brief ComboAction Constructor. Currently empty.
|
||||
*/
|
||||
ComboAction();
|
||||
|
||||
/**
|
||||
* @brief ~ComboAction Destructor. Cleans up all QUndoCommand classes that have been added to it.
|
||||
*/
|
||||
virtual ~ComboAction() override;
|
||||
|
||||
/**
|
||||
* @brief Undo Function
|
||||
*
|
||||
* Called by the QUndoStack to undo.
|
||||
*
|
||||
* Calls QUndoCommand::undo() on all QUndoCommand objects added by append()
|
||||
* in REVERSE order to how they were added. Then calls QUndoCommand::redo() on every action added by appendPost()
|
||||
* in the order they were added (not in reverse).
|
||||
*/
|
||||
virtual void undo() override;
|
||||
|
||||
/**
|
||||
* @brief Redo Function
|
||||
*
|
||||
* Called by the QUndoStack to redo.
|
||||
*
|
||||
* Calls QUndoCommand::redo() on all QUndoCommand objects added by append()
|
||||
* in the order they were added. Then calls QUndoCommand::redo() on every action added by appendPost() in
|
||||
* the order they were added.
|
||||
*/
|
||||
virtual void redo() override;
|
||||
|
||||
/**
|
||||
* @brief Add an undo action
|
||||
*
|
||||
* Add an action to be done/undone. ComboAction takes ownership of this QUndoCommand and will delete it when
|
||||
* it is deleted.
|
||||
*
|
||||
* @param u
|
||||
*
|
||||
* The QUndoCommand to add.
|
||||
*/
|
||||
void append(QUndoCommand* u);
|
||||
|
||||
/**
|
||||
* @brief Add a post-undo PostAction
|
||||
*
|
||||
* Sometimes the results of all the actions require another function to be called (e.g. repainting the Viewer).
|
||||
* QUndoCommand objects added by appendPost() will run after EVERY QUndoCommand added by append() has been run.
|
||||
*
|
||||
* @param u
|
||||
*
|
||||
* The PostAction to add
|
||||
*/
|
||||
void appendPost(QUndoCommand* u);
|
||||
|
||||
/**
|
||||
* @brief Returns whether actions have been appended or not
|
||||
*
|
||||
* @return **TRUE** if actions have been appended, **FALSE** if not.
|
||||
*/
|
||||
bool hasActions();
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Internal array of QUndoCommand objects
|
||||
*/
|
||||
QVector<QUndoCommand*> commands;
|
||||
|
||||
/**
|
||||
* @brief Internal array of PostAction objects
|
||||
*/
|
||||
QVector<QUndoCommand*> post_commands;
|
||||
};
|
||||
|
||||
#endif // COMBOACTION_H
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 COMBOACTION_H
|
||||
#define COMBOACTION_H
|
||||
|
||||
#include <QUndoCommand>
|
||||
#include <QVector>
|
||||
|
||||
/**
|
||||
* @brief The ComboAction class
|
||||
*
|
||||
* The Undo/Redo system works by stacking an action that knows how to "do" and also "undo" itself. As Olive is
|
||||
* a very complex program, there are many actions that can in one "user action". For example, moving a clip over
|
||||
* another will delete the clip under it, which is at least two actions that need to be undone if the user clicks
|
||||
* undo, however the user only (knowingly) did one thing and would find it confusing if this one user action required
|
||||
* to undos to complete undo.
|
||||
*
|
||||
* To address this, ComboAction is an undo action that simply compiles several possible actions into one, doing them
|
||||
* all on every redo, and undoing them all on every undo.
|
||||
*/
|
||||
class ComboAction : public QUndoCommand {
|
||||
public:
|
||||
/**
|
||||
* @brief ComboAction Constructor. Currently empty.
|
||||
*/
|
||||
ComboAction();
|
||||
|
||||
/**
|
||||
* @brief ~ComboAction Destructor. Cleans up all QUndoCommand classes that have been added to it.
|
||||
*/
|
||||
virtual ~ComboAction() override;
|
||||
|
||||
/**
|
||||
* @brief Undo Function
|
||||
*
|
||||
* Called by the QUndoStack to undo.
|
||||
*
|
||||
* Calls QUndoCommand::undo() on all QUndoCommand objects added by append()
|
||||
* in REVERSE order to how they were added. Then calls QUndoCommand::redo() on every action added by appendPost()
|
||||
* in the order they were added (not in reverse).
|
||||
*/
|
||||
virtual void undo() override;
|
||||
|
||||
/**
|
||||
* @brief Redo Function
|
||||
*
|
||||
* Called by the QUndoStack to redo.
|
||||
*
|
||||
* Calls QUndoCommand::redo() on all QUndoCommand objects added by append()
|
||||
* in the order they were added. Then calls QUndoCommand::redo() on every action added by appendPost() in
|
||||
* the order they were added.
|
||||
*/
|
||||
virtual void redo() override;
|
||||
|
||||
/**
|
||||
* @brief Add an undo action
|
||||
*
|
||||
* Add an action to be done/undone. ComboAction takes ownership of this QUndoCommand and will delete it when
|
||||
* it is deleted.
|
||||
*
|
||||
* @param u
|
||||
*
|
||||
* The QUndoCommand to add.
|
||||
*/
|
||||
void append(QUndoCommand* u);
|
||||
|
||||
/**
|
||||
* @brief Add a post-undo PostAction
|
||||
*
|
||||
* Sometimes the results of all the actions require another function to be called (e.g. repainting the Viewer).
|
||||
* QUndoCommand objects added by appendPost() will run after EVERY QUndoCommand added by append() has been run.
|
||||
*
|
||||
* @param u
|
||||
*
|
||||
* The PostAction to add
|
||||
*/
|
||||
void appendPost(QUndoCommand* u);
|
||||
|
||||
/**
|
||||
* @brief Returns whether actions have been appended or not
|
||||
*
|
||||
* @return **TRUE** if actions have been appended, **FALSE** if not.
|
||||
*/
|
||||
bool hasActions();
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Internal array of QUndoCommand objects
|
||||
*/
|
||||
QVector<QUndoCommand*> commands;
|
||||
|
||||
/**
|
||||
* @brief Internal array of PostAction objects
|
||||
*/
|
||||
QVector<QUndoCommand*> post_commands;
|
||||
};
|
||||
|
||||
#endif // COMBOACTION_H
|
||||
|
||||
+23
-23
@@ -1,23 +1,23 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 "undostack.h"
|
||||
|
||||
QUndoStack olive::undo_stack;
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 "undostack.h"
|
||||
|
||||
QUndoStack olive::undo_stack;
|
||||
|
||||
+33
-33
@@ -1,33 +1,33 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 UNDOSTACK_H
|
||||
#define UNDOSTACK_H
|
||||
|
||||
#include <QUndoStack>
|
||||
|
||||
namespace olive {
|
||||
/**
|
||||
* @brief Global undo stack object
|
||||
*/
|
||||
extern QUndoStack undo_stack;
|
||||
}
|
||||
|
||||
#endif // UNDOSTACK_H
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 UNDOSTACK_H
|
||||
#define UNDOSTACK_H
|
||||
|
||||
#include <QUndoStack>
|
||||
|
||||
namespace olive {
|
||||
/**
|
||||
* @brief Global undo stack object
|
||||
*/
|
||||
extern QUndoStack undo_stack;
|
||||
}
|
||||
|
||||
#endif // UNDOSTACK_H
|
||||
|
||||
Reference in New Issue
Block a user