diff -r 1c8ff1928b97 -r 23dba6527a7d main.cpp --- a/main.cpp Thu Nov 23 13:53:08 2006 +0000 +++ b/main.cpp Wed Apr 11 09:21:15 2007 +0000 @@ -1,5 +1,4 @@ #include -#include #include "flagrowobj.h" #include "mainwindow.h" @@ -50,6 +49,7 @@ options.add ("local", SwitchOption, "l", "local"); options.add ("help", SwitchOption, "h", "help"); options.add ("quit", SwitchOption, "q", "quit"); + options.add ("run", StringOption, "r", "run"); options.add ("test", StringOption, "t", "test"); options.setHelpText ( "VYM - View Your Mind\n" @@ -113,9 +113,6 @@ return 0; } - q3InitNetworkProtocols(); - - // Initialize translations QTranslator translator (0); translator.load( QString("vym_")+QTextCodec::locale(), vymBaseDir.path() + "/lang"); @@ -140,7 +137,31 @@ m.fileNew(); m.loadCmdLine(); - // For benchmarking we may want to quit immediatly after drawing + // Run script + if (options.isOn ("run")) + { + QString script; + QString fn=options.getArg ("run"); + if ( !fn.isEmpty() ) + { + QFile f( fn ); + if ( !f.open( QIODevice::ReadOnly ) ) + { + QMessageBox::warning(0, + QObject::tr("Error"), + QObject::tr("Couldn't open %1.\n").arg(fn)); + return 0; + } + + QTextStream ts( &f ); + script= ts.read(); + f.close(); + m.setScript (script); + m.runScript (script); + } + } + + // For benchmarking we may want to quit instead of entering event loop if (options.isOn ("quit")) { return 0;