From 0721b49a1c4e815329283309ee06318e5d23123d Mon Sep 17 00:00:00 2001 From: Oskar Wallgren Date: Sun, 14 Feb 2016 00:40:33 +0100 Subject: [PATCH] Show Main Window before loading/importing project --- src/core/main.cpp | 71 +++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 42 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index d9d032c57..d8b1536c7 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -736,15 +736,18 @@ int main( int argc, char * * argv ) } } - // we try to load given file + // first show the Main Window and then try to load given file + + // [Settel] workaround: showMaximized() doesn't work with + // FVWM2 unless the window is already visible -> show() first + gui->mainWindow()->show(); + if( fullscreen ) + { + gui->mainWindow()->showMaximized(); + } + if( !fileToLoad.isEmpty() ) { - gui->mainWindow()->show(); - if( fullscreen ) - { - gui->mainWindow()->showMaximized(); - } - if( fileToLoad == recoveryFile ) { Engine::getSong()->createNewProjectFromTemplate( fileToLoad ); @@ -761,49 +764,33 @@ int main( int argc, char * * argv ) { return EXIT_SUCCESS; } - - gui->mainWindow()->show(); - if( fullscreen ) - { - gui->mainWindow()->showMaximized(); - } } - else + // If enabled, open last project if there is one. Else, create + // a new one. Also skip recently opened file if limited session to + // lower the chance of opening an already opened file. + else if( ConfigManager::inst()-> + value( "app", "openlastproject" ).toInt() && + !ConfigManager::inst()-> + recentlyOpenedProjects().isEmpty() && + gui->mainWindow()->getSession() != + MainWindow::SessionState::Limited ) { - // If enabled, open last project if there is one. Else, create - // a new one. Also skip recently opened file if limited session to - // lower the chance of opening an already opened file. - if( ConfigManager::inst()-> - value( "app", "openlastproject" ).toInt() && - !ConfigManager::inst()->recentlyOpenedProjects().isEmpty() && - gui->mainWindow()->getSession() - != MainWindow::SessionState::Limited ) - { - QString f = ConfigManager::inst()-> - recentlyOpenedProjects().first(); - QFileInfo recentFile( f ); + QString f = ConfigManager::inst()-> + recentlyOpenedProjects().first(); + QFileInfo recentFile( f ); - if ( recentFile.exists() ) - { - Engine::getSong()->loadProject( f ); - } - else - { - Engine::getSong()->createNewProject(); - } + if ( recentFile.exists() ) + { + Engine::getSong()->loadProject( f ); } else { Engine::getSong()->createNewProject(); } - - // [Settel] workaround: showMaximized() doesn't work with - // FVWM2 unless the window is already visible -> show() first - gui->mainWindow()->show(); - if( fullscreen ) - { - gui->mainWindow()->showMaximized(); - } + } + else + { + Engine::getSong()->createNewProject(); } // Finally we start the auto save timer and also trigger the