Remove unneccessary SvgProvider
This commit is contained in:
parent
0312a367f4
commit
40da0790e2
6 changed files with 3 additions and 79 deletions
|
@ -26,7 +26,6 @@ INSTALLS += i18n
|
||||||
system(lrelease $$PWD/translations/*.ts)
|
system(lrelease $$PWD/translations/*.ts)
|
||||||
|
|
||||||
CONFIG += sailfishapp
|
CONFIG += sailfishapp
|
||||||
QT += svg
|
|
||||||
PKGCONFIG += mlite5 libcurl poppler glib-2.0 cairo
|
PKGCONFIG += mlite5 libcurl poppler glib-2.0 cairo
|
||||||
LIBS += -lcurl -lglib-2.0 -lgobject-2.0 -ldl
|
LIBS += -lcurl -lglib-2.0 -lgobject-2.0 -ldl
|
||||||
DEFINES += MADNESS=1
|
DEFINES += MADNESS=1
|
||||||
|
@ -46,8 +45,7 @@ SOURCES += src/harbour-seaprint.cpp \
|
||||||
ppm2pwg/bytestream/bytestream.cpp \
|
ppm2pwg/bytestream/bytestream.cpp \
|
||||||
src/overrider.cpp \
|
src/overrider.cpp \
|
||||||
src/printerworker.cpp \
|
src/printerworker.cpp \
|
||||||
src/settings.cpp \
|
src/settings.cpp
|
||||||
src/svgprovider.cpp
|
|
||||||
|
|
||||||
DISTFILES += qml/harbour-seaprint.qml \
|
DISTFILES += qml/harbour-seaprint.qml \
|
||||||
qml/components/DependentOn.qml \
|
qml/components/DependentOn.qml \
|
||||||
|
@ -100,8 +98,7 @@ HEADERS += \
|
||||||
src/overrider.h \
|
src/overrider.h \
|
||||||
src/papersizes.h \
|
src/papersizes.h \
|
||||||
src/printerworker.h \
|
src/printerworker.h \
|
||||||
src/settings.h \
|
src/settings.h
|
||||||
src/svgprovider.h
|
|
||||||
|
|
||||||
INCLUDEPATH += ppm2pwg \
|
INCLUDEPATH += ppm2pwg \
|
||||||
ppm2pwg/bytestream
|
ppm2pwg/bytestream
|
||||||
|
|
|
@ -231,7 +231,7 @@ Page {
|
||||||
sourceSize.width: width
|
sourceSize.width: width
|
||||||
|
|
||||||
visible: !parent.valid
|
visible: !parent.valid
|
||||||
source: "image://svg/qml/pages/icon-seaprint-nobg.svg"
|
source: "icon-seaprint-nobg.svg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ BuildRequires: pkgconfig(sailfishapp) >= 1.0.2
|
||||||
BuildRequires: pkgconfig(Qt5Core)
|
BuildRequires: pkgconfig(Qt5Core)
|
||||||
BuildRequires: pkgconfig(Qt5Qml)
|
BuildRequires: pkgconfig(Qt5Qml)
|
||||||
BuildRequires: pkgconfig(Qt5Quick)
|
BuildRequires: pkgconfig(Qt5Quick)
|
||||||
BuildRequires: pkgconfig(Qt5Svg)
|
|
||||||
BuildRequires: pkgconfig(mlite5)
|
BuildRequires: pkgconfig(mlite5)
|
||||||
BuildRequires: desktop-file-utils
|
BuildRequires: desktop-file-utils
|
||||||
BuildRequires: pkgconfig(libcurl)
|
BuildRequires: pkgconfig(libcurl)
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include <src/imageitem.h>
|
#include <src/imageitem.h>
|
||||||
#include <src/mimer.h>
|
#include <src/mimer.h>
|
||||||
#include <src/convertchecker.h>
|
#include <src/convertchecker.h>
|
||||||
#include <src/svgprovider.h>
|
|
||||||
#include <src/settings.h>
|
#include <src/settings.h>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(CURLcode)
|
Q_DECLARE_METATYPE(CURLcode)
|
||||||
|
@ -48,7 +47,6 @@ int main(int argc, char *argv[])
|
||||||
QQuickView* view = SailfishApp::createView();
|
QQuickView* view = SailfishApp::createView();
|
||||||
|
|
||||||
view->engine()->addImportPath(SailfishApp::pathTo("qml/pages").toString());
|
view->engine()->addImportPath(SailfishApp::pathTo("qml/pages").toString());
|
||||||
view->engine()->addImageProvider(QLatin1String("svg"), SvgProvider::instance());
|
|
||||||
|
|
||||||
view->setSource(SailfishApp::pathToMainQml());
|
view->setSource(SailfishApp::pathToMainQml());
|
||||||
view->show();
|
view->show();
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
#include "svgprovider.h"
|
|
||||||
|
|
||||||
|
|
||||||
SvgProvider::SvgProvider() : QQuickImageProvider(QQuickImageProvider::Image, ForceAsynchronousImageLoading)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SvgProvider::~SvgProvider() {
|
|
||||||
}
|
|
||||||
|
|
||||||
SvgProvider* SvgProvider::m_Instance = nullptr;
|
|
||||||
|
|
||||||
SvgProvider* SvgProvider::instance()
|
|
||||||
{
|
|
||||||
static QMutex mutex;
|
|
||||||
if (!m_Instance)
|
|
||||||
{
|
|
||||||
mutex.lock();
|
|
||||||
|
|
||||||
if (!m_Instance)
|
|
||||||
m_Instance = new SvgProvider;
|
|
||||||
|
|
||||||
mutex.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
QImage SvgProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
|
|
||||||
{
|
|
||||||
QSvgRenderer renderer(SailfishApp::pathTo(id).toLocalFile());
|
|
||||||
*size = requestedSize.isValid() ? requestedSize : renderer.defaultSize();
|
|
||||||
|
|
||||||
QImage img(*size, QImage::Format_ARGB32);
|
|
||||||
img.fill(QColor("transparent"));
|
|
||||||
QPainter painter(&img);
|
|
||||||
|
|
||||||
renderer.render(&painter);
|
|
||||||
|
|
||||||
return img;
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
#ifndef SVGPROVIDER_H
|
|
||||||
#define SVGPROVIDER_H
|
|
||||||
|
|
||||||
#include <QQuickImageProvider>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QtSvg/QSvgRenderer>
|
|
||||||
#include <QMutex>
|
|
||||||
#include <QtDebug>
|
|
||||||
#include <sailfishapp.h>
|
|
||||||
|
|
||||||
class SvgProvider : public QQuickImageProvider
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static SvgProvider* instance();
|
|
||||||
|
|
||||||
QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
SvgProvider();
|
|
||||||
~SvgProvider();
|
|
||||||
SvgProvider(const SvgProvider &);
|
|
||||||
SvgProvider& operator=(const SvgProvider &);
|
|
||||||
|
|
||||||
static SvgProvider* m_Instance;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // SVGPROVIDER_H
|
|
Loading…
Reference in a new issue