equal
deleted
inserted
replaced
19 #include <QApplication> |
19 #include <QApplication> |
20 #include <QTranslator> |
20 #include <QTranslator> |
21 #include <QLocale> |
21 #include <QLocale> |
22 #include <QMessageBox> |
22 #include <QMessageBox> |
23 #include <QPlastiqueStyle> |
23 #include <QPlastiqueStyle> |
|
24 #include <QRegExp> |
|
25 #include <QMap> |
24 |
26 |
25 #include "hwform.h" |
27 #include "hwform.h" |
26 #include "hwconsts.h" |
28 #include "hwconsts.h" |
27 |
29 |
28 bool checkForDir(const QString & dir) |
30 bool checkForDir(const QString & dir) |
41 } |
43 } |
42 |
44 |
43 int main(int argc, char *argv[]) |
45 int main(int argc, char *argv[]) |
44 { |
46 { |
45 QApplication app(argc, argv); |
47 QApplication app(argc, argv); |
|
48 |
|
49 QStringList arguments = app.arguments(); |
|
50 QMap<QString, QString> parsedArgs; |
|
51 { |
|
52 QList<QString>::iterator i = arguments.begin(); |
|
53 while(++i != arguments.end()) { |
|
54 QString arg = *i; |
|
55 |
|
56 QRegExp opt("--(\\S+)=(.+)"); |
|
57 if(opt.exactMatch(arg)) { |
|
58 parsedArgs[opt.cap(1)] = opt.cap(2); |
|
59 arguments.erase(i); |
|
60 } |
|
61 } |
|
62 } |
|
63 |
|
64 if(parsedArgs.contains("data-dir")) { |
|
65 QFileInfo f(parsedArgs["data-dir"]); |
|
66 if(!f.exists()) { |
|
67 qWarning() << "WARNING: Cannot open DATA_PATH=" << f.absoluteFilePath(); |
|
68 } |
|
69 *cDataDir = f.absoluteFilePath(); |
|
70 } |
46 |
71 |
47 app.setStyle(new QPlastiqueStyle); |
72 app.setStyle(new QPlastiqueStyle); |
48 |
73 |
49 QDateTime now = QDateTime::currentDateTime(); |
74 QDateTime now = QDateTime::currentDateTime(); |
50 QDateTime zero; |
75 QDateTime zero; |