tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
grantleetheme: merge themes across multiple prefixes
Thomas Tuegel
8 years ago
e6b42d74
4b032f12
+170
-2
5 changed files
expand all
collapse all
unified
split
pkgs
applications
kde
default.nix
grantleetheme
default.nix
grantlee-merge-theme-dirs.patch
grantleetheme_check_null.patch
series
+1
-1
pkgs/applications/kde/default.nix
···
66
66
dolphin-plugins = callPackage ./dolphin-plugins.nix {};
67
67
ffmpegthumbs = callPackage ./ffmpegthumbs.nix { };
68
68
filelight = callPackage ./filelight.nix {};
69
69
-
grantleetheme = callPackage ./grantleetheme.nix {};
69
69
+
grantleetheme = callPackage ./grantleetheme {};
70
70
gwenview = callPackage ./gwenview.nix {};
71
71
k3b = callPackage ./k3b.nix {};
72
72
kalarmcal = callPackage ./kalarmcal.nix {};
+1
-1
pkgs/applications/kde/grantleetheme.nix
pkgs/applications/kde/grantleetheme/default.nix
···
11
11
maintainers = kdepimTeam;
12
12
};
13
13
output = [ "out" "dev" ];
14
14
-
patches = [ ./grantleetheme_check_null.patch ];
14
14
+
patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
15
15
nativeBuildInputs = [ extra-cmake-modules kdoctools ];
16
16
buildInputs = [
17
17
grantlee5 ki18n kiconthemes knewstuff kservice kxmlgui qtbase
+166
pkgs/applications/kde/grantleetheme/grantlee-merge-theme-dirs.patch
···
1
1
+
Index: grantleetheme-17.04.0/src/grantleetheme_p.h
2
2
+
===================================================================
3
3
+
--- grantleetheme-17.04.0.orig/src/grantleetheme_p.h
4
4
+
+++ grantleetheme-17.04.0/src/grantleetheme_p.h
5
5
+
@@ -47,7 +47,7 @@ public:
6
6
+
QString description;
7
7
+
QString name;
8
8
+
QString dirName;
9
9
+
- QString absolutePath;
10
10
+
+ QStringList absolutePaths;
11
11
+
QString author;
12
12
+
QString email;
13
13
+
14
14
+
Index: grantleetheme-17.04.0/src/grantleetheme.cpp
15
15
+
===================================================================
16
16
+
--- grantleetheme-17.04.0.orig/src/grantleetheme.cpp
17
17
+
+++ grantleetheme-17.04.0/src/grantleetheme.cpp
18
18
+
@@ -45,7 +45,7 @@ ThemePrivate::ThemePrivate(const ThemePr
19
19
+
, description(other.description)
20
20
+
, name(other.name)
21
21
+
, dirName(other.dirName)
22
22
+
- , absolutePath(other.absolutePath)
23
23
+
+ , absolutePaths(other.absolutePaths)
24
24
+
, author(other.author)
25
25
+
, email(other.email)
26
26
+
, loader(other.loader)
27
27
+
@@ -63,12 +63,15 @@ void ThemePrivate::setupEngine()
28
28
+
29
29
+
void ThemePrivate::setupLoader()
30
30
+
{
31
31
+
- // Get the parent dir with themes, we set the theme directory separately
32
32
+
- QDir dir(absolutePath);
33
33
+
- dir.cdUp();
34
34
+
+ QStringList templateDirs;
35
35
+
+ for (const QString& path : absolutePaths) {
36
36
+
+ QDir dir(path);
37
37
+
+ dir.cdUp();
38
38
+
+ templateDirs << dir.absolutePath();
39
39
+
+ }
40
40
+
41
41
+
loader = QSharedPointer<Grantlee::FileSystemTemplateLoader>::create();
42
42
+
- loader->setTemplateDirs({ dir.absolutePath() });
43
43
+
+ loader->setTemplateDirs(templateDirs);
44
44
+
loader->setTheme(dirName);
45
45
+
46
46
+
if (!sEngine) {
47
47
+
@@ -102,9 +105,7 @@ QString ThemePrivate::errorTemplate(cons
48
48
+
Grantlee::Context ctx = createContext();
49
49
+
ctx.insert(QStringLiteral("error"), reason);
50
50
+
ctx.insert(QStringLiteral("templateName"), origTemplateName);
51
51
+
- const QString errorString = failedTemplate
52
52
+
- ? failedTemplate->errorString()
53
53
+
- : QStringLiteral("(null template)");
54
54
+
+ const QString errorString = failedTemplate->errorString();
55
55
+
ctx.insert(QStringLiteral("errorMessage"), errorString);
56
56
+
return tpl->render(&ctx);
57
57
+
}
58
58
+
@@ -122,7 +123,7 @@ Theme::Theme(const QString &themePath, c
59
59
+
KConfigGroup group(&config, QStringLiteral("Desktop Entry"));
60
60
+
if (group.isValid()) {
61
61
+
d->dirName = dirName;
62
62
+
- d->absolutePath = themePath;
63
63
+
+ d->absolutePaths = QStringList(themePath);
64
64
+
d->name = group.readEntry("Name", QString());
65
65
+
d->description = group.readEntry("Description", QString());
66
66
+
d->themeFileName = group.readEntry("FileName", QString());
67
67
+
@@ -141,7 +142,7 @@ Theme::~Theme()
68
68
+
69
69
+
bool Theme::operator==(const Theme &other) const
70
70
+
{
71
71
+
- return isValid() && other.isValid() && d->absolutePath == other.absolutePath();
72
72
+
+ return isValid() && other.isValid() && d->absolutePaths == other.absolutePaths();
73
73
+
}
74
74
+
75
75
+
Theme &Theme::operator=(const Theme &other)
76
76
+
@@ -185,7 +186,12 @@ QString Theme::dirName() const
77
77
+
78
78
+
QString Theme::absolutePath() const
79
79
+
{
80
80
+
- return d->absolutePath;
81
81
+
+ return d->absolutePaths.first();
82
82
+
+}
83
83
+
+
84
84
+
+QStringList Theme::absolutePaths() const
85
85
+
+{
86
86
+
+ return d->absolutePaths;
87
87
+
}
88
88
+
89
89
+
QString Theme::author() const
90
90
+
@@ -224,6 +230,13 @@ QString Theme::render(const QString &tem
91
91
+
return result;
92
92
+
}
93
93
+
94
94
+
+void Theme::addThemeDir(const QString& path)
95
95
+
+{
96
96
+
+ QDir dir(path);
97
97
+
+ dir.cdUp();
98
98
+
+ d->absolutePaths << dir.absolutePath();
99
99
+
+}
100
100
+
+
101
101
+
void Theme::addPluginPath(const QString &path)
102
102
+
{
103
103
+
if (!ThemePrivate::sEngine) {
104
104
+
Index: grantleetheme-17.04.0/src/grantleetheme.h
105
105
+
===================================================================
106
106
+
--- grantleetheme-17.04.0.orig/src/grantleetheme.h
107
107
+
+++ grantleetheme-17.04.0/src/grantleetheme.h
108
108
+
@@ -50,11 +50,14 @@ public:
109
109
+
QStringList displayExtraVariables() const;
110
110
+
QString dirName() const;
111
111
+
QString absolutePath() const;
112
112
+
+ QStringList absolutePaths() const;
113
113
+
QString author() const;
114
114
+
QString authorEmail() const;
115
115
+
116
116
+
QString render(const QString &templateName, const QVariantHash &data, const QByteArray &applicationDomain = QByteArray());
117
117
+
118
118
+
+ void addThemeDir(const QString&);
119
119
+
+
120
120
+
static void addPluginPath(const QString &path);
121
121
+
122
122
+
private:
123
123
+
Index: grantleetheme-17.04.0/src/grantleethememanager.cpp
124
124
+
===================================================================
125
125
+
--- grantleetheme-17.04.0.orig/src/grantleethememanager.cpp
126
126
+
+++ grantleetheme-17.04.0/src/grantleethememanager.cpp
127
127
+
@@ -142,25 +142,18 @@ public:
128
128
+
129
129
+
for (const QString &directory : qAsConst(themesDirectories)) {
130
130
+
QDirIterator dirIt(directory, QStringList(), QDir::AllDirs | QDir::NoDotAndDotDot);
131
131
+
- QStringList alreadyLoadedThemeName;
132
132
+
while (dirIt.hasNext()) {
133
133
+
dirIt.next();
134
134
+
const QString dirName = dirIt.fileName();
135
135
+
GrantleeTheme::Theme theme = q->loadTheme(dirIt.filePath(), dirName, defaultDesktopFileName);
136
136
+
if (theme.isValid()) {
137
137
+
QString themeName = theme.name();
138
138
+
- if (alreadyLoadedThemeName.contains(themeName)) {
139
139
+
- int i = 2;
140
140
+
- const QString originalName(theme.name());
141
141
+
- while (alreadyLoadedThemeName.contains(themeName)) {
142
142
+
- themeName = originalName + QStringLiteral(" (%1)").arg(i);
143
143
+
- ++i;
144
144
+
- }
145
145
+
- theme.d->name = themeName;
146
146
+
+ QMap<QString, GrantleeTheme::Theme>::iterator i = themes.find(dirName);
147
147
+
+ if (i != themes.end()) {
148
148
+
+ i.value().addThemeDir(dirIt.filePath());
149
149
+
+ } else {
150
150
+
+ themes.insert(dirName, theme);
151
151
+
}
152
152
+
- alreadyLoadedThemeName << themeName;
153
153
+
- themes.insert(dirName, theme);
154
154
+
- //qDebug()<<" theme.name()"<<theme.name();
155
155
+
}
156
156
+
}
157
157
+
watch->addDir(directory);
158
158
+
@@ -374,7 +367,7 @@ QString ThemeManager::pathFromThemes(con
159
159
+
GrantleeTheme::Theme theme = loadTheme(dirIt.filePath(), dirName, defaultDesktopFileName);
160
160
+
if (theme.isValid()) {
161
161
+
if (dirName == themeName) {
162
162
+
- return theme.absolutePath();
163
163
+
+ return theme.absolutePaths().first();
164
164
+
}
165
165
+
}
166
166
+
}
+2
pkgs/applications/kde/grantleetheme/series
···
1
1
+
grantleetheme_check_null.patch
2
2
+
grantlee-merge-theme-dirs.patch
pkgs/applications/kde/grantleetheme_check_null.patch
pkgs/applications/kde/grantleetheme/grantleetheme_check_null.patch