author | koda |
Sat, 18 Jun 2011 03:14:45 +0200 | |
changeset 5252 | ded882439548 |
parent 5238 | 46ddaf14509d |
child 5257 | 0bbdd47522b9 |
permissions | -rw-r--r-- |
579 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
4976 | 3 |
* Copyright (c) 2005-2011 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 |
||
5252 | 19 |
#include "HWApplication.h" |
20 |
||
579 | 21 |
#include <QTranslator> |
22 |
#include <QLocale> |
|
23 |
#include <QMessageBox> |
|
1416
60b86d6fe9ae
Force plastique style, as others don't fully support stylesheets
unc0rr
parents:
1415
diff
changeset
|
24 |
#include <QPlastiqueStyle> |
2034
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
25 |
#include <QRegExp> |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
26 |
#include <QMap> |
2898 | 27 |
#include <QSettings> |
1146 | 28 |
|
579 | 29 |
#include "hwform.h" |
30 |
#include "hwconsts.h" |
|
31 |
||
3333 | 32 |
#ifdef _WIN32 |
33 |
#include <Shlobj.h> |
|
34 |
#endif |
|
5095
15dd764b728c
fix autorelease pools not being set (issue 209) and format code a little
koda
parents:
4976
diff
changeset
|
35 |
#ifdef __APPLE__ |
15dd764b728c
fix autorelease pools not being set (issue 209) and format code a little
koda
parents:
4976
diff
changeset
|
36 |
#include "CocoaInitializer.h" |
15dd764b728c
fix autorelease pools not being set (issue 209) and format code a little
koda
parents:
4976
diff
changeset
|
37 |
#endif |
3333 | 38 |
|
579 | 39 |
bool checkForDir(const QString & dir) |
40 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
41 |
QDir tmpdir; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
42 |
if (!tmpdir.exists(dir)) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
43 |
if (!tmpdir.mkdir(dir)) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
44 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
45 |
QMessageBox::critical(0, |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
46 |
QObject::tr("Error"), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
47 |
QObject::tr("Cannot create directory %1").arg(dir), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
48 |
QObject::tr("OK")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
49 |
return false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
50 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
51 |
return true; |
579 | 52 |
} |
53 |
||
3697 | 54 |
int main(int argc, char *argv[]) { |
5252 | 55 |
HWApplication app(argc, argv); |
4888 | 56 |
app.setAttribute(Qt::AA_DontShowIconsInMenus,false); |
579 | 57 |
|
2034
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
58 |
QStringList arguments = app.arguments(); |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
59 |
QMap<QString, QString> parsedArgs; |
5252 | 60 |
#ifndef __APPLE__ |
61 |
//HACK: it's difficult/rarely done to use command line args on macs anyways |
|
62 |
// but why does this section of code make the app crash when opening a file? |
|
2034
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
63 |
{ |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
64 |
QList<QString>::iterator i = arguments.begin(); |
2035 | 65 |
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
|
66 |
QString arg = *i; |
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 |
QRegExp opt("--(\\S+)=(.+)"); |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
69 |
if(opt.exactMatch(arg)) { |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
70 |
parsedArgs[opt.cap(1)] = opt.cap(2); |
2035 | 71 |
i = arguments.erase(i); |
72 |
} else { |
|
73 |
++i; |
|
2034
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 |
} |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
76 |
} |
5252 | 77 |
#endif |
2034
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
78 |
|
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
79 |
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
|
80 |
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
|
81 |
if(!f.exists()) { |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
82 |
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
|
83 |
} |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
84 |
*cDataDir = f.absoluteFilePath(); |
3932 | 85 |
custom_data = true; |
2034
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
86 |
} |
decdf48cffd7
david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents:
1969
diff
changeset
|
87 |
|
2428 | 88 |
if(parsedArgs.contains("config-dir")) { |
89 |
QFileInfo f(parsedArgs["config-dir"]); |
|
90 |
*cConfigDir = f.absoluteFilePath(); |
|
3932 | 91 |
custom_config = true; |
2428 | 92 |
} |
93 |
||
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
94 |
app.setStyle(new QPlastiqueStyle); |
2377 | 95 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
96 |
QDateTime now = QDateTime::currentDateTime(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
97 |
srand(now.toTime_t()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
98 |
rand(); |
579 | 99 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
100 |
Q_INIT_RESOURCE(hedgewars); |
579 | 101 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
102 |
qApp->setStyleSheet |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
103 |
(QString( |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
104 |
"HWForm,QDialog{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
105 |
"background-image: url(\":/res/Background.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
106 |
"background-position: bottom center;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
107 |
"background-repeat: repeat-x;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
108 |
"background-color: #141250;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
109 |
"}" |
1154 | 110 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
111 |
"* {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
112 |
"color: #ffcc00;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
113 |
"selection-background-color: #ffcc00;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
114 |
"selection-color: #00351d;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
115 |
"}" |
1893 | 116 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
117 |
"QLineEdit, QListWidget, QTableView, QTextBrowser, QSpinBox, QComboBox, " |
1893 | 118 |
"QComboBox QAbstractItemView, QMenu::item {" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
119 |
"background-color: rgba(13, 5, 68, 70%);" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
120 |
"}" |
1893 | 121 |
|
3185 | 122 |
"QComboBox::separator {" |
123 |
"border: solid; border-width: 3px; border-color: #ffcc00;" |
|
124 |
"}" |
|
125 |
||
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
126 |
"QPushButton, QListWidget, QTableView, QLineEdit, QHeaderView, " |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
127 |
"QTextBrowser, QSpinBox, QToolBox, QComboBox, " |
1893 | 128 |
"QComboBox QAbstractItemView, IconedGroupBox, " |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
129 |
".QGroupBox, GameCFGWidget, TeamSelWidget, SelWeaponWidget, " |
1897 | 130 |
"QTabWidget::pane, QTabBar::tab {" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
131 |
"border: solid;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
132 |
"border-width: 3px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
133 |
"border-color: #ffcc00;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
134 |
"}" |
1893 | 135 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
136 |
"QPushButton:hover, QLineEdit:hover, QListWidget:hover, " |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
137 |
"QSpinBox:hover, QToolBox:hover, QComboBox:hover {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
138 |
"border-color: yellow;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
139 |
"}" |
1893 | 140 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
141 |
"QLineEdit, QListWidget,QTableView, QTextBrowser, " |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
142 |
"QSpinBox, QToolBox { " |
3019 | 143 |
"border-radius: 10px;" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
144 |
"}" |
1893 | 145 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
146 |
"QLineEdit, QLabel, QHeaderView, QListWidget, QTableView, " |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
147 |
"QSpinBox, QToolBox::tab, QComboBox, QComboBox QAbstractItemView, " |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
148 |
"IconedGroupBox, .QGroupBox, GameCFGWidget, TeamSelWidget, " |
3019 | 149 |
"SelWeaponWidget, QCheckBox, QRadioButton, QPushButton {" |
150 |
"font: bold 13px;" |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
151 |
"}" |
2517 | 152 |
"SelWeaponWidget QTabWidget::pane, SelWeaponWidget QTabBar::tab:selected {" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
153 |
"background-position: bottom center;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
154 |
"background-repeat: repeat-x;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
155 |
"background-color: #000000;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
156 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
157 |
".QGroupBox,GameCFGWidget,TeamSelWidget,SelWeaponWidget {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
158 |
"background-position: bottom center;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
159 |
"background-repeat: repeat-x;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
160 |
"border-radius: 16px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
161 |
"background-color: rgba(13, 5, 68, 70%);" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
162 |
"padding: 6px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
163 |
"}" |
2072
6e0fcbcc3f60
Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents:
2035
diff
changeset
|
164 |
/* 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
|
165 |
"IconedGroupBox QComboBox, IconedGroupBox QPushButton, IconedGroupBox QLineEdit, " |
2072
6e0fcbcc3f60
Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents:
2035
diff
changeset
|
166 |
"IconedGroupBox QSpinBox {" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
167 |
"border-radius: 0;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
168 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
169 |
"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
|
170 |
"IconedGroupBox, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
171 |
"background-color: #130f2c;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
172 |
"}" |
1893 | 173 |
|
174 |
||
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
175 |
"QPushButton {" |
3019 | 176 |
"border-radius: 8px;" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
177 |
"background-origin: margin;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
178 |
"background-position: top left;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
179 |
"background-color: rgba(18, 42, 5, 70%);" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
180 |
"}" |
1893 | 181 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
182 |
"QPushButton:pressed{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
183 |
"border-color: white;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
184 |
"}" |
1154 | 185 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
186 |
"QHeaderView {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
187 |
"border-radius: 0;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
188 |
"border-width: 0;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
189 |
"border-bottom-width: 3px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
190 |
"background-color: #00351d;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
191 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
192 |
"QTableView {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
193 |
"alternate-background-color: #2f213a;" |
3865 | 194 |
"gridline-color: transparent;" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
195 |
"}" |
1172 | 196 |
|
1893 | 197 |
"QTabBar::tab {" |
1897 | 198 |
"border-bottom-width: 0;" |
1893 | 199 |
"border-radius: 0;" |
200 |
"border-top-left-radius: 6px;" |
|
201 |
"border-top-right-radius: 6px;" |
|
202 |
"padding: 3px;" |
|
203 |
"}" |
|
204 |
"QTabBar::tab:!selected {" |
|
205 |
"color: #0d0544;" |
|
206 |
"background-color: #ffcc00;" |
|
207 |
"}" |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
208 |
"QSpinBox::up-button{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
209 |
"background: transparent;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
210 |
"width: 16px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
211 |
"height: 10px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
212 |
"}" |
1893 | 213 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
214 |
"QSpinBox::up-arrow {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
215 |
"image: url(\":/res/spin_up.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
216 |
"}" |
1893 | 217 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
218 |
"QSpinBox::down-arrow {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
219 |
"image: url(\":/res/spin_down.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
220 |
"}" |
1893 | 221 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
222 |
"QSpinBox::down-button {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
223 |
"background: transparent;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
224 |
"width: 16px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
225 |
"height: 10px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
226 |
"}" |
1172 | 227 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
228 |
"QComboBox {" |
3019 | 229 |
"border-radius: 10px;" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
230 |
"padding: 3px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
231 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
232 |
"QComboBox:pressed{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
233 |
"border-color: white;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
234 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
235 |
"QComboBox::drop-down{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
236 |
"border: transparent;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
237 |
"width: 25px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
238 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
239 |
"QComboBox::down-arrow {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
240 |
"image: url(\":/res/dropdown.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
241 |
"}" |
2377 | 242 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
243 |
"VertScrArea {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
244 |
"background-position: bottom center;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
245 |
"background-repeat: repeat-x;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
246 |
"}" |
2377 | 247 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
248 |
"IconedGroupBox {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
249 |
"border-radius: 16px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
250 |
"padding: 2px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
251 |
"}" |
1893 | 252 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
253 |
"QGroupBox::title{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
254 |
"subcontrol-origin: margin;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
255 |
"subcontrol-position: top left;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
256 |
"text-align: left;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
257 |
"}" |
1155 | 258 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
259 |
"QCheckBox::indicator:checked{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
260 |
"image: url(\":/res/checked.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
261 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
262 |
"QCheckBox::indicator:unchecked{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
263 |
"image: url(\":/res/unchecked.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
264 |
"}" |
2377 | 265 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
266 |
".QWidget{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
267 |
"background: transparent;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
268 |
"}" |
1893 | 269 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
270 |
"QTabWidget::pane {" |
1893 | 271 |
"border-top-width: 2px;" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
272 |
"}" |
1413 | 273 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
274 |
"QMenu{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
275 |
"background-color: #ffcc00;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
276 |
"margin: 3px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
277 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
278 |
"QMenu::item {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
279 |
"background-color: #0d0544;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
280 |
"border: 1px solid transparent;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
281 |
"font: bold;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
282 |
"padding: 2px 25px 2px 20px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
283 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
284 |
"QMenu::item:selected {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
285 |
"background-color: #2d2564;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
286 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
287 |
"QMenu::indicator {" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
288 |
"width: 16px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
289 |
"height: 16px;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
290 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
291 |
"QMenu::indicator:non-exclusive:checked{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
292 |
"image: url(\":/res/checked.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
293 |
"}" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
294 |
"QMenu::indicator:non-exclusive:unchecked{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
295 |
"image: url(\":/res/unchecked.png\");" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
296 |
"}" |
1450 | 297 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
298 |
"QToolTip{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
299 |
"background-color: #0d0544;" |
3019 | 300 |
"border: 1px solid #ffcc00;" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
301 |
"}" |
2377 | 302 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
303 |
":disabled{" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
304 |
"color: #a0a0a0;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
305 |
"}" |
2072
6e0fcbcc3f60
Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents:
2035
diff
changeset
|
306 |
"SquareLabel, ItemNum {" |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
307 |
"background-color: #000000;" |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
308 |
"}" |
3714 | 309 |
"QSlider::groove::horizontal {" |
310 |
"height: 2px;" |
|
311 |
"margin: 2px 0px;" |
|
312 |
"background-color: #ffcc00;" |
|
313 |
"}" |
|
314 |
"QSlider::handle::horizontal {" |
|
315 |
"border: 0px;" |
|
316 |
"margin: -2px 0px;" |
|
317 |
"border-radius: 3px;" |
|
318 |
"background-color: #ffcc00;" |
|
319 |
"width: 8px;" |
|
320 |
"}" |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
321 |
) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
322 |
); |
1150 | 323 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
324 |
bindir->cd("bin"); // workaround over NSIS installer |
579 | 325 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
326 |
if(cConfigDir->length() == 0) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
327 |
cfgdir->setPath(cfgdir->homePath()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
328 |
else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
329 |
cfgdir->setPath(*cConfigDir); |
2428 | 330 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
331 |
if(cConfigDir->length() == 0) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
332 |
{ |
1965 | 333 |
#ifdef __APPLE__ |
3758 | 334 |
checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars"); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
335 |
cfgdir->cd("Library/Application Support/Hedgewars"); |
3333 | 336 |
#elif defined _WIN32 |
337 |
char path[1024]; |
|
338 |
if(!SHGetFolderPathA(0, CSIDL_PERSONAL, NULL, 0, path)) |
|
339 |
{ |
|
340 |
cfgdir->cd(path); |
|
3758 | 341 |
checkForDir(cfgdir->absolutePath() + "/Hedgewars"); |
3333 | 342 |
cfgdir->cd("Hedgewars"); |
343 |
} |
|
3758 | 344 |
else // couldn't retrieve documents folder? almost impossible, but in case fall back to classic path |
3333 | 345 |
{ |
3758 | 346 |
checkForDir(cfgdir->absolutePath() + "/.hedgewars"); |
3333 | 347 |
cfgdir->cd(".hedgewars"); |
348 |
} |
|
2428 | 349 |
#else |
3758 | 350 |
checkForDir(cfgdir->absolutePath() + "/.hedgewars"); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
351 |
cfgdir->cd(".hedgewars"); |
2428 | 352 |
#endif |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
353 |
} |
3758 | 354 |
|
355 |
if (checkForDir(cfgdir->absolutePath())) |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
356 |
{ |
3758 | 357 |
// alternative loading/lookup paths |
358 |
// TODO: Uncomment paths as they're implemented |
|
359 |
checkForDir(cfgdir->absolutePath() + "/Data"); |
|
360 |
//checkForDir(cfgdir->absolutePath() + "/Data/Forts"); |
|
361 |
//checkForDir(cfgdir->absolutePath() + "/Data/Graphics"); |
|
362 |
//checkForDir(cfgdir->absolutePath() + "/Data/Graphics/Flags"); |
|
363 |
//checkForDir(cfgdir->absolutePath() + "/Data/Graphics/Graves"); |
|
364 |
//checkForDir(cfgdir->absolutePath() + "/Data/Graphics/Hats"); |
|
365 |
//checkForDir(cfgdir->absolutePath() + "/Data/Maps"); |
|
366 |
//checkForDir(cfgdir->absolutePath() + "/Data/Missions"); |
|
367 |
//checkForDir(cfgdir->absolutePath() + "/Data/Missions/Campaign"); |
|
368 |
//checkForDir(cfgdir->absolutePath() + "/Data/Missions/Training"); |
|
369 |
//checkForDir(cfgdir->absolutePath() + "/Data/Sounds"); |
|
370 |
//checkForDir(cfgdir->absolutePath() + "/Data/Sounds/voices"); |
|
371 |
//checkForDir(cfgdir->absolutePath() + "/Data/Themes"); |
|
372 |
||
373 |
// config/save paths |
|
374 |
checkForDir(cfgdir->absolutePath() + "/Demos"); |
|
375 |
checkForDir(cfgdir->absolutePath() + "/Saves"); |
|
376 |
checkForDir(cfgdir->absolutePath() + "/Screenshots"); |
|
377 |
checkForDir(cfgdir->absolutePath() + "/Teams"); |
|
3914 | 378 |
checkForDir(cfgdir->absolutePath() + "/Logs"); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
379 |
} |
579 | 380 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
381 |
datadir->cd(bindir->absolutePath()); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
382 |
datadir->cd(*cDataDir); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
383 |
if(!datadir->cd("hedgewars/Data")) { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
384 |
QMessageBox::critical(0, QMessageBox::tr("Error"), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
385 |
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
|
386 |
"Please check your installation"). |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
387 |
arg(datadir->absolutePath()+"/hedgewars/Data")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
388 |
return 1; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
389 |
} |
579 | 390 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
391 |
Themes = new QStringList(); |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
392 |
QFile userthemesfile(cfgdir->absolutePath() + "/Data/Themes/themes.cfg"); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
393 |
if (userthemesfile.open(QIODevice::ReadOnly)) { |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
394 |
QTextStream stream(&userthemesfile); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
395 |
while (!stream.atEnd()) Themes->append(stream.readLine()); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
396 |
userthemesfile.close(); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
397 |
} |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
398 |
QFile themesfile(datadir->absolutePath() + "/Themes/themes.cfg"); |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
399 |
QString str; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
400 |
if (themesfile.open(QIODevice::ReadOnly)) { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
401 |
QTextStream stream(&themesfile); |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
402 |
while (!stream.atEnd()) { |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
403 |
str = stream.readLine(); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
404 |
if (!Themes->contains(str)) Themes->append(str); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
405 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
406 |
themesfile.close(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
407 |
} else { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
408 |
QMessageBox::critical(0, "Error", "Cannot access themes.cfg", "OK"); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
409 |
} |
579 | 410 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
411 |
QDir tmpdir; |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
412 |
tmpdir.cd(cfgdir->absolutePath()); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
413 |
tmpdir.cd("Data/Maps"); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
414 |
tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
415 |
mapList = new QStringList(tmpdir.entryList(QStringList("*"))); |
1210 | 416 |
|
4513
1dd97c710f5a
added general scripts to multiplayer and added option for scripts to allow user set schemes or weapon sets.
Henek
parents:
3932
diff
changeset
|
417 |
tmpdir.cd(datadir->absolutePath()); |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
418 |
tmpdir.cd("Maps"); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
419 |
tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
420 |
QStringList tmplist = QStringList(tmpdir.entryList(QStringList("*"))); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
421 |
for (QStringList::Iterator it = tmplist.begin(); it != tmplist.end(); ++it) |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
422 |
if (!mapList->contains(*it,Qt::CaseInsensitive)) mapList->append(*it); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
423 |
|
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
424 |
tmpdir.cd(cfgdir->absolutePath()); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
425 |
tmpdir.cd("Data/Scripts/Multiplayer"); |
4513
1dd97c710f5a
added general scripts to multiplayer and added option for scripts to allow user set schemes or weapon sets.
Henek
parents:
3932
diff
changeset
|
426 |
tmpdir.setFilter(QDir::Files | QDir::NoDotAndDotDot); |
1dd97c710f5a
added general scripts to multiplayer and added option for scripts to allow user set schemes or weapon sets.
Henek
parents:
3932
diff
changeset
|
427 |
scriptList = new QStringList(tmpdir.entryList(QStringList("*.lua"))); |
1dd97c710f5a
added general scripts to multiplayer and added option for scripts to allow user set schemes or weapon sets.
Henek
parents:
3932
diff
changeset
|
428 |
|
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
429 |
tmpdir.cd(datadir->absolutePath()); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
430 |
tmpdir.cd("Scripts/Multiplayer"); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
431 |
tmpdir.setFilter(QDir::Files | QDir::NoDotAndDotDot); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
432 |
tmplist = QStringList(tmpdir.entryList(QStringList("*.lua"))); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
433 |
for (QStringList::Iterator it = tmplist.begin(); it != tmplist.end(); ++it) |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
434 |
if (!scriptList->contains(*it,Qt::CaseInsensitive)) scriptList->append(*it); |
2898 | 435 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
436 |
QTranslator Translator; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
437 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
438 |
QSettings settings(cfgdir->absolutePath() + "/hedgewars.ini", QSettings::IniFormat); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
439 |
QString cc = settings.value("misc/locale", "").toString(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
440 |
if(!cc.compare("")) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
441 |
cc = QLocale::system().name(); |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
442 |
QFile tmpfile; |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
443 |
tmpfile.setFileName(cfgdir->absolutePath() + "Data/Locale/hedgewars_" + cc); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
444 |
if (!tmpfile.exists()) tmpfile.setFileName(datadir->absolutePath() + "Locale/hedgewars_" + cc); |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5095
diff
changeset
|
445 |
Translator.load(QFileInfo(tmpfile).absoluteFilePath()); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
446 |
app.installTranslator(&Translator); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
447 |
} |
2898 | 448 |
|
3679 | 449 |
// Win32 registry setup (used for xfire detection etc. - don't set it if we're running in "portable" mode with a custom config dir) |
450 |
#ifdef _WIN32 |
|
3932 | 451 |
if(!custom_config) |
3679 | 452 |
{ |
3932 | 453 |
QSettings registry_hklm("HKEY_LOCAL_MACHINE", QSettings::NativeFormat); |
454 |
registry_hklm.setValue("Software/Hedgewars/Frontend", bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe"); |
|
455 |
registry_hklm.setValue("Software/Hedgewars/Path", bindir->absolutePath().replace("/", "\\")); |
|
3679 | 456 |
} |
457 |
#endif |
|
5095
15dd764b728c
fix autorelease pools not being set (issue 209) and format code a little
koda
parents:
4976
diff
changeset
|
458 |
#ifdef __APPLE__ |
15dd764b728c
fix autorelease pools not being set (issue 209) and format code a little
koda
parents:
4976
diff
changeset
|
459 |
// this creates the autoreleasepool that prevents leaking |
15dd764b728c
fix autorelease pools not being set (issue 209) and format code a little
koda
parents:
4976
diff
changeset
|
460 |
CocoaInitializer initializer; |
15dd764b728c
fix autorelease pools not being set (issue 209) and format code a little
koda
parents:
4976
diff
changeset
|
461 |
#endif |
2898 | 462 |
|
5252 | 463 |
app.form = new HWForm(); |
2377 | 464 |
|
5252 | 465 |
app.form->show(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2913
diff
changeset
|
466 |
return app.exec(); |
2845 | 467 |
} |