Sun, 11 Aug 2013 13:38:12 +0300
Qt4 has QChar::toLatin1() as well so we don't need to use toAscii() in Qt4.
13
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
1 | /* |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
2 | * ZanDemo: Zandronum demo launcher |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
3 | * Copyright (C) 2013 Santeri Piippo |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
4 | * |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
8 | * (at your option) any later version. |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
9 | * |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
13 | * GNU General Public License for more details. |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
14 | * |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
17 | */ |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
18 | |
1 | 19 | #include <QApplication> |
3
d0b278fd29d5
Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents:
2
diff
changeset
|
20 | #include <QSettings> |
0 | 21 | #include "types.h" |
1 | 22 | #include "config.h" |
6
67b6ef6917ba
Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
23 | #include "demo.h" |
0 | 24 | |
1 | 25 | // ============================================================================= |
26 | // ----------------------------------------------------------------------------- | |
11
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
27 | int main (int argc, char* argv[]) { |
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
28 | QApplication app (argc, argv); |
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
29 | app.setApplicationName (UNIXNAME); |
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
30 | app.setOrganizationName (UNIXNAME); |
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
31 | app.setApplicationVersion (versionString()); |
3
d0b278fd29d5
Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents:
2
diff
changeset
|
32 | |
11
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
33 | for (int i = 1; i < argc; ++i) { |
1 | 34 | str arg = argv[i]; |
35 | ||
11
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
36 | if (arg == "--config") { |
5
3c04e05ab24f
Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
37 | ConfigBox dlg; |
3c04e05ab24f
Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
38 | return dlg.exec(); |
1 | 39 | } |
40 | } | |
41 | ||
11
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
42 | if (argc != 2) { |
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
43 | fprint (stderr, "Usage: %1 <demo> - Launch a demo file\n", argv[0]); |
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
44 | fprint (stderr, " %1 --config - Configure " APPNAME "\n", argv[0]); |
6
67b6ef6917ba
Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
45 | return 255; |
67b6ef6917ba
Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
46 | } |
67b6ef6917ba
Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
47 | |
11
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
48 | return launchDemo (argv[1]); |
0 | 49 | } |
50 | ||
1 | 51 | // ============================================================================= |
52 | // ----------------------------------------------------------------------------- | |
5
3c04e05ab24f
Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents:
3
diff
changeset
|
53 | str versionString() { |
11
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
54 | str text = fmt ("v%1.%2", VERSION_MAJOR, VERSION_MINOR); |
0 | 55 | #if VERSION_PATCH != 0 |
11
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
56 | text += fmt (".%1", VERSION_PATCH); |
0 | 57 | #endif |
58 | ||
59 | #if BUILD_ID == BUILD_INTERNAL | |
60 | text += "-intern"; | |
61 | #elif BUILD_ID == BUILD_ALPHA | |
62 | text += "-alpha"; | |
63 | #elif BUILD_ID == BUILD_BETA | |
64 | text += "-beta"; | |
65 | #elif BUILD_ID == BUILD_RC | |
11
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
66 | text += fmt ("-rc%1", RC_ID); |
0 | 67 | #elif BUILD_ID == BUILD_RELEASE |
68 | text += "-rel"; | |
69 | #else | |
70 | # error Invalid build code! | |
71 | #endif // BUILD_ID | |
72 | ||
73 | return text; | |
11
3ddebf76105e
made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
74 | } |