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