ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #07523
[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/lok-qml-async-imageprovider into lp:ubuntu-docviewer-app
Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-docviewer-app/lok-qml-async-imageprovider into lp:ubuntu-docviewer-app with lp:~ubuntu-docviewer-dev/ubuntu-docviewer-app/ubuntu-docviewer-app-re-fix as a prerequisite.
Commit message:
Use QQuickAsyncImageProvider in LOPartsImageProvider class.
This is backported on Ubuntu/Ubuntu Touch since Qt 5.4.1-1ubuntu7.
On any other distro/OS it works only with Qt 5.6 (or later).
Requested reviews:
Jenkins Bot (ubuntu-core-apps-jenkins-bot): continuous-integration
Roman Shchekin (mrqtros)
Ubuntu Document Viewer Developers (ubuntu-docviewer-dev)
For more details, see:
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/lok-qml-async-imageprovider/+merge/282878
Use QQuickAsyncImageProvider in LOPartsImageProvider class.
This is backported on Ubuntu/Ubuntu Touch since Qt 5.4.1-1ubuntu7.
On any other distro/OS it works only with Qt 5.6 (or later).
--
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-docviewer-app/lok-qml-async-imageprovider into lp:ubuntu-docviewer-app.
=== modified file 'po/com.ubuntu.docviewer.pot'
--- po/com.ubuntu.docviewer.pot 2016-01-16 12:31:49 +0000
+++ po/com.ubuntu.docviewer.pot 2016-01-17 21:17:43 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2016-01-16 13:11+0100\n"
+"POT-Creation-Date: 2016-01-07 12:16+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -42,7 +42,7 @@
#: ../src/app/qml/common/DetailsPage.qml:26
#: ../src/app/qml/loView/LOViewDefaultHeader.qml:107
-#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:90
+#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:83
#: ../src/app/qml/textView/TextViewDefaultHeader.qml:69
msgid "Details"
msgstr ""
@@ -189,33 +189,33 @@
#. TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
#. http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
-#: ../src/app/qml/documentPage/DocumentListDelegate.qml:103
+#: ../src/app/qml/documentPage/DocumentListDelegate.qml:100
#, qt-format
msgid "Today, %1"
msgstr ""
#. TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
#. http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
-#: ../src/app/qml/documentPage/DocumentListDelegate.qml:108
+#: ../src/app/qml/documentPage/DocumentListDelegate.qml:105
#, qt-format
msgid "Yesterday, %1"
msgstr ""
#. TRANSLATORS: this is a datetime formatting string,
#. see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
-#: ../src/app/qml/documentPage/DocumentListDelegate.qml:115
-#: ../src/app/qml/documentPage/DocumentListDelegate.qml:134
+#: ../src/app/qml/documentPage/DocumentListDelegate.qml:112
+#: ../src/app/qml/documentPage/DocumentListDelegate.qml:131
msgid "yyyy/MM/dd hh:mm"
msgstr ""
#. TRANSLATORS: this is a datetime formatting string,
#. see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
-#: ../src/app/qml/documentPage/DocumentListDelegate.qml:128
+#: ../src/app/qml/documentPage/DocumentListDelegate.qml:125
msgid "dddd, hh:mm"
msgstr ""
#: ../src/app/qml/documentPage/DocumentPage.qml:23
-#: /tmp/lok-qml-currentpart-moved-build/po/com.ubuntu.docviewer.desktop.in.in.h:3
+#: /tmp/lok-qml-async-imageprovider-build/po/com.ubuntu.docviewer.desktop.in.in.h:3
msgid "Documents"
msgstr ""
@@ -342,13 +342,13 @@
msgstr ""
#: ../src/app/qml/loView/LOViewDefaultHeader.qml:100
-#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:84
+#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:77
#: ../src/app/qml/textView/TextViewDefaultHeader.qml:63
msgid "Disable night mode"
msgstr ""
#: ../src/app/qml/loView/LOViewDefaultHeader.qml:100
-#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:84
+#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:77
#: ../src/app/qml/textView/TextViewDefaultHeader.qml:63
msgid "Enable night mode"
msgstr ""
@@ -403,7 +403,6 @@
#. TRANSLATORS: the first argument (%1) refers to the page currently shown on the screen,
#. while the second one (%2) refers to the total pages count.
-#: ../src/app/qml/pdfView/PdfPresentation.qml:51
#: ../src/app/qml/pdfView/PdfView.qml:35
#, qt-format
msgid "Page %1 of %2"
@@ -413,10 +412,6 @@
msgid "Go to page..."
msgstr ""
-#: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:78
-msgid "Presentation"
-msgstr ""
-
#: ../src/app/qml/pdfView/PdfViewGotoDialog.qml:26
msgid "Go to page"
msgstr ""
@@ -444,10 +439,10 @@
msgid "copy %1"
msgstr ""
-#: /tmp/lok-qml-currentpart-moved-build/po/com.ubuntu.docviewer.desktop.in.in.h:1
+#: /tmp/lok-qml-async-imageprovider-build/po/com.ubuntu.docviewer.desktop.in.in.h:1
msgid "Document Viewer"
msgstr ""
-#: /tmp/lok-qml-currentpart-moved-build/po/com.ubuntu.docviewer.desktop.in.in.h:2
+#: /tmp/lok-qml-async-imageprovider-build/po/com.ubuntu.docviewer.desktop.in.in.h:2
msgid "documents;viewer;pdf;reader;"
msgstr ""
=== modified file 'src/app/qml/loView/PartsView.qml'
--- src/app/qml/loView/PartsView.qml 2016-01-08 16:26:46 +0000
+++ src/app/qml/loView/PartsView.qml 2016-01-17 21:17:43 +0000
@@ -85,13 +85,18 @@
/* UITK 1.3 specs: Slot B */
Image {
+ id: thumb
SlotsLayout.position: SlotsLayout.Leading
- height: parent.height; width: height
+ height: parent.height; width: units.gu(12)
fillMode: Image.PreserveAspectFit
// Do not store a cache of the thumbnail, so that we don't show
// thumbnails of a previously loaded document.
cache: true // TODO PLAY WITH IT
- source: model.thumbnail
+ source: "image://lok/part/%1".arg(model.index)
+ sourceSize {
+ width: thumb.height
+ height: thumb.width
+ }
}
/* UITK 1.3 specs: Slot A */
@@ -141,12 +146,12 @@
Image {
Layout.fillWidth: true
- Layout.preferredHeight: width
+ Layout.fillHeight: true
fillMode: Image.PreserveAspectFit
// Do not store a cache of the thumbnail, so that we don't show
// thumbnails of a previously loaded document.
cache: true // TODO PLAY WITH IT
- source: model.thumbnail
+ source: "image://lok/part/%1".arg(model.index)
}
Label {
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/CMakeLists.txt'
--- src/plugin/libreofficetoolkit-qml-plugin/CMakeLists.txt 2015-12-12 10:06:55 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/CMakeLists.txt 2016-01-17 21:17:43 +0000
@@ -23,6 +23,7 @@
loview.cpp
sgtileitem.cpp
lopartsimageprovider.cpp
+ lopartsimageresponse.cpp
lopartsmodel.cpp
lorendertask.cpp
${QML_SRCS}
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp'
--- src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp 2015-12-14 00:40:55 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp 2016-01-17 21:17:43 +0000
@@ -179,7 +179,7 @@
return result.rgbSwapped();
}
-QImage LODocument::paintThumbnail(int part, qreal size)
+QImage LODocument::paintPart(int part, const QSize &size)
{
if (!m_lokDocument)
return QImage();
@@ -197,11 +197,11 @@
QSize resultSize;
if (tWidth > tHeight) {
- resultSize.setWidth(size);
- resultSize.setHeight(size * tHeight / tWidth);
+ resultSize.setWidth(size.width());
+ resultSize.setHeight(size.width() * tHeight / tWidth);
} else {
- resultSize.setHeight(size);
- resultSize.setWidth(size * tWidth / tHeight);
+ resultSize.setHeight(size.height());
+ resultSize.setWidth(size.height() * tWidth / tHeight);
}
QImage result = QImage(resultSize.width(), resultSize.height(), QImage::Format_RGB32);
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/lodocument.h'
--- src/plugin/libreofficetoolkit-qml-plugin/lodocument.h 2015-12-14 00:40:55 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/lodocument.h 2016-01-17 21:17:43 +0000
@@ -63,7 +63,7 @@
QSize documentSize() const;
QImage paintTile(int part, const QSize& canvasSize, const QRect& tileSize, const qreal& zoom = 1.0);
- QImage paintThumbnail(int part, qreal size);
+ QImage paintPart(int part, const QSize &size);
int partsCount();
QString getPartName(int index) const;
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/lopartsimageprovider.cpp'
--- src/plugin/libreofficetoolkit-qml-plugin/lopartsimageprovider.cpp 2015-12-12 10:06:55 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/lopartsimageprovider.cpp 2016-01-17 21:17:43 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 Canonical, Ltd.
+ * Copyright (C) 2015 Stefano Verzegnassi
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
@@ -15,50 +15,20 @@
*/
#include "lopartsimageprovider.h"
+#include "lopartsimageresponse.h"
#include "lodocument.h"
-#include "../../app/renderengine.h"
LOPartsImageProvider::LOPartsImageProvider(const QSharedPointer<LODocument>& d)
- : QQuickImageProvider(QQuickImageProvider::Image),
+ : QQuickAsyncImageProvider(),
m_document(d)
{ }
-QImage LOPartsImageProvider::requestImage(const QString & id, QSize * size, const QSize & requestedSize)
+QQuickImageResponse *LOPartsImageProvider::requestImageResponse(const QString & id, const QSize & requestedSize)
{
- Q_UNUSED(size)
-
QString type = id.section("/", 0, 0);
- if (requestedSize.isNull() || type != "part" ||
- m_document->documentType() != LODocument::PresentationDocument)
- return QImage();
-
- // Get info from "id".
- int partNumber = id.section("/", 1, 1).toInt();
- int itemId = id.section("/", 2, 2).toInt();
-
- // Once rendered images can be found in hash.
- if (m_images.contains(itemId))
- return m_images[itemId];
-
- const int defaultSize = 256;
-
- RenderEngine::instance()->enqueueTask(createTask(partNumber, defaultSize, itemId));
-
- // Return default image (empty).
- static QImage defaultImage;
- if (defaultImage.isNull())
- defaultImage = QImage(defaultSize, defaultSize, QImage::Format_ARGB32);
-
- return defaultImage;
-}
-
-ThumbnailRenderTask *LOPartsImageProvider::createTask(int part, qreal size, int id) const
-{
- ThumbnailRenderTask* task = new ThumbnailRenderTask();
- task->setId(id);
- task->setPart(part);
- task->setDocument(m_document);
- task->setSize(size);
- return task;
+ bool isValid = bool(!requestedSize.isNull() || type == "part" ||
+ m_document.data()->documentType() == LODocument::PresentationDocument);
+
+ return new LOPartsImageResponse(m_document, id, requestedSize, isValid);
}
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/lopartsimageprovider.h'
--- src/plugin/libreofficetoolkit-qml-plugin/lopartsimageprovider.h 2015-12-12 10:06:55 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/lopartsimageprovider.h 2016-01-17 21:17:43 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 Canonical, Ltd.
+ * Copyright (C) 2015 Stefano Verzegnassi
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
@@ -18,28 +18,20 @@
#ifndef LOPARTSIMAGEPROVIDER_H
#define LOPARTSIMAGEPROVIDER_H
-#include <QQuickImageProvider>
+// For QQuickAsyncImageProvider
+#include <qquickimageprovider.h>
#include <QSharedPointer>
-#include <QHash>
-#include <QDebug>
-
-#include "lorendertask.h"
class LODocument;
-class LOPartsImageProvider : public QQuickImageProvider
+class LOPartsImageProvider : public QQuickAsyncImageProvider
{
public:
LOPartsImageProvider(const QSharedPointer<LODocument>& d);
- QImage requestImage(const QString & id, QSize * size, const QSize & requestedSize);
-
- QHash<int, QImage> m_images;
+ QQuickImageResponse* requestImageResponse(const QString & id, const QSize & requestedSize);
private:
QSharedPointer<LODocument> m_document;
-
-private:
- ThumbnailRenderTask* createTask(int part, qreal size, int id) const;
};
#endif // LOPARTSIMAGEPROVIDER_H
=== added file 'src/plugin/libreofficetoolkit-qml-plugin/lopartsimageresponse.cpp'
--- src/plugin/libreofficetoolkit-qml-plugin/lopartsimageresponse.cpp 1970-01-01 00:00:00 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/lopartsimageresponse.cpp 2016-01-17 21:17:43 +0000
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2015 Roman Shchekin
+ * Copyright (C) 2015 Stefano Verzegnassi
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 3, as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "lopartsimageresponse.h"
+#include "lodocument.h"
+#include "../../app/renderengine.h"
+#include "lorendertask.h"
+
+LOPartsImageResponse::LOPartsImageResponse(const QSharedPointer<LODocument>& document, const QString & id, const QSize & requestedSize, bool requestIsValid) :
+ m_document(document)
+{
+ if (!requestIsValid) {
+ m_errorString = "Requested size or id are not valid.";
+
+ // Emit 'finished' signal and return an empty image.
+ QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
+ return;
+ }
+
+ m_task = new ThumbnailRenderTask();
+ m_task->setIsOwnedByCaller(true); // Take the ownership of the task, for now.
+ m_task->setId(RenderEngine::getNextId());
+ m_task->setPart(id.section("/", 1, 1).toInt());
+ m_task->setDocument(m_document);
+
+ if (!requestedSize.isEmpty()) {
+ m_task->setSize(requestedSize);
+ } else {
+ m_task->setSize(QSize(256, 256));
+ }
+
+ connect(RenderEngine::instance(), &RenderEngine::taskRenderFinished,
+ this, &LOPartsImageResponse::slotTaskRenderFinished);
+
+ QMetaObject::invokeMethod(RenderEngine::instance(), "enqueueTask",
+ Qt::QueuedConnection,
+ Q_ARG(AbstractRenderTask*, m_task));
+}
+
+LOPartsImageResponse::~LOPartsImageResponse()
+{
+ this->cancel();
+}
+
+QString LOPartsImageResponse::errorString() const
+{
+ return m_errorString;
+}
+
+QQuickTextureFactory * LOPartsImageResponse::textureFactory() const
+{
+ return QQuickTextureFactory::textureFactoryForImage(m_image);
+}
+
+void LOPartsImageResponse::cancel()
+{
+ disconnect(RenderEngine::instance(), &RenderEngine::taskRenderFinished,
+ this, &LOPartsImageResponse::slotTaskRenderFinished);
+
+ if (m_task) {
+ // Give to the RenderEngine the ownership of the task, so that it can
+ // be dequeued and deleted.
+ m_task->setIsOwnedByCaller(false);
+
+ QMetaObject::invokeMethod(RenderEngine::instance(), "dequeueTask",
+ Qt::QueuedConnection,
+ Q_ARG(int, m_task->id()));
+ }
+}
+
+void LOPartsImageResponse::slotTaskRenderFinished(AbstractRenderTask* task, QImage img)
+{
+ if (task->id() == m_task->id() && task->type() == RttImpressThumbnail) {
+ m_image = img;
+ Q_EMIT finished();
+ }
+}
=== added file 'src/plugin/libreofficetoolkit-qml-plugin/lopartsimageresponse.h'
--- src/plugin/libreofficetoolkit-qml-plugin/lopartsimageresponse.h 1970-01-01 00:00:00 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/lopartsimageresponse.h 2016-01-17 21:17:43 +0000
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2015 Stefano Verzegnassi
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 3, as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef LOPARTSIMAGERESPONSE_H
+#define LOPARTSIMAGEPROVIDER_H
+
+// For QQuickImageResponse
+#include <qquickimageprovider.h>
+#include <QSharedPointer>
+
+class LODocument;
+class AbstractRenderTask;
+class ThumbnailRenderTask;
+
+class LOPartsImageResponse : public QQuickImageResponse
+{
+public:
+ LOPartsImageResponse(const QSharedPointer<LODocument>& document, const QString & id, const QSize & requestedSize, bool requestIsValid);
+ ~LOPartsImageResponse();
+
+ QString errorString() const override;
+ QQuickTextureFactory * textureFactory() const override;
+ void cancel() override;
+
+private Q_SLOTS:
+ void slotTaskRenderFinished(AbstractRenderTask* task, QImage img);
+
+private:
+ QSharedPointer<LODocument> m_document;
+ ThumbnailRenderTask* m_task;
+
+ QString m_errorString;
+ QImage m_image;
+};
+
+
+#endif // LOPARTSIMAGERESPONSE_H
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/lopartsmodel.cpp'
--- src/plugin/libreofficetoolkit-qml-plugin/lopartsmodel.cpp 2015-10-11 11:31:22 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/lopartsmodel.cpp 2016-01-17 21:17:43 +0000
@@ -33,8 +33,6 @@
QHash<int, QByteArray> roles;
roles[IndexRole] = "index";
roles[NameRole] = "name";
- roles[IdRole] = "id";
- roles[ThumbnailRole] = "thumbnail";
return roles;
}
@@ -57,10 +55,6 @@
return part.index;
case NameRole:
return part.name;
- case IdRole:
- return part.id;
- case ThumbnailRole:
- return part.thumbnail;
default:
return 0;
@@ -79,22 +73,10 @@
QVariantMap map;
map["name"] = part.name;
map["index"] = part.index;
- map["id"] = part.id;
- map["thumbnail"] = part.thumbnail;
return map;
}
-void LOPartsModel::notifyAboutChanges(int id)
-{
- for (int i = 0; i < m_entries.size(); i++)
- if (m_entries[i].id == id) {
- m_entries[i].thumbnail += "/cached";
- Q_EMIT dataChanged(createIndex(i, 0), createIndex(i + 1, 0));
- break;
- }
-}
-
void LOPartsModel::fillModel() {
if (!m_document)
return;
@@ -112,8 +94,6 @@
part.index = i;
part.name = m_document->getPartName(i);
- part.id = RenderEngine::getNextId();
- part.thumbnail = QString("image://lok/part/%1/%2").arg(QString::number(part.index)).arg(QString::number(part.id));
m_entries.append(part);
}
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/lopartsmodel.h'
--- src/plugin/libreofficetoolkit-qml-plugin/lopartsmodel.h 2015-12-12 10:06:55 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/lopartsmodel.h 2016-01-17 21:17:43 +0000
@@ -30,14 +30,11 @@
{
public:
LOPartEntry():
- id(0),
index(0)
{ }
- int id;
int index;
QString name;
- QString thumbnail;
};
class LOPartsModel : public QAbstractListModel
@@ -50,8 +47,6 @@
enum Roles {
NameRole = Qt::UserRole + 1,
IndexRole,
- IdRole,
- ThumbnailRole
};
explicit LOPartsModel(const QSharedPointer<LODocument>& document, QAbstractListModel *parent = 0);
@@ -64,8 +59,6 @@
Q_INVOKABLE QVariantMap get(int index) const;
- void notifyAboutChanges(int id);
-
Q_SIGNALS:
void countChanged();
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/lorendertask.cpp'
--- src/plugin/libreofficetoolkit-qml-plugin/lorendertask.cpp 2016-01-07 11:23:50 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/lorendertask.cpp 2016-01-17 21:17:43 +0000
@@ -21,5 +21,5 @@
QImage ThumbnailRenderTask::doWork()
{
- return m_document->paintThumbnail(m_part, m_size);
+ return m_document->paintPart(m_part, m_size);
}
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/lorendertask.h'
--- src/plugin/libreofficetoolkit-qml-plugin/lorendertask.h 2016-01-07 11:23:50 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/lorendertask.h 2016-01-17 21:17:43 +0000
@@ -48,10 +48,10 @@
virtual RenderTaskType type() { return RttImpressThumbnail; }
virtual QImage doWork();
- qreal size() { return m_size; }
- void setSize(qreal s) { m_size = s; }
+ QSize size() const { return m_size; }
+ void setSize(const QSize & s) { m_size = s; }
protected:
- qreal m_size;
+ QSize m_size;
};
#endif // LORENDERTASK_H
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/loview.cpp'
--- src/plugin/libreofficetoolkit-qml-plugin/loview.cpp 2015-12-14 00:40:55 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/loview.cpp 2016-01-17 21:17:43 +0000
@@ -365,9 +365,15 @@
void LOView::slotTaskRenderFinished(AbstractRenderTask* task, QImage img)
{
if (task->type() == RttTile) {
- updateTileData(task, img);
- } else if (task->type() == RttImpressThumbnail) {
- updateThumbnailModel(task, img);
+ int id = task->id();
+
+ for (auto i = m_tiles.begin(); i != m_tiles.end(); ++i) {
+ SGTileItem* sgtile = i.value();
+ if (sgtile->id() == id) {
+ sgtile->setData(img);
+ break;
+ }
+ }
}
}
@@ -424,25 +430,6 @@
return task;
}
-void LOView::updateTileData(AbstractRenderTask* task, QImage img)
-{
- int id = task->id();
- for (auto i = m_tiles.begin(); i != m_tiles.end(); ++i) {
- SGTileItem* sgtile = i.value();
- if (sgtile->id() == id) {
- sgtile->setData(img);
- break;
- }
- }
-}
-
-void LOView::updateThumbnailModel(AbstractRenderTask* task, QImage img)
-{
- int id = task->id();
- if (!m_imageProvider->m_images.contains(id))
- m_imageProvider->m_images.insert(id, img);
- m_partsModel->notifyAboutChanges(id);
-}
void LOView::setError(const LibreOfficeError::Error &error)
{
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/loview.h'
--- src/plugin/libreofficetoolkit-qml-plugin/loview.h 2016-01-07 11:23:50 +0000
+++ src/plugin/libreofficetoolkit-qml-plugin/loview.h 2016-01-17 21:17:43 +0000
@@ -120,8 +120,6 @@
void setZoomMode(const ZoomMode zoomMode);
void clearView();
TileRenderTask* createTask(const QRect& rect, int id) const;
- void updateTileData(AbstractRenderTask* task, QImage img);
- void updateThumbnailModel(AbstractRenderTask* task, QImage img);
void setError(const LibreOfficeError::Error &error);
};