X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=gui%2Fmainwin.cpp;h=d90abf91f374bb9402952f4daf96e76df585d96b;hp=84835ad8e2139616ad81ea87ef6ba4d1f85f7a88;hb=0ac86f1eb59d72558aa9286c9e438c2bc0941298;hpb=ddc5208315db8ca9ca19f6a59ee7caefe631ffc7 diff --git a/gui/mainwin.cpp b/gui/mainwin.cpp index 84835ad8..d90abf91 100644 --- a/gui/mainwin.cpp +++ b/gui/mainwin.cpp @@ -69,6 +69,7 @@ void MainWin::init() { connect(guiProxy, SIGNAL(csNickUpdated(QString, QString, VarMap)), this, SLOT(updateNick(QString, QString, VarMap))); connect(guiProxy, SIGNAL(csOwnNickSet(QString, QString)), this, SLOT(setOwnNick(QString, QString))); connect(guiProxy, SIGNAL(csBacklogData(BufferId, QList, bool)), this, SLOT(recvBacklogData(BufferId, QList, bool))); + connect(guiProxy, SIGNAL(csUpdateBufferId(BufferId)), this, SLOT(updateBufferId(BufferId))); connect(this, SIGNAL(sendInput(BufferId, QString)), guiProxy, SLOT(gsUserInput(BufferId, QString))); connect(this, SIGNAL(requestBacklog(BufferId, QVariant, QVariant)), guiProxy, SLOT(gsRequestBacklog(BufferId, QVariant, QVariant))); @@ -89,12 +90,9 @@ void MainWin::init() { setupSettingsDlg(); - //Buffer::init(); setupMenus(); setupViews(); - //bufferWidget = 0; - QSettings s; s.beginGroup("Geometry"); //resize(s.value("MainWinSize", QSize(500, 400)).toSize()); @@ -102,35 +100,6 @@ void MainWin::init() { if(s.contains("MainWinState")) restoreState(s.value("MainWinState").toByteArray()); s.endGroup(); - // replay backlog - // FIXME do this right - /* - QHash > hash; - Buffer *b; - - foreach(QString net, coreBackLog.keys()) { - //if(net != "MoepNet") continue; - while(coreBackLog[net].count()) { - //recvMessage(net, coreBackLog[net].takeFirst()); - Message msg = coreBackLog[net].takeLast(); - if(msg.flags & Message::PrivMsg) { - // query - if(msg.flags & Message::Self) b = getBuffer(net, msg.target); - else b = getBuffer(net, nickFromMask(msg.sender)); - } else { - b = getBuffer(net, msg.target); - } - hash[b].prepend(msg); - if(hash[b].count() >= 5) { - ui.bufferWidget->prependMessages(b, hash.take(b)); - } - } - } - foreach(Buffer *buf, hash.keys()) { - ui.bufferWidget->prependMessages(buf, hash.take(buf)); - } -*/ - /* make lookups by id faster */ foreach(BufferId id, coreBuffers) { bufferIds[id.uid()] = id; // make lookups by id faster @@ -205,12 +174,6 @@ void MainWin::registerNetView(NetworkView *view) { connect(this, SIGNAL(bufferUpdated(Buffer *)), view, SLOT(bufferUpdated(Buffer *))); connect(this, SIGNAL(bufferDestroyed(Buffer *)), view, SLOT(bufferDestroyed(Buffer *))); connect(view, SIGNAL(bufferSelected(Buffer *)), this, SLOT(showBuffer(Buffer *))); - //QList bufs; - //typedef QHash bufhash; - //QList foo = buffers.values(); - //foreach(bufhash h, foo) { - // bufs += h.values(); - //} view->setBuffers(buffers.values()); view->setAllowedAreas(Qt::RightDockWidgetArea|Qt::LeftDockWidgetArea); netViews.append(view); @@ -255,7 +218,6 @@ void MainWin::showBuffer(BufferId id) { } void MainWin::showBuffer(Buffer *b) { - //currentBuffer = b->bufferName(); currentNetwork = b->networkName(); currentBuffer = b->bufferId().groupId(); //emit bufferSelected(b); //qApp->processEvents(); @@ -265,9 +227,9 @@ void MainWin::showBuffer(Buffer *b) { void MainWin::networkConnected(QString net) { connected[net] = true; - BufferId id = getStatusBufferId(net); - Buffer *b = getBuffer(id); - b->setActive(true); + //BufferId id = getStatusBufferId(net); + //Buffer *b = getBuffer(id); + //b->setActive(true); //b->displayMsg(Message(id, Message::Server, tr("Connected."))); FIXME // TODO buffersUpdated(); } @@ -283,6 +245,11 @@ void MainWin::networkDisconnected(QString net) { connected[net] = false; } +void MainWin::updateBufferId(BufferId id) { + bufferIds[id.uid()] = id; // make lookups by id faster + getBuffer(id); +} + BufferId MainWin::getBufferId(QString net, QString buf) { foreach(BufferId id, buffers.keys()) { if(id.network() == net && id.buffer() == buf) return id;