Implemented Custom Views (configurable via drag and drop)
[quassel.git] / src / common / main_mono.cpp
1 /***************************************************************************
2  *   Copyright (C) 2005-07 by The Quassel IRC Development Team             *
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) any later version.                                   *
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
21 #include <iostream>
22
23 #include <QApplication>
24
25 #include "client.h"
26 #include "core.h"
27 #include "style.h"
28 #include "global.h"
29 #include "clientproxy.h"
30 #include "coreproxy.h"
31 #include "settings.h"
32 #include "chatwidget.h"
33 #include "mainwin.h"
34
35 int main(int argc, char **argv) {
36   QApplication app(argc, argv);
37   QCoreApplication::setOrganizationDomain("quassel-irc.org");
38   QCoreApplication::setApplicationName("Quassel IRC");
39   QCoreApplication::setOrganizationName("Quassel IRC Development Team");
40
41   Global::runMode = Global::Monolithic;
42   Global::quasselDir = QDir::homePath() + "/.quassel";
43
44   //settings = new Settings();
45   //global = new Global();
46   //guiProxy = new GUIProxy();
47   //coreProxy = new CoreProxy();
48   QObject::connect(Core::localSession(), SIGNAL(proxySignal(CoreSignal, QVariant, QVariant, QVariant)), ClientProxy::instance(), SLOT(recv(CoreSignal, QVariant, QVariant, QVariant)));
49   QObject::connect(ClientProxy::instance(), SIGNAL(send(ClientSignal, QVariant, QVariant, QVariant)), Core::localSession(), SLOT(processSignal(ClientSignal, QVariant, QVariant, QVariant)));
50
51   Settings::init();
52   Style::init();
53
54   MainWin *mainWin = new MainWin();
55   //mainWin->show();
56   Client::init(mainWin);
57   mainWin->init();
58   int exitCode = app.exec();
59   //delete core;
60   Client::destroy();
61   Core::destroy();
62   delete mainWin;
63   //delete guiProxy;
64   //delete coreProxy;
65   //delete global;
66   //delete mainWin;
67   //delete settings;
68   return exitCode;
69 }
70
71 void Client::syncToCore() {
72   //Q_ASSERT(Global::data("CoreReady").toBool());
73   coreBuffers = Core::localSession()->buffers();
74   // NOTE: We don't need to request server states, because in the monolithic version there can't be
75   //       any servers connected at this stage...
76 }
77
78 /*
79 void CoreProxy::sendToGUI(CoreSignal sig, QVariant arg1, QVariant arg2, QVariant arg3) {
80   guiProxy->recv(sig, arg1, arg2, arg3);
81 }
82 */
83
84 /*
85 GUIProxy::GUIProxy() {
86   if(guiProxy) qFatal("Trying to instantiate more than one GUIProxy object!");
87 }
88 */
89 /*
90 void GUIProxy::send(GUISignal sig, QVariant arg1, QVariant arg2, QVariant arg3) {
91   coreProxy->recv(sig, arg1, arg2, arg3);
92 }
93 */
94
95 // Dummy function definitions
96 // These are not needed, since we don't have a network connection to the core.
97 /*
98 void GUIProxy::serverHasData() {}
99 void GUIProxy::connectToCore(QString, quint16) {}
100 void GUIProxy::disconnectFromCore() {}
101 void GUIProxy::updateCoreData(QString) {}
102 void GUIProxy::serverError(QAbstractSocket::SocketError) {}
103 */