uisupport: Provide helpers for dealing with widget changes
[quassel.git] / src / common / quassel.h
index 77f7b87..fd1dfd7 100644 (file)
 
 #pragma once
 
+#include "common-export.h"
+
 #include <functional>
-#include <memory>
 #include <vector>
 
+#include <QCommandLineParser>
 #include <QCoreApplication>
 #include <QFile>
-#include <QObject>
 #include <QLocale>
+#include <QObject>
 #include <QString>
 #include <QStringList>
 
-#include "abstractcliparser.h"
 #include "abstractsignalwatcher.h"
 #include "singleton.h"
 
@@ -39,7 +40,7 @@ class QFile;
 
 class Logger;
 
-class Quassel : public QObject, public Singleton<Quassel>
+class COMMON_EXPORT Quassel : public QObject, public Singleton<Quassel>
 {
     // TODO Qt5: Use Q_GADGET
     Q_OBJECT
@@ -115,11 +116,7 @@ public:
      *
      * This list should be cleaned up after every protocol break, as we can assume them to be present then.
      */
-    #if QT_VERSION >= 0x050000
     enum class Feature : uint32_t {
-    #else
-    enum Feature {
-    #endif
         SynchronizedMarkerLine,
         SaslAuthentication,
         SaslExternal,
@@ -138,9 +135,7 @@ public:
         LongTime,                 ///< Serialize time as 64-bit values
         RichMessages,             ///< Real Name and Avatar URL in backlog
         BacklogFilterType,        ///< BacklogManager supports filtering backlog by MessageType
-#if QT_VERSION >= 0x050500
         EcdsaCertfpKeys,          ///< ECDSA keys for CertFP in identities
-#endif
         LongMessageId,            ///< 64-bit IDs for messages
         SyncedCoreInfo,           ///< CoreInfo dynamically updated using signals
     };
@@ -150,6 +145,8 @@ public:
 
     Quassel();
 
+    void init(RunMode runMode);
+
     /**
      * Provides access to the Logger instance.
      *
@@ -189,7 +186,6 @@ public:
 
     static void loadTranslation(const QLocale &locale);
 
-    static void setCliParser(std::shared_ptr<AbstractCliParser> cliParser);
     static QString optionValue(const QString &option);
     static bool isOptionSet(const QString &option);
 
@@ -222,22 +218,11 @@ public slots:
 signals:
     void messageLogged(const QDateTime &timeStamp, const QString &msg);
 
-protected:
-    static bool init();
-
-    static void setRunMode(Quassel::RunMode runMode);
-
-    static void setDataDirPaths(const QStringList &paths);
-    static QStringList findDataDirPaths();
-
-    friend class CoreApplication;
-    friend class QtUiApplication;
-    friend class MonolithicApplication;
-
 private:
-    void setupEnvironment();
     void registerMetaTypes();
     void setupSignalHandling();
+    void setupEnvironment();
+    void setupCliParser();
 
     /**
      * Requests a reload of relevant runtime configuration.
@@ -257,7 +242,6 @@ private slots:
 private:
     BuildInfo _buildInfo;
     RunMode _runMode;
-    bool _initialized{false};
     bool _quitting{false};
 
     QString _coreDumpFileName;
@@ -265,7 +249,7 @@ private:
     QStringList _dataDirPaths;
     QString _translationDirPath;
 
-    std::shared_ptr<AbstractCliParser> _cliParser;
+    QCommandLineParser _cliParser;
 
     Logger *_logger;
     AbstractSignalWatcher *_signalWatcher{nullptr};
@@ -281,7 +265,7 @@ private:
  *
  * @sa Quassel::Feature
  */
-class Quassel::Features
+class COMMON_EXPORT Quassel::Features
 {
 public:
     /**