X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=f9665c6c3ab17362e057d74b8e92473819cb0a22;hp=5f9ca041b4365276ac61f167d8408cd2098e7603;hb=ddba2696fe051b472d6670e225e67c2f6f1972ce;hpb=77c907c8d6f69d9ecc9cb127044e5679af3aa673 diff --git a/src/client/client.cpp b/src/client/client.cpp index 5f9ca041..f9665c6c 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -77,7 +77,7 @@ Client::Client(QObject *parent) { _monitorBuffer = new Buffer(BufferInfo(), this); _signalProxy->synchronize(_ircListHelper); - + connect(_backlogManager, SIGNAL(backlog(BufferId, const QVariantList &)), this, SLOT(receiveBacklog(BufferId, const QVariantList &))); } @@ -126,11 +126,6 @@ void Client::init() { connect(this, SIGNAL(connected()), mainUi, SLOT(connectedToCore())); connect(this, SIGNAL(disconnected()), mainUi, SLOT(disconnectedFromCore())); - layoutTimer = new QTimer(this); - layoutTimer->setInterval(0); - layoutTimer->setSingleShot(false); - connect(layoutTimer, SIGNAL(timeout()), this, SLOT(layoutMsg())); - } /*** public static methods ***/ @@ -357,6 +352,7 @@ void Client::disconnectFromCore() { _bufferViewManager = 0; } + _messageModel->clear(); _networkModel->clear(); QHash::iterator bufferIter = _buffers.begin(); @@ -389,8 +385,6 @@ void Client::disconnectFromCore() { } Q_ASSERT(_identities.isEmpty()); - layoutQueue.clear(); - layoutTimer->stop(); } void Client::setCoreConfiguration(const QVariantMap &settings) { @@ -437,9 +431,11 @@ void Client::networkDestroyed() { } } -void Client::recvMessage(const Message &msg) { - //checkForHighlight(msg); +void Client::recvMessage(const Message &msg_) { + Message msg = msg_; + checkForHighlight(msg); _messageModel->insertMessage(msg); + buffer(msg.bufferInfo())->updateActivityLevel(msg); } void Client::recvStatusMsg(QString /*net*/, QString /*msg*/) { @@ -447,35 +443,21 @@ void Client::recvStatusMsg(QString /*net*/, QString /*msg*/) { } void Client::receiveBacklog(BufferId bufferId, const QVariantList &msgs) { - //checkForHighlight(msg); //QTime start = QTime::currentTime(); foreach(QVariant v, msgs) { - _messageModel->insertMessage(v.value()); + Message msg = v.value(); + checkForHighlight(msg); + _messageModel->insertMessage(msg); + buffer(msg.bufferInfo())->updateActivityLevel(msg); } //qDebug() << "processed" << msgs.count() << "backlog lines in" << start.msecsTo(QTime::currentTime()); } -void Client::layoutMsg() { - if(layoutQueue.isEmpty()) { - layoutTimer->stop(); - return; - } - - Buffer *buffer = layoutQueue.takeFirst(); - if(buffer->layoutMsg()) { - layoutQueue.append(buffer); // Buffer has more messages in its queue --> Round Robin +// TODO optimize checkForHighlight +void Client::checkForHighlight(Message &msg) { + if(!((msg.type() & (Message::Plain | Message::Notice | Message::Action)) && !(msg.flags() & Message::Self))) return; - } - - if(layoutQueue.isEmpty()) - layoutTimer->stop(); -} -AbstractUiMsg *Client::layoutMsg(const Message &msg) { - return instance()->mainUi->layoutMsg(msg); -} - -void Client::checkForHighlight(Message &msg) { NotificationSettings notificationSettings; const Network *net = network(msg.bufferInfo().networkId()); if(net && !net->myNick().isEmpty()) { @@ -489,9 +471,7 @@ void Client::checkForHighlight(Message &msg) { } foreach(QString nickname, nickList) { QRegExp nickRegExp("^(.*\\W)?" + QRegExp::escape(nickname) + "(\\W.*)?$"); - if((msg.type() & (Message::Plain | Message::Notice | Message::Action)) - && !(msg.flags() & Message::Self) - && nickRegExp.exactMatch(msg.contents())) { + if(nickRegExp.exactMatch(msg.contents())) { msg.setFlags(msg.flags() | Message::Highlight); return; } @@ -509,9 +489,7 @@ void Client::checkForHighlight(Message &msg) { } else { userRegExp = QRegExp("^(.*\\W)?" + QRegExp::escape(name) + "(\\W.*)?$", caseSensitivity); } - if((msg.type() & (Message::Plain | Message::Notice | Message::Action)) - && !(msg.flags() & Message::Self) - && userRegExp.exactMatch(msg.contents())) { + if(userRegExp.exactMatch(msg.contents())) { msg.setFlags(msg.flags() | Message::Highlight); return; } @@ -544,7 +522,6 @@ void Client::bufferRemoved(BufferId bufferId) { Buffer *buff = 0; if(_buffers.contains(bufferId)) { buff = _buffers.take(bufferId); - layoutQueue.removeAll(buff); disconnect(buff, 0, this, 0); }