Commit b74698da authored by Wescoeur's avatar Wescoeur

feat(ImageProvider): add a timer to calculate image loading

parent 824ba007
...@@ -20,13 +20,14 @@ ...@@ -20,13 +20,14 @@
* Author: Ronan Abhamon * Author: Ronan Abhamon
*/ */
#include <QElapsedTimer>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QImage> #include <QImage>
#include <QPainter> #include <QPainter>
#include <QSvgRenderer> #include <QSvgRenderer>
#include <QXmlStreamReader>
#include <QtDebug> #include <QtDebug>
#include <QXmlStreamReader>
#include "../App.hpp" #include "../App.hpp"
...@@ -207,6 +208,9 @@ ImageProvider::ImageProvider () : QQuickImageProvider( ...@@ -207,6 +208,9 @@ ImageProvider::ImageProvider () : QQuickImageProvider(
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
QImage ImageProvider::requestImage (const QString &id, QSize *, const QSize &) { QImage ImageProvider::requestImage (const QString &id, QSize *, const QSize &) {
QElapsedTimer timer;
timer.start();
const QString path = QStringLiteral(":/assets/images/%1").arg(id); const QString path = QStringLiteral(":/assets/images/%1").arg(id);
// 1. Read and update XML content. // 1. Read and update XML content.
...@@ -245,5 +249,7 @@ QImage ImageProvider::requestImage (const QString &id, QSize *, const QSize &) { ...@@ -245,5 +249,7 @@ QImage ImageProvider::requestImage (const QString &id, QSize *, const QSize &) {
QPainter painter(&image); QPainter painter(&image);
renderer.render(&painter); renderer.render(&painter);
qInfo() << QStringLiteral("Image `%1` loaded in %2 milliseconds.").arg(path).arg(timer.elapsed());
return image; return image;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment