00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __MAIN_H__
00025 #define __MAIN_H__
00026
00027 #include "ini/ini.h"
00028 #include "ip2c/ip2c.h"
00029 #include "plugins/pluginloader.h"
00030 #include "datapaths.h"
00031 #include "localizationinfo.h"
00032 #include <QApplication>
00033 #include <QObject>
00034 #include <QStringList>
00035 #include <QUrl>
00036
00037 class RefreshingThread;
00038
00042 class MAIN_EXPORT Main : public QObject
00043 {
00044 public:
00045 static const QString IP2C_FILENAME;
00046
00047 static QApplication* application;
00057 static bool bInstallUpdatesAndRestart;
00058 static IP2C *ip2c;
00059 static DataPaths* dataPaths;
00060 static QWidget* mainWindow;
00061 static PluginLoader* enginePlugins;
00062 static QList<LocalizationInfo> localizations;
00063 static bool running;
00064 static RefreshingThread* refreshingThread;
00065 static QString workingDirectory;
00066 static QString argDataDir;
00067 static bool bPortableMode;
00068
00069 Main(int argc, char* argv[]);
00070 ~Main();
00071
00077 void finalize();
00078
00082 int run();
00083
00084 protected:
00085 static const QString DOOMSEEKER_CONFIG_FILENAME;
00086 static const QString DOOMSEEKER_INI_FILENAME;
00087 static const QString DOOMSEEKER_IRC_INI_FILENAME;
00088
00089 int connectToServerByURL();
00090 void convertOldIniToQSettingsIni();
00091
00092 void createMainWindow();
00093 bool createRemoteConsole();
00094
00095 int runTestMode();
00096
00102 bool initDataDirectories();
00103
00109 int initIP2C();
00110 void initIRCConfig();
00111 void initLocalizationsDefinitions();
00112 void initMainConfig();
00113 void initPluginConfig();
00114 int installPendingUpdates();
00115
00120 bool interpretCommandLineParameters();
00121 void preserveOldConfigBackwardsCompatibility();
00122 void setupRefreshingThread();
00123
00124 char** arguments;
00125 int argumentsCount;
00126 bool bIsFirstRun;
00127 bool bTestMode;
00128 QStringList dataDirectories;
00129 QString rconPluginName;
00130 QString rconAddress;
00131 unsigned short rconPort;
00132 bool startRcon;
00133 int updateFailedCode;
00134 QUrl connectUrl;
00135 };
00136
00137 #endif