QTfrontend/main.cpp
author smaxx
Tue, 03 Aug 2010 14:19:47 +0200
changeset 3717 d88719b0f0dc
parent 3714 c407f00d2851
child 3758 80007c41c35e
permissions -rw-r--r--
Engine: * Added a new weapon: Hammer: Crush half your enemies' health and let them break through thin floors! (Might need some visual improvements) * Removed orientation code from sticky mines due to their new graphics * Added an attachment sound to sticky mines Frontend: * Added the hammer to predefined weapon sets
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
3236
4ab3917d7d44 Update (c) lines to 2010 as unc0rr requested - they all had varying values so I just took the first year mentioned, then tacked on -2010
nemo
parents: 3185
diff changeset
     3
 * Copyright (c) 2005-2010 Andrey Korotaev <unC0Rr@gmail.com>
579
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>
2034
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    24
#include <QRegExp>
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    25
#include <QMap>
2898
c53636f556f8 Frontend:
smxx
parents: 2897
diff changeset
    26
#include <QSettings>
1146
0bc17a69b3d8 Background for Hedgewars is ready
displacer
parents: 1066
diff changeset
    27
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    28
#include "hwform.h"
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    29
#include "hwconsts.h"
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    30
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
    31
#ifdef _WIN32
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
    32
#include <Shlobj.h>
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
    33
#endif
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
    34
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    35
bool checkForDir(const QString & dir)
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    36
{
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    37
    QDir tmpdir;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    38
    if (!tmpdir.exists(dir))
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    39
        if (!tmpdir.mkdir(dir))
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    40
        {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    41
            QMessageBox::critical(0,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    42
                    QObject::tr("Error"),
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    43
                    QObject::tr("Cannot create directory %1").arg(dir),
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    44
                    QObject::tr("OK"));
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    45
            return false;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    46
        }
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    47
    return true;
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    48
}
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    49
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3681
diff changeset
    50
