X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fmain_gui.cpp;fp=src%2Fcommon%2Fmain_gui.cpp;h=0000000000000000000000000000000000000000;hp=e9bd6c8ed92751e482394df823ca4f7ca830e89c;hb=0ac9ce4d7cf768d13993d6aa1d6b791c4149a843;hpb=9a39bcb0e71d45140dc7f2390536cf4f7e13e9fe diff --git a/src/common/main_gui.cpp b/src/common/main_gui.cpp deleted file mode 100644 index e9bd6c8e..00000000 --- a/src/common/main_gui.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005 by The Quassel Team * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include - -#include -#include - -#include "style.h" -#include "global.h" -#include "guiproxy.h" -#include "coreconnectdlg.h" -#include "util.h" -#include "chatwidget.h" - -#include "mainwin.h" - -int main(int argc, char **argv) { - QApplication app(argc, argv); - QApplication::setOrganizationDomain("quassel-irc.org"); - QApplication::setApplicationName("Quassel IRC"); - QApplication::setOrganizationName("The Quassel Team"); - - Global::runMode = Global::GUIOnly; - Global::quasselDir = QDir::homePath() + "/.quassel"; - - global = new Global(); - guiProxy = new GuiProxy(); - - Style::init(); - - MainWin mainWin; - mainWin.init(); - int exitCode = app.exec(); - delete guiProxy; - delete global; - return exitCode; -} - -void MainWin::syncToCore() { - Q_ASSERT(!global->getData("CoreReady").toBool()); - // ok, we are running as standalone GUI - coreConnectDlg = new CoreConnectDlg(this); - if(coreConnectDlg->exec() != QDialog::Accepted) { - //qApp->quit(); - exit(1); - } - VarMap state = coreConnectDlg->getCoreState().toMap(); - delete coreConnectDlg; - VarMap data = state["CoreData"].toMap(); - QString key; - foreach(key, data.keys()) { - global->updateData(key, data[key]); - } - if(!global->getData("CoreReady").toBool()) { - QMessageBox::critical(this, tr("Fatal Error"), tr("Could not synchronize with Quassel Core!
Quassel GUI will be aborted."), QMessageBox::Abort); - //qApp->quit(); - exit(1); - } - /* - foreach(QString net, state["CoreBackLog"].toMap().keys()) { - QByteArray logbuf = state["CoreBackLog"].toMap()[net].toByteArray(); - QDataStream in(&logbuf, QIODevice::ReadOnly); in.setVersion(QDataStream::Qt_4_2); - while(!in.atEnd()) { - Message msg; in >> msg; - coreBackLog[net].append(msg); - } - qDebug() << net << coreBackLog[net].count(); - } - */ - coreBuffers.clear(); - foreach(QVariant v, state["CoreBuffers"].toList()) { coreBuffers.append(v.value()); } -} - -/* - -GuiProxy::GuiProxy() { - if(guiProxy) qFatal("Trying to instantiate more than one CoreProxy object!"); - - blockSize = 0; - - connect(&socket, SIGNAL(readyRead()), this, SLOT(serverHasData())); - connect(&socket, SIGNAL(connected()), this, SIGNAL(coreConnected())); - connect(&socket, SIGNAL(disconnected()), this, SIGNAL(coreDisconnected())); - connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(serverError(QAbstractSocket::SocketError))); - - connect(global, SIGNAL(dataPutLocally(QString)), this, SLOT(updateCoreData(QString))); - connect(this, SIGNAL(csUpdateGlobalData(QString, QVariant)), global, SLOT(updateData(QString, QVariant))); - -} - -void GuiProxy::connectToCore(QString host, quint16 port) { - socket.connectToHost(host, port); -} - -void GuiProxy::disconnectFromCore() { - socket.close(); -} - -void GuiProxy::serverError(QAbstractSocket::SocketError) { - emit coreConnectionError(socket.errorString()); - //qFatal(QString("Connection error: %1").arg(socket.errorString()).toAscii()); -} - -void GuiProxy::serverHasData() { - QVariant item; - while(readDataFromDevice(&socket, blockSize, item)) { - emit recvPartialItem(1,1); - QList sigdata = item.toList(); - Q_ASSERT(sigdata.size() == 4); - recv((CoreSignal)sigdata[0].toInt(), sigdata[1], sigdata[2], sigdata[3]); - blockSize = 0; - } - if(blockSize > 0) { - emit recvPartialItem(socket.bytesAvailable(), blockSize); - } -} -*/ -/* -void GuiProxy::send(GuiSignal sig, QVariant arg1, QVariant arg2, QVariant arg3) { - QList sigdata; - sigdata.append(sig); sigdata.append(arg1); sigdata.append(arg2); sigdata.append(arg3); - //qDebug() << "Sending signal: " << sigdata; - writeDataToDevice(&socket, QVariant(sigdata)); -} -*/ - -void GuiProxy::updateCoreData(QString key) { - QVariant data = global->getData(key); - send(GS_UPDATE_GLOBAL_DATA, key, data); -}