# HG changeset patch # User nemo # Date 1241747351 0 # Node ID decdf48cffd79a656659b881531c63cf160e5da3 # Parent 860b9aea5e86e5e784e9918e5390b2c6c454bc63 david_ac adding a commandline parameter for the data dir, as requested by svenstaro diff -r 860b9aea5e86 -r decdf48cffd7 QTfrontend/main.cpp --- a/QTfrontend/main.cpp Thu May 07 23:57:39 2009 +0000 +++ b/QTfrontend/main.cpp Fri May 08 01:49:11 2009 +0000 @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include "hwform.h" #include "hwconsts.h" @@ -44,6 +46,29 @@ { QApplication app(argc, argv); + QStringList arguments = app.arguments(); + QMap parsedArgs; + { + QList::iterator i = arguments.begin(); + while(++i != arguments.end()) { + QString arg = *i; + + QRegExp opt("--(\\S+)=(.+)"); + if(opt.exactMatch(arg)) { + parsedArgs[opt.cap(1)] = opt.cap(2); + arguments.erase(i); + } + } + } + + if(parsedArgs.contains("data-dir")) { + QFileInfo f(parsedArgs["data-dir"]); + if(!f.exists()) { + qWarning() << "WARNING: Cannot open DATA_PATH=" << f.absoluteFilePath(); + } + *cDataDir = f.absoluteFilePath(); + } + app.setStyle(new QPlastiqueStyle); QDateTime now = QDateTime::currentDateTime();