Browse Source

Merge pull request #603 from CJGoch/extend-convenience-run-to-hand-through-cl-arguments

Extend the ctkPluginFrameworkLauncher convenience run method to accept cl args
Jean-Christophe Fillion-Robin 9 years ago
parent
commit
bd092b1c09

+ 3 - 3
Libs/PluginFramework/ctkPluginFrameworkLauncher.cpp

@@ -388,7 +388,7 @@ void ctkPluginFrameworkLauncher::setFrameworkProperties(const ctkProperties& pro
 }
 
 //----------------------------------------------------------------------------
-QVariant ctkPluginFrameworkLauncher::run(QRunnable* endSplashHandler)
+QVariant ctkPluginFrameworkLauncher::run(QRunnable* endSplashHandler, const QVariant& argument)
 {
   if (d->running)
   {
@@ -424,9 +424,9 @@ QVariant ctkPluginFrameworkLauncher::run(QRunnable* endSplashHandler)
       startup(d->endSplashHandler);
       if (ctkPluginFrameworkProperties::getProperty(PROP_IGNOREAPP).toBool() || d->isForcedRestart())
       {
-        return QVariant();
+        return argument;
       }
-      return run(QVariant());
+      return run(argument);
     }
     catch (const std::exception& e)
     {

+ 2 - 1
Libs/PluginFramework/ctkPluginFrameworkLauncher.h

@@ -107,10 +107,11 @@ public:
    *
    * @param endSplashHandler the block of code to run to tear down the splash
    * 	screen or <code>null</code> if no tear down is required
+   * @param argument the argument passed to the application. Default is QVariant().
    * @return the result of running the application
    * @throws Exception if anything goes wrong
    */
-  static QVariant run(QRunnable* endSplashHandler = NULL);
+  static QVariant run(QRunnable* endSplashHandler = NULL, const QVariant& argument = QVariant());
 
   /**
    * Runs the application for which the platform was started. The platform