mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-02 14:14:10 +00:00
Port a few QLinkedList to QList
QLinkedList is deprecated in later Qt5 and gone in Qt6 The 1:1 port is std::list but in this cases all we ever do is create the lists, push back to them, and pass then around to be read, for that a QList is more than enough
This commit is contained in:
parent
36ee0a1aa7
commit
6767b8739e
|
@ -78,7 +78,7 @@ void AnnotationTest::testDistance_data()
|
|||
|
||||
// lines
|
||||
Okular::LineAnnotation *line = new Okular::LineAnnotation;
|
||||
line->setLinePoints(QLinkedList<Okular::NormalizedPoint>() << 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;
|
||||
|
|
|
@ -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<Okular::PixmapRequest *>() << pixmapReq);
|
||||
m_document->requestPixmaps({pixmapReq});
|
||||
|
||||
// Delete the document
|
||||
delete m_document;
|
||||
|
|
|
@ -17,10 +17,10 @@ QString getAnnotationXml(const Okular::Annotation *annotation)
|
|||
return annotXmlString;
|
||||
}
|
||||
|
||||
bool pointListsAlmostEqual(const QLinkedList<Okular::NormalizedPoint> &points1, const QLinkedList<Okular::NormalizedPoint> &points2)
|
||||
bool pointListsAlmostEqual(const QList<Okular::NormalizedPoint> &points1, const QList<Okular::NormalizedPoint> &points2)
|
||||
{
|
||||
QLinkedListIterator<Okular::NormalizedPoint> it1(points1);
|
||||
QLinkedListIterator<Okular::NormalizedPoint> it2(points2);
|
||||
QListIterator<Okular::NormalizedPoint> it1(points1);
|
||||
QListIterator<Okular::NormalizedPoint> it2(points2);
|
||||
while (it1.hasNext() && it2.hasNext()) {
|
||||
const Okular::NormalizedPoint &p1 = it1.next();
|
||||
const Okular::NormalizedPoint &p2 = it2.next();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#ifndef OKULAR_TESTINGUTILS_H
|
||||
#define OKULAR_TESTINGUTILS_H
|
||||
|
||||
template<class T> class QLinkedList;
|
||||
template<class T> 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<Okular::NormalizedPoint> &points1, const QLinkedList<Okular::NormalizedPoint> &points2);
|
||||
bool pointListsAlmostEqual(const QList<Okular::NormalizedPoint> &points1, const QList<Okular::NormalizedPoint> &points2);
|
||||
|
||||
/*
|
||||
* The AnnotationDisposeWatcher class provides a static disposeAnnotation function
|
||||
|
|
|
@ -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>() << 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<Okular::NormalizedPoint> m_origPoints1;
|
||||
QLinkedList<Okular::NormalizedPoint> m_origPoints2;
|
||||
QList<Okular::NormalizedPoint> m_origPoints1;
|
||||
QList<Okular::NormalizedPoint> m_origPoints2;
|
||||
|
||||
QLinkedList<Okular::NormalizedPoint> m_points1DeltaA;
|
||||
QLinkedList<Okular::NormalizedPoint> m_points1DeltaAB;
|
||||
QLinkedList<Okular::NormalizedPoint> m_points2DeltaA;
|
||||
QLinkedList<Okular::NormalizedPoint> m_points2DeltaAB;
|
||||
QList<Okular::NormalizedPoint> m_points1DeltaA;
|
||||
QList<Okular::NormalizedPoint> m_points1DeltaAB;
|
||||
QList<Okular::NormalizedPoint> m_points2DeltaA;
|
||||
QList<Okular::NormalizedPoint> 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>() << 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>() << 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>() << 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>() << 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>() << 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>() << 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()
|
||||
|
|
|
@ -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<NormalizedPoint> &path)
|
||||
static double distanceSqr(double x, double y, double xScale, double yScale, const QList<NormalizedPoint> &path)
|
||||
{
|
||||
double distance = DBL_MAX;
|
||||
double thisDistance;
|
||||
QLinkedList<NormalizedPoint>::const_iterator i = path.constBegin();
|
||||
QList<NormalizedPoint>::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<NormalizedPoint> m_linePoints;
|
||||
QLinkedList<NormalizedPoint> m_transformedLinePoints;
|
||||
QList<NormalizedPoint> m_linePoints;
|
||||
QList<NormalizedPoint> 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<NormalizedPoint> &points)
|
||||
void LineAnnotation::setLinePoints(const QList<NormalizedPoint> &points)
|
||||
{
|
||||
Q_D(LineAnnotation);
|
||||
d->m_linePoints = points;
|
||||
}
|
||||
|
||||
QLinkedList<NormalizedPoint> LineAnnotation::linePoints() const
|
||||
QList<NormalizedPoint> LineAnnotation::linePoints() const
|
||||
{
|
||||
Q_D(const LineAnnotation);
|
||||
return d->m_linePoints;
|
||||
}
|
||||
|
||||
QLinkedList<NormalizedPoint> LineAnnotation::transformedLinePoints() const
|
||||
QList<NormalizedPoint> 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<NormalizedPoint>::const_iterator it = d->m_linePoints.begin(), end = d->m_linePoints.end();
|
||||
QList<NormalizedPoint>::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<NormalizedPoint> it(m_transformedLinePoints);
|
||||
QMutableListIterator<NormalizedPoint> it(m_transformedLinePoints);
|
||||
while (it.hasNext()) {
|
||||
it.next().transform(matrix);
|
||||
}
|
||||
|
@ -1624,7 +1624,7 @@ void LineAnnotationPrivate::baseTransform(const QTransform &matrix)
|
|||
{
|
||||
AnnotationPrivate::baseTransform(matrix);
|
||||
|
||||
QMutableLinkedListIterator<NormalizedPoint> it(m_linePoints);
|
||||
QMutableListIterator<NormalizedPoint> it(m_linePoints);
|
||||
while (it.hasNext()) {
|
||||
it.next().transform(matrix);
|
||||
}
|
||||
|
@ -1641,7 +1641,7 @@ void LineAnnotationPrivate::translate(const NormalizedPoint &coord)
|
|||
{
|
||||
AnnotationPrivate::translate(coord);
|
||||
|
||||
QMutableLinkedListIterator<NormalizedPoint> it(m_linePoints);
|
||||
QMutableListIterator<NormalizedPoint> 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<NormalizedPoint> transformedLinePoints = m_transformedLinePoints;
|
||||
QList<NormalizedPoint> 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<NormalizedPoint> 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<NormalizedPoint> 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<NormalizedPoint> pathPoints;
|
||||
QList<NormalizedPoint> 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<QLinkedList<NormalizedPoint>> m_inkPaths;
|
||||
QList<QLinkedList<NormalizedPoint>> m_transformedInkPaths;
|
||||
QList<QList<NormalizedPoint>> m_inkPaths;
|
||||
QList<QList<NormalizedPoint>> m_transformedInkPaths;
|
||||
};
|
||||
|
||||
InkAnnotation::InkAnnotation()
|
||||
|
@ -2372,19 +2371,19 @@ InkAnnotation::~InkAnnotation()
|
|||
{
|
||||
}
|
||||
|
||||
void InkAnnotation::setInkPaths(const QList<QLinkedList<NormalizedPoint>> &paths)
|
||||
void InkAnnotation::setInkPaths(const QList<QList<NormalizedPoint>> &paths)
|
||||
{
|
||||
Q_D(InkAnnotation);
|
||||
d->m_inkPaths = paths;
|
||||
}
|
||||
|
||||
QList<QLinkedList<NormalizedPoint>> InkAnnotation::inkPaths() const
|
||||
QList<QList<NormalizedPoint>> InkAnnotation::inkPaths() const
|
||||
{
|
||||
Q_D(const InkAnnotation);
|
||||
return d->m_inkPaths;
|
||||
}
|
||||
|
||||
QList<QLinkedList<NormalizedPoint>> InkAnnotation::transformedInkPaths() const
|
||||
QList<QList<NormalizedPoint>> 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<QLinkedList<NormalizedPoint>>::const_iterator pIt = d->m_inkPaths.begin(), pEnd = d->m_inkPaths.end();
|
||||
QList<QList<NormalizedPoint>>::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<NormalizedPoint> &path = *pIt;
|
||||
QLinkedList<NormalizedPoint>::const_iterator iIt = path.begin(), iEnd = path.end();
|
||||
for (; iIt != iEnd; ++iIt) {
|
||||
const NormalizedPoint &point = *iIt;
|
||||
const QList<NormalizedPoint> &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<NormalizedPoint> &path : m_transformedInkPaths) {
|
||||
for (const QList<NormalizedPoint> &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<NormalizedPoint> it(m_transformedInkPaths[i]);
|
||||
QMutableListIterator<NormalizedPoint> 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<NormalizedPoint> it(m_inkPaths[i]);
|
||||
QMutableListIterator<NormalizedPoint> 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<NormalizedPoint> it(m_inkPaths[i]);
|
||||
QMutableListIterator<NormalizedPoint> 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<NormalizedPoint> path;
|
||||
QList<NormalizedPoint> path;
|
||||
QDomNode pointNode = pathElement.firstChild();
|
||||
while (pointNode.isElement()) {
|
||||
QDomElement pointElement = pointNode.toElement();
|
||||
|
|
|
@ -938,19 +938,25 @@ public:
|
|||
|
||||
/**
|
||||
* Sets the normalized line @p points of the line annotation.
|
||||
*
|
||||
* @since 22.08
|
||||
*/
|
||||
void setLinePoints(const QLinkedList<NormalizedPoint> &points);
|
||||
void setLinePoints(const QList<NormalizedPoint> &points);
|
||||
|
||||
/**
|
||||
* Returns the normalized line points of the line annotation.
|
||||
*
|
||||
* @since 22.08
|
||||
*/
|
||||
QLinkedList<NormalizedPoint> linePoints() const;
|
||||
QList<NormalizedPoint> linePoints() const;
|
||||
|
||||
/**
|
||||
* Returns the transformed (e.g. rotated) normalized line points
|
||||
* of the line annotation.
|
||||
*
|
||||
* @since 22.08
|
||||
*/
|
||||
QLinkedList<NormalizedPoint> transformedLinePoints() const;
|
||||
QList<NormalizedPoint> 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<QLinkedList<NormalizedPoint>> &paths);
|
||||
void setInkPaths(const QList<QList<NormalizedPoint>> &paths);
|
||||
|
||||
/**
|
||||
* Returns the paths of points of the ink annotation.
|
||||
*
|
||||
* @since 22.08
|
||||
*/
|
||||
QList<QLinkedList<NormalizedPoint>> inkPaths() const;
|
||||
QList<QList<NormalizedPoint>> inkPaths() const;
|
||||
|
||||
/**
|
||||
* Returns the paths of transformed (e.g. rotated) points of
|
||||
* the ink annotation.
|
||||
*
|
||||
* @since 22.08
|
||||
*/
|
||||
QList<QLinkedList<NormalizedPoint>> transformedInkPaths() const;
|
||||
QList<QList<NormalizedPoint>> transformedInkPaths() const;
|
||||
|
||||
/**
|
||||
* Returns the sub type of the ink annotation.
|
||||
|
|
|
@ -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<Okular::PixmapRequest *> requestedPixmaps;
|
||||
QList<Okular::PixmapRequest *> requestedPixmaps;
|
||||
requestedPixmaps.push_back(pr);
|
||||
m_parent->requestPixmaps(requestedPixmaps, Okular::Document::NoOption);
|
||||
}
|
||||
|
||||
for (DocumentObserver *observer : qAsConst(m_observers)) {
|
||||
QLinkedList<Okular::PixmapRequest *> requestedPixmaps;
|
||||
QList<Okular::PixmapRequest *> 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<PixmapRequest *> &requests)
|
||||
void Document::requestPixmaps(const QList<PixmapRequest *> &requests)
|
||||
{
|
||||
requestPixmaps(requests, RemoveAllPrevious);
|
||||
}
|
||||
|
||||
void Document::requestPixmaps(const QLinkedList<PixmapRequest *> &requests, PixmapRequestFlags reqOptions)
|
||||
void Document::requestPixmaps(const QList<PixmapRequest *> &requests, PixmapRequestFlags reqOptions)
|
||||
{
|
||||
if (requests.isEmpty()) {
|
||||
return;
|
||||
|
@ -3332,10 +3332,7 @@ void Document::requestPixmaps(const QLinkedList<PixmapRequest *> &requests, Pixm
|
|||
|
||||
if (!d->m_pageController) {
|
||||
// delete requests..
|
||||
QLinkedList<PixmapRequest *>::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<PixmapRequest *> &requests, Pixm
|
|||
DocumentObserver *requesterObserver = requests.first()->observer();
|
||||
QSet<int> requestedPages;
|
||||
{
|
||||
QLinkedList<PixmapRequest *>::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;
|
||||
|
|
|
@ -489,8 +489,10 @@ public:
|
|||
* Sends @p requests for pixmap generation.
|
||||
*
|
||||
* The same as requestPixmaps( requests, RemoveAllPrevious );
|
||||
*
|
||||
* @since 22.08
|
||||
*/
|
||||
void requestPixmaps(const QLinkedList<PixmapRequest *> &requests);
|
||||
void requestPixmaps(const QList<PixmapRequest *> &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<PixmapRequest *> &requests, PixmapRequestFlags reqOptions);
|
||||
void requestPixmaps(const QList<PixmapRequest *> &requests, PixmapRequestFlags reqOptions);
|
||||
|
||||
/**
|
||||
* Sends a request for text page generation for the given page @p pageNumber.
|
||||
|
|
|
@ -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<Okular::NormalizedPoint> points;
|
||||
QList<Okular::NormalizedPoint> points;
|
||||
points.append(Okular::NormalizedPoint(a.x(), a.y(), w, h));
|
||||
points.append(Okular::NormalizedPoint(b.x(), b.y(), w, h));
|
||||
newlineann->setLinePoints(points);
|
||||
|
|
|
@ -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<Okular::PixmapRequest *>() << req);
|
||||
m_document->requestPixmaps({req});
|
||||
QVERIFY(m_document->page(0)->hasPixmap(dummyDocumentObserver, 3, 2));
|
||||
|
||||
// Obtain image
|
||||
|
|
|
@ -307,7 +307,7 @@ static void updatePopplerAnnotationFromOkularAnnotation(const Okular::TextAnnota
|
|||
static void updatePopplerAnnotationFromOkularAnnotation(const Okular::LineAnnotation *oLineAnnotation, Poppler::LineAnnotation *pLineAnnotation)
|
||||
{
|
||||
QLinkedList<QPointF> points;
|
||||
const QLinkedList<Okular::NormalizedPoint> annotPoints = oLineAnnotation->linePoints();
|
||||
const QList<Okular::NormalizedPoint> 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<QLinkedList<QPointF>> paths;
|
||||
const QList<QLinkedList<Okular::NormalizedPoint>> inkPathsList = oInkAnnotation->inkPaths();
|
||||
for (const QLinkedList<Okular::NormalizedPoint> &path : inkPathsList) {
|
||||
const QList<QList<Okular::NormalizedPoint>> inkPathsList = oInkAnnotation->inkPaths();
|
||||
for (const QList<Okular::NormalizedPoint> &path : inkPathsList) {
|
||||
QLinkedList<QPointF> 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<Okular::NormalizedPoint> points;
|
||||
QList<Okular::NormalizedPoint> points;
|
||||
const QLinkedList<QPointF> 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<QLinkedList<QPointF>> popplerInkPaths = popplerAnnotation->inkPaths();
|
||||
QList<QLinkedList<Okular::NormalizedPoint>> okularInkPaths;
|
||||
QList<QList<Okular::NormalizedPoint>> okularInkPaths;
|
||||
for (const QLinkedList<QPointF> &popplerInkPath : popplerInkPaths) {
|
||||
QLinkedList<Okular::NormalizedPoint> okularInkPath;
|
||||
QList<Okular::NormalizedPoint> okularInkPath;
|
||||
for (const QPointF &popplerPoint : popplerInkPath) {
|
||||
okularInkPath << Okular::NormalizedPoint(popplerPoint.x(), popplerPoint.y());
|
||||
}
|
||||
|
|
|
@ -463,19 +463,14 @@ void PagePainter::paintCroppedPageOnPainter(QPainter *destPainter,
|
|||
Okular::InkAnnotation *ia = (Okular::InkAnnotation *)a;
|
||||
|
||||
// draw each ink path
|
||||
const QList<QLinkedList<Okular::NormalizedPoint>> transformedInkPaths = ia->transformedInkPaths();
|
||||
const QList<QList<Okular::NormalizedPoint>> 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<Okular::NormalizedPoint> &inkPath = transformedInkPaths[p];
|
||||
|
||||
for (const QList<Okular::NormalizedPoint> &inkPath : transformedInkPaths) {
|
||||
// normalize page point to image
|
||||
QLinkedList<Okular::NormalizedPoint>::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<Okular::NormalizedPoint> transformedLinePoints = la->transformedLinePoints();
|
||||
const QList<Okular::NormalizedPoint> 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)};
|
||||
|
|
|
@ -84,7 +84,7 @@ QCursor AnnotatorEngine::cursor() const
|
|||
return Qt::CrossCursor;
|
||||
}
|
||||
|
||||
SmoothPath::SmoothPath(const QLinkedList<Okular::NormalizedPoint> &points, const QPen &pen, qreal opacity, QPainter::CompositionMode compositionMode)
|
||||
SmoothPath::SmoothPath(const QList<Okular::NormalizedPoint> &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<Okular::NormalizedPoint>::const_iterator pIt = points.begin(), pEnd = points.end();
|
||||
QList<Okular::NormalizedPoint>::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<Okular::Annotation *> SmoothPathEngine::end()
|
|||
ann->style().setWidth(m_annotElement.attribute(QStringLiteral("width")).toDouble());
|
||||
}
|
||||
// fill points
|
||||
QList<QLinkedList<Okular::NormalizedPoint>> list = ia->inkPaths();
|
||||
QList<QList<Okular::NormalizedPoint>> list = ia->inkPaths();
|
||||
list.append(points);
|
||||
ia->setInkPaths(list);
|
||||
// set boundaries
|
||||
|
|
|
@ -86,11 +86,11 @@ private:
|
|||
class SmoothPath
|
||||
{
|
||||
public:
|
||||
SmoothPath(const QLinkedList<Okular::NormalizedPoint> &points, const QPen &pen, qreal opacity = 1.0, QPainter::CompositionMode compositionMode = QPainter::CompositionMode_SourceOver);
|
||||
SmoothPath(const QList<Okular::NormalizedPoint> &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<Okular::NormalizedPoint> points;
|
||||
const QList<Okular::NormalizedPoint> points;
|
||||
const QPen pen;
|
||||
const qreal opacity;
|
||||
const QPainter::CompositionMode compositionMode;
|
||||
|
@ -112,7 +112,7 @@ public:
|
|||
|
||||
private:
|
||||
// data
|
||||
QLinkedList<Okular::NormalizedPoint> points;
|
||||
QList<Okular::NormalizedPoint> points;
|
||||
Okular::NormalizedRect totalRect;
|
||||
Okular::NormalizedPoint lastPoint;
|
||||
QPainter::CompositionMode compositionMode;
|
||||
|
|
|
@ -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>() << 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>() << 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;
|
||||
|
|
|
@ -112,8 +112,6 @@ void MagnifierView::requestPixmap()
|
|||
Okular::NormalizedRect nrect = normalizedView();
|
||||
|
||||
if (m_page && !m_page->hasPixmap(this, full_width, full_height, nrect)) {
|
||||
QLinkedList<Okular::PixmapRequest *> 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});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4640,7 +4640,7 @@ void PageView::delayedResizeEvent()
|
|||
slotRequestVisiblePixmaps();
|
||||
}
|
||||
|
||||
static void slotRequestPreloadPixmap(PageView *pageView, const PageViewItem *i, const QRect expandedViewportRect, QLinkedList<Okular::PixmapRequest *> *requestedPixmaps)
|
||||
static void slotRequestPreloadPixmap(PageView *pageView, const PageViewItem *i, const QRect expandedViewportRect, QList<Okular::PixmapRequest *> *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<Okular::PixmapRequest *> requestedPixmaps;
|
||||
QList<Okular::PixmapRequest *> requestedPixmaps;
|
||||
QVector<Okular::VisiblePageRect *> visibleRects;
|
||||
for (PageViewItem *i : qAsConst(d->items)) {
|
||||
const QSet<FormWidgetIface *> formWidgetsList = i->formWidgets();
|
||||
|
|
|
@ -559,12 +559,8 @@ public:
|
|||
// add note
|
||||
Okular::LineAnnotation *la = new Okular::LineAnnotation();
|
||||
ann = la;
|
||||
QLinkedList<Okular::NormalizedPoint> 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);
|
||||
|
|
|
@ -1451,7 +1451,7 @@ void PresentationWidget::requestPixmaps()
|
|||
// operation will take long: set busy cursor
|
||||
QApplication::setOverrideCursor(QCursor(Qt::BusyCursor));
|
||||
// request the pixmap
|
||||
QLinkedList<Okular::PixmapRequest *> requests;
|
||||
QList<Okular::PixmapRequest *> requests;
|
||||
requests.push_back(new Okular::PixmapRequest(this, m_frameIndex, pixW, pixH, dpr, PRESENTATION_PRIO, Okular::PixmapRequest::NoFeature));
|
||||
// restore cursor
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
|
|
@ -672,7 +672,7 @@ void ThumbnailListPrivate::slotRequestVisiblePixmaps()
|
|||
|
||||
// scroll from the top to the last visible thumbnail
|
||||
m_visibleThumbnails.clear();
|
||||
QLinkedList<Okular::PixmapRequest *> requestedPixmaps;
|
||||
QList<Okular::PixmapRequest *> requestedPixmaps;
|
||||
QVector<ThumbnailWidget *>::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) {
|
||||
|
|
Loading…
Reference in a new issue