Merged changes from branch "sput" r50:55 back into trunk.
[quassel.git] / main / main_mono.cpp
1 /***************************************************************************
2  *   Copyright (C) 2005 by The Quassel 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 "core.h"
26 #include "style.h"
27 #include "global.h"
28 #include "guiproxy.h"
29 #include "coreproxy.h"
30
31 #include "mainwin.h"
32
33 int main(int argc, char **argv) {
34   QApplication app(argc, argv);
35   QApplication::setOrganizationDomain("quassel-irc.org");
36   QApplication::setApplicationName("Quassel IRC");
37   QApplication::setOrganizationName("The Quassel Team");
38
39   Global::runMode = Global::Monolithic;
40   Global::quasselDir = QDir::homePath() + "/.quassel";
41
42   global = new Global();
43   guiProxy = new GUIProxy();
44   coreProxy = new CoreProxy();
45
46   Style::init();
47
48   MainWin mainWin;
49   mainWin.show();
50   int exitCode = app.exec();
51   delete core;
52   delete guiProxy;
53   delete coreProxy;
54   delete global;
55   return exitCode;
56 }
57
58 void MainWin::syncToCore() {
59   Q_ASSERT(global->getData("CoreReady").toBool());
60   coreBackLog = core->getBackLog();
61   // NOTE: We don't need to request server states, because in the monolithic version there can't be
62   //       any servers connected at this stage...
63 }
64
65 void CoreProxy::sendToGUI(CoreSignal sig, QVariant arg1, QVariant arg2, QVariant arg3) {
66   guiProxy->recv(sig, arg1, arg2, arg3);
67 }
68
69 GUIProxy::GUIProxy() {
70   if(guiProxy) qFatal("Trying to instantiate more than one CoreProxy object!");
71 }
72
73 void GUIProxy::send(GUISignal sig, QVariant arg1, QVariant arg2, QVariant arg3) {
74   coreProxy->recv(sig, arg1, arg2, arg3);
75 }
76
77 // Dummy function definitions
78 // These are not needed, since we don't have a network connection to the core.
79 void GUIProxy::serverHasData() {}
80 void GUIProxy::connectToCore(QString, quint16) {}
81 void GUIProxy::disconnectFromCore() {}
82 void GUIProxy::updateCoreData(QString) {}
83 void GUIProxy::serverError(QAbstractSocket::SocketError) {}
84