main.h
1 //------------------------------------------------------------------------------
2 // main.h
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2009 "Blzut3" <admin@maniacsvault.net>
22 //------------------------------------------------------------------------------
23 
24 #ifndef __MAIN_H__
25 #define __MAIN_H__
26 
27 #include <QApplication>
28 #include <QObject>
29 #include <QStringList>
30 #include <QUrl>
31 
32 class LocalizationInfo;
33 
37 class Main : public QObject
38 {
39  Q_OBJECT
40 
41  public:
52  static QList<LocalizationInfo> localizations;
53  static QString argDataDir;
54 
55  Main(int argc, char* argv[]);
56  ~Main();
57 
63  void finalize();
64 
68  int run();
69 
70  protected:
71  int connectToServerByURL();
72  void convertOldIniToQSettingsIni();
73 
74  void createMainWindow();
75  bool createRemoteConsole();
76 
77  int runTestMode();
78 
84  bool initDataDirectories();
85 
91  int initIP2C();
92  void initIRCConfig();
93  void initLocalizationsDefinitions();
94  void initMainConfig();
95  void initPasswordsConfig();
96  void initPluginConfig();
97  int installPendingUpdates();
98 
104  void setupRefreshingThread();
105 
106  char** arguments;
107  int argumentsCount;
108  bool bIsFirstRun;
109  bool bTestMode;
110  QStringList dataDirectories;
111  QString rconPluginName;
112  QString rconAddress;
113  unsigned short rconPort;
114  bool startRcon;
115  int updateFailedCode;
116  QUrl connectUrl;
117 
118  private:
119  bool bPortableMode;
120 };
121 
122 #endif /* __MAIN_H__ */
static bool bInstallUpdatesAndRestart
If true then program will install updates and restart instead of quitting if quit is requested...
Definition: main.h:51
int initIP2C()
Definition: main.cpp:349
int run()
Replaces main().
Definition: main.cpp:125
void finalize()
Called by main() after run() returns.
bool initDataDirectories()
Definition: main.cpp:318
QString rconAddress
If not empty assume we want to launch an rcon client.
Definition: main.h:112
bool interpretCommandLineParameters()
Definition: main.cpp:459
Definition: main.h:37