X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatscene.cpp;h=78c33c88060c7cfc075410849f8ad022dff9a621;hp=92ad3725af4c349203596dafb9efe23c610340a5;hb=3a3e844f9fcfd12235a0086af75ecd503b621ef4;hpb=8d736eb601e79e8fe1a866eb67e626b33f651d7a diff --git a/src/qtui/chatscene.cpp b/src/qtui/chatscene.cpp index 92ad3725..78c33c88 100644 --- a/src/qtui/chatscene.cpp +++ b/src/qtui/chatscene.cpp @@ -20,6 +20,8 @@ #include "chatscene.h" +#include + #include #include #include @@ -31,12 +33,6 @@ #include #include -#ifdef HAVE_KDE4 -# include -#else -# include -#endif - #ifdef HAVE_WEBENGINE # include #elif defined HAVE_WEBKIT @@ -62,10 +58,10 @@ const qreal minContentsWidth = 200; -ChatScene::ChatScene(QAbstractItemModel *model, const QString &idString, qreal width, ChatView *parent) +ChatScene::ChatScene(QAbstractItemModel *model, QString idString, qreal width, ChatView *parent) : QGraphicsScene(0, 0, width, 0, (QObject *)parent), _chatView(parent), - _idString(idString), + _idString(std::move(idString)), _model(model), _singleBufferId(BufferId()), _sceneRect(0, 0, width, 0), @@ -77,7 +73,7 @@ ChatScene::ChatScene(QAbstractItemModel *model, const QString &idString, qreal w _markerLineJumpPending(false), _cutoffMode(CutoffRight), _alwaysBracketSender(false), - _selectingItem(0), + _selectingItem(nullptr), _selectionStart(-1), _isSelecting(false), _clickMode(NoClick), @@ -188,7 +184,7 @@ void ChatScene::resetColumnWidths() ChatLine *ChatScene::chatLine(MsgId msgId, bool matchExact, bool ignoreDayChange) const { if (!_lines.count()) - return 0; + return nullptr; QList::ConstIterator start = _lines.begin(); QList::ConstIterator end = _lines.end(); @@ -213,10 +209,10 @@ ChatLine *ChatScene::chatLine(MsgId msgId, bool matchExact, bool ignoreDayChange return *start; if (matchExact) - return 0; + return nullptr; if (start == _lines.begin()) // not (yet?) in our scene - return 0; + return nullptr; // if we didn't find the exact msgId, take the next-lower one (this makes sense for lastSeen) @@ -228,7 +224,7 @@ ChatLine *ChatScene::chatLine(MsgId msgId, bool matchExact, bool ignoreDayChange if (_lines.at(i)->msgType() != Message::DayChange) return _lines.at(i); } - return 0; + return nullptr; } // return the next-lower line @@ -240,7 +236,7 @@ ChatLine *ChatScene::chatLine(MsgId msgId, bool matchExact, bool ignoreDayChange return *start; } while (start != _lines.begin()); - return 0; + return nullptr; } @@ -251,7 +247,7 @@ ChatItem *ChatScene::chatItemAt(const QPointF &scenePos) const if (line) return line->itemAt(line->mapFromScene(scenePos)); } - return 0; + return nullptr; } @@ -425,7 +421,7 @@ void ChatScene::rowsInserted(const QModelIndex &index, int start, int end) // neither pre- or append means we have to do dirty work: move items... if (!(atTop || atBottom)) { - ChatLine *line = 0; + ChatLine *line = nullptr; for (int i = 0; i <= end; i++) { line = _lines.at(i); line->setPos(0, line->pos().y() - h); @@ -490,7 +486,7 @@ void ChatScene::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int e if (_selectingItem) { int row = _selectingItem->row(); if (row >= start && row <= end) - setSelectingItem(0); + setSelectingItem(nullptr); } // remove items from scene @@ -498,7 +494,7 @@ void ChatScene::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int e int lineCount = start; while (lineIter != _lines.end() && lineCount <= end) { if ((*lineIter) == markerLine()->chatLine()) - markerLine()->setChatLine(0); + markerLine()->setChatLine(nullptr); h += (*lineIter)->height(); delete *lineIter; lineIter = _lines.erase(lineIter); @@ -540,7 +536,7 @@ void ChatScene::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int e moveStart = start; offset = -offset; } - ChatLine *line = 0; + ChatLine *line = nullptr; for (int i = moveStart; i <= moveEnd; i++) { line = _lines.at(i); line->setPos(0, line->pos().y() + offset); @@ -1233,7 +1229,7 @@ void ChatScene::loadWebPreview(ChatItem *parentItem, const QUrl &url, const QRec if (webPreview.previewItem->scene()) removeItem(webPreview.previewItem); delete webPreview.previewItem; - webPreview.previewItem = 0; + webPreview.previewItem = nullptr; } webPreview.previewState = WebPreview::NoPreview; } @@ -1303,9 +1299,9 @@ void ChatScene::webPreviewNextStep() case WebPreview::HidePreview: if (webPreview.previewItem) { delete webPreview.previewItem; - webPreview.previewItem = 0; + webPreview.previewItem = nullptr; } - webPreview.parentItem = 0; + webPreview.parentItem = nullptr; webPreview.url = QUrl(); webPreview.urlRect = QRectF(); webPreview.previewState = WebPreview::NoPreview; @@ -1322,7 +1318,7 @@ void ChatScene::clearWebPreview(ChatItem *parentItem) webPreview.previewState = WebPreview::NoPreview; // we haven't loaded anything yet break; case WebPreview::ShowPreview: - if (parentItem == 0 || webPreview.parentItem == parentItem) { + if (parentItem == nullptr || webPreview.parentItem == parentItem) { if (webPreview.previewItem && webPreview.previewItem->scene()) removeItem(webPreview.previewItem); }