32 */ |
32 */ |
33 |
33 |
34 #include <QApplication> |
34 #include <QApplication> |
35 #include <QTranslator> |
35 #include <QTranslator> |
36 #include <QLocale> |
36 #include <QLocale> |
|
37 #include <QMessageBox> |
|
38 #include <QFileInfo> |
37 #include "hwform.h" |
39 #include "hwform.h" |
|
40 #include "hwconsts.h" |
|
41 |
|
42 QDir * bindir; |
|
43 QDir * cfgdir; |
|
44 QDir * datadir; |
38 |
45 |
39 int main(int argc, char *argv[]) |
46 int main(int argc, char *argv[]) |
40 { |
47 { |
41 QApplication app(argc, argv); |
48 QApplication app(argc, argv); |
|
49 |
|
50 QDir mydir = QFileInfo(argv[0]).dir(); |
|
51 bindir = new QDir(mydir); |
|
52 cfgdir = new QDir(); |
|
53 |
|
54 cfgdir->setPath(cfgdir->homePath()); |
|
55 if (!cfgdir->exists(".hedgewars")) |
|
56 { |
|
57 if (!cfgdir->mkdir(".hedgewars")) |
|
58 { |
|
59 QMessageBox::critical(0, |
|
60 QObject::tr("Error"), |
|
61 QObject::tr("Cannot create directory %1").arg("/.hedgewars"), |
|
62 QObject::tr("Quit")); |
|
63 } |
|
64 } |
|
65 cfgdir->cd(".hedgewars"); |
|
66 |
|
67 datadir = new QDir(mydir); |
|
68 datadir->cd("../share/hedgewars/Data"); |
42 |
69 |
43 Q_INIT_RESOURCE(hedgewars); |
70 Q_INIT_RESOURCE(hedgewars); |
44 |
71 |
45 QTranslator Translator; |
72 QTranslator Translator; |
46 Translator.load(":/translations/hedgewars_" + QLocale::system().name()); |
73 Translator.load(":/translations/hedgewars_" + QLocale::system().name()); |
47 app.installTranslator(&Translator); |
74 app.installTranslator(&Translator); |
48 |
75 |
49 HWForm *Form = new HWForm; |
76 HWForm *Form = new HWForm(); |
50 Form->show(); |
77 Form->show(); |
51 return app.exec(); |
78 return app.exec(); |
52 } |
79 } |