Some small SongEditor fixes

This commit is contained in:
Lukas W
2015-01-15 16:29:19 +01:00
parent b720ec5537
commit a52e4724cf
2 changed files with 27 additions and 25 deletions

View File

@@ -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;

View File

@@ -104,11 +104,6 @@ SongEditor::SongEditor( Song * _song ) :
static_cast<QVBoxLayout *>( 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<QMdiSubWindow *>( 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<QMdiSubWindow *>( parentWidget() ) );
m_editor->scrolled(0);
}