QTfrontend/main.cpp
author unc0rr
Tue, 06 Jan 2009 19:47:19 +0000
changeset 1592 5ee77ee470a6
parent 1577 e3e37c730dc0
child 1893 85c61bc5e160
permissions -rw-r--r--
Start converting network protocol to no-disconnecting religion
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     1
/*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 579
diff changeset
     2
 * Hedgewars, a free turn based strategy game
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     3
 * Copyright (c) 2005-2007 Andrey Korotaev <unC0Rr@gmail.com>
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     4
 *
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     8
 *
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    12
 * GNU General Public License for more details.
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    13
 *
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    17
 */
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    18
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    19
#include <QApplication>
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    20
#include <QTranslator>
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    21
#include <QLocale>
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    22
#include <QMessageBox>
1416
60b86d6fe9ae Force plastique style, as others don't fully support stylesheets
unc0rr
parents: 1415
diff changeset
    23
#include <QPlastiqueStyle>
1146
0bc17a69b3d8 Background for Hedgewars is ready
displacer
parents: 1066
diff changeset
    24
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    25
#include "hwform.h"
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    26
#include "hwconsts.h"
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    27
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    28
bool checkForDir(const QString & dir)
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    29
{
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    30
	QDir tmpdir;
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    31
	if (!tmpdir.exists(dir))
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    32
		if (!tmpdir.mkdir(dir))
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    33
		{
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    34
			QMessageBox::critical(0,
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    35
					QObject::tr("Error"),
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    36
					QObject::tr("Cannot create directory %1").arg(dir),
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    37
					QObject::tr("OK"));
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    38
			return false;
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    39
		}
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    40
	return true;
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    41
}
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    42
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    43
int main(int argc, char *argv[])
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    44
{
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    45
	QApplication app(argc, argv);
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    46
1416
60b86d6fe9ae Force plastique style, as others don't fully support stylesheets
unc0rr
parents: 1415
diff changeset
    47
	app.setStyle(new QPlastiqueStyle);
60b86d6fe9ae Force plastique style, as others don't fully support stylesheets
unc0rr
parents: 1415
diff changeset
    48
	
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    49
	QDateTime now = QDateTime::currentDateTime();
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    50
	QDateTime zero;
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    51
	srand(now.secsTo(zero));
1215
0c1c294c0f7e Themes list now works
unc0rr
parents: 1214
diff changeset
    52
	rand();
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    53
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    54
	Q_INIT_RESOURCE(hedgewars);
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    55
1146
0bc17a69b3d8 Background for Hedgewars is ready
displacer
parents: 1066
diff changeset
    56
	qApp->setStyleSheet
1152
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
    57
		(QString(
1219
89babaafe99d Make dialogs and messageboxes be customized like main form
unc0rr
parents: 1217
diff changeset
    58
			"HWForm,QDialog{"
1152
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
    59
				"background-image: url(\":/res/Background.png\");"
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
    60
				"background-position: bottom center;"
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
    61
				"background-repeat: repeat-x;"
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
    62
				"background-color: #870c8f;"
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
    63
				"}"
1154
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
    64
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
    65
			"QPushButton{"
1152
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
    66
				"border: solid;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
    67
				"border-width: 3px;"
1157
c2e02c52dcad Try to modify QGroupBox view
unc0rr
parents: 1155
diff changeset
    68
				"border-radius: 10px;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
    69
				"border-color: #ffcc00;"
1168
f3c68684ef88 Finally fix save button look
unc0rr
parents: 1167
diff changeset
    70
				"background-origin: margin;"
f3c68684ef88 Finally fix save button look
unc0rr
parents: 1167
diff changeset
    71
				"background-position: top left;"
1167
2aa93ec4718b Set bg color for QPushButton
unc0rr
parents: 1161
diff changeset
    72
				"background-color: #00351d;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
    73
				"color: #ffcc00;"
1152
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
    74
				"}"
1153
825931b81ad4 Iconed "Back" button everywhere
unc0rr
parents: 1152
diff changeset
    75
				"QPushButton:hover{"
1152
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
    76
				"border-color: yellow;"
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
    77
				"}"
1153
825931b81ad4 Iconed "Back" button everywhere
unc0rr
parents: 1152
diff changeset
    78
				"QPushButton:pressed{"
1152
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
    79
				"border-color: white;"
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
    80
				"}"
1154
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
    81
1160
216dc01354a2 Customize LineEdit look
unc0rr
parents: 1157
diff changeset
    82
			"QLineEdit{"
216dc01354a2 Customize LineEdit look
unc0rr
parents: 1157
diff changeset
    83
				"border: solid;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
    84
				"border-width: 3px;"
1160
216dc01354a2 Customize LineEdit look
unc0rr
parents: 1157
diff changeset
    85
				"border-radius: 12px;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
    86
				"border-color: #ffcc00;"
1160
216dc01354a2 Customize LineEdit look
unc0rr
parents: 1157
diff changeset
    87
				"background-color: #0d0544;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
    88
				"color: #ffcc00;"
1160
216dc01354a2 Customize LineEdit look
unc0rr
parents: 1157
diff changeset
    89
				"font: bold 14px;"
216dc01354a2 Customize LineEdit look
unc0rr
parents: 1157
diff changeset
    90
				"}"
216dc01354a2 Customize LineEdit look
unc0rr
parents: 1157
diff changeset
    91
			"QLineEdit:hover{"
216dc01354a2 Customize LineEdit look
unc0rr
parents: 1157
diff changeset
    92
				"border-color: yellow;"
216dc01354a2 Customize LineEdit look
unc0rr
parents: 1157
diff changeset
    93
				"}"
216dc01354a2 Customize LineEdit look
unc0rr
parents: 1157
diff changeset
    94
1172
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
    95
			"QLabel{"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
    96
				"color: #ffcc00;"
1172
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
    97
				"font: bold 14px;"
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
    98
				"}"
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
    99
1390
914fa66aec05 Set custom background color on servers list widget
unc0rr
parents: 1377
diff changeset
   100
			"QListWidget,QTableView{"
1171
ab9932feda49 - Start work on team select widget
unc0rr
parents: 1168
diff changeset
   101
				"border: solid;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   102
				"border-width: 3px;"
1171
ab9932feda49 - Start work on team select widget
unc0rr
parents: 1168
diff changeset
   103
				"border-radius: 12px;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   104
				"border-color: #ffcc00;"
1171
ab9932feda49 - Start work on team select widget
unc0rr
parents: 1168
diff changeset
   105
				"background-color: #0d0544;"
1211
94c4f20abdda Fill themes list with themes
unc0rr
parents: 1210
diff changeset
   106
//				"alternate-background-color: #2f213a;" //what's it?
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   107
				"color: #ffcc00;"
1171
ab9932feda49 - Start work on team select widget
unc0rr
parents: 1168
diff changeset
   108
				"font: bold 14px;"
ab9932feda49 - Start work on team select widget
unc0rr
parents: 1168
diff changeset
   109
				"}"
ab9932feda49 - Start work on team select widget
unc0rr
parents: 1168
diff changeset
   110
			"QListWidget:hover{"
ab9932feda49 - Start work on team select widget
unc0rr
parents: 1168
diff changeset
   111
				"border-color: yellow;"
ab9932feda49 - Start work on team select widget
unc0rr
parents: 1168
diff changeset
   112
				"}"
ab9932feda49 - Start work on team select widget
unc0rr
parents: 1168
diff changeset
   113
1377
a9e768739345 - Customize QTextBrowser look
unc0rr
parents: 1289
diff changeset
   114
			"QTextBrowser{"
a9e768739345 - Customize QTextBrowser look
unc0rr
parents: 1289
diff changeset
   115
				"border: solid;"
a9e768739345 - Customize QTextBrowser look
unc0rr
parents: 1289
diff changeset
   116
				"border-width: 3px;"
a9e768739345 - Customize QTextBrowser look
unc0rr
parents: 1289
diff changeset
   117
				"border-radius: 12px;"
a9e768739345 - Customize QTextBrowser look
unc0rr
parents: 1289
diff changeset
   118
				"border-color: #ffcc00;"
a9e768739345 - Customize QTextBrowser look
unc0rr
parents: 1289
diff changeset
   119
				"background-color: #0d0544;"
a9e768739345 - Customize QTextBrowser look
unc0rr
parents: 1289
diff changeset
   120
				"color: #ffcc00;"
1577
e3e37c730dc0 - Decrease font size in chat
unc0rr
parents: 1455
diff changeset
   121
//				"font: bold 14px;"
1377
a9e768739345 - Customize QTextBrowser look
unc0rr
parents: 1289
diff changeset
   122
				"}"
a9e768739345 - Customize QTextBrowser look
unc0rr
parents: 1289
diff changeset
   123
1161
edf18b880beb Customize SpinBox look (not finished)
unc0rr
parents: 1160
diff changeset
   124
			"QSpinBox{"
edf18b880beb Customize SpinBox look (not finished)
unc0rr
parents: 1160
diff changeset
   125
				"border: solid;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   126
				"border-width: 3px;"
1161
edf18b880beb Customize SpinBox look (not finished)
unc0rr
parents: 1160
diff changeset
   127
				"border-radius: 12px;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   128
				"border-color: #ffcc00;"
1161
edf18b880beb Customize SpinBox look (not finished)
unc0rr
parents: 1160
diff changeset
   129
				"background-color: #0d0544;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   130
				"color: #ffcc00;"
1161
edf18b880beb Customize SpinBox look (not finished)
unc0rr
parents: 1160
diff changeset
   131
				"font: bold 14px;"
edf18b880beb Customize SpinBox look (not finished)
unc0rr
parents: 1160
diff changeset
   132
				"}"
edf18b880beb Customize SpinBox look (not finished)
unc0rr
parents: 1160
diff changeset
   133
			"QSpinBox:hover{"
edf18b880beb Customize SpinBox look (not finished)
unc0rr
parents: 1160
diff changeset
   134
				"border-color: yellow;"
edf18b880beb Customize SpinBox look (not finished)
unc0rr
parents: 1160
diff changeset
   135
				"}"
1289
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   136
			"QSpinBox::up-button{"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   137
				"background: transparent;"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   138
				"width: 16px;"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   139
				"height: 10px;"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   140
				"}"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   141
			"QSpinBox::up-arrow{"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   142
				"image: url(\":/res/spin_up.png\");"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   143
				//"width: 5px;"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   144
				//"height: 5px;"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   145
				"}"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   146
			"QSpinBox::down-button{"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   147
				"background: transparent;"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   148
				"width: 16px;"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   149
				"height: 10px;"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   150
				"}"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   151
			"QSpinBox::down-arrow{"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   152
				"image: url(\":/res/spin_down.png\");"
789db262d90d - Customize spinbox arrows
unc0rr
parents: 1252
diff changeset
   153
				"}"
1161
edf18b880beb Customize SpinBox look (not finished)
unc0rr
parents: 1160
diff changeset
   154
1172
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   155
			"QToolBox{"
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   156
				"border: solid;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   157
				"border-width: 3px;"
1172
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   158
				"border-radius: 12px;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   159
				"border-color: #ffcc00;"
1252
2e2719c0a397 - Reorganize headers according to Qt's style guide
unc0rr
parents: 1228
diff changeset
   160
				//"background-color: #0d0544;"
1172
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   161
			"}"
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   162
			"QToolBox::tab{"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   163
				"color: #ffcc00;"
1172
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   164
				"font: bold 14px;"
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   165
				"}"
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   166
			"QToolBox:hover{"
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   167
				"border-color: yellow;"
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   168
				"}"
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   169
1154
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   170
			"QComboBox{"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   171
				"border: solid;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   172
				"border-width: 3px;"
1161
edf18b880beb Customize SpinBox look (not finished)
unc0rr
parents: 1160
diff changeset
   173
				"border-radius: 15px;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   174
				"border-color: #ffcc00;"
1154
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   175
				"background-color: #0d0544;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   176
				"color: #ffcc00;"
1154
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   177
				"font: bold 14px;"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   178
				"padding: 3px;"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   179
//				"text-align: center;"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   180
				"}"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   181
			"QComboBox:hover{"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   182
				"border-color: yellow;"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   183
				"}"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   184
			"QComboBox:pressed{"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   185
				"border-color: white;"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   186
				"}"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   187
			"QComboBox::drop-down{"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   188
				"border: transparent;"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   189
				"width: 25px;"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   190
				"}"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   191
			"QComboBox::down-arrow {"
1155
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   192
				"image: url(\":/res/dropdown.png\");"
1154
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   193
				"}"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   194
			"QComboBox QAbstractItemView{"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   195
				"border: solid transparent;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   196
				"border-width: 3px;"
1157
c2e02c52dcad Try to modify QGroupBox view
unc0rr
parents: 1155
diff changeset
   197
				//"border-radius: 12px;" -- bad corners look
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   198
				"border-color: #ffcc00;"
1154
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   199
				"background-color: #0d0544;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   200
				"color: #ffcc00;"
1154
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   201
				"font: bold 14px;"
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   202
				"}"
1425
7ee750565e2d Add background image to team select widget
unc0rr
parents: 1418
diff changeset
   203
			
7ee750565e2d Add background image to team select widget
unc0rr
parents: 1418
diff changeset
   204
			"VertScrArea{"
7ee750565e2d Add background image to team select widget
unc0rr
parents: 1418
diff changeset
   205
				"background-image: url(\":/res/panelbg.png\");"
7ee750565e2d Add background image to team select widget
unc0rr
parents: 1418
diff changeset
   206
				"background-position: bottom center;"
7ee750565e2d Add background image to team select widget
unc0rr
parents: 1418
diff changeset
   207
				"background-repeat: repeat-x;"
7ee750565e2d Add background image to team select widget
unc0rr
parents: 1418
diff changeset
   208
				"}"
7ee750565e2d Add background image to team select widget
unc0rr
parents: 1418
diff changeset
   209
			
1198
b600b0d9408c Reorganize widgets on options page
unc0rr
parents: 1197
diff changeset
   210
			"IconedGroupBox{"
b600b0d9408c Reorganize widgets on options page
unc0rr
parents: 1197
diff changeset
   211
				"border: solid;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   212
				"border-width: 3px;"
1198
b600b0d9408c Reorganize widgets on options page
unc0rr
parents: 1197
diff changeset
   213
				"border-radius: 16px;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   214
				"border-color: #ffcc00;"
1198
b600b0d9408c Reorganize widgets on options page
unc0rr
parents: 1197
diff changeset
   215
				"background-color: #130f2c;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   216
				"color: #ffcc00;"
1198
b600b0d9408c Reorganize widgets on options page
unc0rr
parents: 1197
diff changeset
   217
				"font: bold 14px;"
1228
8fa4a7055aff - Update copyrights
unc0rr
parents: 1219
diff changeset
   218
				"padding: 2px;"
1198
b600b0d9408c Reorganize widgets on options page
unc0rr
parents: 1197
diff changeset
   219
				"}"
1455
7d0a4ecd8210 Better look for weapon sets page
unc0rr
parents: 1450
diff changeset
   220
			".QGroupBox,GameCFGWidget,TeamSelWidget,SelWeaponWidget{"
1197
0d935c599fa3 Add background to groupboxes
unc0rr
parents: 1195
diff changeset
   221
				"background-image: url(\":/res/panelbg.png\");"
0d935c599fa3 Add background to groupboxes
unc0rr
parents: 1195
diff changeset
   222
				"background-position: bottom center;"
0d935c599fa3 Add background to groupboxes
unc0rr
parents: 1195
diff changeset
   223
				"background-repeat: repeat-x;"
1155
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   224
				"border: solid;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   225
				"border-width: 3px;"
1155
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   226
				"border-radius: 16px;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   227
				"border-color: #ffcc00;"
1198
b600b0d9408c Reorganize widgets on options page
unc0rr
parents: 1197
diff changeset
   228
				"background-color: #040200;"
1199
543d1268847b More work on options page
unc0rr
parents: 1198
diff changeset
   229
				"padding: 6px;"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   230
				"color: #ffcc00;"
1155
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   231
				"font: bold 14px;"
1209
7f6cb1d7be2a Start remaking multiplayer page
unc0rr
parents: 1201
diff changeset
   232
				//"margin-top: 24px;"
1201
4390e7343542 Move QGroupBox title a bit
unc0rr
parents: 1199
diff changeset
   233
				"}"
4390e7343542 Move QGroupBox title a bit
unc0rr
parents: 1199
diff changeset
   234
			".QGroupBox::title{"
4390e7343542 Move QGroupBox title a bit
unc0rr
parents: 1199
diff changeset
   235
				"subcontrol-origin: margin;"
4390e7343542 Move QGroupBox title a bit
unc0rr
parents: 1199
diff changeset
   236
				"subcontrol-position: top left;"
4390e7343542 Move QGroupBox title a bit
unc0rr
parents: 1199
diff changeset
   237
				//"padding-left: 82px;"
4390e7343542 Move QGroupBox title a bit
unc0rr
parents: 1199
diff changeset
   238
				//"padding-top: 26px;"
4390e7343542 Move QGroupBox title a bit
unc0rr
parents: 1199
diff changeset
   239
				"text-align: left;"
1155
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   240
				"}"
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   241
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   242
			"QCheckBox{"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   243
				"color: #ffcc00;"
1155
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   244
				"font: bold 14px;"
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   245
				"}"
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   246
			"QCheckBox::indicator:checked{"
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   247
				"image: url(\":/res/checked.png\");"
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   248
				"}"
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   249
			"QCheckBox::indicator:unchecked{"
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   250
				"image: url(\":/res/unchecked.png\");"
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   251
				"}"
1172
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   252
			
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   253
			"QRadioButton{"
1214
090f94cd663e - Make border 3px width
unc0rr
parents: 1211
diff changeset
   254
				"color: #ffcc00;"
1172
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   255
				"font: bold 14px;"
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   256
				"}"
1252
2e2719c0a397 - Reorganize headers according to Qt's style guide
unc0rr
parents: 1228
diff changeset
   257
			
2e2719c0a397 - Reorganize headers according to Qt's style guide
unc0rr
parents: 1228
diff changeset
   258
			".QWidget{"
2e2719c0a397 - Reorganize headers according to Qt's style guide
unc0rr
parents: 1228
diff changeset
   259
				"background: transparent;"
2e2719c0a397 - Reorganize headers according to Qt's style guide
unc0rr
parents: 1228
diff changeset
   260
				"}"
2e2719c0a397 - Reorganize headers according to Qt's style guide
unc0rr
parents: 1228
diff changeset
   261
			".QTabWidget{"
2e2719c0a397 - Reorganize headers according to Qt's style guide
unc0rr
parents: 1228
diff changeset
   262
				//"background: transparent;"
2e2719c0a397 - Reorganize headers according to Qt's style guide
unc0rr
parents: 1228
diff changeset
   263
				"background-color: #130f2c;"
2e2719c0a397 - Reorganize headers according to Qt's style guide
unc0rr
parents: 1228
diff changeset
   264
				"}"
1413
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   265
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   266
			"QMenu{"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   267
				"background-color: #ffcc00;"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   268
				"margin: 3px;"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   269
				"}"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   270
			"QMenu::item{"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   271
				"background-color: #0d0544;"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   272
				"border: 1px solid transparent;"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   273
				"font: bold;"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   274
				"color: #ffcc00;"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   275
				"padding: 2px 25px 2px 20px;"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   276
				"}"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   277
			"QMenu::item:selected{"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   278
				"border-color: yellow;"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   279
				"background-color: #2d2564;"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   280
				"}"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   281
			"QMenu::indicator{"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   282
				"width: 16px;"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   283
				"height: 16px;"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   284
				"}"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   285
			"QMenu::indicator:non-exclusive:checked{"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   286
				"image: url(\":/res/checked.png\");"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   287
				"}"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   288
			"QMenu::indicator:non-exclusive:unchecked{"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   289
				"image: url(\":/res/unchecked.png\");"
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   290
				"}"
1450
f854866390a5 Add tooltips
unc0rr
parents: 1438
diff changeset
   291
f854866390a5 Add tooltips
unc0rr
parents: 1438
diff changeset
   292
			"QToolTip{"
f854866390a5 Add tooltips
unc0rr
parents: 1438
diff changeset
   293
				"background-color: #0d0544;"
f854866390a5 Add tooltips
unc0rr
parents: 1438
diff changeset
   294
				"}"
1438
b1cb4381a1e0 - Make disbled controls look better
unc0rr
parents: 1425
diff changeset
   295
			
b1cb4381a1e0 - Make disbled controls look better
unc0rr
parents: 1425
diff changeset
   296
			":disabled{"
b1cb4381a1e0 - Make disbled controls look better
unc0rr
parents: 1425
diff changeset
   297
				"color: #a0a0a0;"
b1cb4381a1e0 - Make disbled controls look better
unc0rr
parents: 1425
diff changeset
   298
				"}"
1152
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
   299
			)
c72b939c00df Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents: 1150
diff changeset
   300
		);
1150
ae86e36dad2e - Make look better
unc0rr
parents: 1149
diff changeset
   301
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   302
	bindir->cd("bin"); // workaround over NSIS installer
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   303
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   304
	cfgdir->setPath(cfgdir->homePath());
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   305
	if (checkForDir(cfgdir->absolutePath() + "/.hedgewars"))
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   306
	{
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   307
		checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos");
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   308
		checkForDir(cfgdir->absolutePath() + "/.hedgewars/Saves");
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   309
	}
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   310
	cfgdir->cd(".hedgewars");
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   311
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   312
	datadir->cd(bindir->absolutePath());
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   313
	datadir->cd(*cDataDir);
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   314
	if(!datadir->cd("hedgewars/Data")) {
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   315
		QMessageBox::critical(0, QMessageBox::tr("Error"),
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   316
			QMessageBox::tr("Failed to open data directory:\n%1\n"
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   317
					"Please check your installation").
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   318
					arg(datadir->absolutePath()+"/hedgewars/Data"));
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   319
		return 1;
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   320
	}
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   321
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   322
	QTranslator Translator;
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   323
	Translator.load(datadir->absolutePath() + "/Locale/hedgewars_" + QLocale::system().name());
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   324
	app.installTranslator(&Translator);
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   325
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   326
	Themes = new QStringList();
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   327
	QFile themesfile(datadir->absolutePath() + "/Themes/themes.cfg");
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   328
	if (themesfile.open(QIODevice::ReadOnly)) {
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   329
		QTextStream stream(&themesfile);
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   330
		QString str;
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   331
		while (!stream.atEnd())
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   332
		{
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   333
			Themes->append(stream.readLine());
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   334
		}
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   335
		themesfile.close();
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   336
	} else {
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   337
		QMessageBox::critical(0, "Error", "Cannot access themes.cfg", "OK");
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   338
	}
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   339
1210
bfed1b89bc85 Add themes list to map selection widget
unc0rr
parents: 1209
diff changeset
   340
	QDir tmpdir;
bfed1b89bc85 Add themes list to map selection widget
unc0rr
parents: 1209
diff changeset
   341
	tmpdir.cd(datadir->absolutePath());
bfed1b89bc85 Add themes list to map selection widget
unc0rr
parents: 1209
diff changeset
   342
	tmpdir.cd("Maps");
bfed1b89bc85 Add themes list to map selection widget
unc0rr
parents: 1209
diff changeset
   343
	tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
bfed1b89bc85 Add themes list to map selection widget
unc0rr
parents: 1209
diff changeset
   344
	mapList = new QStringList(tmpdir.entryList(QStringList("*")));
bfed1b89bc85 Add themes list to map selection widget
unc0rr
parents: 1209
diff changeset
   345
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   346
	HWForm *Form = new HWForm();
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   347
	Form->show();
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   348
	return app.exec();
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   349
}