forked from stephanemagnenat/homebrew-kf5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kf5-kiconthemes.rb
86 lines (76 loc) · 2.75 KB
/
kf5-kiconthemes.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
require "formula"
class Kf5Kiconthemes < Formula
url "http://download.kde.org/stable/frameworks/5.15/kiconthemes-5.15.0.tar.xz"
sha1 "18ba5a1a1d9fa478c976bca1c78619af0d3a43f4"
homepage "http://www.kde.org/"
head 'git://anongit.kde.org/kiconthemes.git'
def patches
DATA
end
depends_on "cmake" => :build
depends_on "haraldf/kf5/kf5-extra-cmake-modules" => :build
depends_on "haraldf/kf5/kf5-kconfigwidgets"
depends_on "haraldf/kf5/kf5-kitemviews"
depends_on "qt5" => "with-d-bus"
def install
args = std_cmake_args
system "cmake", ".", *args
system "make", "install"
prefix.install "install_manifest.txt"
end
end
__END__
diff --git a/src/kicontheme.cpp b/src/kicontheme.cpp
index d0ab4b9..535956b 100644
--- a/src/kicontheme.cpp
+++ b/src/kicontheme.cpp
@@ -171,6 +171,50 @@ KIconTheme::KIconTheme(const QString &name, const QString &appName, const QStrin
return;
}
+#ifdef Q_OS_MAC
+ // make QIcon aware of the theme & paths
+
+ // only update search paths once.
+ auto paths = QIcon::themeSearchPaths();
+ // assume count()==1 is the default {":/icons"} case
+ if (paths.count()==1) {
+
+ // app overloads first
+ paths += QStandardPaths::locateAll(QStandardPaths::AppDataLocation, "icons", QStandardPaths::LocateDirectory);
+ // generics after
+ paths += icnlibs;
+
+ QIcon::setThemeSearchPaths( paths );
+ qWarning() << "QIcon::setThemeSearchPaths" << paths ;
+
+
+ // warn about 'inherited' themes that will not be seen
+ {
+ auto getWarnings = [&](const QString& str) {
+ QStringList ret;
+ if (name != str) {
+ ret = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, "icons/" + str, QStandardPaths::LocateDirectory);
+ }
+ return ret;
+ };
+
+ QStringList warning_paths;
+ warning_paths += getWarnings(defaultThemeName());
+ warning_paths += getWarnings(QLatin1String("hicolor"));
+ warning_paths += getWarnings(QLatin1String("locolor"));
+
+ for ( auto&& warning_path : warning_paths ) {
+ qWarning() << "OSX only: Unsupported inheriting icon theme found at '" << warning_path << "'"
+ "\n\tTry renaming or merging to/into '" << name << "'";
+ }
+ }
+ }
+ if (QIcon::themeName() != name) {
+ QIcon::setThemeName(name);
+ qWarning() << "QIcon::themeName(): " << QIcon::themeName();
+ }
+#endif
+
// Use KSharedConfig to avoid parsing the file many times, from each component.
// Need to keep a ref to it to make this useful
d->sharedConfig = KSharedConfig::openConfig(fileName, KConfig::NoGlobals);