/***************************************************************************
- * Copyright (C) 2005-2016 by the Quassel Project *
+ * Copyright (C) 2005-2018 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include "messagemodel.h"
ChatViewSearchController::ChatViewSearchController(QObject *parent)
- : QObject(parent),
- _scene(0),
- _currentHighlight(0),
- _caseSensitive(false),
- _searchSenders(false),
- _searchMsgs(true),
- _searchOnlyRegularMsgs(true)
+ : QObject(parent)
{
}
return;
if (_scene) {
- disconnect(_scene, 0, this, 0);
- disconnect(Client::messageModel(), 0, this, 0);
+ disconnect(_scene, nullptr, this, nullptr);
+ disconnect(Client::messageModel(), nullptr, this, nullptr);
qDeleteAll(_highlightItems);
_highlightItems.clear();
}
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();
if (reuse) {
QSet<ChatLine *> chatLines;
foreach(SearchHighlightItem *highlightItem, _highlightItems) {
- ChatLine *line = qgraphicsitem_cast<ChatLine *>(highlightItem->parentItem());
+ auto *line = qgraphicsitem_cast<ChatLine *>(highlightItem->parentItem());
if (line)
chatLines << line;
}
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) {
}
foreach(QGraphicsItem *child, line->childItems()) {
- SearchHighlightItem *highlightItem = qgraphicsitem_cast<SearchHighlightItem *>(child);
+ auto *highlightItem = qgraphicsitem_cast<SearchHighlightItem *>(child);
if (!highlightItem)
continue;
{
QSet<ChatLine *> chatLines;
foreach(SearchHighlightItem *item, _highlightItems) {
- ChatLine *line = qgraphicsitem_cast<ChatLine *>(item->parentItem());
+ auto *line = qgraphicsitem_cast<ChatLine *>(item->parentItem());
if (line)
chatLines << line;
}
{
QList<SearchHighlightItem *> searchHighlights;
foreach(QGraphicsItem *child, line->childItems()) {
- SearchHighlightItem *highlightItem = qgraphicsitem_cast<SearchHighlightItem *>(child);
+ auto *highlightItem = qgraphicsitem_cast<SearchHighlightItem *>(child);
if (highlightItem)
searchHighlights << highlightItem;
}
void ChatViewSearchController::sceneDestroyed()
{
// WARNING: don't call any methods on scene!
- _scene = 0;
+ _scene = nullptr;
// the items will be automatically deleted when the scene is destroyed
// so we just have to clear the list;
_highlightItems.clear();
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);
}