09aa5902aa63c1637b2be50da6de69ad7d580f73
[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 void Global::registerMetaTypes() {
69   // Complex types
70   qRegisterMetaType<QVariant>("QVariant");
71   qRegisterMetaType<Message>("Message");
72   qRegisterMetaType<BufferInfo>("BufferInfo");
73   qRegisterMetaType<Identity>("Identity");
74
75   qRegisterMetaTypeStreamOperators<QVariant>("QVariant");
76   qRegisterMetaTypeStreamOperators<Message>("Message");
77   qRegisterMetaTypeStreamOperators<BufferInfo>("BufferInfo");
78   qRegisterMetaTypeStreamOperators<Identity>("Identity");
79
80   // Basic types (typedefs)
81   // These use the standard stream operators
82   qRegisterMetaType<IdentityId>("IdentityId");
83   qRegisterMetaType<BufferId>("BufferId");
84   qRegisterMetaType<NetworkId>("NetworkId");
85
86   qRegisterMetaTypeStreamOperators<IdentityId>("IdentityId");
87   qRegisterMetaTypeStreamOperators<BufferId>("BufferId");
88   qRegisterMetaTypeStreamOperators<NetworkId>("NetworkId");
89
90 }
91
92 Global::RunMode Global::runMode;
93 uint Global::defaultPort;
94