diff --git a/autotests/annotationstest.cpp b/autotests/annotationstest.cpp index c8c75cf8f..8849c3357 100644 --- a/autotests/annotationstest.cpp +++ b/autotests/annotationstest.cpp @@ -78,7 +78,7 @@ void AnnotationTest::testDistance_data() // lines Okular::LineAnnotation *line = new Okular::LineAnnotation; - line->setLinePoints(QLinkedList() << Okular::NormalizedPoint(0.1, 0.1) << Okular::NormalizedPoint(0.9, 0.1)); + line->setLinePoints({Okular::NormalizedPoint(0.1, 0.1), Okular::NormalizedPoint(0.9, 0.1)}); m_document->addPageAnnotation(0, line); QTest::newRow("Line: Base point 1") << (Okular::Annotation *)line << 0.1 << 0.1 << 0; QTest::newRow("Line: Base point 2") << (Okular::Annotation *)line << 0.5 << 0.1 << 0; diff --git a/autotests/documenttest.cpp b/autotests/documenttest.cpp index db19ca60b..597425c61 100644 --- a/autotests/documenttest.cpp +++ b/autotests/documenttest.cpp @@ -52,7 +52,7 @@ void DocumentTest::testCloseDuringRotationJob() // Request a pixmap. A RotationJob will be enqueued but not started Okular::PixmapRequest *pixmapReq = new Okular::PixmapRequest(dummyDocumentObserver, 0, 100, 100, qApp->devicePixelRatio(), 1, Okular::PixmapRequest::NoFeature); - m_document->requestPixmaps(QLinkedList() << pixmapReq); + m_document->requestPixmaps({pixmapReq}); // Delete the document delete m_document; diff --git a/autotests/testingutils.cpp b/autotests/testingutils.cpp index 94d153870..cbc4b1773 100644 --- a/autotests/testingutils.cpp +++ b/autotests/testingutils.cpp @@ -17,10 +17,10 @@ QString getAnnotationXml(const Okular::Annotation *annotation) return annotXmlString; } -bool pointListsAlmostEqual(const QLinkedList &points1, const QLinkedList &points2) +bool pointListsAlmostEqual(const QList &points1, const QList &points2) { - QLinkedListIterator it1(points1); - QLinkedListIterator it2(points2); + QListIterator it1(points1); + QListIterator it2(points2); while (it1.hasNext() && it2.hasNext()) { const Okular::NormalizedPoint &p1 = it1.next(); const Okular::NormalizedPoint &p2 = it2.next(); diff --git a/autotests/testingutils.h b/autotests/testingutils.h index bcf44298f..f3fdaaa94 100644 --- a/autotests/testingutils.h +++ b/autotests/testingutils.h @@ -7,7 +7,7 @@ #ifndef OKULAR_TESTINGUTILS_H #define OKULAR_TESTINGUTILS_H -template class QLinkedList; +template class QList; class QString; namespace Okular @@ -27,7 +27,7 @@ QString getAnnotationXml(const Okular::Annotation *annotation); * Returns true if the pairwise comparison coordinates of points in @p points1 and @p points2 are almost * equal (according to qFuzzyCompare) */ -bool pointListsAlmostEqual(const QLinkedList &points1, const QLinkedList &points2); +bool pointListsAlmostEqual(const QList &points1, const QList &points2); /* * The AnnotationDisposeWatcher class provides a static disposeAnnotation function diff --git a/autotests/translateannotationtest.cpp b/autotests/translateannotationtest.cpp index 4f0aaaab8..f63839a71 100644 --- a/autotests/translateannotationtest.cpp +++ b/autotests/translateannotationtest.cpp @@ -16,7 +16,7 @@ Okular::LineAnnotation *getNewLineAnnotation(double startX, double startY, double endX, double endY) { Okular::LineAnnotation *line = new Okular::LineAnnotation; - line->setLinePoints(QLinkedList() << Okular::NormalizedPoint(startX, startY) << Okular::NormalizedPoint(endX, endY)); + line->setLinePoints({Okular::NormalizedPoint(startX, startY), Okular::NormalizedPoint(endX, endY)}); double left = qMin(startX, endX); double top = qMin(startY, endY); @@ -49,13 +49,13 @@ private: Okular::NormalizedPoint m_deltaA; Okular::NormalizedPoint m_deltaB; - QLinkedList m_origPoints1; - QLinkedList m_origPoints2; + QList m_origPoints1; + QList m_origPoints2; - QLinkedList m_points1DeltaA; - QLinkedList m_points1DeltaAB; - QLinkedList m_points2DeltaA; - QLinkedList m_points2DeltaAB; + QList m_points1DeltaA; + QList m_points1DeltaAB; + QList m_points2DeltaA; + QList m_points2DeltaAB; }; void TranslateAnnotationTest::initTestCase() @@ -68,17 +68,17 @@ void TranslateAnnotationTest::initTestCase() m_deltaB = Okular::NormalizedPoint(0.1, 0.2); // Build lists of expected points for various states - m_origPoints1 = QLinkedList() << Okular::NormalizedPoint(0.1, 0.1) << Okular::NormalizedPoint(0.2, 0.3); + m_origPoints1 = {Okular::NormalizedPoint(0.1, 0.1), Okular::NormalizedPoint(0.2, 0.3)}; - m_points1DeltaA = QLinkedList() << Okular::NormalizedPoint(0.15, 0.2) << Okular::NormalizedPoint(0.25, 0.4); + m_points1DeltaA = {Okular::NormalizedPoint(0.15, 0.2), Okular::NormalizedPoint(0.25, 0.4)}; - m_points1DeltaAB = QLinkedList() << Okular::NormalizedPoint(0.25, 0.4) << Okular::NormalizedPoint(0.35, 0.6); + m_points1DeltaAB = {Okular::NormalizedPoint(0.25, 0.4), Okular::NormalizedPoint(0.35, 0.6)}; - m_origPoints2 = QLinkedList() << Okular::NormalizedPoint(0.1, 0.1) << Okular::NormalizedPoint(0.3, 0.4); + m_origPoints2 = {Okular::NormalizedPoint(0.1, 0.1), Okular::NormalizedPoint(0.3, 0.4)}; - m_points2DeltaA = QLinkedList() << Okular::NormalizedPoint(0.15, 0.2) << Okular::NormalizedPoint(0.35, 0.5); + m_points2DeltaA = {Okular::NormalizedPoint(0.15, 0.2), Okular::NormalizedPoint(0.35, 0.5)}; - m_points2DeltaAB = QLinkedList() << Okular::NormalizedPoint(0.25, 0.4) << Okular::NormalizedPoint(0.45, 0.7); + m_points2DeltaAB = {Okular::NormalizedPoint(0.25, 0.4), Okular::NormalizedPoint(0.45, 0.7)}; } void TranslateAnnotationTest::cleanupTestCase() diff --git a/core/annotations.cpp b/core/annotations.cpp index b2c3fdb3d..5811429ea 100644 --- a/core/annotations.cpp +++ b/core/annotations.cpp @@ -43,11 +43,11 @@ static bool isLeftOfVector(const NormalizedPoint &a, const NormalizedPoint &b, c * * Does piecewise comparison and selects the distance to the closest segment */ -static double distanceSqr(double x, double y, double xScale, double yScale, const QLinkedList &path) +static double distanceSqr(double x, double y, double xScale, double yScale, const QList &path) { double distance = DBL_MAX; double thisDistance; - QLinkedList::const_iterator i = path.constBegin(); + QList::const_iterator i = path.constBegin(); NormalizedPoint lastPoint = *i; for (++i; i != path.constEnd(); ++i) { @@ -1414,8 +1414,8 @@ public: void setAnnotationProperties(const QDomNode &node) override; AnnotationPrivate *getNewAnnotationPrivate() override; - QLinkedList m_linePoints; - QLinkedList m_transformedLinePoints; + QList m_linePoints; + QList m_transformedLinePoints; LineAnnotation::TermStyle m_lineStartStyle; LineAnnotation::TermStyle m_lineEndStyle; bool m_lineClosed : 1; @@ -1440,19 +1440,19 @@ LineAnnotation::~LineAnnotation() { } -void LineAnnotation::setLinePoints(const QLinkedList &points) +void LineAnnotation::setLinePoints(const QList &points) { Q_D(LineAnnotation); d->m_linePoints = points; } -QLinkedList LineAnnotation::linePoints() const +QList LineAnnotation::linePoints() const { Q_D(const LineAnnotation); return d->m_linePoints; } -QLinkedList LineAnnotation::transformedLinePoints() const +QList LineAnnotation::transformedLinePoints() const { Q_D(const LineAnnotation); return d->m_transformedLinePoints; @@ -1598,7 +1598,7 @@ void LineAnnotation::store(QDomNode &node, QDomDocument &document) const // append the list of points int points = d->m_linePoints.count(); if (points > 1) { - QLinkedList::const_iterator it = d->m_linePoints.begin(), end = d->m_linePoints.end(); + QList::const_iterator it = d->m_linePoints.begin(), end = d->m_linePoints.end(); while (it != end) { const NormalizedPoint &p = *it; QDomElement pElement = document.createElement(QStringLiteral("point")); @@ -1614,7 +1614,7 @@ void LineAnnotationPrivate::transform(const QTransform &matrix) { AnnotationPrivate::transform(matrix); - QMutableLinkedListIterator it(m_transformedLinePoints); + QMutableListIterator it(m_transformedLinePoints); while (it.hasNext()) { it.next().transform(matrix); } @@ -1624,7 +1624,7 @@ void LineAnnotationPrivate::baseTransform(const QTransform &matrix) { AnnotationPrivate::baseTransform(matrix); - QMutableLinkedListIterator it(m_linePoints); + QMutableListIterator it(m_linePoints); while (it.hasNext()) { it.next().transform(matrix); } @@ -1641,7 +1641,7 @@ void LineAnnotationPrivate::translate(const NormalizedPoint &coord) { AnnotationPrivate::translate(coord); - QMutableLinkedListIterator it(m_linePoints); + QMutableListIterator it(m_linePoints); while (it.hasNext()) { NormalizedPoint &p = it.next(); p.x = p.x + coord.x; @@ -1718,7 +1718,7 @@ AnnotationPrivate *LineAnnotationPrivate::getNewAnnotationPrivate() double LineAnnotationPrivate::distanceSqr(double x, double y, double xScale, double yScale) const { - QLinkedList transformedLinePoints = m_transformedLinePoints; + QList transformedLinePoints = m_transformedLinePoints; if (m_lineClosed) { // Close the path transformedLinePoints.append(transformedLinePoints.first()); @@ -1907,12 +1907,11 @@ double GeomAnnotationPrivate::distanceSqr(double x, double y, double xScale, dou return AnnotationPrivate::distanceSqr(x, y, xScale, yScale); } - QLinkedList edges; - edges << NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.top); - edges << NormalizedPoint(m_transformedBoundary.right, m_transformedBoundary.top); - edges << NormalizedPoint(m_transformedBoundary.right, m_transformedBoundary.bottom); - edges << NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.bottom); - edges << NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.top); + const QList edges = {NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.top), + NormalizedPoint(m_transformedBoundary.right, m_transformedBoundary.top), + NormalizedPoint(m_transformedBoundary.right, m_transformedBoundary.bottom), + NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.bottom), + NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.top)}; distance = ::distanceSqr(x, y, xScale, yScale, edges); if (m_transformedBoundary.contains(x, y)) { @@ -2213,7 +2212,7 @@ double HighlightAnnotationPrivate::distanceSqr(double x, double y, double xScale NormalizedPoint point(x, y); double outsideDistance = DBL_MAX; for (const HighlightAnnotation::Quad &quad : m_highlightQuads) { - QLinkedList pathPoints; + QList pathPoints; // first, we check if the point is within the area described by the 4 quads // this is the case, if the point is always on one side of each segments delimiting the polygon: @@ -2354,8 +2353,8 @@ public: void setAnnotationProperties(const QDomNode &node) override; AnnotationPrivate *getNewAnnotationPrivate() override; - QList> m_inkPaths; - QList> m_transformedInkPaths; + QList> m_inkPaths; + QList> m_transformedInkPaths; }; InkAnnotation::InkAnnotation() @@ -2372,19 +2371,19 @@ InkAnnotation::~InkAnnotation() { } -void InkAnnotation::setInkPaths(const QList> &paths) +void InkAnnotation::setInkPaths(const QList> &paths) { Q_D(InkAnnotation); d->m_inkPaths = paths; } -QList> InkAnnotation::inkPaths() const +QList> InkAnnotation::inkPaths() const { Q_D(const InkAnnotation); return d->m_inkPaths; } -QList> InkAnnotation::transformedInkPaths() const +QList> InkAnnotation::transformedInkPaths() const { Q_D(const InkAnnotation); return d->m_transformedInkPaths; @@ -2410,14 +2409,12 @@ void InkAnnotation::store(QDomNode &node, QDomDocument &document) const return; } - QList>::const_iterator pIt = d->m_inkPaths.begin(), pEnd = d->m_inkPaths.end(); + QList>::const_iterator pIt = d->m_inkPaths.begin(), pEnd = d->m_inkPaths.end(); for (; pIt != pEnd; ++pIt) { QDomElement pathElement = document.createElement(QStringLiteral("path")); inkElement.appendChild(pathElement); - const QLinkedList &path = *pIt; - QLinkedList::const_iterator iIt = path.begin(), iEnd = path.end(); - for (; iIt != iEnd; ++iIt) { - const NormalizedPoint &point = *iIt; + const QList &path = *pIt; + for (const NormalizedPoint &point : path) { QDomElement pointElement = document.createElement(QStringLiteral("point")); pathElement.appendChild(pointElement); pointElement.setAttribute(QStringLiteral("x"), QString::number(point.x)); @@ -2429,7 +2426,7 @@ void InkAnnotation::store(QDomNode &node, QDomDocument &document) const double InkAnnotationPrivate::distanceSqr(double x, double y, double xScale, double yScale) const { double distance = DBL_MAX; - for (const QLinkedList &path : m_transformedInkPaths) { + for (const QList &path : m_transformedInkPaths) { const double thisDistance = ::distanceSqr(x, y, xScale, yScale, path); if (thisDistance < distance) { distance = thisDistance; @@ -2443,7 +2440,7 @@ void InkAnnotationPrivate::transform(const QTransform &matrix) AnnotationPrivate::transform(matrix); for (int i = 0; i < m_transformedInkPaths.count(); ++i) { - QMutableLinkedListIterator it(m_transformedInkPaths[i]); + QMutableListIterator it(m_transformedInkPaths[i]); while (it.hasNext()) { it.next().transform(matrix); } @@ -2455,7 +2452,7 @@ void InkAnnotationPrivate::baseTransform(const QTransform &matrix) AnnotationPrivate::baseTransform(matrix); for (int i = 0; i < m_inkPaths.count(); ++i) { - QMutableLinkedListIterator it(m_inkPaths[i]); + QMutableListIterator it(m_inkPaths[i]); while (it.hasNext()) { it.next().transform(matrix); } @@ -2474,7 +2471,7 @@ void InkAnnotationPrivate::translate(const NormalizedPoint &coord) AnnotationPrivate::translate(coord); for (int i = 0; i < m_inkPaths.count(); ++i) { - QMutableLinkedListIterator it(m_inkPaths[i]); + QMutableListIterator it(m_inkPaths[i]); while (it.hasNext()) { NormalizedPoint &p = it.next(); p.x = p.x + coord.x; @@ -2508,7 +2505,7 @@ void InkAnnotationPrivate::setAnnotationProperties(const QDomNode &node) } // build each path parsing 'point' subnodes - QLinkedList path; + QList path; QDomNode pointNode = pathElement.firstChild(); while (pointNode.isElement()) { QDomElement pointElement = pointNode.toElement(); diff --git a/core/annotations.h b/core/annotations.h index 57530de9d..a1c889a8d 100644 --- a/core/annotations.h +++ b/core/annotations.h @@ -938,19 +938,25 @@ public: /** * Sets the normalized line @p points of the line annotation. + * + * @since 22.08 */ - void setLinePoints(const QLinkedList &points); + void setLinePoints(const QList &points); /** * Returns the normalized line points of the line annotation. + * + * @since 22.08 */ - QLinkedList linePoints() const; + QList linePoints() const; /** * Returns the transformed (e.g. rotated) normalized line points * of the line annotation. + * + * @since 22.08 */ - QLinkedList transformedLinePoints() const; + QList transformedLinePoints() const; /** * Sets the line starting @p style of the line annotation. @@ -1336,19 +1342,25 @@ public: /** * Sets the @p paths of points for the ink annotation. + * + * @since 22.08 */ - void setInkPaths(const QList> &paths); + void setInkPaths(const QList> &paths); /** * Returns the paths of points of the ink annotation. + * + * @since 22.08 */ - QList> inkPaths() const; + QList> inkPaths() const; /** * Returns the paths of transformed (e.g. rotated) points of * the ink annotation. + * + * @since 22.08 */ - QList> transformedInkPaths() const; + QList> transformedInkPaths() const; /** * Returns the sub type of the ink annotation. diff --git a/core/document.cpp b/core/document.cpp index f03be1173..93e0a3b30 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -1602,13 +1602,13 @@ void DocumentPrivate::refreshPixmaps(int pageNumber) // Need to do this ↑↓ in two steps since requestPixmaps can end up calling cancelRenderingBecauseOf // which changes m_pixmaps and thus breaks the loop above for (PixmapRequest *pr : qAsConst(pixmapsToRequest)) { - QLinkedList requestedPixmaps; + QList requestedPixmaps; requestedPixmaps.push_back(pr); m_parent->requestPixmaps(requestedPixmaps, Okular::Document::NoOption); } for (DocumentObserver *observer : qAsConst(m_observers)) { - QLinkedList requestedPixmaps; + QList requestedPixmaps; TilesManager *tilesManager = page->d->tilesManager(observer); if (tilesManager) { @@ -3319,12 +3319,12 @@ bool DocumentPrivate::cancelRenderingBecauseOf(PixmapRequest *executingRequest, return true; } -void Document::requestPixmaps(const QLinkedList &requests) +void Document::requestPixmaps(const QList &requests) { requestPixmaps(requests, RemoveAllPrevious); } -void Document::requestPixmaps(const QLinkedList &requests, PixmapRequestFlags reqOptions) +void Document::requestPixmaps(const QList &requests, PixmapRequestFlags reqOptions) { if (requests.isEmpty()) { return; @@ -3332,10 +3332,7 @@ void Document::requestPixmaps(const QLinkedList &requests, Pixm if (!d->m_pageController) { // delete requests.. - QLinkedList::const_iterator rIt = requests.constBegin(), rEnd = requests.constEnd(); - for (; rIt != rEnd; ++rIt) { - delete *rIt; - } + qDeleteAll(requests); // ..and return return; } @@ -3346,10 +3343,9 @@ void Document::requestPixmaps(const QLinkedList &requests, Pixm DocumentObserver *requesterObserver = requests.first()->observer(); QSet requestedPages; { - QLinkedList::const_iterator rIt = requests.constBegin(), rEnd = requests.constEnd(); - for (; rIt != rEnd; ++rIt) { - Q_ASSERT((*rIt)->observer() == requesterObserver); - requestedPages.insert((*rIt)->pageNumber()); + for (PixmapRequest *request : requests) { + Q_ASSERT(request->observer() == requesterObserver); + requestedPages.insert(request->pageNumber()); } } const bool removeAllPrevious = reqOptions & RemoveAllPrevious; diff --git a/core/document.h b/core/document.h index 558d94ddd..9d698ceb7 100644 --- a/core/document.h +++ b/core/document.h @@ -489,8 +489,10 @@ public: * Sends @p requests for pixmap generation. * * The same as requestPixmaps( requests, RemoveAllPrevious ); + * + * @since 22.08 */ - void requestPixmaps(const QLinkedList &requests); + void requestPixmaps(const QList &requests); /** * Sends @p requests for pixmap generation. @@ -498,9 +500,9 @@ public: * @param requests the linked list of requests * @param reqOptions the options for the request * - * @since 0.7 (KDE 4.1) + * @since 22.08 */ - void requestPixmaps(const QLinkedList &requests, PixmapRequestFlags reqOptions); + void requestPixmaps(const QList &requests, PixmapRequestFlags reqOptions); /** * Sends a request for text page generation for the given page @p pageNumber. diff --git a/generators/djvu/generator_djvu.cpp b/generators/djvu/generator_djvu.cpp index a3a64e4f6..88b827fe3 100644 --- a/generators/djvu/generator_djvu.cpp +++ b/generators/djvu/generator_djvu.cpp @@ -373,7 +373,7 @@ Okular::Annotation *DjVuGenerator::convertKDjVuAnnotation(int w, int h, KDjVu::A QRect rect = QRect(a, b).normalized(); newlineann->setBoundingRectangle(Okular::NormalizedRect(Okular::Utils::rotateRect(rect, w, h, 0), w, h)); // line points - QLinkedList points; + QList points; points.append(Okular::NormalizedPoint(a.x(), a.y(), w, h)); points.append(Okular::NormalizedPoint(b.x(), b.y(), w, h)); newlineann->setLinePoints(points); diff --git a/generators/kimgio/tests/kimgiotest.cpp b/generators/kimgio/tests/kimgiotest.cpp index 898dedf4b..d0ad8b0a7 100644 --- a/generators/kimgio/tests/kimgiotest.cpp +++ b/generators/kimgio/tests/kimgiotest.cpp @@ -93,7 +93,7 @@ void KIMGIOTest::testExifOrientation() // Generate pixmap Okular::PixmapRequest *req = new Okular::PixmapRequest(dummyDocumentObserver, 0, 3, 2, qApp->devicePixelRatio(), 1, Okular::PixmapRequest::NoFeature); - m_document->requestPixmaps(QLinkedList() << req); + m_document->requestPixmaps({req}); QVERIFY(m_document->page(0)->hasPixmap(dummyDocumentObserver, 3, 2)); // Obtain image diff --git a/generators/poppler/annots.cpp b/generators/poppler/annots.cpp index 536b78b9a..76515a9a4 100644 --- a/generators/poppler/annots.cpp +++ b/generators/poppler/annots.cpp @@ -307,7 +307,7 @@ static void updatePopplerAnnotationFromOkularAnnotation(const Okular::TextAnnota static void updatePopplerAnnotationFromOkularAnnotation(const Okular::LineAnnotation *oLineAnnotation, Poppler::LineAnnotation *pLineAnnotation) { QLinkedList points; - const QLinkedList annotPoints = oLineAnnotation->linePoints(); + const QList annotPoints = oLineAnnotation->linePoints(); for (const Okular::NormalizedPoint &p : annotPoints) { points.append(normPointToPointF(p)); } @@ -363,8 +363,8 @@ static void updatePopplerAnnotationFromOkularAnnotation(const Okular::StampAnnot static void updatePopplerAnnotationFromOkularAnnotation(const Okular::InkAnnotation *oInkAnnotation, Poppler::InkAnnotation *pInkAnnotation) { QList> paths; - const QList> inkPathsList = oInkAnnotation->inkPaths(); - for (const QLinkedList &path : inkPathsList) { + const QList> inkPathsList = oInkAnnotation->inkPaths(); + for (const QList &path : inkPathsList) { QLinkedList points; for (const Okular::NormalizedPoint &p : path) { points.append(normPointToPointF(p)); @@ -876,7 +876,7 @@ static Okular::Annotation *createAnnotationFromPopplerAnnotation(const Poppler:: oLineAnn->setShowCaption(popplerAnnotation->lineShowCaption()); oLineAnn->setLineIntent(popplerToOkular(popplerAnnotation->lineIntent())); - QLinkedList points; + QList points; const QLinkedList popplerPoints = popplerAnnotation->linePoints(); for (const QPointF &p : popplerPoints) { points << Okular::NormalizedPoint(p.x(), p.y()); @@ -928,9 +928,9 @@ static Okular::Annotation *createAnnotationFromPopplerAnnotation(const Poppler:: Okular::InkAnnotation *oInkAnn = new Okular::InkAnnotation(); const QList> popplerInkPaths = popplerAnnotation->inkPaths(); - QList> okularInkPaths; + QList> okularInkPaths; for (const QLinkedList &popplerInkPath : popplerInkPaths) { - QLinkedList okularInkPath; + QList okularInkPath; for (const QPointF &popplerPoint : popplerInkPath) { okularInkPath << Okular::NormalizedPoint(popplerPoint.x(), popplerPoint.y()); } diff --git a/gui/pagepainter.cpp b/gui/pagepainter.cpp index d3fa19601..085c2bbf0 100644 --- a/gui/pagepainter.cpp +++ b/gui/pagepainter.cpp @@ -463,19 +463,14 @@ void PagePainter::paintCroppedPageOnPainter(QPainter *destPainter, Okular::InkAnnotation *ia = (Okular::InkAnnotation *)a; // draw each ink path - const QList> transformedInkPaths = ia->transformedInkPaths(); + const QList> transformedInkPaths = ia->transformedInkPaths(); const QPen inkPen = buildPen(a, a->style().width(), acolor); - int paths = transformedInkPaths.size(); - for (int p = 0; p < paths; p++) { - NormalizedPath path; - const QLinkedList &inkPath = transformedInkPaths[p]; - + for (const QList &inkPath : transformedInkPaths) { // normalize page point to image - QLinkedList::const_iterator pIt = inkPath.constBegin(), pEnd = inkPath.constEnd(); - for (; pIt != pEnd; ++pIt) { - const Okular::NormalizedPoint &inkPoint = *pIt; + NormalizedPath path; + for (const Okular::NormalizedPoint &inkPoint : inkPath) { Okular::NormalizedPoint point; point.x = (inkPoint.x - xOffset) * xScale; point.y = (inkPoint.y - yOffset) * yScale; @@ -1060,7 +1055,7 @@ LineAnnotPainter::LineAnnotPainter(const Okular::LineAnnotation *a, QSizeF pageS void LineAnnotPainter::draw(QImage &image) const { - const QLinkedList transformedLinePoints = la->transformedLinePoints(); + const QList transformedLinePoints = la->transformedLinePoints(); if (transformedLinePoints.count() == 2) { const Okular::NormalizedPoint delta {transformedLinePoints.last().x - transformedLinePoints.first().x, transformedLinePoints.first().y - transformedLinePoints.last().y}; const double angle {atan2(delta.y * aspectRatio, delta.x)}; diff --git a/part/annotationtools.cpp b/part/annotationtools.cpp index efb70a5bc..b9a727944 100644 --- a/part/annotationtools.cpp +++ b/part/annotationtools.cpp @@ -84,7 +84,7 @@ QCursor AnnotatorEngine::cursor() const return Qt::CrossCursor; } -SmoothPath::SmoothPath(const QLinkedList &points, const QPen &pen, qreal opacity, QPainter::CompositionMode compositionMode) +SmoothPath::SmoothPath(const QList &points, const QPen &pen, qreal opacity, QPainter::CompositionMode compositionMode) : points(points) , pen(pen) , opacity(opacity) @@ -176,7 +176,7 @@ void SmoothPath::paint(QPainter *painter, double xScale, double yScale) const painter->setOpacity(opacity); QPainterPath path; - QLinkedList::const_iterator pIt = points.begin(), pEnd = points.end(); + QList::const_iterator pIt = points.begin(), pEnd = points.end(); path.moveTo(QPointF(pIt->x * xScale, pIt->y * yScale)); ++pIt; for (; pIt != pEnd; ++pIt) { @@ -207,7 +207,7 @@ QList SmoothPathEngine::end() ann->style().setWidth(m_annotElement.attribute(QStringLiteral("width")).toDouble()); } // fill points - QList> list = ia->inkPaths(); + QList> list = ia->inkPaths(); list.append(points); ia->setInkPaths(list); // set boundaries diff --git a/part/annotationtools.h b/part/annotationtools.h index 84ff84761..3ac0bb551 100644 --- a/part/annotationtools.h +++ b/part/annotationtools.h @@ -86,11 +86,11 @@ private: class SmoothPath { public: - SmoothPath(const QLinkedList &points, const QPen &pen, qreal opacity = 1.0, QPainter::CompositionMode compositionMode = QPainter::CompositionMode_SourceOver); + SmoothPath(const QList &points, const QPen &pen, qreal opacity = 1.0, QPainter::CompositionMode compositionMode = QPainter::CompositionMode_SourceOver); void paint(QPainter *painter, double xScale, double yScale) const; private: - const QLinkedList points; + const QList points; const QPen pen; const qreal opacity; const QPainter::CompositionMode compositionMode; @@ -112,7 +112,7 @@ public: private: // data - QLinkedList points; + QList points; Okular::NormalizedRect totalRect; Okular::NormalizedPoint lastPoint; QPainter::CompositionMode compositionMode; diff --git a/part/editannottooldialog.cpp b/part/editannottooldialog.cpp index ba2ba867e..63a7f47f9 100644 --- a/part/editannottooldialog.cpp +++ b/part/editannottooldialog.cpp @@ -296,12 +296,12 @@ void EditAnnotToolDialog::createStubAnnotation() m_stubann->style().setColor(Qt::green); } else if (toolType == ToolStraightLine) { Okular::LineAnnotation *la = new Okular::LineAnnotation(); - la->setLinePoints(QLinkedList() << Okular::NormalizedPoint(0, 0) << Okular::NormalizedPoint(1, 0)); + la->setLinePoints({Okular::NormalizedPoint(0, 0), Okular::NormalizedPoint(1, 0)}); la->style().setColor(QColor(0xff, 0xe0, 0x00)); m_stubann = la; } else if (toolType == ToolPolygon) { Okular::LineAnnotation *la = new Okular::LineAnnotation(); - la->setLinePoints(QLinkedList() << Okular::NormalizedPoint(0, 0) << Okular::NormalizedPoint(1, 0) << Okular::NormalizedPoint(1, 1)); + la->setLinePoints({Okular::NormalizedPoint(0, 0), Okular::NormalizedPoint(1, 0), Okular::NormalizedPoint(1, 1)}); la->setLineClosed(true); la->style().setColor(QColor(0x00, 0x7e, 0xee)); m_stubann = la; diff --git a/part/magnifierview.cpp b/part/magnifierview.cpp index c774755d9..ce40c5c99 100644 --- a/part/magnifierview.cpp +++ b/part/magnifierview.cpp @@ -112,8 +112,6 @@ void MagnifierView::requestPixmap() Okular::NormalizedRect nrect = normalizedView(); if (m_page && !m_page->hasPixmap(this, full_width, full_height, nrect)) { - QLinkedList requestedPixmaps; - Okular::PixmapRequest *p = new Okular::PixmapRequest(this, m_current, full_width, full_height, devicePixelRatioF(), PAGEVIEW_PRIO, Okular::PixmapRequest::Asynchronous); if (m_page->hasTilesManager(this)) { @@ -129,9 +127,8 @@ void MagnifierView::requestPixmap() const double right = qMin(nrect.right + rect_width, 1.0); p->setNormalizedRect(Okular::NormalizedRect(left, top, right, bottom)); - requestedPixmaps.push_back(p); - m_document->requestPixmaps(requestedPixmaps); + m_document->requestPixmaps({p}); } } diff --git a/part/pageview.cpp b/part/pageview.cpp index c4a326eab..ff8ae2a82 100644 --- a/part/pageview.cpp +++ b/part/pageview.cpp @@ -4640,7 +4640,7 @@ void PageView::delayedResizeEvent() slotRequestVisiblePixmaps(); } -static void slotRequestPreloadPixmap(PageView *pageView, const PageViewItem *i, const QRect expandedViewportRect, QLinkedList *requestedPixmaps) +static void slotRequestPreloadPixmap(PageView *pageView, const PageViewItem *i, const QRect expandedViewportRect, QList *requestedPixmaps) { Okular::NormalizedRect preRenderRegion; const QRect intersectionRect = expandedViewportRect.intersected(i->croppedGeometry()); @@ -4689,7 +4689,7 @@ void PageView::slotRequestVisiblePixmaps(int newValue) // iterate over all items d->visibleItems.clear(); - QLinkedList requestedPixmaps; + QList requestedPixmaps; QVector visibleRects; for (PageViewItem *i : qAsConst(d->items)) { const QSet formWidgetsList = i->formWidgets(); diff --git a/part/pageviewannotator.cpp b/part/pageviewannotator.cpp index ec18b3395..fa17dca6b 100644 --- a/part/pageviewannotator.cpp +++ b/part/pageviewannotator.cpp @@ -559,12 +559,8 @@ public: // add note Okular::LineAnnotation *la = new Okular::LineAnnotation(); ann = la; - QLinkedList list; - for (int i = 0; i < points.count(); ++i) { - list.append(points[i]); - } - la->setLinePoints(list); + la->setLinePoints(points); if (numofpoints == -1) { la->setLineClosed(true); diff --git a/part/presentationwidget.cpp b/part/presentationwidget.cpp index 45b3ad913..79ddc9dbf 100644 --- a/part/presentationwidget.cpp +++ b/part/presentationwidget.cpp @@ -1451,7 +1451,7 @@ void PresentationWidget::requestPixmaps() // operation will take long: set busy cursor QApplication::setOverrideCursor(QCursor(Qt::BusyCursor)); // request the pixmap - QLinkedList requests; + QList requests; requests.push_back(new Okular::PixmapRequest(this, m_frameIndex, pixW, pixH, dpr, PRESENTATION_PRIO, Okular::PixmapRequest::NoFeature)); // restore cursor QApplication::restoreOverrideCursor(); diff --git a/part/thumbnaillist.cpp b/part/thumbnaillist.cpp index 463d6b04a..83a8f2950 100644 --- a/part/thumbnaillist.cpp +++ b/part/thumbnaillist.cpp @@ -672,7 +672,7 @@ void ThumbnailListPrivate::slotRequestVisiblePixmaps() // scroll from the top to the last visible thumbnail m_visibleThumbnails.clear(); - QLinkedList requestedPixmaps; + QList requestedPixmaps; QVector::const_iterator tIt = m_thumbnails.constBegin(), tEnd = m_thumbnails.constEnd(); const QRect viewportRect = q->viewport()->rect().translated(q->horizontalScrollBar()->value(), q->verticalScrollBar()->value()); for (; tIt != tEnd; ++tIt) {