author | smaxx |
Tue, 14 Sep 2010 18:41:37 +0200 | |
changeset 3865 | 0b1c426b035f |
parent 3758 | 80007c41c35e |
child 3914 | c5c903c6225b |
permissions | -rw-r--r-- |
579 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
3236
4ab3917d7d44
Update (c) lines to 2010 as unc0rr requested - they all had varying values so I just took the first year mentioned, then tacked on -2010
nemo
parents:
3185
diff
changeset
|
3 |
* Copyright (c) 2005-2010 Andrey Korotaev <unC0Rr@gmail.com> |
579 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
#include <QApplication> |
|
20 |
#include <QTranslator> |
|
21 |
#include <QLocale> |
|
22 |
#include <QMessageBox> |
|
1416
60b86d6fe9ae
Force plastique style, as others don't fully support stylesheets
unc0rr
parents:
1415
diff
changeset
|
23 |
#include <QPlastiqueStyle> |
2034
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
24 |
#include <QRegExp> |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
25 |
#include <QMap> |
2898 | 26 |
#include <QSettings> |
1146 | 27 |
|
579 | 28 |
#include "hwform.h" |
29 |
#include "hwconsts.h" |
|
30 |
||
3333 | 31 |
#ifdef _WIN32 |
32 |
#include <Shlobj.h> |
|
33 |
#endif |
|
34 |
||
579 | 35 |
bool checkForDir(const QString & dir) |
36 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
37 |
QDir tmpdir; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
38 |
if (!tmpdir.exists(dir)) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
39 |
if (!tmpdir.mkdir(dir)) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
40 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
41 |
QMessageBox::critical(0, |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
42 |
QObject::tr("Error"), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
43 |
QObject::tr("Cannot create directory %1").arg(dir), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
44 |
QObject::tr("OK")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
45 |
return false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
46 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
47 |
return true; |
579 | 48 |
} |
49 |
||
3697 | 50 |
int main(int argc, char *argv[]) { |
2261 | 51 |
QApplication app(argc, argv); |
579 | 52 |
|
2034
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
53 |
QStringList arguments = app.arguments(); |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
54 |
QMap<QString, QString> parsedArgs; |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
55 |
{ |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
56 |
QList<QString>::iterator i = arguments.begin(); |
2035 | 57 |
while(i != arguments.end()) { |
2034
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
58 |
QString arg = *i; |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
59 |
|
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
60 |
QRegExp opt("--(\\S+)=(.+)"); |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
61 |
if(opt.exactMatch(arg)) { |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
62 |
parsedArgs[opt.cap(1)] = opt.cap(2); |
2035 | 63 |
i = arguments.erase(i); |
64 |
} else { |
|
65 |
++i; |
|
2034
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
66 |
} |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
67 |
} |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
68 |
} |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
69 |
|
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
70 |
if(parsedArgs.contains("data-dir")) { |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
71 |
QFileInfo f(parsedArgs["data-dir"]); |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
72 |
if(!f.exists()) { |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
73 |
qWarning() << "WARNING: Cannot open DATA_PATH=" << f.absoluteFilePath(); |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
74 |
} |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
75 |
*cDataDir = f.absoluteFilePath(); |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
76 |
} |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
77 |
|
2428 | 78 |
if(parsedArgs.contains("config-dir")) { |
79 |
QFileInfo f(parsedArgs["config-dir"]); |
|
80 |
*cConfigDir = f.absoluteFilePath(); |
|
81 |
} |
|
82 |
||
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
83 |
app.setStyle(new QPlastiqueStyle); |
2377 | 84 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
85 |
QDateTime now = QDateTime::currentDateTime(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
86 |
srand(now.toTime_t()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
87 |
rand(); |
579 | 88 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
89 |
Q_INIT_RESOURCE(hedgewars); |
579 | 90 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
91 |
qApp->setStyleSheet |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
92 |
(QString( |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
93 |
"HWForm,QDialog{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
94 |
"background-image: url(\":/res/Background.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
95 |
"background-position: bottom center;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
96 |
"background-repeat: repeat-x;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
97 |
"background-color: #141250;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
98 |
"}" |
1154 | 99 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
100 |
"* {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
101 |
"color: #ffcc00;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
102 |
"selection-background-color: #ffcc00;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
103 |
"selection-color: #00351d;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
104 |
"}" |
1893 | 105 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
106 |
"QLineEdit, QListWidget, QTableView, QTextBrowser, QSpinBox, QComboBox, " |
1893 | 107 |
"QComboBox QAbstractItemView, QMenu::item {" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
108 |
"background-color: rgba(13, 5, 68, 70%);" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
109 |
"}" |
1893 | 110 |
|
3185 | 111 |
"QComboBox::separator {" |
112 |
"border: solid; border-width: 3px; border-color: #ffcc00;" |
|
113 |
"}" |
|
114 |
||
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
115 |
"QPushButton, QListWidget, QTableView, QLineEdit, QHeaderView, " |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
116 |
"QTextBrowser, QSpinBox, QToolBox, QComboBox, " |
1893 | 117 |
"QComboBox QAbstractItemView, IconedGroupBox, " |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
118 |
".QGroupBox, GameCFGWidget, TeamSelWidget, SelWeaponWidget, " |
1897 | 119 |
"QTabWidget::pane, QTabBar::tab {" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
120 |
"border: solid;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
121 |
"border-width: 3px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
122 |
"border-color: #ffcc00;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
123 |
"}" |
1893 | 124 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
125 |
"QPushButton:hover, QLineEdit:hover, QListWidget:hover, " |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
126 |
"QSpinBox:hover, QToolBox:hover, QComboBox:hover {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
127 |
"border-color: yellow;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
128 |
"}" |
1893 | 129 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
130 |
"QLineEdit, QListWidget,QTableView, QTextBrowser, " |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
131 |
"QSpinBox, QToolBox { " |
3019 | 132 |
"border-radius: 10px;" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
133 |
"}" |
1893 | 134 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
135 |
"QLineEdit, QLabel, QHeaderView, QListWidget, QTableView, " |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
136 |
"QSpinBox, QToolBox::tab, QComboBox, QComboBox QAbstractItemView, " |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
137 |
"IconedGroupBox, .QGroupBox, GameCFGWidget, TeamSelWidget, " |
3019 | 138 |
"SelWeaponWidget, QCheckBox, QRadioButton, QPushButton {" |
139 |
"font: bold 13px;" |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
140 |
"}" |
2517 | 141 |
"SelWeaponWidget QTabWidget::pane, SelWeaponWidget QTabBar::tab:selected {" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
142 |
"background-position: bottom center;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
143 |
"background-repeat: repeat-x;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
144 |
"background-color: #000000;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
145 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
146 |
".QGroupBox,GameCFGWidget,TeamSelWidget,SelWeaponWidget {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
147 |
"background-position: bottom center;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
148 |
"background-repeat: repeat-x;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
149 |
"border-radius: 16px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
150 |
"background-color: rgba(13, 5, 68, 70%);" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
151 |
"padding: 6px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
152 |
"}" |
2072
6e0fcbcc3f60
Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents:
2035
diff
changeset
|
153 |
/* Experimenting with PaintOnScreen and border-radius on IconedGroupBox children didn't work out well |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
154 |
"IconedGroupBox QComboBox, IconedGroupBox QPushButton, IconedGroupBox QLineEdit, " |
2072
6e0fcbcc3f60
Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents:
2035
diff
changeset
|
155 |
"IconedGroupBox QSpinBox {" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
156 |
"border-radius: 0;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
157 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
158 |
"IconedGroupBox, IconedGroupBox *, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{" */ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
159 |
"IconedGroupBox, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
160 |
"background-color: #130f2c;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
161 |
"}" |
1893 | 162 |
|
163 |
||
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
164 |
"QPushButton {" |
3019 | 165 |
"border-radius: 8px;" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
166 |
"background-origin: margin;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
167 |
"background-position: top left;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
168 |
"background-color: rgba(18, 42, 5, 70%);" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
169 |
"}" |
1893 | 170 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
171 |
"QPushButton:pressed{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
172 |
"border-color: white;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
173 |
"}" |
1154 | 174 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
175 |
"QHeaderView {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
176 |
"border-radius: 0;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
177 |
"border-width: 0;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
178 |
"border-bottom-width: 3px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
179 |
"background-color: #00351d;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
180 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
181 |
"QTableView {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
182 |
"alternate-background-color: #2f213a;" |
3865 | 183 |
"gridline-color: transparent;" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
184 |
"}" |
1172 | 185 |
|
1893 | 186 |
"QTabBar::tab {" |
1897 | 187 |
"border-bottom-width: 0;" |
1893 | 188 |
"border-radius: 0;" |
189 |
"border-top-left-radius: 6px;" |
|
190 |
"border-top-right-radius: 6px;" |
|
191 |
"padding: 3px;" |
|
192 |
"}" |
|
193 |
"QTabBar::tab:!selected {" |
|
194 |
"color: #0d0544;" |
|
195 |
"background-color: #ffcc00;" |
|
196 |
"}" |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
197 |
"QSpinBox::up-button{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
198 |
"background: transparent;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
199 |
"width: 16px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
200 |
"height: 10px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
201 |
"}" |
1893 | 202 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
203 |
"QSpinBox::up-arrow {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
204 |
"image: url(\":/res/spin_up.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
205 |
"}" |
1893 | 206 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
207 |
"QSpinBox::down-arrow {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
208 |
"image: url(\":/res/spin_down.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
209 |
"}" |
1893 | 210 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
211 |
"QSpinBox::down-button {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
212 |
"background: transparent;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
213 |
"width: 16px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
214 |
"height: 10px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
215 |
"}" |
1172 | 216 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
217 |
"QComboBox {" |
3019 | 218 |
"border-radius: 10px;" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
219 |
"padding: 3px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
220 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
221 |
"QComboBox:pressed{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
222 |
"border-color: white;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
223 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
224 |
"QComboBox::drop-down{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
225 |
"border: transparent;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
226 |
"width: 25px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
227 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
228 |
"QComboBox::down-arrow {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
229 |
"image: url(\":/res/dropdown.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
230 |
"}" |
2377 | 231 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
232 |
"VertScrArea {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
233 |
"background-position: bottom center;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
234 |
"background-repeat: repeat-x;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
235 |
"}" |
2377 | 236 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
237 |
"IconedGroupBox {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
238 |
"border-radius: 16px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
239 |
"padding: 2px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
240 |
"}" |
1893 | 241 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
242 |
"QGroupBox::title{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
243 |
"subcontrol-origin: margin;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
244 |
"subcontrol-position: top left;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
245 |
"text-align: left;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
246 |
"}" |
1155 | 247 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
248 |
"QCheckBox::indicator:checked{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
249 |
"image: url(\":/res/checked.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
250 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
251 |
"QCheckBox::indicator:unchecked{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
252 |
"image: url(\":/res/unchecked.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
253 |
"}" |
2377 | 254 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
255 |
".QWidget{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
256 |
"background: transparent;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
257 |
"}" |
1893 | 258 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
259 |
"QTabWidget::pane {" |
1893 | 260 |
"border-top-width: 2px;" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
261 |
"}" |
1413 | 262 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
263 |
"QMenu{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
264 |
"background-color: #ffcc00;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
265 |
"margin: 3px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
266 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
267 |
"QMenu::item {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
268 |
"background-color: #0d0544;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
269 |
"border: 1px solid transparent;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
270 |
"font: bold;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
271 |
"padding: 2px 25px 2px 20px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
272 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
273 |
"QMenu::item:selected {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
274 |
"background-color: #2d2564;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
275 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
276 |
"QMenu::indicator {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
277 |
"width: 16px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
278 |
"height: 16px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
279 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
280 |
"QMenu::indicator:non-exclusive:checked{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
281 |
"image: url(\":/res/checked.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
282 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
283 |
"QMenu::indicator:non-exclusive:unchecked{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
284 |
"image: url(\":/res/unchecked.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
285 |
"}" |
1450 | 286 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
287 |
"QToolTip{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
288 |
"background-color: #0d0544;" |
3019 | 289 |
"border: 1px solid #ffcc00;" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
290 |
"}" |
2377 | 291 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
292 |
":disabled{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
293 |
"color: #a0a0a0;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
294 |
"}" |
2072
6e0fcbcc3f60
Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents:
2035
diff
changeset
|
295 |
"SquareLabel, ItemNum {" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
296 |
"background-color: #000000;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
297 |
"}" |
3714 | 298 |
"QSlider::groove::horizontal {" |
299 |
"height: 2px;" |
|
300 |
"margin: 2px 0px;" |
|
301 |
"background-color: #ffcc00;" |
|
302 |
"}" |
|
303 |
"QSlider::handle::horizontal {" |
|
304 |
"border: 0px;" |
|
305 |
"margin: -2px 0px;" |
|
306 |
"border-radius: 3px;" |
|
307 |
"background-color: #ffcc00;" |
|
308 |
"width: 8px;" |
|
309 |
"}" |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
310 |
) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
311 |
); |
1150 | 312 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
313 |
bindir->cd("bin"); // workaround over NSIS installer |
579 | 314 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
315 |
if(cConfigDir->length() == 0) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
316 |
cfgdir->setPath(cfgdir->homePath()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
317 |
else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
318 |
cfgdir->setPath(*cConfigDir); |
2428 | 319 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
320 |
if(cConfigDir->length() == 0) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
321 |
{ |
1965 | 322 |
#ifdef __APPLE__ |
3758 | 323 |
checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars"); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
324 |
cfgdir->cd("Library/Application Support/Hedgewars"); |
3333 | 325 |
#elif defined _WIN32 |
326 |
char path[1024]; |
|
327 |
if(!SHGetFolderPathA(0, CSIDL_PERSONAL, NULL, 0, path)) |
|
328 |
{ |
|
329 |
cfgdir->cd(path); |
|
3758 | 330 |
checkForDir(cfgdir->absolutePath() + "/Hedgewars"); |
3333 | 331 |
cfgdir->cd("Hedgewars"); |
332 |
} |
|
3758 | 333 |
else // couldn't retrieve documents folder? almost impossible, but in case fall back to classic path |
3333 | 334 |
{ |
3758 | 335 |
checkForDir(cfgdir->absolutePath() + "/.hedgewars"); |
3333 | 336 |
cfgdir->cd(".hedgewars"); |
337 |
} |
|
2428 | 338 |
#else |
3758 | 339 |
checkForDir(cfgdir->absolutePath() + "/.hedgewars"); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
340 |
cfgdir->cd(".hedgewars"); |
2428 | 341 |
#endif |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
342 |
} |
3758 | 343 |
|
344 |
if (checkForDir(cfgdir->absolutePath())) |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
345 |
{ |
3758 | 346 |
// alternative loading/lookup paths |
347 |
// TODO: Uncomment paths as they're implemented |
|
348 |
checkForDir(cfgdir->absolutePath() + "/Data"); |
|
349 |
//checkForDir(cfgdir->absolutePath() + "/Data/Forts"); |
|
350 |
//checkForDir(cfgdir->absolutePath() + "/Data/Graphics"); |
|
351 |
//checkForDir(cfgdir->absolutePath() + "/Data/Graphics/Flags"); |
|
352 |
//checkForDir(cfgdir->absolutePath() + "/Data/Graphics/Graves"); |
|
353 |
//checkForDir(cfgdir->absolutePath() + "/Data/Graphics/Hats"); |
|
354 |
//checkForDir(cfgdir->absolutePath() + "/Data/Maps"); |
|
355 |
//checkForDir(cfgdir->absolutePath() + "/Data/Missions"); |
|
356 |
//checkForDir(cfgdir->absolutePath() + "/Data/Missions/Campaign"); |
|
357 |
//checkForDir(cfgdir->absolutePath() + "/Data/Missions/Training"); |
|
358 |
//checkForDir(cfgdir->absolutePath() + "/Data/Sounds"); |
|
359 |
//checkForDir(cfgdir->absolutePath() + "/Data/Sounds/voices"); |
|
360 |
//checkForDir(cfgdir->absolutePath() + "/Data/Themes"); |
|
361 |
||
362 |
// config/save paths |
|
363 |
checkForDir(cfgdir->absolutePath() + "/Demos"); |
|
364 |
checkForDir(cfgdir->absolutePath() + "/Saves"); |
|
365 |
checkForDir(cfgdir->absolutePath() + "/Screenshots"); |
|
366 |
checkForDir(cfgdir->absolutePath() + "/Teams"); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
367 |
} |
579 | 368 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
369 |
datadir->cd(bindir->absolutePath()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
370 |
datadir->cd(*cDataDir); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
371 |
if(!datadir->cd("hedgewars/Data")) { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
372 |
QMessageBox::critical(0, QMessageBox::tr("Error"), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
373 |
QMessageBox::tr("Failed to open data directory:\n%1\n" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
374 |
"Please check your installation"). |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
375 |
arg(datadir->absolutePath()+"/hedgewars/Data")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
376 |
return 1; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
377 |
} |
579 | 378 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
379 |
Themes = new QStringList(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
380 |
QFile themesfile(datadir->absolutePath() + "/Themes/themes.cfg"); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
381 |
if (themesfile.open(QIODevice::ReadOnly)) { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
382 |
QTextStream stream(&themesfile); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
383 |
QString str; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
384 |
while (!stream.atEnd()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
385 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
386 |
Themes->append(stream.readLine()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
387 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
388 |
themesfile.close(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
389 |
} else { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
390 |
QMessageBox::critical(0, "Error", "Cannot access themes.cfg", "OK"); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
391 |
} |
579 | 392 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
393 |
QDir tmpdir; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
394 |
tmpdir.cd(datadir->absolutePath()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
395 |
tmpdir.cd("Maps"); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
396 |
tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
397 |
mapList = new QStringList(tmpdir.entryList(QStringList("*"))); |
1210 | 398 |
|
2898 | 399 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
400 |
QTranslator Translator; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
401 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
402 |
QSettings settings(cfgdir->absolutePath() + "/hedgewars.ini", QSettings::IniFormat); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
403 |
QString cc = settings.value("misc/locale", "").toString(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
404 |
if(!cc.compare("")) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
405 |
cc = QLocale::system().name(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
406 |
Translator.load(datadir->absolutePath() + "/Locale/hedgewars_" + cc); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
407 |
app.installTranslator(&Translator); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
408 |
} |
2898 | 409 |
|
3679 | 410 |
// Win32 registry setup (used for xfire detection etc. - don't set it if we're running in "portable" mode with a custom config dir) |
411 |
#ifdef _WIN32 |
|
412 |
if(cConfigDir->length() == 0) |
|
413 |
{ |
|
414 |
QSettings registry(QSettings::NativeFormat, QSettings::UserScope, "Hedgewars Project", "Hedgewars"); |
|
415 |
QFileInfo f(argv[0]); |
|
416 |
registry.setValue("file", f.absoluteFilePath()); |
|
417 |
registry.setValue("path", f.absolutePath()); |
|
418 |
} |
|
419 |
#endif |
|
2898 | 420 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
421 |
HWForm *Form = new HWForm(); |
2377 | 422 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
423 |
Form->show(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
424 |
return app.exec(); |
2845 | 425 |
} |