mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
undo infrastructure: collect the texts for the executed commands
This creates a single string with all the undo texts that are on the stack. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
053356c49b
commit
626a149b7c
2 changed files with 11 additions and 0 deletions
|
@ -20,6 +20,7 @@ void setClean(); // Call after save - this marks a state where no changes need
|
||||||
bool isClean(); // Any changes need to be saved?
|
bool isClean(); // Any changes need to be saved?
|
||||||
QAction *undoAction(QObject *parent); // Create an undo action.
|
QAction *undoAction(QObject *parent); // Create an undo action.
|
||||||
QAction *redoAction(QObject *parent); // Create an redo action.
|
QAction *redoAction(QObject *parent); // Create an redo action.
|
||||||
|
QString changesMade(); // return a string with the texts from all commands on the undo stack -> for commit message
|
||||||
|
|
||||||
// 2) Dive-list related commands
|
// 2) Dive-list related commands
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,16 @@ QAction *redoAction(QObject *parent)
|
||||||
return undoStack.createRedoAction(parent, QCoreApplication::translate("Command", "&Redo"));
|
return undoStack.createRedoAction(parent, QCoreApplication::translate("Command", "&Redo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return a string that can be used for the commit message and should list the changes that
|
||||||
|
// were made to the dive list
|
||||||
|
QString changesMade()
|
||||||
|
{
|
||||||
|
QString changeTexts;
|
||||||
|
for (int i = 0; i < undoStack.index(); i++)
|
||||||
|
changeTexts += undoStack.text(i) + "\n";
|
||||||
|
return changeTexts;
|
||||||
|
}
|
||||||
|
|
||||||
bool execute(Base *cmd)
|
bool execute(Base *cmd)
|
||||||
{
|
{
|
||||||
if (cmd->workToBeDone()) {
|
if (cmd->workToBeDone()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue