aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <[email protected]>2015-10-21 20:55:17 +0200
committerChristoph Cullmann <[email protected]>2015-10-21 20:55:17 +0200
commit4ed0fafd538e152c52a4c7f82011521673424279 (patch)
treefea9d2eacdc1a88a9887ce816933b80d0231841f
parent0515bbbafec9b7b03cbd761198b51d331912bef7 (diff)
fix icon search, was mix of wrong paths + missing icon engine ;=)
-rw-r--r--icons.h35
-rw-r--r--kate/main.cpp2
-rw-r--r--kwrite/main.cpp2
-rw-r--r--mac.txt33
4 files changed, 44 insertions, 28 deletions
diff --git a/icons.h b/icons.h
index 4e2d918..75b9d81 100644
--- a/icons.h
+++ b/icons.h
@@ -20,38 +20,23 @@
#pragma once
#include <QIcon>
+#include <QResource>
/**
- * Setup icons, if no icons found globally, fallback to local bundled icons
+ * If we have some local breeze icon resource, prefer it
*/
static void setupIconTheme()
{
/**
- * magic icon path search: if we have no global icons, search for local bundled ones!
+ * Search in local "share" and "Resources"
*/
- if (QIcon::fromTheme(QStringLiteral("document-new")).isNull()) {
- /**
- * fallback theme is breeze ATM
- */
- QIcon::setThemeName(QStringLiteral("breeze"));
-
- /**
- * probe multiple local paths relative to application binary
- */
- QStringList localPathSuffixes;
- localPathSuffixes << QStringLiteral("/../icons") << QStringLiteral("/../share/icons") << QStringLiteral("/../Resources/icons");
- Q_FOREACH (const QString &localPathSuffix, localPathSuffixes) {
- /**
- * try new path, break if icons found
- */
- QIcon::setThemeSearchPaths(QStringList() << QCoreApplication::applicationDirPath() + localPathSuffix);
-
- /**
- * icons there?
- */
- if (!QIcon::fromTheme(QStringLiteral("document-new")).isNull()) {
- break;
- }
+ QStringList localPathSuffixes;
+ localPathSuffixes << QStringLiteral("/../share/breeze.rcc") << QStringLiteral("/../Resources/breeze.rcc");
+ Q_FOREACH (const QString &localPathSuffix, localPathSuffixes) {
+ const QString localIconsResource = QCoreApplication::applicationDirPath() + localPathSuffix;
+ if (QFile::exists(localIconsResource) && QResource::registerResource(localIconsResource)) {
+ QIcon::setThemeName(QStringLiteral("breeze"));
+ break;
}
}
}
diff --git a/kate/main.cpp b/kate/main.cpp
index d991315..434b326 100644
--- a/kate/main.cpp
+++ b/kate/main.cpp
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
/**
- * magic icon path search: if we have no global icons, search for local bundled ones!
+ * if we have some local breeze icon resource, prefer it
*/
setupIconTheme();
diff --git a/kwrite/main.cpp b/kwrite/main.cpp
index 6f6e4a3..4a26276 100644
--- a/kwrite/main.cpp
+++ b/kwrite/main.cpp
@@ -46,7 +46,7 @@ extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
QApplication app(argc, argv);
/**
- * magic icon path search: if we have no global icons, search for local bundled ones!
+ * if we have some local breeze icon resource, prefer it
*/
setupIconTheme();
diff --git a/mac.txt b/mac.txt
index 1c200ae..275a28d 100644
--- a/mac.txt
+++ b/mac.txt
@@ -10,7 +10,8 @@ set -e
# install CMake 3.3.2
# set path to Qt 5.5.0 stuff
-export PATH=~/Qt5.5.0/5.5/clang_64/bin:/Applications/CMake.app/Contents/bin:$PATH
+export QTDIR=~/Qt5.5.0/5.5/clang_64
+export PATH=$QTDIR/bin:/Applications/CMake.app/Contents/bin:$PATH
# remember some dirs
export PREFIX=`pwd`/usr
@@ -92,4 +93,34 @@ build_framework solid
build_framework kio
build_framework kparts
build_framework ktexteditor
+
+# clear old bundles
+rm -rf /Applications/KDE/kate.app
+rm -rf /Applications/KDE/kwrite.app
+
build_framework kate
+
+# create icon resource file
+cd src
+
+rm -rf iconres
+mkdir iconres
+cd iconres
+git archive --format tar --remote kde:breeze HEAD icons > breeze.tgz
+mkdir icons
+tar -C icons -s /^icons/breeze/ -xvzf breeze.tgz
+rm breeze.tgz
+rcc -project -o ../breeze.qrc
+mv ../breeze.qrc .
+rcc -binary -o breeze.rcc breeze.qrc
+cp breeze.rcc /Applications/KDE/kate.app/Contents/Resources/breeze.rcc
+cp breeze.rcc /Applications/KDE/kwrite.app/Contents/Resources/breeze.rcc
+cd ..
+
+cd ..
+
+# call patched macdeployqt for both bundles
+# that needs patch from https://bugreports.qt.io/browse/QTBUG-48836
+# deploy qt plugins as extra plugins, too, as e.g. iconengine will be missing otherwise ;)
+macdeployqt /Applications/KDE/kate.app -extra-plugins=$PREFIX/lib/plugins -extra-plugins=$QTDIR/plugins -dmg
+macdeployqt /Applications/KDE/kwrite.app -extra-plugins=$PREFIX/lib/plugins -extra-plugins=$QTDIR/plugins -dmg