Changeset View
Changeset View
Standalone View
Standalone View
kcms/fonts/previewimageprovider.cpp
Show All 15 Lines | 1 | /* | |||
---|---|---|---|---|---|
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | Boston, MA 02110-1301, USA. | 17 | Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include <QApplication> | 20 | #include <QApplication> | ||
21 | #include <QPainter> | 21 | #include <QPainter> | ||
22 | #include <QPalette> | 22 | #include <QPalette> | ||
23 | 23 | | |||
24 | #include <KWindowSystem> | ||||
25 | | ||||
24 | #include "kxftconfig.h" | 26 | #include "kxftconfig.h" | ||
25 | #include "previewimageprovider.h" | 27 | #include "previewimageprovider.h" | ||
26 | #include "previewrenderengine.h" | 28 | #include "previewrenderengine.h" | ||
27 | 29 | | |||
28 | QImage combineImages(const QList<QImage>& images, const QColor& bgnd, int spacing=0) | 30 | QImage combineImages(const QList<QImage>& images, const QColor& bgnd, int spacing=0) | ||
29 | { | 31 | { | ||
30 | int width = 0; | 32 | int width = 0; | ||
31 | int height = 0; | 33 | int height = 0; | ||
Show All 31 Lines | |||||
63 | PreviewImageProvider::PreviewImageProvider(const QFont& font) | 65 | PreviewImageProvider::PreviewImageProvider(const QFont& font) | ||
64 | : QQuickImageProvider(QQuickImageProvider::Image) | 66 | : QQuickImageProvider(QQuickImageProvider::Image) | ||
65 | , m_font(font) | 67 | , m_font(font) | ||
66 | { | 68 | { | ||
67 | } | 69 | } | ||
68 | 70 | | |||
69 | QImage PreviewImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) | 71 | QImage PreviewImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) | ||
70 | { | 72 | { | ||
73 | if (!KWindowSystem::isPlatformX11()) { | ||||
74 | return QImage(); | ||||
75 | } | ||||
76 | | ||||
71 | int subPixelIndex = 0; | 77 | int subPixelIndex = 0; | ||
72 | int hintingIndex = 0; | 78 | int hintingIndex = 0; | ||
73 | 79 | | |||
74 | const auto idpart = id.splitRef(QLatin1Char('.'))[0]; | 80 | const auto idpart = id.splitRef(QLatin1Char('.'))[0]; | ||
75 | const auto sections = idpart.split(QLatin1Char('_')); | 81 | const auto sections = idpart.split(QLatin1Char('_')); | ||
76 | 82 | | |||
77 | if (sections.size() >= 2) { | 83 | if (sections.size() >= 2) { | ||
78 | subPixelIndex = sections[0].toInt(); | 84 | subPixelIndex = sections[0].toInt(); | ||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |