X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fquassel.h;h=30e02b201fa932013c05c6040bdad6c14f763ae7;hb=7fdaa5c9df2e632685ef2d8d0177ac22b7145a6f;hp=53d9e0bf9dd97e77222bbcf7e46a205b99ccdab1;hpb=ab16c77fe03b73a863d9b52b11919bcbac903f58;p=quassel.git diff --git a/src/common/quassel.h b/src/common/quassel.h index 53d9e0bf..30e02b20 100644 --- a/src/common/quassel.h +++ b/src/common/quassel.h @@ -27,6 +27,8 @@ #include "abstractcliparser.h" +class QFile; + class Quassel { Q_DECLARE_TR_FUNCTIONS(Quassel) @@ -58,6 +60,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); @@ -101,15 +123,28 @@ public: static bool DEBUG; + enum LogLevel { + DebugLevel, + InfoLevel, + WarningLevel, + ErrorLevel + }; + + static inline LogLevel logLevel(); + static inline QFile *logFile(); + static inline bool logToSyslog(); + static void logFatalMessage(const char *msg); 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(); @@ -117,25 +152,38 @@ 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; + + static LogLevel _logLevel; + static QFile *_logFile; + static bool _logToSyslog; }; +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; } QString Quassel::optionValue(const QString &key) { return cliParser()->value(key); } bool Quassel::isOptionSet(const QString &key) { return cliParser()->isSet(key); } +Quassel::LogLevel Quassel::logLevel() { return _logLevel; } +QFile *Quassel::logFile() { return _logFile; } +bool Quassel::logToSyslog() { return _logToSyslog; } + #endif