int main(int argc, char *argv[]) {
2261
57e99c908e7c a lot of stuff:
koda
parents: 2077
diff changeset
    51
    QApplication app(argc, argv);
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    52
2034
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    53
    QStringList arguments = app.arguments();
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    54
    QMap<QString, QString> parsedArgs;
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    55
    {
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    56
        QList<QString>::iterator i = arguments.begin();
2035
70734c4f52a7 patch to prior checkin
nemo
parents: 2034
diff changeset
    57
        while(i != arguments.end()) {
2034
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    58
            QString arg = *i;
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    59
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    60
            QRegExp opt("--(\\S+)=(.+)");
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    61
            if(opt.exactMatch(arg)) {
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    62
                parsedArgs[opt.cap(1)] = opt.cap(2);
2035
70734c4f52a7 patch to prior checkin
nemo
parents: 2034
diff changeset
    63
                i = arguments.erase(i);
70734c4f52a7 patch to prior checkin
nemo
parents: 2034
diff changeset
    64
            } else {
70734c4f52a7 patch to prior checkin
nemo
parents: 2034
diff changeset
    65
              ++i;
2034
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    66
            }
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    67
        }
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    68
    }
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    69
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    70
    if(parsedArgs.contains("data-dir")) {
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    71
        QFileInfo f(parsedArgs["data-dir"]);
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    72
        if(!f.exists()) {
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    73
            qWarning() << "WARNING: Cannot open DATA_PATH=" << f.absoluteFilePath();
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    74
        }
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    75
        *cDataDir = f.absoluteFilePath();
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    76
    }
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    77
2428
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
    78
    if(parsedArgs.contains("config-dir")) {
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
    79
        QFileInfo f(parsedArgs["config-dir"]);
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
    80
        *cConfigDir = f.absoluteFilePath();
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
    81
    }
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
    82
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    83
    app.setStyle(new QPlastiqueStyle);
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
    84
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    85
    QDateTime now = QDateTime::currentDateTime();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    86
    srand(now.toTime_t());
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    87
    rand();
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    88
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    89
    Q_INIT_RESOURCE(hedgewars);
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    90
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    91
    qApp->setStyleSheet
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    92
        (QString(
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    93
            "HWForm,QDialog{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    94
                "background-image: url(\":/res/Background.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    95
                "background-position: bottom center;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    96
                "background-repeat: repeat-x;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    97
                "background-color: #141250;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    98
                "}"
1154
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
    99
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   100
            "* {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   101
                "color: #ffcc00;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   102
                "selection-background-color: #ffcc00;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   103
                "selection-color: #00351d;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   104
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   105
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   106
            "QLineEdit, QListWidget, QTableView, QTextBrowser, QSpinBox, QComboBox, "
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   107
            "QComboBox QAbstractItemView, QMenu::item {"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   108
                "background-color: rgba(13, 5, 68, 70%);"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   109
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   110
3185
19d84448835f Frontend:
smxx
parents: 3019
diff changeset
   111
            "QComboBox::separator {"
19d84448835f Frontend:
smxx
parents: 3019
diff changeset
   112
                "border: solid; border-width: 3px; border-color: #ffcc00;"
19d84448835f Frontend:
smxx
parents: 3019
diff changeset
   113
            "}"
19d84448835f Frontend:
smxx
parents: 3019
diff changeset
   114
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   115
            "QPushButton, QListWidget, QTableView, QLineEdit, QHeaderView, "
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   116
            "QTextBrowser, QSpinBox, QToolBox, QComboBox, "
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   117
            "QComboBox QAbstractItemView, IconedGroupBox, "
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   118
            ".QGroupBox, GameCFGWidget, TeamSelWidget, SelWeaponWidget, "
1897
e9dcb47013c7 - Some style changes by nemo
unc0rr
parents: 1894
diff changeset
   119
            "QTabWidget::pane, QTabBar::tab {"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   120
                "border: solid;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   121
                "border-width: 3px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   122
                "border-color: #ffcc00;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   123
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   124
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   125
            "QPushButton:hover, QLineEdit:hover, QListWidget:hover, "
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   126
            "QSpinBox:hover, QToolBox:hover, QComboBox:hover {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   127
                "border-color: yellow;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   128
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   129
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   130
            "QLineEdit, QListWidget,QTableView, QTextBrowser, "
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   131
            "QSpinBox, QToolBox { "
3019
d6e19f35d98d Frontend:
smxx
parents: 2948
diff changeset
   132
                "border-radius: 10px;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   133
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   134
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   135
            "QLineEdit, QLabel, QHeaderView, QListWidget, QTableView, "
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   136
            "QSpinBox, QToolBox::tab, QComboBox, QComboBox QAbstractItemView, "
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   137
            "IconedGroupBox, .QGroupBox, GameCFGWidget, TeamSelWidget, "
3019
d6e19f35d98d Frontend:
smxx
parents: 2948
diff changeset
   138
            "SelWeaponWidget, QCheckBox, QRadioButton, QPushButton {"
d6e19f35d98d Frontend:
smxx
parents: 2948
diff changeset
   139
                "font: bold 13px;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   140
            "}"
2517
6ed1fba6da18 weapon edit style tweak
nemo
parents: 2428
diff changeset
   141
            "SelWeaponWidget QTabWidget::pane, SelWeaponWidget QTabBar::tab:selected {"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   142
                "background-position: bottom center;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   143
                "background-repeat: repeat-x;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   144
                "background-color: #000000;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   145
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   146
            ".QGroupBox,GameCFGWidget,TeamSelWidget,SelWeaponWidget {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   147
                "background-position: bottom center;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   148
                "background-repeat: repeat-x;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   149
                "border-radius: 16px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   150
                "background-color: rgba(13, 5, 68, 70%);"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   151
                "padding: 6px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   152
            "}"
2072
6e0fcbcc3f60 Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents: 2035
diff changeset
   153
/*  Experimenting with PaintOnScreen and border-radius on IconedGroupBox children didn't work out well
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   154
            "IconedGroupBox QComboBox, IconedGroupBox QPushButton, IconedGroupBox QLineEdit, "
2072
6e0fcbcc3f60 Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents: 2035
diff changeset
   155
            "IconedGroupBox QSpinBox {"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   156
                "border-radius: 0;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   157
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   158
            "IconedGroupBox, IconedGroupBox *, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{" */
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   159
            "IconedGroupBox, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   160
                "background-color: #130f2c;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   161
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   162
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   163
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   164
            "QPushButton {"
3019
d6e19f35d98d Frontend:
smxx
parents: 2948
diff changeset
   165
                "border-radius: 8px;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   166
                "background-origin: margin;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   167
                "background-position: top left;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   168
                "background-color: rgba(18, 42, 5, 70%);"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   169
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   170
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   171
            "QPushButton:pressed{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   172
                "border-color: white;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   173
            "}"
1154
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   174
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   175
            "QHeaderView {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   176
                "border-radius: 0;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   177
                "border-width: 0;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   178
                "border-bottom-width: 3px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   179
                "background-color: #00351d;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   180
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   181
            "QTableView {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   182
                "alternate-background-color: #2f213a;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   183
            "}"
1172
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   184
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   185
            "QTabBar::tab {"
1897
e9dcb47013c7 - Some style changes by nemo
unc0rr
parents: 1894
diff changeset
   186
                 "border-bottom-width: 0;"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   187
                 "border-radius: 0;"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   188
                 "border-top-left-radius: 6px;"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   189
                 "border-top-right-radius: 6px;"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   190
                 "padding: 3px;"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   191
            "}"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   192
            "QTabBar::tab:!selected {"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   193
                 "color: #0d0544;"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   194
                 "background-color: #ffcc00;"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   195
            "}"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   196
            "QSpinBox::up-button{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   197
                "background: transparent;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   198
                "width: 16px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   199
                "height: 10px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   200
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   201
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   202
            "QSpinBox::up-arrow {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   203
                "image: url(\":/res/spin_up.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   204
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   205
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   206
            "QSpinBox::down-arrow {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   207
                "image: url(\":/res/spin_down.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   208
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   209
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   210
            "QSpinBox::down-button {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   211
                "background: transparent;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   212
                "width: 16px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   213
                "height: 10px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   214
            "}"
1172
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   215
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   216
            "QComboBox {"
3019
d6e19f35d98d Frontend:
smxx
parents: 2948
diff changeset
   217
                "border-radius: 10px;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   218
                "padding: 3px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   219
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   220
            "QComboBox:pressed{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   221
                "border-color: white;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   222
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   223
            "QComboBox::drop-down{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   224
                "border: transparent;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   225
                "width: 25px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   226
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   227
            "QComboBox::down-arrow {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   228
                "image: url(\":/res/dropdown.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   229
            "}"
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
   230
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   231
            "VertScrArea {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   232
                "background-position: bottom center;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   233
                "background-repeat: repeat-x;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   234
            "}"
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
   235
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   236
            "IconedGroupBox {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   237
                "border-radius: 16px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   238
                "padding: 2px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   239
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   240
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   241
            "QGroupBox::title{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   242
                "subcontrol-origin: margin;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   243
                "subcontrol-position: top left;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   244
                "text-align: left;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   245
                "}"
1155
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   246
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   247
            "QCheckBox::indicator:checked{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   248
                "image: url(\":/res/checked.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   249
                "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   250
            "QCheckBox::indicator:unchecked{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   251
                "image: url(\":/res/unchecked.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   252
                "}"
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
   253
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   254
            ".QWidget{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   255
                "background: transparent;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   256
                "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   257
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   258
            "QTabWidget::pane {"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   259
                "border-top-width: 2px;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   260
            "}"
1413
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   261
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   262
            "QMenu{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   263
                "background-color: #ffcc00;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   264
                "margin: 3px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   265
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   266
            "QMenu::item {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   267
                "background-color: #0d0544;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   268
                "border: 1px solid transparent;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   269
                "font: bold;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   270
                "padding: 2px 25px 2px 20px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   271
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   272
            "QMenu::item:selected {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   273
                "background-color: #2d2564;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   274
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   275
            "QMenu::indicator {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   276
                "width: 16px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   277
                "height: 16px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   278
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   279
            "QMenu::indicator:non-exclusive:checked{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   280
                "image: url(\":/res/checked.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   281
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   282
            "QMenu::indicator:non-exclusive:unchecked{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   283
                "image: url(\":/res/unchecked.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   284
            "}"
1450
f854866390a5 Add tooltips
unc0rr
parents: 1438
diff changeset
   285
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   286
            "QToolTip{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   287
                "background-color: #0d0544;"
3019
d6e19f35d98d Frontend:
smxx
parents: 2948
diff changeset
   288
                "border: 1px solid #ffcc00;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   289
            "}"
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
   290
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   291
            ":disabled{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   292
                "color: #a0a0a0;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   293
            "}"
2072
6e0fcbcc3f60 Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents: 2035
diff changeset
   294
            "SquareLabel, ItemNum {"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   295
                "background-color: #000000;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   296
            "}"
3714
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   297
            "QSlider::groove::horizontal {"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   298
                "height: 2px;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   299
                "margin: 2px 0px;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   300
                "background-color: #ffcc00;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   301
            "}"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   302
            "QSlider::handle::horizontal {"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   303
                "border: 0px;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   304
                "margin: -2px 0px;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   305
                "border-radius: 3px;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   306
                "background-color: #ffcc00;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   307
                "width: 8px;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   308
            "}"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   309
            )
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   310
        );
1150
ae86e36dad2e - Make look better
unc0rr
parents: 1149
diff changeset
   311
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   312
    bindir->cd("bin"); // workaround over NSIS installer
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   313
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   314
    if(cConfigDir->length() == 0)
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   315
        cfgdir->setPath(cfgdir->homePath());
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   316
    else
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   317
        cfgdir->setPath(*cConfigDir);
2428
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
   318
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   319
    if(cConfigDir->length() == 0)
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   320
    {
1965
340bfd438ca5 - Apply koda's patch
unc0rr
parents: 1940
diff changeset
   321
#ifdef __APPLE__
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   322
        if (checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars"))
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   323
        {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   324
            checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars/Demos");
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   325
            checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars/Saves");
3350
5cd02aafc612 Engine:
smxx
parents: 3333
diff changeset
   326
            checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars/Screenshots");
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   327
            checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars/Teams");
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   328
        }
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   329
        cfgdir->cd("Library/Application Support/Hedgewars");
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   330
#elif defined _WIN32
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   331
        char path[1024];
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   332
        if(!SHGetFolderPathA(0, CSIDL_PERSONAL, NULL, 0, path))
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   333
        {
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   334
            cfgdir->cd(path);
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   335
            if (checkForDir(cfgdir->absolutePath() + "/Hedgewars"))
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   336
            {
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   337
                checkForDir(cfgdir->absolutePath() + "/Hedgewars/Demos");
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   338
                checkForDir(cfgdir->absolutePath() + "/Hedgewars/Saves");
3350
5cd02aafc612 Engine:
smxx
parents: 3333
diff changeset
   339
                checkForDir(cfgdir->absolutePath() + "/Hedgewars/Screenshots");
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   340
                checkForDir(cfgdir->absolutePath() + "/Hedgewars/Teams");
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   341
            }
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   342
            cfgdir->cd("Hedgewars");
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   343
        }
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   344
        else
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   345
        {
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   346
            if (checkForDir(cfgdir->absolutePath() + "/.hedgewars"))
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   347
            {
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   348
                checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos");
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   349
                checkForDir(cfgdir->absolutePath() + "/.hedgewars/Saves");
3350
5cd02aafc612 Engine:
smxx
parents: 3333
diff changeset
   350
                checkForDir(cfgdir->absolutePath() + "/.hedgewars/Screenshots");
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   351
                checkForDir(cfgdir->absolutePath() + "/.hedgewars/Teams");
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   352
            }
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   353
            cfgdir->cd(".hedgewars");
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   354
        }
2428
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
   355
#else
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   356
        if (checkForDir(cfgdir->absolutePath() + "/.hedgewars"))
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   357
        {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   358
            checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos");
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   359
            checkForDir(cfgdir->absolutePath() + "/.hedgewars/Saves");
3350
5cd02aafc612 Engine:
smxx
parents: 3333
diff changeset
   360
            checkForDir(cfgdir->absolutePath() + "/.hedgewars/Screenshots");
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   361
            checkForDir(cfgdir->absolutePath() + "/.hedgewars/Teams");
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   362
        }
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   363
        cfgdir->cd(".hedgewars");
2428
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
   364
#endif
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   365
    }
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   366
    else
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   367
    {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   368
        if (checkForDir(cfgdir->absolutePath()))
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   369
        {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   370
            checkForDir(cfgdir->absolutePath() + "/Demos");
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   371
            checkForDir(cfgdir->absolutePath() + "/Saves");
3350
5cd02aafc612 Engine:
smxx
parents: 3333
diff changeset
   372
            checkForDir(cfgdir->absolutePath() + "/Screenshots");
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   373
            checkForDir(cfgdir->absolutePath() + "/Teams");
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   374
        }
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   375
    }
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   376
2898
c53636f556f8 Frontend:
smxx
parents: 2897
diff changeset
   377
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   378
    datadir->cd(bindir->absolutePath());
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   379
    datadir->cd(*cDataDir);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   380
    if(!datadir->cd("hedgewars/Data")) {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   381
        QMessageBox::critical(0, QMessageBox::tr("Error"),
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   382
            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
   383
                    "Please check your installation").
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   384
                    arg(datadir->absolutePath()+"/hedgewars/Data"));
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   385
        return 1;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   386
    }
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   387
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   388
    Themes = new QStringList();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   389
    QFile themesfile(datadir->absolutePath() + "/Themes/themes.cfg");
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   390
    if (themesfile.open(QIODevice::ReadOnly)) {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   391
        QTextStream stream(&themesfile);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   392
        QString str;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   393
        while (!stream.atEnd())
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   394
        {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   395
            Themes->append(stream.readLine());
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   396
        }
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   397
        themesfile.close();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   398
    } else {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   399
        QMessageBox::critical(0, "Error", "Cannot access themes.cfg", "OK");
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   400
    }
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   401
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   402
    QDir tmpdir;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   403
    tmpdir.cd(datadir->absolutePath());
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   404
    tmpdir.cd("Maps");
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   405
    tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   406
    mapList = new QStringList(tmpdir.entryList(QStringList("*")));
1210
bfed1b89bc85 Add themes list to map selection widget
unc0rr
parents: 1209
diff changeset
   407
2898
c53636f556f8 Frontend:
smxx
parents: 2897
diff changeset
   408
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   409
    QTranslator Translator;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   410
    {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   411
        QSettings settings(cfgdir->absolutePath() + "/hedgewars.ini", QSettings::IniFormat);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   412
        QString cc = settings.value("misc/locale", "").toString();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   413
        if(!cc.compare(""))
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   414
            cc = QLocale::system().name();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   415
        Translator.load(datadir->absolutePath() + "/Locale/hedgewars_" + cc);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   416
        app.installTranslator(&Translator);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   417
    }
2898
c53636f556f8 Frontend:
smxx
parents: 2897
diff changeset
   418
3679
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   419
    // Win32 registry setup (used for xfire detection etc. - don't set it if we're running in "portable" mode with a custom config dir)
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   420
#ifdef _WIN32
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   421
    if(cConfigDir->length() == 0)
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   422
    {
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   423
        QSettings registry(QSettings::NativeFormat, QSettings::UserScope, "Hedgewars Project", "Hedgewars");
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   424
        QFileInfo f(argv[0]);
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   425
        registry.setValue("file", f.absoluteFilePath());
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   426
        registry.setValue("path", f.absolutePath());
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   427
    }
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   428
#endif
2898
c53636f556f8 Frontend:
smxx
parents: 2897
diff changeset
   429
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   430
    HWForm *Form = new HWForm();
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
   431
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   432
    Form->show();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   433
    return app.exec();
2845
19db164dd20d Frontend:
smxx
parents: 2798
diff changeset
   434
}