From: Manuel Nickschas Date: Tue, 19 Jun 2007 09:37:08 +0000 (+0000) Subject: Setting status buffer active on connection (by creating a BufferId for it in Core X-Git-Tag: 0.1.0~209 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=b27b03c4239150189b7ae8963ca2e8c9b1a0ce4a;hp=7ec4585cecc74ce8d9a94b0e52f00a96d105e79e;ds=inline Setting status buffer active on connection (by creating a BufferId for it in Core before we try to access the corresponding Buffer in GUI), fixing BR #40. --- diff --git a/core/core.cpp b/core/core.cpp index b1815d9c..2a8d4cc2 100644 --- a/core/core.cpp +++ b/core/core.cpp @@ -56,8 +56,11 @@ void Core::init() { connect(&server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); //startListening(); // FIXME if(Global::runMode == Global::Monolithic) { // TODO Make GUI user configurable - guiUser = storage->validateUser("Default", "password"); - if(!guiUser) guiUser = storage->addUser("Default", "password"); + try { + guiUser = storage->validateUser("Default", "password"); + } catch(Storage::AuthError) { + guiUser = storage->addUser("Default", "password"); + } Q_ASSERT(guiUser); Global::setGuiUser(guiUser); createSession(guiUser); @@ -253,8 +256,8 @@ void Core::recvProxySignal(CoreSignal sig, QVariant arg1, QVariant arg2, QVarian CoreSession::CoreSession(UserId uid, Storage *_storage) : user(uid), storage(_storage) { coreProxy = new CoreProxy(); - connect(coreProxy, SIGNAL(send(CoreSignal, QVariant, QVariant, QVariant)), this, SIGNAL(proxySignal(CoreSignal, QVariant, QVariant, QVariant))); + connect(coreProxy, SIGNAL(send(CoreSignal, QVariant, QVariant, QVariant)), this, SIGNAL(proxySignal(CoreSignal, QVariant, QVariant, QVariant))); connect(coreProxy, SIGNAL(requestServerStates()), this, SIGNAL(serverStateRequested())); connect(coreProxy, SIGNAL(gsRequestConnect(QStringList)), this, SLOT(connectToIrc(QStringList))); connect(coreProxy, SIGNAL(gsUserInput(BufferId, QString)), this, SLOT(msgFromGui(BufferId, QString))); @@ -267,7 +270,6 @@ CoreSession::CoreSession(UserId uid, Storage *_storage) : user(uid), storage(_st connect(storage, SIGNAL(bufferIdUpdated(BufferId)), coreProxy, SLOT(csUpdateBufferId(BufferId))); connect(Global::instance(), SIGNAL(dataUpdatedRemotely(UserId, QString)), this, SLOT(globalDataUpdated(UserId, QString))); connect(Global::instance(), SIGNAL(dataPutLocally(UserId, QString)), this, SLOT(globalDataUpdated(UserId, QString))); - } CoreSession::~CoreSession() { @@ -299,6 +301,10 @@ void CoreSession::connectToIrc(QStringList networks) { connect(this, SIGNAL(connectToIrc(QString)), server, SLOT(connectToIrc(QString))); connect(this, SIGNAL(disconnectFromIrc(QString)), server, SLOT(disconnectFromIrc(QString))); connect(this, SIGNAL(msgFromGui(QString, QString, QString)), server, SLOT(userInput(QString, QString, QString))); + + connect(server, SIGNAL(connected(QString)), this, SLOT(serverConnected(QString))); + connect(server, SIGNAL(disconnected(QString)), this, SLOT(serverDisconnected(QString))); + connect(server, SIGNAL(serverState(QString, VarMap)), coreProxy, SLOT(csServerState(QString, VarMap))); //connect(server, SIGNAL(displayMsg(Message)), this, SLOT(recvMessageFromServer(Message))); connect(server, SIGNAL(displayMsg(Message::Type, QString, QString, QString, quint8)), this, SLOT(recvMessageFromServer(Message::Type, QString, QString, QString, quint8))); @@ -313,7 +319,7 @@ void CoreSession::connectToIrc(QStringList networks) { connect(server, SIGNAL(queryRequested(QString, QString)), coreProxy, SLOT(csQueryRequested(QString, QString))); // TODO add error handling connect(server, SIGNAL(connected(QString)), coreProxy, SLOT(csServerConnected(QString))); - connect(server, SIGNAL(disconnected(QString)), this, SLOT(serverDisconnected(QString))); + connect(server, SIGNAL(disconnected(QString)), coreProxy, SLOT(csServerDisconnected(QString))); server->start(); servers[net] = server; @@ -322,6 +328,10 @@ void CoreSession::connectToIrc(QStringList networks) { } } +void CoreSession::serverConnected(QString net) { + storage->getBufferId(userId(), net); // create status buffer +} + void CoreSession::serverDisconnected(QString net) { delete servers[net]; servers.remove(net); diff --git a/core/core.h b/core/core.h index 400c21eb..c4a66465 100644 --- a/core/core.h +++ b/core/core.h @@ -109,6 +109,7 @@ class CoreSession : public QObject { void globalDataUpdated(UserId, QString); void recvStatusMsgFromServer(QString msg); void recvMessageFromServer(Message::Type, QString target, QString text, QString sender = "", quint8 flags = Message::None); + void serverConnected(QString net); void serverDisconnected(QString net); private: diff --git a/gui/mainwin.cpp b/gui/mainwin.cpp index 08792035..2b63b178 100644 --- a/gui/mainwin.cpp +++ b/gui/mainwin.cpp @@ -153,7 +153,7 @@ void MainWin::setupMenus() { } void MainWin::setupViews() { - BufferTreeModel *model = new BufferTreeModel(this); + BufferTreeModel *model = new BufferTreeModel(this); // FIXME Where is the delete for that? :p connect(model, SIGNAL(bufferSelected(Buffer *)), this, SLOT(showBuffer(Buffer *))); connect(this, SIGNAL(bufferSelected(Buffer *)), model, SLOT(selectBuffer(Buffer *))); connect(this, SIGNAL(bufferUpdated(Buffer *)), model, SLOT(bufferUpdated(Buffer *))); @@ -237,10 +237,10 @@ void MainWin::showBuffer(Buffer *b) { void MainWin::networkConnected(QString net) { connected[net] = true; - //BufferId id = getStatusBufferId(net); - //Buffer *b = getBuffer(id); - //b->setActive(true); - //b->displayMsg(Message(id, Message::Server, tr("Connected."))); FIXME + BufferId id = getStatusBufferId(net); + Buffer *b = getBuffer(id); + b->setActive(true); + //b->displayMsg(Message(id, Message::Server, tr("Connected."))); // TODO buffersUpdated(); } diff --git a/main/main_mono.cpp b/main/main_mono.cpp index fdfb22f7..d9c682f4 100644 --- a/main/main_mono.cpp +++ b/main/main_mono.cpp @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2005 by The Quassel Team * + * Copyright (C) 2005-07 by The Quassel IRC Development 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 *