From 12eaecb7cac54a170a8cbb8570fcf8b4e145c04b Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 8 May 2018 11:22:32 +0200 Subject: Install icons as qrc file as use them from there. The plan is that this will help on windows with symlinks not working. --- applications/kube/main.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'applications') 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 @@ #include #include #include +#include #include #include "framework/src/keyring.h" @@ -168,17 +169,14 @@ int main(int argc, char *argv[]) app.setApplicationVersion(kube_VERSION_STRING); app.setFont(QFont{"Noto Sans", app.font().pointSize(), QFont::Normal}); - //On Mac OS we want to include Contents/Resources/icons in the bundle, and that path is in AppDataLocations. - QStringList iconSearchPaths; - for (const auto &p : QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)) { - auto iconPath = p + "/icons/"; - //I'm getting broken paths reported from standardLocations - if (iconPath.contains("kube.appContents")) { - iconPath.replace("kube.appContents", "kube.app/Contents"); - } - iconSearchPaths << iconPath; + const QString kubeIcons = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("kube-icons.rcc")); + if (!QResource::registerResource(kubeIcons, "/icons/kube")) { + qWarning() << "Failed to register icon resource!" << kubeIcons; + Q_ASSERT(false); + } else { + QIcon::setThemeSearchPaths(QStringList() << QStringLiteral(":/icons")); + QIcon::setThemeName(QStringLiteral("kube")); } - QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() + iconSearchPaths); QCommandLineParser parser; parser.setApplicationDescription("A communication and collaboration client."); -- cgit v1.2.3