diff options
author | Florian Jung <flo@windfisch.org> | 2011-05-15 16:52:14 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-05-15 16:52:14 +0000 |
commit | c7d22c133d2d9a5e8494d0285af10da6a6dff9d9 (patch) | |
tree | e5dfd68bde4f86f32e3595c4b9bfdb9b21a071ea /muse2/muse/waveedit | |
parent | a79460c36201572c453974a93e62903fe77fd824 (diff) |
defaults for toolbars are now saved
Diffstat (limited to 'muse2/muse/waveedit')
-rw-r--r-- | muse2/muse/waveedit/waveedit.cpp | 21 | ||||
-rw-r--r-- | muse2/muse/waveedit/waveedit.h | 4 |
2 files changed, 23 insertions, 2 deletions
diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp index 0e3c1c30..f2d936f4 100644 --- a/muse2/muse/waveedit/waveedit.cpp +++ b/muse2/muse/waveedit/waveedit.cpp @@ -42,6 +42,7 @@ extern QColor readColor(Xml& xml); int WaveEdit::_widthInit = 600; int WaveEdit::_heightInit = 400; +QByteArray WaveEdit::_toolbarInit; //--------------------------------------------------------- // closeEvent @@ -170,8 +171,8 @@ WaveEdit::WaveEdit(PartList* pl) // ToolBar: Solo Cursor1 Cursor2 addToolBarBreak(); - tb1 = addToolBar(tr("Pianoroll tools")); - tb1->setObjectName("Pianoroll tools"); + tb1 = addToolBar(tr("WaveEdit tools")); + tb1->setObjectName("WaveEdit tools"); //tb1->setLabel(tr("weTools")); solo = new QToolButton(); @@ -249,6 +250,8 @@ WaveEdit::WaveEdit(PartList* pl) connect(hscroll, SIGNAL(scaleChanged(int)), SLOT(updateHScrollRange())); connect(song, SIGNAL(songChanged(int)), SLOT(songChanged1(int))); + if (!_toolbarInit.isEmpty()) + restoreState(_toolbarInit); initShortcuts(); @@ -354,6 +357,8 @@ void WaveEdit::readConfiguration(Xml& xml) _widthInit = xml.parseInt(); else if (tag == "height") _heightInit = xml.parseInt(); + else if (tag == "toolbars") + _toolbarInit = QByteArray::fromHex(xml.parse1().toAscii()); else xml.unknown("WaveEdit"); break; @@ -379,6 +384,7 @@ void WaveEdit::writeConfiguration(int level, Xml& xml) xml.colorTag(level, "bgcolor", config.waveEditBackgroundColor); xml.intTag(level, "width", _widthInit); xml.intTag(level, "height", _heightInit); + xml.strTag(level, "toolbars", _toolbarInit.toHex().data()); xml.tag(level, "/waveedit"); } @@ -442,6 +448,17 @@ void WaveEdit::resizeEvent(QResizeEvent* ev) } //--------------------------------------------------------- +// focusOutEvent +//--------------------------------------------------------- + +void WaveEdit::focusOutEvent(QFocusEvent* ev) + { + QWidget::focusOutEvent(ev); + _toolbarInit=saveState(); + } + + +//--------------------------------------------------------- // songChanged1 // signal from "song" //--------------------------------------------------------- diff --git a/muse2/muse/waveedit/waveedit.h b/muse2/muse/waveedit/waveedit.h index 67230897..921b314c 100644 --- a/muse2/muse/waveedit/waveedit.h +++ b/muse2/muse/waveedit/waveedit.h @@ -14,6 +14,8 @@ #include <QResizeEvent> #include <QKeyEvent> #include <QCloseEvent> +#include <QByteArray> + #include "midieditor.h" class QToolButton; @@ -45,11 +47,13 @@ class WaveEdit : public MidiEditor { QAction* pasteAction; static int _widthInit, _heightInit; + static QByteArray _toolbarInit; Q_OBJECT virtual void closeEvent(QCloseEvent*); virtual void resizeEvent(QResizeEvent* ev); virtual void keyPressEvent(QKeyEvent*); + virtual void focusOutEvent(QFocusEvent*); QMenu* menuFunctions, *select, *menuGain; |