QTfrontend/main.cpp
author sheepluva
Thu, 20 Oct 2011 23:25:16 +0200
changeset 6160 863d3edf5690
parent 6129 d1e37b104683
child 6167 728cabee2c9f
permissions -rw-r--r--
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
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
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4888
diff changeset
     3
 * Copyright (c) 2005-2011 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
5252
ded882439548 file association for mac!
koda
parents: 5238
diff changeset
    19
#include "HWApplication.h"
ded882439548 file association for mac!
koda
parents: 5238
diff changeset
    20
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    21
#include <QTranslator>
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    22
#include <QLocale>
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    23
#include <QMessageBox>
1416
60b86d6fe9ae Force plastique style, as others don't fully support stylesheets
unc0rr
parents: 1415
diff changeset
    24
#include <QPlastiqueStyle>
2034
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    25
#include <QRegExp>
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    26
#include <QMap>
2898
c53636f556f8 Frontend:
smxx
parents: 2897
diff changeset
    27
#include <QSettings>
5289
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
    28
#include <QStringListModel>
1146
0bc17a69b3d8 Background for Hedgewars is ready
displacer
parents: 1066
diff changeset
    29
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    30
#include "hwform.h"
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    31
#include "hwconsts.h"
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    32
6160
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
    33
#include "HWDataManager.h"
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
    34
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
    35
#ifdef _WIN32
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
    36
#include <Shlobj.h>
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
    37
#endif
5095
15dd764b728c fix autorelease pools not being set (issue 209) and format code a little
koda
parents: 4976
diff changeset
    38
#ifdef __APPLE__
15dd764b728c fix autorelease pools not being set (issue 209) and format code a little
koda
parents: 4976
diff changeset
    39
#include "CocoaInitializer.h"
15dd764b728c fix autorelease pools not being set (issue 209) and format code a little
koda
parents: 4976
diff changeset
    40
#endif
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
    41
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    42
bool checkForDir(const QString & dir)
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    43
{
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    44
    QDir tmpdir;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    45
    if (!tmpdir.exists(dir))
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    46
        if (!tmpdir.mkdir(dir))
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    47
        {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    48
            QMessageBox::critical(0,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    49
                    QObject::tr("Error"),
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    50
                    QObject::tr("Cannot create directory %1").arg(dir),
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    51
                    QObject::tr("OK"));
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    52
            return false;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    53
        }
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    54
    return true;
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    55
}
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    56
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3681
diff changeset
    57
int main(int argc, char *argv[]) {
5252
ded882439548 file association for mac!
koda
parents: 5238
diff changeset
    58
    HWApplication app(argc, argv);
4888
3c96e99468c5 activate icon display in menus
sheepluva
parents: 4513
diff changeset
    59
    app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    60
2034
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    61
    QStringList arguments = app.arguments();
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    62
    QMap<QString, QString> parsedArgs;
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    63
    {
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    64
        QList<QString>::iterator i = arguments.begin();
2035
70734c4f52a7 patch to prior checkin
nemo
parents: 2034
diff changeset
    65
        while(i != arguments.end()) {
2034
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    66
            QString arg = *i;
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    67
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    68
            QRegExp opt("--(\\S+)=(.+)");
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    69
            if(opt.exactMatch(arg)) {
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    70
                parsedArgs[opt.cap(1)] = opt.cap(2);
2035
70734c4f52a7 patch to prior checkin
nemo
parents: 2034
diff changeset
    71
                i = arguments.erase(i);
70734c4f52a7 patch to prior checkin
nemo
parents: 2034
diff changeset
    72
            } else {
70734c4f52a7 patch to prior checkin
nemo
parents: 2034
diff changeset
    73
              ++i;
2034
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    74
            }
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    75
        }
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    76
    }
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    77
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    78
    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
    79
        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
    80
        if(!f.exists()) {
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    81
            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
    82
        }
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    83
        *cDataDir = f.absoluteFilePath();
3932
2fc211f60015 Engine:
smaxx
parents: 3914
diff changeset
    84
        custom_data = true;
2034
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    85
    }
