X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatviewsearchcontroller.cpp;h=cff190820d52fd55285afdf63ea91a2be31a5dc3;hb=a0e333e994dce2d949a84930293382020e724596;hp=bb6dc3674d0dca07fe429c5a451da5daa269f8d1;hpb=39328183a6a87c6eb10a9dbbffcd5d65bf154a1f;p=quassel.git diff --git a/src/qtui/chatviewsearchcontroller.cpp b/src/qtui/chatviewsearchcontroller.cpp index bb6dc367..cff19082 100644 --- a/src/qtui/chatviewsearchcontroller.cpp +++ b/src/qtui/chatviewsearchcontroller.cpp @@ -30,13 +30,7 @@ #include "messagemodel.h" ChatViewSearchController::ChatViewSearchController(QObject *parent) - : QObject(parent), - _scene(nullptr), - _currentHighlight(0), - _caseSensitive(false), - _searchSenders(false), - _searchMsgs(true), - _searchOnlyRegularMsgs(true) + : QObject(parent) { } @@ -75,7 +69,7 @@ void ChatViewSearchController::setScene(ChatScene *scene) if (!scene) return; - connect(_scene, SIGNAL(destroyed()), this, SLOT(sceneDestroyed())); + connect(_scene, &QObject::destroyed, this, &ChatViewSearchController::sceneDestroyed); connect(_scene, SIGNAL(layoutChanged()), this, SLOT(repositionHighlights())); connect(Client::messageModel(), SIGNAL(finishedBacklogFetch(BufferId)), this, SLOT(updateHighlights())); updateHighlights(); @@ -124,7 +118,7 @@ void ChatViewSearchController::updateHighlights(bool reuse) if (reuse) { QSet chatLines; foreach(SearchHighlightItem *highlightItem, _highlightItems) { - ChatLine *line = qgraphicsitem_cast(highlightItem->parentItem()); + auto *line = qgraphicsitem_cast(highlightItem->parentItem()); if (line) chatLines << line; } @@ -151,7 +145,7 @@ void ChatViewSearchController::updateHighlights(bool reuse) int start = 0; int end = _highlightItems.count() - 1; QPointF startPos; QPointF endPos; - while (1) { + while (true) { startPos = _highlightItems[start]->scenePos(); endPos = _highlightItems[end]->scenePos(); if (startPos == oldHighlightPos) { @@ -265,7 +259,7 @@ void ChatViewSearchController::updateHighlights(ChatLine *line) } foreach(QGraphicsItem *child, line->childItems()) { - SearchHighlightItem *highlightItem = qgraphicsitem_cast(child); + auto *highlightItem = qgraphicsitem_cast(child); if (!highlightItem) continue; @@ -310,7 +304,7 @@ void ChatViewSearchController::repositionHighlights() { QSet chatLines; foreach(SearchHighlightItem *item, _highlightItems) { - ChatLine *line = qgraphicsitem_cast(item->parentItem()); + auto *line = qgraphicsitem_cast(item->parentItem()); if (line) chatLines << line; } @@ -325,7 +319,7 @@ void ChatViewSearchController::repositionHighlights(ChatLine *line) { QList searchHighlights; foreach(QGraphicsItem *child, line->childItems()) { - SearchHighlightItem *highlightItem = qgraphicsitem_cast(child); + auto *highlightItem = qgraphicsitem_cast(child); if (highlightItem) searchHighlights << highlightItem; } @@ -428,7 +422,7 @@ SearchHighlightItem::SearchHighlightItem(QRectF wordRect, QGraphicsItem *parent) setPos(wordRect.x(), wordRect.y()); updateGeometry(wordRect.width(), wordRect.height()); - connect(&_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(updateHighlight(qreal))); + connect(&_timeLine, &QTimeLine::valueChanged, this, &SearchHighlightItem::updateHighlight); }