[vlmc-devel] MainWindow: Show the wizard when no project parameter is passed.

Hugo Beauzée-Luyssen git at videolan.org
Mon Sep 12 14:04:53 CEST 2011


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon Sep 12 14:04:19 2011 +0200| [f9dcc6ef786f734ea726d2b3b5ff9d4020826275] | committer: Hugo Beauzée-Luyssen

MainWindow: Show the wizard when no project parameter is passed.

Before this, ./vlmc -vvv would have not show the wizard.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=f9dcc6ef786f734ea726d2b3b5ff9d4020826275
---

 src/Gui/MainWindow.cpp |   16 +++++++++-------
 src/Gui/MainWindow.h   |    1 +
 src/Main/guimain.cpp   |    6 +++++-
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index ddd2964..adc317e 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -143,13 +143,6 @@ MainWindow::MainWindow( QWidget *parent ) :
     restoreGeometry( s.value( "MainWindowGeometry" ).toByteArray() );
     // Restore the layout
     restoreState( s.value( "MainWindowState" ).toByteArray() );
-
-    if ( s.value( "ShowWizardStartup", true ).toBool() )
-    {
-        //If a project was opened from the command line: don't show the wizard.
-        if ( qApp->arguments().size() == 1 )
-            m_pWizard->show();
-    }
 }
 
 MainWindow::~MainWindow()
@@ -161,6 +154,15 @@ MainWindow::~MainWindow()
 }
 
 void
+MainWindow::showWizard()
+{
+    QSettings s;
+
+    if ( s.value( "ShowWizardStartup", true ).toBool() )
+        m_pWizard->show();
+}
+
+void
 MainWindow::changeEvent( QEvent *e )
 {
     switch ( e->type() )
diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h
index 802577a..7816077 100644
--- a/src/Gui/MainWindow.h
+++ b/src/Gui/MainWindow.h
@@ -52,6 +52,7 @@ public:
     ~MainWindow();
 
     void registerWidgetInWindowMenu( QDockWidget* widget );
+    void        showWizard();
 
 public slots:
     void        zoomIn();
diff --git a/src/Main/guimain.cpp b/src/Main/guimain.cpp
index 7c94ba0..4a1bc97 100644
--- a/src/Main/guimain.cpp
+++ b/src/Main/guimain.cpp
@@ -115,6 +115,7 @@ VLMCmain( int argc, char **argv )
     MainWindow w;
 
     /* Check for project file */
+    bool        project = false;
     for ( int i = 1; i < argc; i++ )
     {
         QString arg = argv[i];
@@ -122,10 +123,13 @@ VLMCmain( int argc, char **argv )
         if ( argc > ( i + 1 ) && ( arg == "--project" || arg == "-p" ) )
         {
             GUIProjectManager::getInstance()->loadProject( argv[i+1] );
+            project = true;
             break;
         }
     }
-
+    //Don't show the wizard if a project has been passed through command line.
+    if ( project == false )
+        w.showWizard();
     w.show();
     return app.exec();
 }



More information about the Vlmc-devel mailing list