made the signalproxy compile with MSVC
[quassel.git] / src / common / global.cpp
1 /***************************************************************************
2  *   Copyright (C) 2005-08 by the Quassel Project                          *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
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.                                           *
9  *                                                                         *
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.                          *
14  *                                                                         *
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  ***************************************************************************/
20 #include <QObject>
21 #include <QMetaType>
22
23 #include "global.h"
24 #include "logger.h"
25 #include "message.h"
26 #include "identity.h"
27 #include "bufferinfo.h"
28 #include "types.h"
29 #include "syncableobject.h"
30
31 extern void messageHandler(QtMsgType type, const char *msg);
32
33 /* not done yet */
34 /*
35 void Global::initIconMap() {
36 // Do not depend on GUI in core!
37   QDomDocument doc("IconMap");
38   QFile file("images/iconmap.xml");
39   if(!file.open(QIODevice::ReadOnly)) {
40     qDebug() << "Error opening iconMap file!";
41     return;
42   } else if(!doc.setContent(&file)) {
43     file.close();
44     qDebug() << "Error parsing iconMap file!";
45   } else {
46     file.close();
47
48   }
49 }
50 */
51
52 /**
53  * Retrieves an icon determined by its symbolic name. The mapping shall later
54  * be performed by a theme manager or something like that.
55  * @param symbol Symbol of requested icon
56  * @return Pointer to a newly created QIcon
57  */
58 //
59 //QIcon *Global::getIcon(QString /*symbol*/) {
60   //if(symbol == "connect"
61
62 //  return 0;
63 //}
64
65 //! Register our custom types with Qt's Meta Object System.
66 /**  This makes them available for QVariant and in signals/slots, among other things.
67  *
68  */
69 void Global::registerMetaTypes() {
70   // Complex types
71   qRegisterMetaType<QVariant>("QVariant");
72   qRegisterMetaType<Message>("Message");
73   qRegisterMetaType<BufferInfo>("BufferInfo");
74   qRegisterMetaType<Identity>("Identity");
75
76   qRegisterMetaTypeStreamOperators<QVariant>("QVariant");
77   qRegisterMetaTypeStreamOperators<Message>("Message");
78   qRegisterMetaTypeStreamOperators<BufferInfo>("BufferInfo");
79   qRegisterMetaTypeStreamOperators<Identity>("Identity");
80
81   // Basic types (typedefs)
82   // These use the standard stream operators
83   qRegisterMetaType<IdentityId>("IdentityId");
84   qRegisterMetaType<BufferId>("BufferId");
85   qRegisterMetaType<NetworkId>("NetworkId");
86   qRegisterMetaType<UserId>("UserId");
87
88   qRegisterMetaTypeStreamOperators<IdentityId>("IdentityId");
89   qRegisterMetaTypeStreamOperators<BufferId>("BufferId");
90   qRegisterMetaTypeStreamOperators<NetworkId>("NetworkId");
91   qRegisterMetaTypeStreamOperators<UserId>("UserId");
92
93 }
94
95 // Static variables
96
97 QString Global::quasselVersion;
98 QString Global::quasselDate;
99 uint Global::quasselBuild;
100 uint Global::clientBuildNeeded;
101 QString Global::clientVersionNeeded;
102 uint Global::coreBuildNeeded;
103 QString Global::coreVersionNeeded;
104
105 Global::RunMode Global::runMode;
106 uint Global::defaultPort;