[vlmc-devel] Main: reorder code

Jean-Baptiste Kempf git at videolan.org
Sun Mar 2 16:27:58 CET 2014


vlmc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Mar  2 15:53:30 2014 +0100| [1a36e09e0702dd91351ada70c51cc203c5687068] | committer: Jean-Baptiste Kempf

Main: reorder code

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

 src/Main/main.cpp |   40 +++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/src/Main/main.cpp b/src/Main/main.cpp
index df2186f..f2c60af 100644
--- a/src/Main/main.cpp
+++ b/src/Main/main.cpp
@@ -57,6 +57,8 @@ VLMCmainCommon( const QCoreApplication &app )
     app.setOrganizationDomain( "videolan.org" );
     app.setApplicationVersion( PROJECT_VERSION );
 
+    QSettings s;
+
     qRegisterMetaType<Workflow::TrackType>( "Workflow::TrackType" );
     qRegisterMetaType<Vlmc::FrameChangedReason>( "Vlmc::FrameChangedReason" );
     qRegisterMetaType<QVariant>( "QVariant" );
@@ -79,13 +81,26 @@ VLMCGuimain( int argc, char **argv )
     QApplication app( argc, argv );
     VLMCmainCommon( app );
 
+    /* Load a project file */
+    bool        project = false;
+    for ( int i = 1; i < argc; i++ )
+    {
+        QString arg = argv[i];
+
+        if ( argc > ( i + 1 ) && ( arg == "--project" || arg == "-p" ) )
+        {
+            GUIProjectManager::getInstance()->loadProject( argv[i+1] );
+            project = true;
+            break;
+        }
+    }
+
+    /* Translations */
     QSettings s;
-    s.setFallbacksEnabled( false );
     LanguageHelper::getInstance()->languageChanged(
             s.value( "vlmc/VLMCLang", "default" ) );
 
 #if defined( Q_WS_WIN )
-
     QFile  css(":/styles/windows");
     if ( css.open( QIODevice::ReadOnly | QIODevice::Text ) )
     {
@@ -124,24 +139,14 @@ VLMCGuimain( int argc, char **argv )
     IntroDialog d;
     d.exec();
 #endif
-    MainWindow w;
 
-    /* Check for project file */
-    bool        project = false;
-    for ( int i = 1; i < argc; i++ )
-    {
-        QString arg = argv[i];
+    MainWindow w;
 
-        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();
+
+    /* Main Window display */
     w.show();
     return app.exec();
 }
@@ -157,13 +162,15 @@ int
 VLMCCoremain( int argc, char **argv )
 {
     QCoreApplication app( argc, argv );
+    VLMCmainCommon( app );
+
+    /* Load a project file */
     if ( app.arguments().count() < 3 )
     {
         vlmcCritical() << "Usage: ./vlmc project.vlmc output_file";
         return 1;
     }
 
-    VLMCmainCommon( app );
 
 #ifndef WITH_GUI
     ConsoleRenderer renderer;
@@ -185,4 +192,3 @@ VLMCmain( int argc, char **argv )
 #endif
 }
 
-



More information about the Vlmc-devel mailing list