Committing a lot of identity stuff which is still disabled.
[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
30 extern void messageHandler(QtMsgType type, const char *msg);
31
32 /* not done yet */
33 /*
34 void Global::initIconMap() {
35 // Do not depend on GUI in core!
36   QDomDocument doc("IconMap");
37   QFile file("images/iconmap.xml");
38   if(!file.open(QIODevice::ReadOnly)) {
39     qDebug() << "Error opening iconMap file!";
40     return;
41   } else if(!doc.setContent(&file)) {
42     file.close();
43     qDebug() << "Error parsing iconMap file!";
44   } else {
45     file.close();
46
47   }
48 }
49 */
50
51 /**
52  * Retrieves an icon determined by its symbolic name. The mapping shall later
53  * be performed by a theme manager or something like that.
54  * @param symbol Symbol of requested icon
55  * @return Pointer to a newly created QIcon
56  */
57 //
58 //QIcon *Global::getIcon(QString /*symbol*/) {
59   //if(symbol == "connect"
60
61 //  return 0;
62 //}
63
64 //! Register our custom types with Qt's Meta Object System.
65 /**  This makes them available for QVariant and in signals/slots, among other things.
66  */
67 void Global::registerMetaTypes() {
68   // Complex types
69   qRegisterMetaType<QVariant>("QVariant");
70   qRegisterMetaType<Message>("Message");
71   qRegisterMetaType<BufferInfo>("BufferInfo");
72   qRegisterMetaType<Identity>("Identity");
73
74   qRegisterMetaTypeStreamOperators<QVariant>("QVariant");
75   qRegisterMetaTypeStreamOperators<Message>("Message");
76   qRegisterMetaTypeStreamOperators<BufferInfo>("BufferInfo");
77   qRegisterMetaTypeStreamOperators<Identity>("Identity");
78
79   // Basic types (typedefs)
80   // These use the standard stream operators
81   qRegisterMetaType<IdentityId>("IdentityId");
82   qRegisterMetaType<BufferId>("BufferId");
83   qRegisterMetaType<NetworkId>("NetworkId");
84
85   qRegisterMetaTypeStreamOperators<IdentityId>("IdentityId");
86   qRegisterMetaTypeStreamOperators<BufferId>("BufferId");
87   qRegisterMetaTypeStreamOperators<NetworkId>("NetworkId");
88
89 }
90
91 Global::RunMode Global::runMode;
92 uint Global::defaultPort;
93