diff --git a/Core/Core.cc b/Core/Core.cc index 98ae571ac5930a476a6a32876203fa511119d5c5..7827e9bedd1d9561cbee5aff07094e6452343bc5 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -658,6 +658,9 @@ void Core::updateView() { } } + if ( !OpenFlipper::Options::gui() ) + return; + if ( OpenFlipper::Options::restrictFrameRate() ) { int elapsed = redrawTime_->elapsed (); @@ -682,7 +685,7 @@ void Core::updateView() { redrawTime_->restart (); - if ( OpenFlipper::Options::gui() && !OpenFlipper::Options::loadingSettings() && !OpenFlipper::Options::redrawDisabled() ) { + if ( !OpenFlipper::Options::loadingSettings() && !OpenFlipper::Options::redrawDisabled() ) { for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) coreWidget_->examiner_widgets_[i]->updateGL(); diff --git a/Core/ParseIni.cc b/Core/ParseIni.cc index 32da48f7ffd078c5aabc584efcc8ce57eae5cd7a..ac2e4404365d7fd9301d2a106172eafa4853933f 100644 --- a/Core/ParseIni.cc +++ b/Core/ParseIni.cc @@ -588,12 +588,12 @@ void Core::openIniFile( QString _filename, resetScenegraph(); - for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) { - PluginFunctions::viewerProperties(i).drawMode( OpenFlipper::Options::standardDrawMode() ); - coreWidget_->examiner_widgets_[i]->viewAll(); - } + if ( OpenFlipper::Options::gui() ){ + for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) { + PluginFunctions::viewerProperties(i).drawMode( OpenFlipper::Options::standardDrawMode() ); + coreWidget_->examiner_widgets_[i]->viewAll(); + } - if ( OpenFlipper::Options::gui() ) { coreWidget_->statusMessage( "Loading ini File " + _filename + " ... Done", 4000); coreWidget_->setStatus(ApplicationStatus::READY ); } diff --git a/Core/openFunctions.cc b/Core/openFunctions.cc index 16f40f8854f4fee901e85cebbd62101b5f445ebb..fc107d1d56d970d076df425e24370e883db6433e 100644 --- a/Core/openFunctions.cc +++ b/Core/openFunctions.cc @@ -59,7 +59,8 @@ void Core::resetScenegraph() { } // Update the draw Modes Menu - coreWidget_->slotUpdateGlobalDrawMenu(); + if ( OpenFlipper::Options::gui() ) + coreWidget_->slotUpdateGlobalDrawMenu(); } //======================================================================================== @@ -104,6 +105,8 @@ void Core::slotCommandLineOpen() { emit executeFileScript(commandLineScriptNames_[i]); } + if ( !OpenFlipper::Options::gui() && !OpenFlipper::Options::remoteControl()) + exitApplication(); } /// Load object by guessing DataType depending on the files extension diff --git a/OpenFlipper.cc b/OpenFlipper.cc index 119069aa41a4058cdf53debd5b8a34f4ca0761e0..231ddb2f9645795232addacc930e7007a05d0e41 100644 --- a/OpenFlipper.cc +++ b/OpenFlipper.cc @@ -246,7 +246,7 @@ bool parseCommandLineOptions(CSimpleOpt& args){ OpenFlipper::Options::splash(false); break; case OPT_REMOTE: - remoteControl = true; + OpenFlipper::Options::remoteControl(true); break; case OPT_HELP: showHelp(); @@ -280,17 +280,15 @@ int main(int argc, char **argv) OpenFlipper::Options::argc(&argc); OpenFlipper::Options::argv(&argv); - //print arguments - std::fstream filestr ("/Users/moebius/param.log", std::fstream::out); - - for (int i=0; i < argc; i++) - filestr << argv[i] << " "; - filestr << std::endl; - - filestr.close(); - CSimpleOpt args(argc, argv, g_rgOptions); + //check only batchMode before the core is created + while (args.Next()) + if (args.OptionId() == OPT_BATCH ){ + OpenFlipper::Options::nogui(true); + break; + } + // Only Install signal handler if not running in debug version, otherwise gdb will get confused // #ifndef DEBUG // Set a handler for segfaults @@ -349,8 +347,7 @@ int main(int argc, char **argv) for ( int i = 0 ; i < args.FileCount(); ++i ) w->commandLineScript(args.File(i)); - if ( remoteControl ) - return app.exec(); + return app.exec(); } return 0; diff --git a/common/GlobalOptions.cc b/common/GlobalOptions.cc index 16ec108a8efce6ab99865cd69ec9885bbec69046..aaf9692b575c98ccdee1fa269329e0ddc06046ec 100644 --- a/common/GlobalOptions.cc +++ b/common/GlobalOptions.cc @@ -195,6 +195,8 @@ static int* argc_; static char *** argv_; +static bool remoteControl_ = false; + # if __WORDSIZE == 64 const bool is64 = true; #else @@ -680,6 +682,14 @@ void argv( char*** _argv) { argv_ = _argv; } +bool remoteControl(){ + return remoteControl_; +} + +void remoteControl(bool _remote){ + remoteControl_ = _remote; +} + void doSlotDebugging( bool _debugging ) { doSlotDebugging_ = _debugging; } diff --git a/common/GlobalOptions.hh b/common/GlobalOptions.hh index 955bf8d39652860ad441c810f10e70f998f81108..bc0e8a04fe35dea5f08f9fbee3b447d3a31592db 100644 --- a/common/GlobalOptions.hh +++ b/common/GlobalOptions.hh @@ -609,7 +609,13 @@ void argc( int* _argc ); DLLEXPORT void argv( char*** _argv); +/// is the core remoteControlled? +DLLEXPORT +bool remoteControl(); +/// is the core remoteControlled? +DLLEXPORT +void remoteControl( bool _remote ); //=========================================================================== /** @name Debugging Options