summaryrefslogtreecommitdiffstats
path: root/applications
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-08 11:22:32 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-08 18:36:29 +0200
commit12eaecb7cac54a170a8cbb8570fcf8b4e145c04b (patch)
tree2954910a02be3e50c823ddade1b2077126fb9890 /applications
parent81c05eee49fbb2ddc58025ac4b8834bdc59e41e7 (diff)
downloadkube-12eaecb7cac54a170a8cbb8570fcf8b4e145c04b.tar.gz
kube-12eaecb7cac54a170a8cbb8570fcf8b4e145c04b.zip
Install icons as qrc file as use them from there.
The plan is that this will help on windows with symlinks not working.
Diffstat (limited to 'applications')
-rw-r--r--applications/kube/main.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/applications/kube/main.cpp b/applications/kube/main.cpp
index aafbeef8..efe31ea2 100644
--- a/applications/kube/main.cpp
+++ b/applications/kube/main.cpp
@@ -48,6 +48,7 @@
48#include <QQmlContext> 48#include <QQmlContext>
49#include <QIcon> 49#include <QIcon>
50#include <QStandardPaths> 50#include <QStandardPaths>
51#include <QResource>
51#include <sink/store.h> 52#include <sink/store.h>
52 53
53#include "framework/src/keyring.h" 54#include "framework/src/keyring.h"
@@ -168,17 +169,14 @@ int main(int argc, char *argv[])
168 app.setApplicationVersion(kube_VERSION_STRING); 169 app.setApplicationVersion(kube_VERSION_STRING);
169 app.setFont(QFont{"Noto Sans", app.font().pointSize(), QFont::Normal}); 170 app.setFont(QFont{"Noto Sans", app.font().pointSize(), QFont::Normal});
170 171
171 //On Mac OS we want to include Contents/Resources/icons in the bundle, and that path is in AppDataLocations. 172 const QString kubeIcons = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("kube-icons.rcc"));
172 QStringList iconSearchPaths; 173 if (!QResource::registerResource(kubeIcons, "/icons/kube")) {
173 for (const auto &p : QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)) { 174 qWarning() << "Failed to register icon resource!" << kubeIcons;
174 auto iconPath = p + "/icons/"; 175 Q_ASSERT(false);
175 //I'm getting broken paths reported from standardLocations 176 } else {
176 if (iconPath.contains("kube.appContents")) { 177 QIcon::setThemeSearchPaths(QStringList() << QStringLiteral(":/icons"));
177 iconPath.replace("kube.appContents", "kube.app/Contents"); 178 QIcon::setThemeName(QStringLiteral("kube"));
178 }
179 iconSearchPaths << iconPath;
180 } 179 }
181 QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() + iconSearchPaths);
182 180
183 QCommandLineParser parser; 181 QCommandLineParser parser;
184 parser.setApplicationDescription("A communication and collaboration client."); 182 parser.setApplicationDescription("A communication and collaboration client.");