From: Marcus Eggenberger Date: Mon, 25 Aug 2008 17:46:25 +0000 (+0200) Subject: Finishing my personal crusade against Buffer. X-Git-Tag: 0.3.0~11 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=332069a1830ed3a055ac6f2d7661bae1cc83e40c Finishing my personal crusade against Buffer. Note: this was heavy surgery... please let me know if I did cut the guts or any other innards... --- diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index f6651ae4..aa77ae1c 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -8,7 +8,7 @@ include(${QT_USE_FILE}) set(SOURCES abstractmessageprocessor.cpp - buffer.cpp + backlogrequester.cpp buffermodel.cpp buffersettings.cpp client.cpp @@ -27,7 +27,6 @@ set(SOURCES set(MOC_HDRS abstractmessageprocessor.h - buffer.h buffermodel.h client.h clientbacklogmanager.h @@ -44,6 +43,7 @@ set(MOC_HDRS treemodel.h) set(HEADERS + backlogrequester.h buffersettings.h clientsettings.h) diff --git a/src/client/buffer.cpp b/src/client/backlogrequester.cpp similarity index 73% rename from src/client/buffer.cpp rename to src/client/backlogrequester.cpp index 9108d690..c22b6b6d 100644 --- a/src/client/buffer.cpp +++ b/src/client/backlogrequester.cpp @@ -17,25 +17,29 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include -#include "buffer.h" +#include "backlogrequester.h" -#include "buffersyncer.h" -#include "client.h" -#include "networkmodel.h" -#include "quasselui.h" -#include "util.h" +#include +#include "backlogmanager.h" -Buffer::Buffer(BufferInfo bufferid, QObject *parent) - : QObject(parent), - _bufferInfo(bufferid) +BacklogRequester::BacklogRequester(BacklogManager *backlogManager) + : backlogManager(backlogManager) { + Q_ASSERT(backlogManager); } -BufferInfo Buffer::bufferInfo() const { - // still needed by the gui *sigh* to request the backlogs *sigh* - return _bufferInfo; +// FIXED BACKLOG REQUESTER +const int FixedBacklogRequester::backlogCount(500); + +FixedBacklogRequester::FixedBacklogRequester(BacklogManager *backlogManager) + : BacklogRequester(backlogManager) +{ } +void FixedBacklogRequester::requestBacklog() { + foreach(BufferId bufferId, allBufferIds()) { + backlogManager->requestBacklog(bufferId, backlogCount, -1); + } +} diff --git a/src/client/buffer.h b/src/client/backlogrequester.h similarity index 69% rename from src/client/buffer.h rename to src/client/backlogrequester.h index 84f34a39..5ef71b28 100644 --- a/src/client/buffer.h +++ b/src/client/backlogrequester.h @@ -18,42 +18,39 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _BUFFER_H_ -#define _BUFFER_H_ +#ifndef BACKLOGREQUESTER_H +#define BACKLOGREQUESTER_H -#include +#include -class AbstractUiMsg; -class IrcChannel; -class NickModel; +#include "client.h" +#include "networkmodel.h" +#include "types.h" -struct BufferState; +class BacklogManager; -#include "message.h" -#include "bufferinfo.h" +class BacklogRequester { +public: + BacklogRequester(BacklogManager *backlogManger); + virtual inline ~BacklogRequester() {} -/** - */ -class Buffer : public QObject { - Q_OBJECT + virtual void requestBacklog() = 0; -public: - enum Activity { - NoActivity = 0x00, - OtherActivity = 0x01, - NewMessage = 0x02, - Highlight = 0x40 - }; - Q_DECLARE_FLAGS(ActivityLevel, Activity) +protected: + inline QList allBufferIds() const { return Client::networkModel()->allBufferIds(); } + BacklogManager *backlogManager; +}; - Buffer(BufferInfo, QObject *parent = 0); - BufferInfo bufferInfo() const; +class FixedBacklogRequester : public BacklogRequester { +public: + FixedBacklogRequester(BacklogManager *backlogManager); + + virtual void requestBacklog(); private: - BufferInfo _bufferInfo; + static const int backlogCount; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(Buffer::ActivityLevel) -#endif +#endif //BACKLOGREQUESTER_H diff --git a/src/client/buffermodel.cpp b/src/client/buffermodel.cpp index 594dc83d..e124db6d 100644 --- a/src/client/buffermodel.cpp +++ b/src/client/buffermodel.cpp @@ -22,7 +22,6 @@ #include "networkmodel.h" #include "mappedselectionmodel.h" -#include "buffer.h" #include "global.h" #include diff --git a/src/client/client.cpp b/src/client/client.cpp index 55a9df3b..ce734cc5 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -78,9 +78,6 @@ Client::Client(QObject *parent) _syncedToCore(false) { _signalProxy->synchronize(_ircListHelper); - - connect(_backlogManager, SIGNAL(backlog(BufferId, const QVariantList &)), - this, SLOT(receiveBacklog(BufferId, const QVariantList &))); } Client::~Client() { @@ -91,8 +88,6 @@ void Client::init() { _currentCoreAccount = 0; _networkModel = new NetworkModel(this); - connect(this, SIGNAL(bufferUpdated(BufferInfo)), - _networkModel, SLOT(bufferUpdated(BufferInfo))); connect(this, SIGNAL(networkRemoved(NetworkId)), _networkModel, SLOT(networkRemoved(NetworkId))); @@ -105,7 +100,7 @@ void Client::init() { p->attachSlot(SIGNAL(displayMsg(const Message &)), this, SLOT(recvMessage(const Message &))); p->attachSlot(SIGNAL(displayStatusMsg(QString, QString)), this, SLOT(recvStatusMsg(QString, QString))); - p->attachSlot(SIGNAL(bufferInfoUpdated(BufferInfo)), this, SLOT(updateBufferInfo(BufferInfo))); + p->attachSlot(SIGNAL(bufferInfoUpdated(BufferInfo)), _networkModel, SLOT(bufferUpdated(BufferInfo))); p->attachSignal(this, SIGNAL(sendInput(BufferInfo, QString))); p->attachSignal(this, SIGNAL(requestNetworkStates())); @@ -138,51 +133,6 @@ void Client::setCurrentCoreAccount(AccountId id) { _currentCoreAccount = id; } -QList Client::allBufferInfos() { - QList bufferids; - foreach(Buffer *buffer, buffers()) { - bufferids << buffer->bufferInfo(); - } - return bufferids; -} - -QList Client::buffers() { - return instance()->_buffers.values(); -} - - -Buffer *Client::statusBuffer(const NetworkId &networkId) const { - if(_statusBuffers.contains(networkId)) - return _statusBuffers[networkId]; - else - return 0; -} - -Buffer *Client::buffer(BufferInfo bufferInfo) { - Buffer *buff = 0; - if(instance()->_buffers.contains(bufferInfo.bufferId())) - buff = instance()->_buffers[bufferInfo.bufferId()]; - - if(!buff) { - Client *client = Client::instance(); - buff = new Buffer(bufferInfo, client); - connect(buff, SIGNAL(destroyed()), client, SLOT(bufferDestroyed())); - client->_buffers[bufferInfo.bufferId()] = buff; - if(bufferInfo.type() == BufferInfo::StatusBuffer) - client->_statusBuffers[bufferInfo.networkId()] = buff; - - emit client->bufferUpdated(bufferInfo); - - // I don't like this: but currently there isn't really a prettier way: - if(isSynced()) { // this slows down syncing a lot, so disable it during sync - QModelIndex bufferIdx = networkModel()->bufferIndex(bufferInfo.bufferId()); - bufferModel()->setCurrentIndex(bufferModel()->mapFromSource(bufferIdx)); - } - } - Q_ASSERT(buff); - return buff; -} - bool Client::isConnected() { return instance()->_connectedToCore; } @@ -362,17 +312,6 @@ void Client::disconnectFromCore() { _messageModel->clear(); _networkModel->clear(); - QHash::iterator bufferIter = _buffers.begin(); - while(bufferIter != _buffers.end()) { - Buffer *buffer = bufferIter.value(); - disconnect(buffer, SIGNAL(destroyed()), this, 0); - bufferIter = _buffers.erase(bufferIter); - buffer->deleteLater(); - } - Q_ASSERT(_buffers.isEmpty()); - - _statusBuffers.clear(); - QHash::iterator netIter = _networks.begin(); while(netIter != _networks.end()) { Network *net = netIter.value(); @@ -400,31 +339,6 @@ void Client::setCoreConfiguration(const QVariantMap &settings) { /*** ***/ -void Client::updateBufferInfo(BufferInfo id) { - emit bufferUpdated(id); -} - -void Client::bufferDestroyed() { - Buffer *buffer = static_cast(sender()); - QHash::iterator iter = _buffers.begin(); - while(iter != _buffers.end()) { - if(iter.value() == buffer) { - iter = _buffers.erase(iter); - break; - } - iter++; - } - - QHash::iterator statusIter = _statusBuffers.begin(); - while(statusIter != _statusBuffers.end()) { - if(statusIter.value() == buffer) { - statusIter = _statusBuffers.erase(statusIter); - break; - } - statusIter++; - } -} - void Client::networkDestroyed() { Network *net = static_cast(sender()); QHash::iterator netIter = _networks.begin(); @@ -448,19 +362,6 @@ void Client::recvMessage(const Message &msg_) { messageProcessor()->process(msg); } -void Client::receiveBacklog(BufferId bufferId, const QVariantList &msgs) { - if(msgs.isEmpty()) return; - //QTime start = QTime::currentTime(); - QList msglist; - foreach(QVariant v, msgs) { - Message msg = v.value(); - msg.setFlags(msg.flags() | Message::Backlog); - msglist << msg; - } - messageProcessor()->process(msglist); - //qDebug() << "processed" << msgs.count() << "backlog lines in" << start.msecsTo(QTime::currentTime()); -} - void Client::setBufferLastSeenMsg(BufferId id, const MsgId &msgId) { if(!bufferSyncer()) return; @@ -473,14 +374,7 @@ void Client::removeBuffer(BufferId id) { } void Client::bufferRemoved(BufferId bufferId) { - // first remove the buffer from hash. this prohibits further lastSeenUpdates - Buffer *buff = 0; - if(_buffers.contains(bufferId)) { - buff = _buffers.take(bufferId); - disconnect(buff, 0, this, 0); - } - - // then we select a sane buffer (status buffer) + // select a sane buffer (status buffer) /* we have to manually select a buffer because otherwise inconsitent changes * to the model might occur: * the result of a buffer removal triggers a change in the selection model. @@ -495,9 +389,6 @@ void Client::bufferRemoved(BufferId bufferId) { // and remove it from the model networkModel()->removeBuffer(bufferId); - - if(buff) - buff->deleteLater(); } void Client::bufferRenamed(BufferId bufferId, const QString &newName) { diff --git a/src/client/client.h b/src/client/client.h index e626d756..62ad9b09 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -18,17 +18,17 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _CLIENT_H_ -#define _CLIENT_H_ +#ifndef CLIENT_H_ +#define CLIENT_H_ #include #include #include #include -#include "buffer.h" // needed for activity lvl +#include "bufferinfo.h" +#include "types.h" -class BufferInfo; class Message; class MessageModel; class AbstractMessageProcessor; @@ -62,11 +62,6 @@ public: static void destroy(); static void init(AbstractUi *); - static QList allBufferInfos(); - static QList buffers(); - // static Buffer *buffer(BufferId bufferUid); - static Buffer *buffer(BufferInfo); - static QList networkIds(); static const Network * network(NetworkId); @@ -118,10 +113,6 @@ public: signals: void sendInput(BufferInfo, QString message); - void showBuffer(Buffer *); - void bufferUpdated(BufferInfo bufferInfo); - void backlogReceived(Buffer *, QList); - void requestBacklog(BufferInfo, QVariant, QVariant); void requestNetworkStates(); void showConfigWizard(const QVariantMap &coredata); @@ -173,10 +164,7 @@ private slots: void recvMessage(const Message &message); void recvStatusMsg(QString network, QString message); - void receiveBacklog(BufferId bufferId, const QVariantList &msgs); - void updateBufferInfo(BufferInfo); - void bufferDestroyed(); void networkDestroyed(); void coreIdentityCreated(const Identity &); void coreIdentityRemoved(IdentityId); @@ -197,8 +185,6 @@ private: static void setCurrentCoreAccount(AccountId); static inline BufferSyncer *bufferSyncer() { return instance()->_bufferSyncer; } - Buffer *statusBuffer(const NetworkId &networkid) const; - static QPointer instanceptr; QPointer socket; @@ -219,8 +205,6 @@ private: bool _connectedToCore, _syncedToCore; - QHash _buffers; - QHash _statusBuffers; // fast lookup QHash _networks; QHash _identities; diff --git a/src/client/clientbacklogmanager.cpp b/src/client/clientbacklogmanager.cpp index 86b1b1c1..ce22e337 100644 --- a/src/client/clientbacklogmanager.cpp +++ b/src/client/clientbacklogmanager.cpp @@ -19,6 +19,9 @@ ***************************************************************************/ #include "clientbacklogmanager.h" + +#include "abstractmessageprocessor.h" +#include "backlogrequester.h" #include "client.h" #include @@ -29,7 +32,25 @@ ClientBacklogManager::ClientBacklogManager(QObject *parent) } void ClientBacklogManager::receiveBacklog(BufferId bufferId, int lastMsgs, int offset, QVariantList msgs) { + Q_UNUSED(bufferId) Q_UNUSED(lastMsgs) Q_UNUSED(offset) - emit backlog(bufferId, msgs); + + if(msgs.isEmpty()) + return; + + //QTime start = QTime::currentTime(); + QList msglist; + foreach(QVariant v, msgs) { + Message msg = v.value(); + msg.setFlags(msg.flags() | Message::Backlog); + msglist << msg; + } + Client::messageProcessor()->process(msglist); + //qDebug() << "processed" << msgs.count() << "backlog lines in" << start.msecsTo(QTime::currentTime()); +} + +void ClientBacklogManager::requestInitialBacklog() { + FixedBacklogRequester backlogRequester(this); + backlogRequester.requestBacklog(); } diff --git a/src/client/clientbacklogmanager.h b/src/client/clientbacklogmanager.h index 5ead6636..d9171cfe 100644 --- a/src/client/clientbacklogmanager.h +++ b/src/client/clientbacklogmanager.h @@ -33,9 +33,7 @@ public: public slots: virtual void receiveBacklog(BufferId bufferId, int lastMsgs, int offset, QVariantList msgs); - -signals: - void backlog(BufferId bufferId, const QVariantList &msgs); + void requestInitialBacklog(); }; #endif // CLIENTBACKLOGMANAGER_H diff --git a/src/client/clientsyncer.cpp b/src/client/clientsyncer.cpp index 4ec529c0..79d8c91f 100644 --- a/src/client/clientsyncer.cpp +++ b/src/client/clientsyncer.cpp @@ -30,6 +30,7 @@ #include "ircuser.h" #include "ircchannel.h" #include "network.h" +#include "networkmodel.h" #include "signalproxy.h" @@ -262,8 +263,10 @@ void ClientSyncer::syncToCore(const QVariantMap &sessionState) { // create buffers // FIXME: get rid of this crap QVariantList bufferinfos = sessionState["BufferInfos"].toList(); + NetworkModel *networkModel = Client::networkModel(); + Q_ASSERT(networkModel); foreach(QVariant vinfo, bufferinfos) - Client::buffer(vinfo.value()); // create Buffers and BufferItems + networkModel->bufferUpdated(vinfo.value()); // create BufferItems QVariantList networkids = sessionState["NetworkIds"].toList(); diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index 75a18af8..3e1bb107 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -22,7 +22,6 @@ #include -#include "bufferinfo.h" #include "buffermodel.h" #include "client.h" #include "signalproxy.h" @@ -174,19 +173,19 @@ QString NetworkItem::toolTip(int column) const { BufferItem::BufferItem(const BufferInfo &bufferInfo, AbstractTreeItem *parent) : PropertyMapItem(QStringList() << "bufferName" << "topic" << "nickCount", parent), _bufferInfo(bufferInfo), - _activity(Buffer::NoActivity) + _activity(BufferInfo::NoActivity) { setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled); } -void BufferItem::setActivityLevel(Buffer::ActivityLevel level) { +void BufferItem::setActivityLevel(BufferInfo::ActivityLevel level) { if(_activity != level) { _activity = level; emit dataChanged(); } } -//void BufferItem::updateActivityLevel(Buffer::ActivityLevel level) { +//void BufferItem::updateActivityLevel(BufferInfo::ActivityLevel level) { void BufferItem::updateActivityLevel(const Message &msg) { if(isCurrentBuffer()) return; @@ -197,14 +196,14 @@ void BufferItem::updateActivityLevel(const Message &msg) { if(lastSeenMsgId() >= msg.msgId()) return; - Buffer::ActivityLevel oldLevel = activityLevel(); + BufferInfo::ActivityLevel oldLevel = activityLevel(); - _activity |= Buffer::OtherActivity; + _activity |= BufferInfo::OtherActivity; if(msg.type() & (Message::Plain | Message::Notice | Message::Action)) - _activity |= Buffer::NewMessage; + _activity |= BufferInfo::NewMessage; if(msg.flags() & Message::Highlight) - _activity |= Buffer::Highlight; + _activity |= BufferInfo::Highlight; if(oldLevel != _activity) emit dataChanged(); @@ -235,7 +234,7 @@ bool BufferItem::setData(int column, const QVariant &value, int role) { qDebug() << "BufferItem::setData(int column, const QVariant &value, int role):" << this << column << value << role; switch(role) { case NetworkModel::BufferActivityRole: - setActivityLevel((Buffer::ActivityLevel)value.toInt()); + setActivityLevel((BufferInfo::ActivityLevel)value.toInt()); return true; default: return PropertyMapItem::setData(column, value, role); @@ -921,7 +920,7 @@ void NetworkModel::updateBufferActivity(const Message &msg) { bufferItem(msg.bufferInfo())->updateActivityLevel(msg); } -void NetworkModel::setBufferActivity(const BufferId &bufferId, Buffer::ActivityLevel level) { +void NetworkModel::setBufferActivity(const BufferId &bufferId, BufferInfo::ActivityLevel level) { BufferItem *bufferItem = findBufferItem(bufferId); if(!bufferItem) { qDebug() << "NetworkModel::setBufferActivity(): buffer is unknown:" << bufferId; diff --git a/src/client/networkmodel.h b/src/client/networkmodel.h index 4ea7ddc0..117bbd78 100644 --- a/src/client/networkmodel.h +++ b/src/client/networkmodel.h @@ -24,7 +24,7 @@ #include #include "treemodel.h" -#include "buffer.h" +#include "bufferinfo.h" #include @@ -35,6 +35,7 @@ class BufferInfo; #include "clientsettings.h" #include "ircchannel.h" #include "ircuser.h" +#include "message.h" #include "network.h" class MappedSelectionModel; @@ -110,9 +111,9 @@ public: inline const MsgId &lastSeenMsgId() const { return _lastSeenMsgId; } inline void setLastSeenMsgId(const MsgId &msgId) { _lastSeenMsgId = msgId; } - inline Buffer::ActivityLevel activityLevel() const { return _activity; } - void setActivityLevel(Buffer::ActivityLevel level); - //void updateActivityLevel(Buffer::ActivityLevel level); + inline BufferInfo::ActivityLevel activityLevel() const { return _activity; } + void setActivityLevel(BufferInfo::ActivityLevel level); + //void updateActivityLevel(BufferInfo::ActivityLevel level); void updateActivityLevel(const Message &msg); bool isCurrentBuffer() const; @@ -123,7 +124,7 @@ public slots: private: BufferInfo _bufferInfo; - Buffer::ActivityLevel _activity; + BufferInfo::ActivityLevel _activity; MsgId _lastSeenMsgId; }; @@ -294,7 +295,7 @@ public: const Network *networkByIndex(const QModelIndex &index) const; - Buffer::ActivityLevel bufferActivity(const BufferInfo &buffer) const; + BufferInfo::ActivityLevel bufferActivity(const BufferInfo &buffer) const; QString bufferName(BufferId bufferId); BufferInfo::Type bufferType(BufferId bufferId); @@ -303,11 +304,13 @@ public: NetworkId networkId(BufferId bufferId); QString networkName(BufferId bufferId); + inline QList allBufferIds() const { return _bufferItemCache.keys(); } + public slots: void bufferUpdated(BufferInfo bufferInfo); void removeBuffer(BufferId bufferId); void setLastSeenMsgId(const BufferId &bufferId, const MsgId &msgId); - void setBufferActivity(const BufferId &bufferId, Buffer::ActivityLevel activity); + void setBufferActivity(const BufferId &bufferId, BufferInfo::ActivityLevel activity); void updateBufferActivity(const Message &msg); void networkRemoved(const NetworkId &networkId); diff --git a/src/common/bufferinfo.h b/src/common/bufferinfo.h index 9a7292c6..cf385626 100644 --- a/src/common/bufferinfo.h +++ b/src/common/bufferinfo.h @@ -36,6 +36,14 @@ public: GroupBuffer = 0x08 }; + enum Activity { + NoActivity = 0x00, + OtherActivity = 0x01, + NewMessage = 0x02, + Highlight = 0x40 + }; + Q_DECLARE_FLAGS(ActivityLevel, Activity) + BufferInfo(); BufferInfo(BufferId id, NetworkId networkid, Type type, uint gid = 0, QString buf = QString()); @@ -69,6 +77,7 @@ QDataStream &operator>>(QDataStream &in, BufferInfo &bufferInfo); QDebug operator<<(QDebug dbg, const BufferInfo &b); Q_DECLARE_METATYPE(BufferInfo); +Q_DECLARE_OPERATORS_FOR_FLAGS(BufferInfo::ActivityLevel) uint qHash(const BufferInfo &); diff --git a/src/qtui/chatmonitorfilter.cpp b/src/qtui/chatmonitorfilter.cpp index 9817b9bc..e30faa59 100644 --- a/src/qtui/chatmonitorfilter.cpp +++ b/src/qtui/chatmonitorfilter.cpp @@ -20,7 +20,6 @@ #include "chatmonitorfilter.h" -#include "buffer.h" #include "client.h" #include "chatlinemodel.h" #include "networkmodel.h" diff --git a/src/qtui/chatview.cpp b/src/qtui/chatview.cpp index 20557e2f..1eee2245 100644 --- a/src/qtui/chatview.cpp +++ b/src/qtui/chatview.cpp @@ -21,7 +21,6 @@ #include #include -#include "buffer.h" #include "chatlinemodelitem.h" #include "chatscene.h" #include "chatview.h" diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index a7c99ff9..91e8adb7 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -123,8 +123,6 @@ void MainWin::init() { else resize(QSize(800, 500)); - Client::signalProxy()->attachSignal(this, SIGNAL(requestBacklog(BufferInfo, QVariant, QVariant))); - connect(QApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(saveLayout())); connect(Client::instance(), SIGNAL(networkCreated(NetworkId)), this, SLOT(clientNetworkCreated(NetworkId))); @@ -398,9 +396,7 @@ void MainWin::connectedToCore() { connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigDeleted(int)), this, SLOT(removeBufferView(int))); connect(Client::bufferViewManager(), SIGNAL(initDone()), this, SLOT(loadLayout())); - foreach(BufferInfo id, Client::allBufferInfos()) { - Client::backlogManager()->requestBacklog(id.bufferId(), 500, -1); - } + Client::backlogManager()->requestInitialBacklog(); setConnectedState(); } diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index eb3f8153..a055115a 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -110,7 +110,6 @@ class MainWin : public QMainWindow { signals: void connectToCore(const QVariantMap &connInfo); void disconnectFromCore(); - void requestBacklog(BufferInfo, QVariant, QVariant); private: Ui::MainWin ui; diff --git a/src/qtui/nicklistwidget.cpp b/src/qtui/nicklistwidget.cpp index 25333cff..20051512 100644 --- a/src/qtui/nicklistwidget.cpp +++ b/src/qtui/nicklistwidget.cpp @@ -20,7 +20,6 @@ #include "nicklistwidget.h" -#include "buffer.h" #include "nickview.h" #include "client.h" #include "networkmodel.h" diff --git a/src/qtui/settingspages/bufferviewsettingspage.cpp b/src/qtui/settingspages/bufferviewsettingspage.cpp index 5282f7c4..00faf0c0 100644 --- a/src/qtui/settingspages/bufferviewsettingspage.cpp +++ b/src/qtui/settingspages/bufferviewsettingspage.cpp @@ -196,9 +196,7 @@ void BufferViewSettingsPage::newBufferView(const QString &bufferViewName) { QList bufferIds; if(config->addNewBuffersAutomatically()) { - foreach(BufferInfo bufferInfo, Client::allBufferInfos()) { - bufferIds << bufferInfo.bufferId(); - } + bufferIds = Client::networkModel()->allBufferIds(); if(config->sortAlphabetically()) qSort(bufferIds.begin(), bufferIds.end(), bufferIdLessThan); } @@ -378,9 +376,7 @@ void BufferViewSettingsPage::saveConfig(BufferViewConfig *config) { if(_newBufferViews.contains(config)) { QList bufferIds; if(config->addNewBuffersAutomatically()) { - foreach(BufferInfo bufferInfo, Client::allBufferInfos()) { - bufferIds << bufferInfo.bufferId(); - } + bufferIds = Client::networkModel()->allBufferIds(); if(config->sortAlphabetically()) qSort(bufferIds.begin(), bufferIds.end(), bufferIdLessThan); } diff --git a/src/uisupport/abstractbuffercontainer.cpp b/src/uisupport/abstractbuffercontainer.cpp index ed898e91..8b89e8c4 100644 --- a/src/uisupport/abstractbuffercontainer.cpp +++ b/src/uisupport/abstractbuffercontainer.cpp @@ -91,7 +91,7 @@ void AbstractBufferContainer::setCurrentBuffer(BufferId bufferId) { _currentBuffer = bufferId; showChatView(bufferId); - Client::networkModel()->setBufferActivity(bufferId, Buffer::NoActivity); + Client::networkModel()->setBufferActivity(bufferId, BufferInfo::NoActivity); // Client::setBufferLastSeenMsg(bufferId, _chatViews[bufferId]->lastMsgId()); setFocus(); } diff --git a/src/uisupport/bufferviewfilter.cpp b/src/uisupport/bufferviewfilter.cpp index d3a1b521..58998530 100644 --- a/src/uisupport/bufferviewfilter.cpp +++ b/src/uisupport/bufferviewfilter.cpp @@ -24,6 +24,7 @@ #include #include +#include "bufferinfo.h" #include "buffermodel.h" #include "client.h" #include "networkmodel.h" @@ -202,7 +203,7 @@ bool BufferViewFilter::filterAcceptBuffer(const QModelIndex &source_bufferIndex) // add the buffer if... if(config()->isInitialized() && !config()->removedBuffers().contains(bufferId) // it hasn't been manually removed and either && ((config()->addNewBuffersAutomatically() && !config()->temporarilyRemovedBuffers().contains(bufferId)) // is totally unknown to us (a new buffer)... - || (config()->temporarilyRemovedBuffers().contains(bufferId) && activityLevel > Buffer::OtherActivity))) { // or was just temporarily hidden and has a new message waiting for us. + || (config()->temporarilyRemovedBuffers().contains(bufferId) && activityLevel > BufferInfo::OtherActivity))) { // or was just temporarily hidden and has a new message waiting for us. addBuffer(bufferId); } // note: adding the buffer to the valid list does not temper with the following filters ("show only channels" and stuff) @@ -304,13 +305,13 @@ QVariant BufferViewFilter::foreground(const QModelIndex &index) const { if(!index.data(NetworkModel::ItemActiveRole).toBool()) return _FgColorInactiveActivity; - Buffer::ActivityLevel activity = (Buffer::ActivityLevel)index.data(NetworkModel::BufferActivityRole).toInt(); + BufferInfo::ActivityLevel activity = (BufferInfo::ActivityLevel)index.data(NetworkModel::BufferActivityRole).toInt(); - if(activity & Buffer::Highlight) + if(activity & BufferInfo::Highlight) return _FgColorHighlightActivity; - if(activity & Buffer::NewMessage) + if(activity & BufferInfo::NewMessage) return _FgColorNewMessageActivity; - if(activity & Buffer::OtherActivity) + if(activity & BufferInfo::OtherActivity) return _FgColorOtherActivity; return _FgColorNoActivity;