1 /***************************************************************************
2 * Copyright (C) 2005-08 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 ***************************************************************************/
29 #include "bufferinfo.h"
31 #include "syncableobject.h"
33 extern void messageHandler(QtMsgType type, const char *msg);
37 void Global::initIconMap() {
38 // Do not depend on GUI in core!
39 QDomDocument doc("IconMap");
40 QFile file("images/iconmap.xml");
41 if(!file.open(QIODevice::ReadOnly)) {
42 qDebug() << "Error opening iconMap file!";
44 } else if(!doc.setContent(&file)) {
46 qDebug() << "Error parsing iconMap file!";
55 * Retrieves an icon determined by its symbolic name. The mapping shall later
56 * be performed by a theme manager or something like that.
57 * @param symbol Symbol of requested icon
58 * @return Pointer to a newly created QIcon
61 //QIcon *Global::getIcon(QString /*symbol*/) {
62 //if(symbol == "connect"
67 //! Register our custom types with Qt's Meta Object System.
68 /** This makes them available for QVariant and in signals/slots, among other things.
71 void Global::registerMetaTypes() {
73 qRegisterMetaType<QVariant>("QVariant");
74 qRegisterMetaType<Message>("Message");
75 qRegisterMetaType<BufferInfo>("BufferInfo");
76 qRegisterMetaType<NetworkInfo>("NetworkInfo");
77 qRegisterMetaType<Identity>("Identity");
78 qRegisterMetaType<Network::ConnectionState>("Network::ConnectionState");
80 qRegisterMetaTypeStreamOperators<QVariant>("QVariant");
81 qRegisterMetaTypeStreamOperators<Message>("Message");
82 qRegisterMetaTypeStreamOperators<BufferInfo>("BufferInfo");
83 qRegisterMetaTypeStreamOperators<NetworkInfo>("NetworkInfo");
84 qRegisterMetaTypeStreamOperators<Identity>("Identity");
85 qRegisterMetaTypeStreamOperators<qint8>("Network::ConnectionState");
87 qRegisterMetaType<IdentityId>("IdentityId");
88 qRegisterMetaType<BufferId>("BufferId");
89 qRegisterMetaType<NetworkId>("NetworkId");
90 qRegisterMetaType<UserId>("UserId");
91 qRegisterMetaType<AccountId>("AccountId");
92 qRegisterMetaType<MsgId>("MsgId");
94 qRegisterMetaTypeStreamOperators<IdentityId>("IdentityId");
95 qRegisterMetaTypeStreamOperators<BufferId>("BufferId");
96 qRegisterMetaTypeStreamOperators<NetworkId>("NetworkId");
97 qRegisterMetaTypeStreamOperators<UserId>("UserId");
98 qRegisterMetaTypeStreamOperators<AccountId>("AccountId");
99 qRegisterMetaTypeStreamOperators<MsgId>("MsgId");
103 //! This includes version.inc and possibly version.gen and sets up our version numbers.
104 void Global::setupVersion() {
106 # include "version.inc"
107 # include "version.gen"
109 if(quasselGeneratedVersion.isEmpty()) {
110 if(quasselCommit.isEmpty())
111 quasselVersion = QString("v%1 (unknown rev)").arg(quasselBaseVersion);
113 quasselVersion = QString("v%1 (dist-%2, %3)").arg(quasselBaseVersion).arg(quasselCommit.left(7))
114 .arg(QDateTime::fromTime_t(quasselArchiveDate).toLocalTime().toString("yyyy-MM-dd"));
116 QStringList parts = quasselGeneratedVersion.split(':');
117 quasselVersion = QString("v%1").arg(parts[0]);
118 if(parts.count() >= 2) quasselVersion.append(QString(" (%1)").arg(parts[1]));
120 quasselBuildDate = __DATE__;
121 quasselBuildTime = __TIME__;
126 QString Global::quasselVersion;
127 QString Global::quasselBaseVersion;
128 QString Global::quasselGeneratedVersion;
129 QString Global::quasselBuildDate;
130 QString Global::quasselBuildTime;
131 QString Global::quasselCommit;
132 uint Global::quasselArchiveDate;
133 uint Global::protocolVersion;
134 uint Global::clientNeedsProtocol;
135 uint Global::coreNeedsProtocol;
137 Global::RunMode Global::runMode;
138 uint Global::defaultPort;