1 /***************************************************************************
2 * Copyright (C) 2005-09 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
24 #include <QCoreApplication>
27 #include "abstractcliparser.h"
30 Q_DECLARE_TR_FUNCTIONS(Quassel)
40 QString fancyVersionString; // clickable rev
41 QString plainVersionString; // no <a> tag
44 QString generatedVersion;
50 uint clientNeedsProtocol;
51 uint coreNeedsProtocol;
53 QString applicationName;
54 QString coreApplicationName;
55 QString clientApplicationName;
56 QString organizationName;
57 QString organizationDomain;
62 static void setupBuildInfo(const QString &generated);
63 static inline const BuildInfo & buildInfo();
64 static inline RunMode runMode();
66 static QString configDirPath();
67 static QStringList dataDirPaths();
68 static QString findDataFilePath(const QString &filename);
70 static inline void setCliParser(AbstractCliParser *cliParser);
71 static inline AbstractCliParser *cliParser();
72 static inline QString optionValue(const QString &option);
73 static inline bool isOptionSet(const QString &option);
75 static const QString &coreDumpFileName();
79 static void logFatalMessage(const char *msg);
85 inline void setRunMode(RunMode mode);
86 inline void setDataDirPaths(const QStringList &paths);
87 QStringList findDataDirPaths() const;
90 void registerMetaTypes();
92 static void handleSignal(int signal);
93 static void logBacktrace(const QString &filename);
95 static BuildInfo _buildInfo;
96 static AbstractCliParser *_cliParser;
97 static RunMode _runMode;
98 static bool _initialized;
100 static QString _coreDumpFileName;
101 static QString _configDirPath;
102 static QStringList _dataDirPaths;
105 const Quassel::BuildInfo & Quassel::buildInfo() { return _buildInfo; }
106 Quassel::RunMode Quassel::runMode() { return _runMode; }
107 void Quassel::setRunMode(Quassel::RunMode mode) { _runMode = mode; }
108 void Quassel::setDataDirPaths(const QStringList &paths) { _dataDirPaths = paths; }
110 void Quassel::setCliParser(AbstractCliParser *parser) { _cliParser = parser; }
111 AbstractCliParser *Quassel::cliParser() { return _cliParser; }
112 QString Quassel::optionValue(const QString &key) { return cliParser()->value(key); }
113 bool Quassel::isOptionSet(const QString &key) { return cliParser()->isSet(key); }