src/main.cpp

Sat, 06 Jun 2015 22:28:34 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sat, 06 Jun 2015 22:28:34 +0300
changeset 43
1394901b557a
parent 42
9528f8d06962
child 44
d0bf58f3560f
permissions
-rw-r--r--

Renamed cfg.cpp/h to config.cpp/h

13
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 11
diff changeset
1 /*
30
6b82f6a3ad53 renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
2 * ZCinema: Zandronum demo launcher
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
3 * Copyright (C) 2013-2015 Teemu Piippo
13
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
c9b22c06307c Done config box base
Teemu Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
19 #include <QApplication>
42
9528f8d06962 rename config.cpp/h to configwindow.cpp/h
Teemu Piippo <crimsondusk64@gmail.com>
parents: 41
diff changeset
20 #include "configwindow.h"
0
bb264814dd81 Initial commit
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include "types.h"
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
22 #include "demo.h"
26
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
23 #include "prompts.h"
40
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
24 #include "hginfo.h"
0
bb264814dd81 Initial commit
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
26 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
27 // -------------------------------------------------------------------------------------------------
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
28 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
29
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
30 int main (int argc, char* argv[])
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
31 {
11
3ddebf76105e made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
32 QApplication app (argc, argv);
3ddebf76105e made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
33 app.setApplicationName (UNIXNAME);
3ddebf76105e made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
34 app.setOrganizationName (UNIXNAME);
3ddebf76105e made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
35 app.setApplicationVersion (versionString());
38
db677d321cf4 Fix demo launching
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
36 qRegisterMetaType<ZandronumVersion> ("ZandronumVersion");
db677d321cf4 Fix demo launching
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
37 qRegisterMetaTypeStreamOperators<ZandronumVersion> ("ZandronumVersion");
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
38
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
39 for (int i = 1; i < argc; ++i)
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
40 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
41 QString arg = argv[i];
41
e985ebb67fdd Removed trailing tabs
Teemu Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
42
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
43 if (arg == "--config")
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
44 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
45 ConfigWindow dlg;
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 3
diff changeset
46 return dlg.exec();
1
c9b22c06307c Done config box base
Teemu Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
47 }
c9b22c06307c Done config box base
Teemu Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
48 }
41
e985ebb67fdd Removed trailing tabs
Teemu Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
49
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
50 if (argc > 1)
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
51 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
52 return launchDemo (argv[1]);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
53 }
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
54 else
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
55 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
56 FindFilePrompt* dlg = new FindFilePrompt (NULL);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
57
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
58 if (not dlg->exec())
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
59 return 0;
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
60
26
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
61 return launchDemo (dlg->path());
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
62 }
0
bb264814dd81 Initial commit
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 }
bb264814dd81 Initial commit
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
65 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
66 // -------------------------------------------------------------------------------------------------
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
67 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
68
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
69 QString versionString()
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
70 {
40
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
71 #ifndef RELEASE
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
72 # ifdef HG_NODE
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
73 // non-release with hg info
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
74 return VERSION_STRING "-" HG_NODE;
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
75 # else
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
76 // non-release, no hg info
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
77 return VERSION_STRING "-beta";
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
78 # endif
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
79 #else
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
80 // release
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
81 return VERSION_STRING;
40
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
82 #endif
11
3ddebf76105e made style more consistent
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
83 }
26
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
84
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
85 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
86 // -------------------------------------------------------------------------------------------------
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
87 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
88
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
89 QString versionSignature()
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
90 {
40
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
91 #ifdef HG_DATE_STRING
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
92 # define DATE_INFO " (" HG_DATE_STRING ")"
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
93 #else
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
94 # define DATE_INFO ""
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
95 #endif
41
e985ebb67fdd Removed trailing tabs
Teemu Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
96
40
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 38
diff changeset
97 return QString (APPNAME) + " " + versionString() + DATE_INFO;
26
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
98 }

mercurial