decdf48cffd7 david_ac adding a commandline parameter for the data dir, as requested by svenstaro
nemo
parents: 1969
diff changeset
    86
2428
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
    87
    if(parsedArgs.contains("config-dir")) {
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
    88
        QFileInfo f(parsedArgs["config-dir"]);
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
    89
        *cConfigDir = f.absoluteFilePath();
3932
2fc211f60015 Engine:
smaxx
parents: 3914
diff changeset
    90
        custom_config = true;
2428
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
    91
    }
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
    92
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    93
    app.setStyle(new QPlastiqueStyle);
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
    94
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    95
    QDateTime now = QDateTime::currentDateTime();
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    96
    srand(now.toTime_t());
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    97
    rand();
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    98
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
    99
    Q_INIT_RESOURCE(hedgewars);
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   100
5849
b84b41aba275 fix for issue #269
sheepluva
parents: 5756
diff changeset
   101
    QString styleSheetFromHell =
b84b41aba275 fix for issue #269
sheepluva
parents: 5756
diff changeset
   102
        QString(
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   103
            "HWForm,QDialog{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   104
                "background-image: url(\":/res/Background.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   105
                "background-position: bottom center;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   106
                "background-repeat: repeat-x;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   107
                "background-color: #141250;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   108
                "}"
1154
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   109
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   110
            "* {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   111
                "color: #ffcc00;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   112
                "selection-background-color: #ffcc00;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   113
                "selection-color: #00351d;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   114
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   115
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   116
            "QLineEdit, QListWidget, QTableView, QTextBrowser, QSpinBox, QComboBox, "
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   117
            "QComboBox QAbstractItemView, QMenu::item {"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   118
                "background-color: rgba(13, 5, 68, 70%);"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   119
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   120
3185
19d84448835f Frontend:
smxx
parents: 3019
diff changeset
   121
            "QComboBox::separator {"
19d84448835f Frontend:
smxx
parents: 3019
diff changeset
   122
                "border: solid; border-width: 3px; border-color: #ffcc00;"
19d84448835f Frontend:
smxx
parents: 3019
diff changeset
   123
            "}"
19d84448835f Frontend:
smxx
parents: 3019
diff changeset
   124
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   125
            "QPushButton, QListWidget, QTableView, QLineEdit, QHeaderView, "
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   126
            "QTextBrowser, QSpinBox, QToolBox, QComboBox, "
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   127
            "QComboBox QAbstractItemView, IconedGroupBox, "
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   128
            ".QGroupBox, GameCFGWidget, TeamSelWidget, SelWeaponWidget, "
1897
e9dcb47013c7 - Some style changes by nemo
unc0rr
parents: 1894
diff changeset
   129
            "QTabWidget::pane, QTabBar::tab {"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   130
                "border: solid;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   131
                "border-width: 3px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   132
                "border-color: #ffcc00;"
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
            "QPushButton:hover, QLineEdit:hover, QListWidget:hover, "
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   136
            "QSpinBox:hover, QToolBox:hover, QComboBox:hover {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   137
                "border-color: yellow;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   138
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   139
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   140
            "QLineEdit, QListWidget,QTableView, QTextBrowser, "
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   141
            "QSpinBox, QToolBox { "
3019
d6e19f35d98d Frontend:
smxx
parents: 2948
diff changeset
   142
                "border-radius: 10px;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   143
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   144
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   145
            "QLineEdit, QLabel, QHeaderView, QListWidget, QTableView, "
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   146
            "QSpinBox, QToolBox::tab, QComboBox, QComboBox QAbstractItemView, "
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   147
            "IconedGroupBox, .QGroupBox, GameCFGWidget, TeamSelWidget, "
3019
d6e19f35d98d Frontend:
smxx
parents: 2948
diff changeset
   148
            "SelWeaponWidget, QCheckBox, QRadioButton, QPushButton {"
d6e19f35d98d Frontend:
smxx
parents: 2948
diff changeset
   149
                "font: bold 13px;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   150
            "}"
2517
6ed1fba6da18 weapon edit style tweak
nemo
parents: 2428
diff changeset
   151
            "SelWeaponWidget QTabWidget::pane, SelWeaponWidget QTabBar::tab:selected {"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   152
                "background-position: bottom center;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   153
                "background-repeat: repeat-x;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   154
                "background-color: #000000;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   155
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   156
            ".QGroupBox,GameCFGWidget,TeamSelWidget,SelWeaponWidget {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   157
                "background-position: bottom center;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   158
                "background-repeat: repeat-x;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   159
                "border-radius: 16px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   160
                "background-color: rgba(13, 5, 68, 70%);"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   161
                "padding: 6px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   162
            "}"
2072
6e0fcbcc3f60 Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents: 2035
diff changeset
   163
/*  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
   164
            "IconedGroupBox QComboBox, IconedGroupBox QPushButton, IconedGroupBox QLineEdit, "
2072
6e0fcbcc3f60 Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents: 2035
diff changeset
   165
            "IconedGroupBox QSpinBox {"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   166
                "border-radius: 0;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   167
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   168
            "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
   169
            "IconedGroupBox, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   170
                "background-color: #130f2c;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   171
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   172
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   173
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   174
            "QPushButton {"
3019
d6e19f35d98d Frontend:
smxx
parents: 2948
diff changeset
   175
                "border-radius: 8px;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   176
                "background-origin: margin;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   177
                "background-position: top left;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   178
                "background-color: rgba(18, 42, 5, 70%);"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   179
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   180
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   181
            "QPushButton:pressed{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   182
                "border-color: white;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   183
            "}"
1154
03cc0ab9c013 Customize comboboxes look
unc0rr
parents: 1153
diff changeset
   184
6129
d1e37b104683 Hide focus outline on buttons.
Florian Fabre
parents: 5925
diff changeset
   185
            "QPushButton:focus {"
d1e37b104683 Hide focus outline on buttons.
Florian Fabre
parents: 5925
diff changeset
   186
                "outline: none;"
d1e37b104683 Hide focus outline on buttons.
Florian Fabre
parents: 5925
diff changeset
   187
            "}"
d1e37b104683 Hide focus outline on buttons.
Florian Fabre
parents: 5925
diff changeset
   188
d1e37b104683 Hide focus outline on buttons.
Florian Fabre
parents: 5925
diff changeset
   189
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   190
            "QHeaderView {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   191
                "border-radius: 0;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   192
                "border-width: 0;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   193
                "border-bottom-width: 3px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   194
                "background-color: #00351d;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   195
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   196
            "QTableView {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   197
                "alternate-background-color: #2f213a;"
3865
0b1c426b035f Frontend:
smaxx
parents: 3758
diff changeset
   198
                "gridline-color: transparent;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   199
            "}"
1172
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   200
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   201
            "QTabBar::tab {"
1897
e9dcb47013c7 - Some style changes by nemo
unc0rr
parents: 1894
diff changeset
   202
                 "border-bottom-width: 0;"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   203
                 "border-radius: 0;"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   204
                 "border-top-left-radius: 6px;"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   205
                 "border-top-right-radius: 6px;"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   206
                 "padding: 3px;"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   207
            "}"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   208
            "QTabBar::tab:!selected {"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   209
                 "color: #0d0544;"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   210
                 "background-color: #ffcc00;"
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   211
            "}"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   212
            "QSpinBox::up-button{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   213
                "background: transparent;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   214
                "width: 16px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   215
                "height: 10px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   216
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   217
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   218
            "QSpinBox::up-arrow {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   219
                "image: url(\":/res/spin_up.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   220
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   221
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   222
            "QSpinBox::down-arrow {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   223
                "image: url(\":/res/spin_down.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   224
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   225
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   226
            "QSpinBox::down-button {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   227
                "background: transparent;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   228
                "width: 16px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   229
                "height: 10px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   230
            "}"
1172
8542fc1ff5cf Some more customizations
unc0rr
parents: 1171
diff changeset
   231
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   232
            "QComboBox {"
3019
d6e19f35d98d Frontend:
smxx
parents: 2948
diff changeset
   233
                "border-radius: 10px;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   234
                "padding: 3px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   235
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   236
            "QComboBox:pressed{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   237
                "border-color: white;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   238
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   239
            "QComboBox::drop-down{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   240
                "border: transparent;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   241
                "width: 25px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   242
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   243
            "QComboBox::down-arrow {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   244
                "image: url(\":/res/dropdown.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   245
            "}"
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
   246
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   247
            "VertScrArea {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   248
                "background-position: bottom center;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   249
                "background-repeat: repeat-x;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   250
            "}"
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
   251
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   252
            "IconedGroupBox {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   253
                "border-radius: 16px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   254
                "padding: 2px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   255
            "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   256
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   257
            "QGroupBox::title{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   258
                "subcontrol-origin: margin;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   259
                "subcontrol-position: top left;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   260
                "text-align: left;"
5925
2a9353b800cd Move options caption to box title. This frees up quite a bit of space at 800x600
nemo
parents: 5849
diff changeset
   261
                "left: 15px;"
2a9353b800cd Move options caption to box title. This frees up quite a bit of space at 800x600
nemo
parents: 5849
diff changeset
   262
                "top: -4px;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   263
                "}"
1155
ffd0a34171f1 Customize checkboxes
unc0rr
parents: 1154
diff changeset
   264
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   265
            "QCheckBox::indicator:checked{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   266
                "image: url(\":/res/checked.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   267
                "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   268
            "QCheckBox::indicator:unchecked{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   269
                "image: url(\":/res/unchecked.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   270
                "}"
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
   271
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   272
            ".QWidget{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   273
                "background: transparent;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   274
                "}"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   275
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   276
            "QTabWidget::pane {"
1893
85c61bc5e160 Style fixes by nemo
unc0rr
parents: 1577
diff changeset
   277
                "border-top-width: 2px;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   278
            "}"
1413
6393a1d5ac18 Customize menu look
unc0rr
parents: 1390
diff changeset
   279
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   280
            "QMenu{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   281
                "background-color: #ffcc00;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   282
                "margin: 3px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   283
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   284
            "QMenu::item {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   285
                "background-color: #0d0544;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   286
                "border: 1px solid transparent;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   287
                "font: bold;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   288
                "padding: 2px 25px 2px 20px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   289
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   290
            "QMenu::item:selected {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   291
                "background-color: #2d2564;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   292
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   293
            "QMenu::indicator {"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   294
                "width: 16px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   295
                "height: 16px;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   296
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   297
            "QMenu::indicator:non-exclusive:checked{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   298
                "image: url(\":/res/checked.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   299
            "}"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   300
            "QMenu::indicator:non-exclusive:unchecked{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   301
                "image: url(\":/res/unchecked.png\");"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   302
            "}"
1450
f854866390a5 Add tooltips
unc0rr
parents: 1438
diff changeset
   303
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   304
            "QToolTip{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   305
                "background-color: #0d0544;"
3019
d6e19f35d98d Frontend:
smxx
parents: 2948
diff changeset
   306
                "border: 1px solid #ffcc00;"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   307
            "}"
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
   308
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   309
            ":disabled{"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   310
                "color: #a0a0a0;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   311
            "}"
2072
6e0fcbcc3f60 Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents: 2035
diff changeset
   312
            "SquareLabel, ItemNum {"
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   313
                "background-color: #000000;"
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   314
            "}"
3714
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   315
            "QSlider::groove::horizontal {"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   316
                "height: 2px;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   317
                "margin: 2px 0px;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   318
                "background-color: #ffcc00;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   319
            "}"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   320
            "QSlider::handle::horizontal {"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   321
                "border: 0px;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   322
                "margin: -2px 0px;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   323
                "border-radius: 3px;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   324
                "background-color: #ffcc00;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   325
                "width: 8px;"
c407f00d2851 Engine:
smaxx
parents: 3697
diff changeset
   326
            "}"
5849
b84b41aba275 fix for issue #269
sheepluva
parents: 5756
diff changeset
   327
            );
1150
ae86e36dad2e - Make look better
unc0rr
parents: 1149
diff changeset
   328
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   329
    bindir->cd("bin"); // workaround over NSIS installer
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   330
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   331
    if(cConfigDir->length() == 0)
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   332
        cfgdir->setPath(cfgdir->homePath());
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   333
    else
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   334
        cfgdir->setPath(*cConfigDir);
2428
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
   335
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   336
    if(cConfigDir->length() == 0)
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   337
    {
1965
340bfd438ca5 - Apply koda's patch
unc0rr
parents: 1940
diff changeset
   338
#ifdef __APPLE__
3758
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   339
        checkForDir(cfgdir->absolutePath() + "/Library/Application Support/Hedgewars");
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   340
        cfgdir->cd("Library/Application Support/Hedgewars");
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   341
#elif defined _WIN32
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   342
        char path[1024];
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   343
        if(!SHGetFolderPathA(0, CSIDL_PERSONAL, NULL, 0, path))
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   344
        {
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   345
            cfgdir->cd(path);
3758
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   346
            checkForDir(cfgdir->absolutePath() + "/Hedgewars");
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   347
            cfgdir->cd("Hedgewars");
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   348
        }
3758
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   349
        else // couldn't retrieve documents folder? almost impossible, but in case fall back to classic path
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   350
        {
3758
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   351
            checkForDir(cfgdir->absolutePath() + "/.hedgewars");
3333
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   352
            cfgdir->cd(".hedgewars");
560e2766c445 Frontend:
smxx
parents: 3236
diff changeset
   353
        }
2428
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
   354
#else
3758
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   355
        checkForDir(cfgdir->absolutePath() + "/.hedgewars");
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   356
        cfgdir->cd(".hedgewars");
2428
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2418
diff changeset
   357
#endif
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   358
    }
3758
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   359
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   360
    if (checkForDir(cfgdir->absolutePath()))
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   361
    {
3758
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   362
        // alternative loading/lookup paths
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   363
        // TODO: Uncomment paths as they're implemented
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   364
        checkForDir(cfgdir->absolutePath() + "/Data");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   365
        //checkForDir(cfgdir->absolutePath() + "/Data/Forts");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   366
        //checkForDir(cfgdir->absolutePath() + "/Data/Graphics");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   367
        //checkForDir(cfgdir->absolutePath() + "/Data/Graphics/Flags");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   368
        //checkForDir(cfgdir->absolutePath() + "/Data/Graphics/Graves");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   369
        //checkForDir(cfgdir->absolutePath() + "/Data/Graphics/Hats");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   370
        //checkForDir(cfgdir->absolutePath() + "/Data/Maps");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   371
        //checkForDir(cfgdir->absolutePath() + "/Data/Missions");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   372
        //checkForDir(cfgdir->absolutePath() + "/Data/Missions/Campaign");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   373
        //checkForDir(cfgdir->absolutePath() + "/Data/Missions/Training");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   374
        //checkForDir(cfgdir->absolutePath() + "/Data/Sounds");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   375
        //checkForDir(cfgdir->absolutePath() + "/Data/Sounds/voices");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   376
        //checkForDir(cfgdir->absolutePath() + "/Data/Themes");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   377
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   378
        // config/save paths
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   379
        checkForDir(cfgdir->absolutePath() + "/Demos");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   380
        checkForDir(cfgdir->absolutePath() + "/Saves");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   381
        checkForDir(cfgdir->absolutePath() + "/Screenshots");
80007c41c35e Frontend:
smaxx
parents: 3714
diff changeset
   382
        checkForDir(cfgdir->absolutePath() + "/Teams");
3914
c5c903c6225b Engine:
smaxx
parents: 3865
diff changeset
   383
        checkForDir(cfgdir->absolutePath() + "/Logs");
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   384
    }
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   385
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   386
    datadir->cd(bindir->absolutePath());
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   387
    datadir->cd(*cDataDir);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   388
    if(!datadir->cd("hedgewars/Data")) {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   389
        QMessageBox::critical(0, QMessageBox::tr("Error"),
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   390
            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
   391
                    "Please check your installation").
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   392
                    arg(datadir->absolutePath()+"/hedgewars/Data"));
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   393
        return 1;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   394
    }
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   395
5276
562070d3f978 Derive themes list from list of dirs in Themes folder which have icon.png inside
unc0rr
parents: 5257
diff changeset
   396
    {
6160
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   397
        QStringList themes;
5289
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   398
6160
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   399
        themes.append(HWDataManager::instance().entryList(
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   400
                         "Themes",
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   401
                         QDir::AllDirs | QDir::NoDotAndDotDot)
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   402
                     );
5289
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   403
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   404
        QList<QPair<QIcon, QIcon> > icons;
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   405
5307
dd53755e0fca Fix broken theme icon loading from user dir
unc0rr
parents: 5300
diff changeset
   406
        themes.sort();
5289
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   407
        for(int i = themes.size() - 1; i >= 0; --i)
5276
562070d3f978 Derive themes list from list of dirs in Themes folder which have icon.png inside
unc0rr
parents: 5257
diff changeset
   408
        {
6160
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   409
            QFile * tmpfile =
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   410
            HWDataManager::instance().findFileForRead(
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   411
                                QString("Themes/%1/icon.png").arg(themes.at(i))
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   412
                            );
5307
dd53755e0fca Fix broken theme icon loading from user dir
unc0rr
parents: 5300
diff changeset
   413
6160
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   414
            if(tmpfile->exists())
5307
dd53755e0fca Fix broken theme icon loading from user dir
unc0rr
parents: 5300
diff changeset
   415
            { // load icon
dd53755e0fca Fix broken theme icon loading from user dir
unc0rr
parents: 5300
diff changeset
   416
                QPair<QIcon, QIcon> ic;
6160
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   417
                ic.first = QIcon(tmpfile->fileName());
5289
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   418
6160
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   419
                QFile * previewIconFile =
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   420
                    HWDataManager::instance().findFileForRead(
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   421
                            QString("Themes/%1/icon@2x.png").arg(themes.at(i))
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   422
                        );
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   423
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   424
                ic.second = QIcon(previewIconFile->fileName());
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   425
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   426
                // this QFile is not needed any further
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   427
                delete previewIconFile;
5289
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   428
5307
dd53755e0fca Fix broken theme icon loading from user dir
unc0rr
parents: 5300
diff changeset
   429
                icons.prepend(ic);
dd53755e0fca Fix broken theme icon loading from user dir
unc0rr
parents: 5300
diff changeset
   430
            }
dd53755e0fca Fix broken theme icon loading from user dir
unc0rr
parents: 5300
diff changeset
   431
            else
dd53755e0fca Fix broken theme icon loading from user dir
unc0rr
parents: 5300
diff changeset
   432
            {
dd53755e0fca Fix broken theme icon loading from user dir
unc0rr
parents: 5300
diff changeset
   433
                themes.removeAt(i);
5276
562070d3f978 Derive themes list from list of dirs in Themes folder which have icon.png inside
unc0rr
parents: 5257
diff changeset
   434
            }
6160
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   435
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   436
            // this QFile is not needed any further
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   437
            delete tmpfile;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   438
        }
5289
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   439
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   440
        themesModel = new ThemesModel(themes);
5307
dd53755e0fca Fix broken theme icon loading from user dir
unc0rr
parents: 5300
diff changeset
   441
        Q_ASSERT(themes.size() == icons.size());
5289
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   442
        for(int i = 0; i < icons.size(); ++i)
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   443
        {
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   444
            themesModel->setData(themesModel->index(i), icons[i].first, Qt::DecorationRole);
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   445
            themesModel->setData(themesModel->index(i), icons[i].second, Qt::UserRole);
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   446
        }
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   447
    }
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
   448
6160
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   449
    mapList = new QStringList(HWDataManager::instance().entryList(
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   450
                                 QString("Maps"),
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   451
                                 QDir::Dirs | QDir::NoDotAndDotDot
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   452
                                 )
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   453
                             );
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5095
diff changeset
   454
 
6160
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   455
    scriptList = new QStringList(HWDataManager::instance().entryList(
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   456
                                     QString("Scripts/Multiplayer"),
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   457
                                     QDir::Dirs | QDir::NoDotAndDotDot,
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   458
                                     QStringList("*.lua")
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   459
                                     )
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   460
                                 );
2898
c53636f556f8 Frontend:
smxx
parents: 2897
diff changeset
   461
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   462
    QTranslator Translator;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   463
    {
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   464
        QSettings settings(cfgdir->absolutePath() + "/hedgewars.ini", QSettings::IniFormat);
5289
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   465
        QString cc = settings.value("misc/locale", QString()).toString();
9d18b61bd3eb - Implement ThemesModel (load theme icons once, store in memory, don't reload from disk every time selection changes)
unc0rr
parents: 5276
diff changeset
   466
        if(cc.isEmpty())
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   467
            cc = QLocale::system().name();
6160
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   468
        QFile * tmpfile = HWDataManager::instance().findFileForRead(
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   469
                                            QString("Locale/hedgewars_" + cc));
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6129
diff changeset
   470
        Translator.load(tmpfile->fileName());
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   471
        app.installTranslator(&Translator);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   472
    }
2898
c53636f556f8 Frontend:
smxx
parents: 2897
diff changeset
   473
5756
b451fd21ff4c Extract downloaded content into temp dir
unc0rr
parents: 5307
diff changeset
   474
#ifdef _WIN32
3679
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   475
    // Win32 registry setup (used for xfire detection etc. - don't set it if we're running in "portable" mode with a custom config dir)
3932
2fc211f60015 Engine:
smaxx
parents: 3914
diff changeset
   476
    if(!custom_config)
3679
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   477
    {
3932
2fc211f60015 Engine:
smaxx
parents: 3914
diff changeset
   478
        QSettings registry_hklm("HKEY_LOCAL_MACHINE", QSettings::NativeFormat);
2fc211f60015 Engine:
smaxx
parents: 3914
diff changeset
   479
        registry_hklm.setValue("Software/Hedgewars/Frontend", bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe");
2fc211f60015 Engine:
smaxx
parents: 3914
diff changeset
   480
        registry_hklm.setValue("Software/Hedgewars/Path", bindir->absolutePath().replace("/", "\\"));
3679
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   481
    }
acf5acc18522 Frontend:
smaxx
parents: 3350
diff changeset
   482
#endif
5095
15dd764b728c fix autorelease pools not being set (issue 209) and format code a little
koda
parents: 4976
diff changeset
   483
#ifdef __APPLE__
15dd764b728c fix autorelease pools not being set (issue 209) and format code a little
koda
parents: 4976
diff changeset
   484
    // this creates the autoreleasepool that prevents leaking
15dd764b728c fix autorelease pools not being set (issue 209) and format code a little
koda
parents: 4976
diff changeset
   485
    CocoaInitializer initializer;
15dd764b728c fix autorelease pools not being set (issue 209) and format code a little
koda
parents: 4976
diff changeset
   486
#endif
2898
c53636f556f8 Frontend:
smxx
parents: 2897
diff changeset
   487
5849
b84b41aba275 fix for issue #269
sheepluva
parents: 5756
diff changeset
   488
    app.form = new HWForm(NULL,styleSheetFromHell);
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
   489
5252
ded882439548 file association for mac!
koda
parents: 5238
diff changeset
   490
    app.form->show();
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2913
diff changeset
   491
    return app.exec();
2845
19db164dd20d Frontend:
smxx
parents: 2798
diff changeset
   492
}