Fix CoreFeatures; disable SASL support if core isn't new enough
[quassel.git] / src / common / quassel.h
index 9492ec6..86469c4 100644 (file)
@@ -22,6 +22,7 @@
 #define QUASSEL_H_
 
 #include <QCoreApplication>
+#include <QLocale>
 #include <QString>
 
 #include "abstractcliparser.h"
@@ -57,6 +58,26 @@ public:
     QString organizationDomain;
   };
 
+  //! A list of features that are optional in core and/or client, but need runtime checking
+  /** Some features require an uptodate counterpart, but don't justify a protocol break.
+   *  This is what we use this enum for. Add such features to it and check at runtime on the other
+   *  side for their existence.
+   *
+   *  This list should be cleaned up after every protocol break, as we can assume them to be present then.
+   */
+  enum Feature {
+    SynchronizedMarkerLine = 0x0001,
+    SaslAuthentication = 0x0002,
+
+    NumFeatures = 0x0002
+  };
+  Q_DECLARE_FLAGS(Features, Feature);
+
+  //! The features the current version of Quassel supports (\sa Feature)
+  /** \return An ORed list of all enum values in Feature
+   */
+  static Features features();
+
   virtual ~Quassel();
 
   static void setupBuildInfo(const QString &generated);
@@ -81,6 +102,16 @@ public:
   */
   static QString findDataFilePath(const QString &filename);
 
+  static QString translationDirPath();
+
+  //! Returns a list of directories we look for scripts in
+  /** We look for a subdirectory named "scripts" in the configdir and in all datadir paths.
+  *   \return A list of directory paths containing executable scripts for /exec
+  */
+  static QStringList scriptDirPaths();
+
+  static void loadTranslation(const QLocale &locale);
+
   static inline void setCliParser(AbstractCliParser *cliParser);
   static inline AbstractCliParser *cliParser();
   static inline QString optionValue(const QString &option);
@@ -95,10 +126,12 @@ public:
 protected:
   Quassel();
   virtual bool init();
+  virtual void quit();
 
   inline void setRunMode(RunMode mode);
   inline void setDataDirPaths(const QStringList &paths);
   QStringList findDataDirPaths() const;
+  inline void disableCrashhandler();
 
 private:
   void registerMetaTypes();
@@ -106,20 +139,26 @@ private:
   static void handleSignal(int signal);
   static void logBacktrace(const QString &filename);
 
+  static Quassel *_instance;
   static BuildInfo _buildInfo;
   static AbstractCliParser *_cliParser;
   static RunMode _runMode;
   static bool _initialized;
+  static bool _handleCrashes;
 
   static QString _coreDumpFileName;
   static QString _configDirPath;
   static QStringList _dataDirPaths;
+  static QString _translationDirPath;
 };
 
+Q_DECLARE_OPERATORS_FOR_FLAGS(Quassel::Features);
+
 const Quassel::BuildInfo & Quassel::buildInfo() { return _buildInfo; }
 Quassel::RunMode Quassel::runMode() { return _runMode; }
 void Quassel::setRunMode(Quassel::RunMode mode) { _runMode = mode; }
 void Quassel::setDataDirPaths(const QStringList &paths) { _dataDirPaths = paths; }
+void Quassel::disableCrashhandler() { _handleCrashes = false; }
 
 void Quassel::setCliParser(AbstractCliParser *parser) { _cliParser = parser; }
 AbstractCliParser *Quassel::cliParser() { return _cliParser; }