Finally sanitizificat0red the mess and #ifdef hell with main.cpp, Global:: and friends
[quassel.git] / src / core / coreapplication.h
similarity index 52%
rename from src/common/global.h
rename to src/core/coreapplication.h
index 26f9f6b..14eec29 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-08 by the Quassel Project                          *
+ *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
-// This file needs probably to go away at some point. Not much left anymore.
+#ifndef COREAPPLICATION_H_
+#define COREAPPLICATION_H_
 
-#ifndef _GLOBAL_H_
-#define _GLOBAL_H_
+#include <QCoreApplication>
 
-#include "cliparser.h"
+#include "quassel.h"
 
-#include <QString>
+/// Encapsulates CoreApplication's logic.
+/** This allows it to be reused within MonolithicApplication as well.
+ */
+class CoreApplicationInternal {
+  Q_DECLARE_TR_FUNCTIONS(CoreApplicationInternal)
 
-// Enable some shortcuts and stuff
-//#define DEVELMODE
+  public:
+    CoreApplicationInternal();
+    ~CoreApplicationInternal();
 
-/* Some global stuff */
-
-namespace Global {
-
-  extern QString quasselVersion;
-  extern QString quasselBaseVersion;
-  extern QString quasselBuildDate;
-  extern QString quasselBuildTime;
-  extern QString quasselCommit;
-  extern uint quasselArchiveDate;
-  extern uint protocolVersion;
-
-  extern uint clientNeedsProtocol;  //< Minimum protocol version the client needs
-  extern uint coreNeedsProtocol;    //< Minimum protocol version the core needs
-
-  extern QString quasselGeneratedVersion;  //< This is possibly set in version.gen
+    bool init();
+};
 
-  // We need different config (QSettings) files for client and gui, since the core cannot work with GUI types
-  // Set these here. They're used in ClientSettings and CoreSettings.
-  const QString coreApplicationName = "Quassel Core";
-  const QString clientApplicationName = "Quassel Client";
+class CoreApplication : public QCoreApplication, public Quassel {
+  Q_OBJECT
+  public:
+    CoreApplication(int &argc, char **argv);
+    ~CoreApplication();
 
-  enum RunMode { Monolithic, ClientOnly, CoreOnly };
-  extern RunMode runMode;
-  extern unsigned int defaultPort;
+    bool init();
 
-  extern bool DEBUG;
-  extern CliParser parser;
-  void registerMetaTypes();
-  void setupVersion();
+  private:
+    CoreApplicationInternal *_internal;
 };
 
 #endif