summaryrefslogtreecommitdiff
path: root/muse2/muse/undo.cpp
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2012-09-17 22:29:46 +0000
committerTim E. Real <termtech@rogers.com>2012-09-17 22:29:46 +0000
commitedd3eb6d5b73b2868398bef6ae7fbb6fd92c5800 (patch)
treee2da58edd541ce359fa513a9332d7a37965efef5 /muse2/muse/undo.cpp
parentef0a06629a9d4652b3a91d85af768e7e5797fe2a (diff)
Info text on Undo/Redo buttons/menu text/tooltips ("Undo AddTrack" etc).
In cases of multiple items in one operation, the first is shown, with ", .." ("Undo AddTrack, ..").
Diffstat (limited to 'muse2/muse/undo.cpp')
-rw-r--r--muse2/muse/undo.cpp48
1 files changed, 47 insertions, 1 deletions
diff --git a/muse2/muse/undo.cpp b/muse2/muse/undo.cpp
index 45642652..65ca04bf 100644
--- a/muse2/muse/undo.cpp
+++ b/muse2/muse/undo.cpp
@@ -214,6 +214,7 @@ void Song::startUndo()
{
redoList->clearDelete(); // redo must be invalidated when a new undo is started
MusEGlobal::redoAction->setEnabled(false);
+ setUndoRedoText();
undoList->push_back(Undo());
updateFlags = 0;
@@ -231,6 +232,49 @@ void Song::endUndo(SongChangedFlags_t flags)
undoMode = false;
}
+//---------------------------------------------------------
+// setUndoRedoText
+//---------------------------------------------------------
+
+void Song::setUndoRedoText()
+{
+ if(MusEGlobal::undoAction)
+ {
+ QString s = tr("Und&o");
+ if(MusEGlobal::undoAction->isEnabled())
+ {
+ if(!undoList->empty() && !undoList->back().empty())
+ {
+ int sz = undoList->back().size();
+ //if(sz >= 2)
+ // s += QString(" (%1)").arg(sz);
+ s += QString(" ") + undoList->back().front().typeName();
+ if(sz >= 2)
+ s += ", .."; // Hm, the tooltip will not show three dots "..."
+ }
+ }
+ MusEGlobal::undoAction->setText(s);
+ }
+
+ if(MusEGlobal::redoAction)
+ {
+ QString s = tr("Re&do");
+ if(MusEGlobal::redoAction->isEnabled())
+ {
+ if(!redoList->empty() && !redoList->back().empty())
+ {
+ int sz = redoList->back().size();
+ //if(sz >= 2)
+ // s += QString(" (%1)").arg(sz);
+ s += QString(" ") + redoList->back().front().typeName();
+ if(sz >= 2)
+ s += ", ..";
+ }
+ }
+ MusEGlobal::redoAction->setText(s);
+ }
+}
+
void cleanOperationGroup(Undo& group)
{
@@ -277,12 +321,14 @@ bool Song::applyOperationGroup(Undo& group, bool doUndo)
{
undoList->pop_back();
MusEGlobal::undoAction->setEnabled(!undoList->empty());
+ setUndoRedoText();
}
else
{
redoList->clearDelete(); // redo must be invalidated when a new undo is started
MusEGlobal::redoAction->setEnabled(false);
- }
+ setUndoRedoText();
+ }
return doUndo;
}