diff -r 310f1d82cf89 -r c585be63ec69 main.cpp --- a/main.cpp Mon Mar 05 23:22:51 2007 +0000 +++ b/main.cpp Tue Mar 06 19:37:39 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;