diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-02-22 11:11:28 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-02-22 11:11:28 +0100 |
commit | 12160008f45b2b470d29ff475fc3e7eb3a263ebd (patch) | |
tree | 86b2da9f897aa72f8a65ed43295f5c3c6ff689db /applications | |
parent | 6d2c64352773c32045acb92fd3947cf6bbfd3101 (diff) | |
download | kube-12160008f45b2b470d29ff475fc3e7eb3a263ebd.tar.gz kube-12160008f45b2b470d29ff475fc3e7eb3a263ebd.zip |
Added the kube logo
Diffstat (limited to 'applications')
-rw-r--r-- | applications/kube-mail/main.cpp | 29 | ||||
-rw-r--r-- | applications/kube-mail/package/contents/ui/main.qml | 18 |
2 files changed, 46 insertions, 1 deletions
diff --git a/applications/kube-mail/main.cpp b/applications/kube-mail/main.cpp index 0e9556c9..5efe14ff 100644 --- a/applications/kube-mail/main.cpp +++ b/applications/kube-mail/main.cpp | |||
@@ -3,14 +3,41 @@ | |||
3 | 3 | ||
4 | #include <QStandardPaths> | 4 | #include <QStandardPaths> |
5 | #include <KPackage/PackageLoader> | 5 | #include <KPackage/PackageLoader> |
6 | #include <QQuickImageProvider> | ||
7 | #include <QIcon> | ||
6 | 8 | ||
7 | #include <QDebug> | 9 | #include <QDebug> |
8 | 10 | ||
11 | class KubeImageProvider : public QQuickImageProvider | ||
12 | { | ||
13 | public: | ||
14 | KubeImageProvider() | ||
15 | : QQuickImageProvider(QQuickImageProvider::Pixmap) | ||
16 | { | ||
17 | } | ||
18 | |||
19 | QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) Q_DECL_OVERRIDE | ||
20 | { | ||
21 | const auto icon = QIcon::fromTheme(id); | ||
22 | auto expectedSize = requestedSize; | ||
23 | if (!icon.availableSizes().contains(requestedSize) && !icon.availableSizes().isEmpty()) { | ||
24 | expectedSize = icon.availableSizes().first(); | ||
25 | } | ||
26 | const auto pixmap = icon.pixmap(expectedSize); | ||
27 | if (size) { | ||
28 | *size = pixmap.size(); | ||
29 | } | ||
30 | return pixmap; | ||
31 | } | ||
32 | }; | ||
33 | |||
9 | int main(int argc, char *argv[]) | 34 | int main(int argc, char *argv[]) |
10 | { | 35 | { |
11 | QGuiApplication app(argc, argv); | 36 | QGuiApplication app(argc, argv); |
12 | auto package = KPackage::PackageLoader::self()->loadPackage("KPackage/GenericQML", "org.kde.kube.mail"); | 37 | auto package = KPackage::PackageLoader::self()->loadPackage("KPackage/GenericQML", "org.kde.kube.mail"); |
13 | Q_ASSERT(package.isValid()); | 38 | Q_ASSERT(package.isValid()); |
14 | QQmlApplicationEngine engine(QUrl::fromLocalFile(package.filePath("mainscript"))); | 39 | QQmlApplicationEngine engine; |
40 | engine.addImageProvider(QLatin1String("kube"), new KubeImageProvider); | ||
41 | engine.load(QUrl::fromLocalFile(package.filePath("mainscript"))); | ||
15 | return app.exec(); | 42 | return app.exec(); |
16 | } | 43 | } |
diff --git a/applications/kube-mail/package/contents/ui/main.qml b/applications/kube-mail/package/contents/ui/main.qml index 9d341e0a..5549bcde 100644 --- a/applications/kube-mail/package/contents/ui/main.qml +++ b/applications/kube-mail/package/contents/ui/main.qml | |||
@@ -67,6 +67,24 @@ ApplicationWindow { | |||
67 | Row { | 67 | Row { |
68 | anchors.fill: parent | 68 | anchors.fill: parent |
69 | 69 | ||
70 | Rectangle { | ||
71 | height: parent.height | ||
72 | color: "transparent" | ||
73 | Image { | ||
74 | id: img | ||
75 | height: parent.height | ||
76 | fillMode: Image.PreserveAspectCrop | ||
77 | anchors { | ||
78 | verticalCenter: parent.verticalCenter | ||
79 | left: parent.left | ||
80 | leftMargin: -20 | ||
81 | } | ||
82 | source: "image://kube/kube_logo" | ||
83 | sourceSize.height: parent.height * 2.5 | ||
84 | } | ||
85 | width: img.width * 0.7 | ||
86 | } | ||
87 | |||
70 | PlasmaComponents.ToolButton { | 88 | PlasmaComponents.ToolButton { |
71 | height: parent.height | 89 | height: parent.height |
72 | iconName: "mail-message-new" | 90 | iconName: "mail-message-new" |