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 ***************************************************************************/
25 #include "quasselui.h"
27 #if defined BUILD_CORE
28 #include <QCoreApplication>
31 #elif defined BUILD_QTGUI
32 #include <QApplication>
35 #include "clientproxy.h"
38 #elif defined BUILD_MONO
39 #include <QApplication>
41 #include "coreproxy.h"
44 #include "clientproxy.h"
48 #error "Something is wrong - you need to #define a build mode!"
51 int main(int argc, char **argv) {
52 #if defined BUILD_CORE
53 Global::runMode = Global::CoreOnly;
54 QCoreApplication app(argc, argv);
55 #elif defined BUILD_QTGUI
56 Global::runMode = Global::ClientOnly;
57 QApplication app(argc, argv);
59 Global::runMode = Global::Monolithic;
60 QApplication app(argc, argv);
62 //AbstractUi *foo = new AbstractUi();
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();
81 // Core::instance(); // create and init the core object
84 int exitCode = app.exec();
87 // the mainWin has to be deleted before the Core
88 // if not Quassel will crash on exit under certain conditions since the gui
89 // still wants to access clientdata
101 QVariant Client::connectToLocalCore(QString, QString) { return QVariant(); }
102 void Client::disconnectFromLocalCore() {}
103 #elif defined BUILD_MONO
105 QVariant Client::connectToLocalCore(QString user, QString passwd) {
106 // TODO catch exceptions
107 QVariant reply = Core::connectLocalClient(user, passwd);
108 QObject::connect(Core::localSession(), SIGNAL(proxySignal(CoreSignal, QVariant, QVariant, QVariant)), ClientProxy::instance(), SLOT(recv(CoreSignal, QVariant, QVariant, QVariant)));
109 QObject::connect(ClientProxy::instance(), SIGNAL(send(ClientSignal, QVariant, QVariant, QVariant)), Core::localSession(), SLOT(processSignal(ClientSignal, QVariant, QVariant, QVariant)));
113 void Client::disconnectFromLocalCore() {
114 disconnect(Core::localSession(), 0, ClientProxy::instance(), 0);
115 disconnect(ClientProxy::instance(), 0, Core::localSession(), 0);
116 Core::disconnectLocalClient();