SongEditor: always bring up to front after loading a project

When just opening a song in order to listen to it, it's very annyoing to
manually bring up the song editor each time, therefore do it
automatically.
(cherry picked from commit 6be555d61a)
This commit is contained in:
Tobias Doerffel
2011-01-05 11:53:56 +01:00
parent a6c6e18508
commit dc06302745
4 changed files with 30 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
/*
* song.cpp - root of the model tree
*
* Copyright (c) 2004-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2011 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -1006,6 +1006,8 @@ void song::loadProject( const QString & _file_name )
engine::projectJournal()->setJournalling( true );
emit projectLoaded();
m_loadingProject = false;
m_modified = false;
@@ -1013,10 +1015,6 @@ void song::loadProject( const QString & _file_name )
{
engine::mainWindow()->resetWindowTitle();
}
if( engine::getSongEditor() )
{
engine::getSongEditor()->scrolled( 0 );
}
}

View File

@@ -1,7 +1,7 @@
/*
* song_editor.cpp - basic window for song-editing
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2011 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -28,6 +28,7 @@
#include <QtGui/QLabel>
#include <QtGui/QLayout>
#include <QtGui/QMdiArea>
#include <QtGui/QMdiSubWindow>
#include <QtGui/QPainter>
#include <QtGui/QScrollBar>
#include <QtGui/QToolBar>
@@ -96,6 +97,10 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
m_positionLine = new positionLine( this );
// let's get notified when loading a project
connect( m_s, SIGNAL( projectLoaded() ),
this, SLOT( adjustUiAfterProjectLoad() ) );
// create own toolbar
m_toolBar = new QWidget( this );
m_toolBar->setObjectName( "toolbar" );
@@ -479,6 +484,22 @@ 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
engine::mainWindow()->workspace()->setActiveSubWindow(
qobject_cast<QMdiSubWindow *>( parentWidget() ) );
}
scrolled( 0 );
}
bool songEditor::allowRubberband() const
{
return( m_editModeButton->isChecked() );