1 /***************************************************************************
2 * Copyright (C) 2005-07 by The Quassel IRC Development Team *
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) any later version. *
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 ***************************************************************************/
23 #if defined BUILD_CORE
24 #include <QCoreApplication>
28 #elif defined BUILD_QTGUI
29 #include <QApplication>
31 #include "clientproxy.h"
35 #elif defined BUILD_MONO
36 #include <QApplication>
38 #include "clientproxy.h"
40 #include "coresession.h"
45 #error "Something is wrong - you need to #define a build mode!"
48 int main(int argc, char **argv) {
49 qRegisterMetaType<Message>("Message");
50 qRegisterMetaType<BufferId>("BufferId");
51 qRegisterMetaTypeStreamOperators<Message>("Message");
52 qRegisterMetaTypeStreamOperators<BufferId>("BufferId");
54 #if defined BUILD_CORE
55 Global::runMode = Global::CoreOnly;
56 QCoreApplication app(argc, argv);
57 #elif defined BUILD_QTGUI
58 Global::runMode = Global::ClientOnly;
59 QApplication app(argc, argv);
61 Global::runMode = Global::Monolithic;
62 QApplication app(argc, argv);
64 QCoreApplication::setOrganizationDomain("quassel-irc.org");
65 QCoreApplication::setApplicationName("Quassel IRC");
66 QCoreApplication::setOrganizationName("Quassel IRC Development Team");
68 Global::quasselDir = QDir::homePath() + "/.quassel";
70 Core::instance(); // create and init the core
77 QtGui *gui = new QtGui();
82 int exitCode = app.exec();
85 // the mainWin has to be deleted before the Core
86 // if not Quassel will crash on exit under certain conditions since the gui
87 // still wants to access clientdata
99 QVariant Client::connectToLocalCore(QString, QString) { return QVariant(); }
100 void Client::disconnectFromLocalCore() {}
102 #elif defined BUILD_MONO
103 QVariant Client::connectToLocalCore(QString user, QString passwd) {
104 // TODO catch exceptions
105 QVariant reply = Core::connectLocalClient(user, passwd);
106 QObject::connect(Core::localSession(), SIGNAL(proxySignal(CoreSignal, QVariant, QVariant, QVariant)), ClientProxy::instance(), SLOT(recv(CoreSignal, QVariant, QVariant, QVariant)));
107 QObject::connect(ClientProxy::instance(), SIGNAL(send(ClientSignal, QVariant, QVariant, QVariant)), Core::localSession(), SLOT(processSignal(ClientSignal, QVariant, QVariant, QVariant)));
111 void Client::disconnectFromLocalCore() {
112 disconnect(Core::localSession(), 0, ClientProxy::instance(), 0);
113 disconnect(ClientProxy::instance(), 0, Core::localSession(), 0);
114 Core::disconnectLocalClient();