diff --git a/include/SongEditor.h b/include/SongEditor.h index 9b2e6cd94..12f20de1b 100644 --- a/include/SongEditor.h +++ b/include/SongEditor.h @@ -66,6 +66,9 @@ public: SongEditor( Song * _song ); ~SongEditor(); + void saveSettings(QDomDocument& doc, QDomElement& element); + void loadSettings(QDomElement& element); + public slots: void scrolled( int _new_pos ); @@ -94,9 +97,6 @@ private slots: void zoomingChanged(); - void adjustUiAfterProjectLoad(); - - private: virtual void keyPressEvent( QKeyEvent * _ke ); virtual void wheelEvent( QWheelEvent * _we ); @@ -148,6 +148,8 @@ protected slots: void recordAccompany(); void stop(); + void adjustUiAfterProjectLoad(); + private: QAction* m_addBBTrackAction; QAction* m_addSampleTrackAction; diff --git a/src/gui/editors/SongEditor.cpp b/src/gui/editors/SongEditor.cpp index 5d754c3cc..900b936a5 100644 --- a/src/gui/editors/SongEditor.cpp +++ b/src/gui/editors/SongEditor.cpp @@ -104,11 +104,6 @@ SongEditor::SongEditor( Song * _song ) : static_cast( layout() )->insertWidget( 1, m_timeLine ); - // let's get notified when loading a project - connect( m_song, SIGNAL( projectLoaded() ), - this, SLOT( adjustUiAfterProjectLoad() ) ); - - // add some essential widgets to global tool-bar QWidget * tb = gui->mainWindow()->toolBar(); @@ -264,6 +259,16 @@ SongEditor::~SongEditor() { } +void SongEditor::saveSettings(QDomDocument& doc, QDomElement& element) +{ + MainWindow::saveWidgetState(parentWidget(), element); +} + +void SongEditor::loadSettings(QDomElement& element) +{ + MainWindow::restoreWidgetState(parentWidget(), element); +} + @@ -595,23 +600,6 @@ void SongEditor::zoomingChanged() - -void SongEditor::adjustUiAfterProjectLoad() -{ - //if( isMaximized() ) - { - // make sure to bring us to front as the song editor is the central - // widget in a song and when just opening a song in order to listen to - // it, it's very annyoing to manually bring up the song editor each time - gui->mainWindow()->workspace()->setActiveSubWindow( - qobject_cast( parentWidget() ) ); - } - scrolled( 0 ); -} - - - - bool SongEditor::allowRubberband() const { return m_mode == SelectMode; @@ -691,6 +679,8 @@ SongEditorWindow::SongEditorWindow(Song* song) : m_toolBar->addSeparator(); m_toolBar->addWidget( zoom_lbl ); m_toolBar->addWidget( m_zoomingComboBox ); + + connect(song, SIGNAL(projectLoaded()), this, SLOT(adjustUiAfterProjectLoad())); } QSize SongEditorWindow::sizeHint() const @@ -729,3 +719,13 @@ void SongEditorWindow::stop() m_editor->m_song->stop(); gui->pianoRoll()->stopRecording(); } + +void SongEditorWindow::adjustUiAfterProjectLoad() +{ + // make sure to bring us to front as the song editor is the central + // widget in a song and when just opening a song in order to listen to + // it, it's very annyoing to manually bring up the song editor each time + gui->mainWindow()->workspace()->setActiveSubWindow( + qobject_cast( parentWidget() ) ); + m_editor->scrolled(0); +}