Merge lp:~smartboyhw/ubuntu/raring/kde-gtk-config/2.1.1-1ubuntu1-1st-push into lp:ubuntu/raring/kde-gtk-config
- Raring (13.04)
- 2.1.1-1ubuntu1-1st-push
- Merge into raring
Proposed by
Howard Chan
Status: | Merged |
---|---|
Merged at revision: | 8 |
Proposed branch: | lp:~smartboyhw/ubuntu/raring/kde-gtk-config/2.1.1-1ubuntu1-1st-push |
Merge into: | lp:ubuntu/raring/kde-gtk-config |
Diff against target: |
1100 lines (+26/-946) 13 files modified
.pc/.quilt_patches (+0/-1) .pc/.quilt_series (+0/-1) .pc/.version (+0/-1) .pc/applied-patches (+0/-2) .pc/check-gtk-preview-files-in-runtime/src/gtkconfigkcmodule.cpp (+0/-462) .pc/mirgation-from-package-src:kcm-gtk/src/gtkconfigkcmodule.cpp (+0/-451) debian/changelog (+16/-0) debian/control (+4/-2) debian/copyright (+1/-1) debian/gtk3_preview.1 (+1/-1) debian/gtk_preview.1 (+1/-1) debian/reload_gtk_apps.1 (+1/-1) src/gtkconfigkcmodule.cpp (+2/-22) |
To merge this branch: | bzr merge lp:~smartboyhw/ubuntu/raring/kde-gtk-config/2.1.1-1ubuntu1-1st-push |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu branches | Pending | ||
Review via email: mp+151434@code.launchpad.net |
Commit message
Description of the change
New version 2.1.1-1 and fixing LP: #1103013.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === removed directory '.pc' | |||
2 | === removed file '.pc/.quilt_patches' | |||
3 | --- .pc/.quilt_patches 2012-09-07 22:01:43 +0000 | |||
4 | +++ .pc/.quilt_patches 1970-01-01 00:00:00 +0000 | |||
5 | @@ -1,1 +0,0 @@ | |||
6 | 1 | debian/patches | ||
7 | 2 | 0 | ||
8 | === removed file '.pc/.quilt_series' | |||
9 | --- .pc/.quilt_series 2012-09-07 22:01:43 +0000 | |||
10 | +++ .pc/.quilt_series 1970-01-01 00:00:00 +0000 | |||
11 | @@ -1,1 +0,0 @@ | |||
12 | 1 | series | ||
13 | 2 | 0 | ||
14 | === removed file '.pc/.version' | |||
15 | --- .pc/.version 2012-03-13 06:57:17 +0000 | |||
16 | +++ .pc/.version 1970-01-01 00:00:00 +0000 | |||
17 | @@ -1,1 +0,0 @@ | |||
18 | 1 | 2 | ||
19 | 2 | 0 | ||
20 | === removed file '.pc/applied-patches' | |||
21 | --- .pc/applied-patches 2012-11-13 12:03:49 +0000 | |||
22 | +++ .pc/applied-patches 1970-01-01 00:00:00 +0000 | |||
23 | @@ -1,2 +0,0 @@ | |||
24 | 1 | mirgation-from-package-src:kcm-gtk | ||
25 | 2 | check-gtk-preview-files-in-runtime | ||
26 | 3 | 0 | ||
27 | === removed directory '.pc/check-gtk-preview-files-in-runtime' | |||
28 | === removed directory '.pc/check-gtk-preview-files-in-runtime/src' | |||
29 | === removed file '.pc/check-gtk-preview-files-in-runtime/src/gtkconfigkcmodule.cpp' | |||
30 | --- .pc/check-gtk-preview-files-in-runtime/src/gtkconfigkcmodule.cpp 2012-11-07 00:35:58 +0000 | |||
31 | +++ .pc/check-gtk-preview-files-in-runtime/src/gtkconfigkcmodule.cpp 1970-01-01 00:00:00 +0000 | |||
32 | @@ -1,462 +0,0 @@ | |||
33 | 1 | /* KDE GTK Configuration Module | ||
34 | 2 | * | ||
35 | 3 | * Copyright 2011 José Antonio Sanchez Reynaga <joanzare@gmail.com> | ||
36 | 4 | * Copyright 2011 Aleix Pol Gonzalez <aleixpol@blue-systems.com> | ||
37 | 5 | * | ||
38 | 6 | * This library is free software; you can redistribute it and/or | ||
39 | 7 | * modify it under the terms of the GNU Lesser General Public | ||
40 | 8 | * License as published by the Free Software Foundation; either | ||
41 | 9 | * version 2.1 of the License, or (at your option) version 3, or any | ||
42 | 10 | * later version accepted by the membership of KDE e.V. (or its | ||
43 | 11 | * successor approved by the membership of KDE e.V.), which shall | ||
44 | 12 | * act as a proxy defined in Section 6 of version 3 of the license. | ||
45 | 13 | * | ||
46 | 14 | * This library is distributed in the hope that it will be useful, | ||
47 | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
48 | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
49 | 17 | * Lesser General Public License for more details. | ||
50 | 18 | * | ||
51 | 19 | * You should have received a copy of the GNU Lesser General Public | ||
52 | 20 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
53 | 21 | */ | ||
54 | 22 | |||
55 | 23 | #include "gtkconfigkcmodule.h" | ||
56 | 24 | #include <kaboutdata.h> | ||
57 | 25 | #include <KGenericFactory> | ||
58 | 26 | #include <KPluginFactory> | ||
59 | 27 | #include <KProcess> | ||
60 | 28 | #include <KStandardDirs> | ||
61 | 29 | #include <QtGui> | ||
62 | 30 | #include <QX11EmbedContainer> | ||
63 | 31 | #include "ui_gui.h" | ||
64 | 32 | #include "abstractappearance.h" | ||
65 | 33 | #include "iconthemesmodel.h" | ||
66 | 34 | #include <kicontheme.h> | ||
67 | 35 | |||
68 | 36 | K_PLUGIN_FACTORY(GTKConfigKCModuleFactory, registerPlugin<GTKConfigKCModule>();) | ||
69 | 37 | K_EXPORT_PLUGIN(GTKConfigKCModuleFactory("cgc","kde-gtk-config")) | ||
70 | 38 | |||
71 | 39 | QMap<QString, int> gtkToolbarInit() | ||
72 | 40 | { | ||
73 | 41 | QMap<QString, int> gtkToolbar; | ||
74 | 42 | gtkToolbar["GTK_TOOLBAR_ICONS"] = 0; | ||
75 | 43 | gtkToolbar["GTK_TOOLBAR_TEXT"] = 1; | ||
76 | 44 | gtkToolbar["GTK_TOOLBAR_BOTH"] = 2; | ||
77 | 45 | gtkToolbar["GTK_TOOLBAR_BOTH_HORIZ"] = 3; | ||
78 | 46 | return gtkToolbar; | ||
79 | 47 | } | ||
80 | 48 | |||
81 | 49 | static QMap<QString, int> gtkToolbar = gtkToolbarInit(); | ||
82 | 50 | |||
83 | 51 | GTKConfigKCModule::GTKConfigKCModule(QWidget* parent, const QVariantList& args ) | ||
84 | 52 | : KCModule(GTKConfigKCModuleFactory::componentData(), parent) | ||
85 | 53 | , ui(new Ui::GUI) | ||
86 | 54 | , installer(0) | ||
87 | 55 | , uninstaller(0) | ||
88 | 56 | , m_saveEnabled(true) | ||
89 | 57 | { | ||
90 | 58 | Q_UNUSED(args); | ||
91 | 59 | KAboutData *acercade = new KAboutData("cgc","kcm_cgc",ki18n("KDE GTK Config"), "2.0", | ||
92 | 60 | ki18n("Configure your GTK Applications"), | ||
93 | 61 | KAboutData::License_LGPL_V3, | ||
94 | 62 | ki18n("Copyright 2011 José Antonio Sánchez Reynaga")); | ||
95 | 63 | acercade->addAuthor(ki18n("José Antonio Sánchez Reynaga (antonioJASR)"),ki18n("Main Developer"), "joanzare@gmail.com"); | ||
96 | 64 | acercade->addAuthor(ki18n("Aleix Pol i Gonzalez"), ki18n("Feature development. Previews, code refactoring."), "aleixpol@blue-systems.com"); | ||
97 | 65 | acercade->addCredit(ki18n("Manuel Tortosa (manutortosa)"), ki18n("Ideas, tester, internationalization")); | ||
98 | 66 | acercade->addCredit(ki18n("Adrián Chaves Fernández (Gallaecio)"), ki18n("Internationalization")); | ||
99 | 67 | setAboutData(acercade); | ||
100 | 68 | |||
101 | 69 | ui->setupUi(this); | ||
102 | 70 | appareance = new AppearenceGTK; | ||
103 | 71 | m_iconsModel = new IconThemesModel(false, this); | ||
104 | 72 | ui->cb_icon->setModel(m_iconsModel); | ||
105 | 73 | ui->cb_icon_fallback->setModel(m_iconsModel); | ||
106 | 74 | |||
107 | 75 | QFile oldConfigFile(QDir::homePath()+"/.gtkrc-2.0-kde"); | ||
108 | 76 | QFile newConfigFile(QDir::homePath()+"/.gtkrc-2.0"); | ||
109 | 77 | if(oldConfigFile.exists()) { | ||
110 | 78 | newConfigFile.remove(); | ||
111 | 79 | if( !oldConfigFile.rename(newConfigFile.fileName()) ) | ||
112 | 80 | kDebug() << "Could not rename old config: " + oldConfigFile.fileName(); | ||
113 | 81 | else | ||
114 | 82 | kDebug() << "Old config " + oldConfigFile.fileName() + | ||
115 | 83 | "was successfully renamed to " + newConfigFile.fileName(); | ||
116 | 84 | } | ||
117 | 85 | |||
118 | 86 | m_tempGtk2Preview = KGlobal::dirs()->saveLocation("tmp", "gtkrc-2.0", false); | ||
119 | 87 | m_tempGtk3Preview = KGlobal::dirs()->saveLocation("tmp", ".config/gtk-3.0/settings.ini", false); | ||
120 | 88 | |||
121 | 89 | ui->gtk2Preview->setIcon(KIcon("document-preview")); //!! for some reason it doesn't work with QIcon::fromTheme | ||
122 | 90 | ui->gtk3Preview->setIcon(KIcon("document-preview")); | ||
123 | 91 | |||
124 | 92 | m_p2 = new KProcess(this); | ||
125 | 93 | m_p2->setEnv("GTK2_RC_FILES", m_tempGtk2Preview, true); | ||
126 | 94 | *m_p2 << KStandardDirs::findExe("gtk_preview"); | ||
127 | 95 | |||
128 | 96 | m_p3 = new KProcess(this); | ||
129 | 97 | m_p3->setEnv("XDG_CONFIG_HOME", KGlobal::dirs()->saveLocation("tmp", ".config")); | ||
130 | 98 | *m_p3 << KStandardDirs::findExe("gtk3_preview"); | ||
131 | 99 | |||
132 | 100 | //UI changes | ||
133 | 101 | connect(ui->cb_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); | ||
134 | 102 | connect(ui->cb_theme_gtk3, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); | ||
135 | 103 | connect(ui->cb_icon, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); | ||
136 | 104 | connect(ui->cb_icon_fallback ,SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); | ||
137 | 105 | connect(ui->font, SIGNAL(fontSelected(QFont)), this, SLOT(appChanged())); | ||
138 | 106 | connect(ui->cb_toolbar_icons, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); | ||
139 | 107 | connect(ui->checkBox_icon_gtk_menus, SIGNAL(clicked(bool)), this, SLOT(appChanged())); | ||
140 | 108 | connect(ui->checkBox_icon_gtk_buttons, SIGNAL(clicked(bool)), this, SLOT(appChanged())); | ||
141 | 109 | |||
142 | 110 | //preview updates | ||
143 | 111 | connect(ui->cb_icon_fallback, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme())); | ||
144 | 112 | connect(ui->cb_icon, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme())); | ||
145 | 113 | connect(ui->gtk2Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk2IfNecessary(bool))); | ||
146 | 114 | connect(ui->gtk3Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk3IfNecessary(bool))); | ||
147 | 115 | |||
148 | 116 | connect(m_p2, SIGNAL(finished(int)), this, SLOT(untogglePreview())); | ||
149 | 117 | connect(m_p3, SIGNAL(finished(int)), this, SLOT(untogglePreview())); | ||
150 | 118 | |||
151 | 119 | QMenu* m = new QMenu(this); | ||
152 | 120 | m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK2 themes..."), this, SLOT(showThemeGHNS())); | ||
153 | 121 | m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK3 themes..."), this, SLOT(installThemeGTK3GHNS())); | ||
154 | 122 | m->addAction(KIcon("archive-insert"), i18n("Install a local theme..."), this, SLOT(showDialogForInstall())); | ||
155 | 123 | m->addAction(KIcon("archive-remove"), i18n("Uninstall a local theme..."), this, SLOT(showDialogForUninstall())); | ||
156 | 124 | ui->newThemes->setMenu(m); | ||
157 | 125 | ui->newThemes->setIcon(KIcon("download")); | ||
158 | 126 | } | ||
159 | 127 | |||
160 | 128 | GTKConfigKCModule::~GTKConfigKCModule() | ||
161 | 129 | { | ||
162 | 130 | m_p2->kill(); | ||
163 | 131 | m_p3->kill(); | ||
164 | 132 | |||
165 | 133 | QFile::remove(m_tempGtk2Preview); | ||
166 | 134 | QFile::remove(m_tempGtk3Preview); | ||
167 | 135 | delete appareance; | ||
168 | 136 | |||
169 | 137 | m_p2->waitForFinished(); | ||
170 | 138 | m_p3->waitForFinished(); | ||
171 | 139 | delete ui; | ||
172 | 140 | } | ||
173 | 141 | |||
174 | 142 | QString fontToString(const QFont& f) | ||
175 | 143 | { | ||
176 | 144 | QString style; | ||
177 | 145 | |||
178 | 146 | if(f.bold()) | ||
179 | 147 | style += " bold"; | ||
180 | 148 | if(f.italic()) | ||
181 | 149 | style += " italic"; | ||
182 | 150 | |||
183 | 151 | return f.family() + style + ' ' + QString::number(f.pointSize()); | ||
184 | 152 | } | ||
185 | 153 | |||
186 | 154 | void GTKConfigKCModule::syncUI() | ||
187 | 155 | { | ||
188 | 156 | appareance->setThemeGtk3(ui->cb_theme_gtk3->currentText()); | ||
189 | 157 | appareance->setTheme(ui->cb_theme->currentText()); | ||
190 | 158 | appareance->setIcon(ui->cb_icon->itemData(ui->cb_icon->currentIndex(), IconThemesModel::DirNameRole).toString()); | ||
191 | 159 | appareance->setIconFallback(ui->cb_icon_fallback->itemData(ui->cb_icon_fallback->currentIndex(), IconThemesModel::DirNameRole).toString()); | ||
192 | 160 | appareance->setFont(fontToString(ui->font->font())); | ||
193 | 161 | |||
194 | 162 | appareance->setToolbarStyle(gtkToolbar.key(ui->cb_toolbar_icons->currentIndex())); | ||
195 | 163 | appareance->setShowIconsInButtons(ui->checkBox_icon_gtk_buttons->isChecked()); | ||
196 | 164 | appareance->setShowIconsInMenus(ui->checkBox_icon_gtk_menus->isChecked()); | ||
197 | 165 | } | ||
198 | 166 | |||
199 | 167 | void GTKConfigKCModule::showThemeGHNS() | ||
200 | 168 | { | ||
201 | 169 | KNS3::DownloadDialog d("cgctheme.knsrc", this); | ||
202 | 170 | if(d.exec()) { | ||
203 | 171 | refreshLists(); | ||
204 | 172 | } | ||
205 | 173 | } | ||
206 | 174 | |||
207 | 175 | void GTKConfigKCModule::installThemeGTK3GHNS() | ||
208 | 176 | { | ||
209 | 177 | KNS3::DownloadDialog d("cgcgtk3.knsrc", this); | ||
210 | 178 | if(d.exec()) { | ||
211 | 179 | refreshLists(); | ||
212 | 180 | } | ||
213 | 181 | } | ||
214 | 182 | |||
215 | 183 | QFont stringToFont(const QString& font) | ||
216 | 184 | { | ||
217 | 185 | QRegExp fontRx(QString(" (italic)? *(bold)? *([0-9]+)$")); | ||
218 | 186 | int pos = fontRx.indexIn(font); | ||
219 | 187 | QString fontFamily = font.left(pos); | ||
220 | 188 | |||
221 | 189 | bool italic = !fontRx.cap(1).isEmpty(); | ||
222 | 190 | QFont::Weight bold = fontRx.cap(2).isEmpty() ? QFont::Normal : QFont::Bold; | ||
223 | 191 | int fontSize = fontRx.cap(3).toInt(); | ||
224 | 192 | |||
225 | 193 | return QFont(fontFamily, fontSize, bold, italic); | ||
226 | 194 | } | ||
227 | 195 | |||
228 | 196 | void GTKConfigKCModule::refreshLists() | ||
229 | 197 | { | ||
230 | 198 | refreshThemesUi(true); | ||
231 | 199 | |||
232 | 200 | QString font = appareance->getFont(); | ||
233 | 201 | // Q_ASSERT(!font.isEmpty()); | ||
234 | 202 | ui->font->setFont(stringToFont(font)); | ||
235 | 203 | |||
236 | 204 | ui->cb_toolbar_icons->setCurrentIndex(gtkToolbar[appareance->getToolbarStyle()]); | ||
237 | 205 | |||
238 | 206 | ui->checkBox_icon_gtk_buttons->setChecked(appareance->getShowIconsInButtons()); | ||
239 | 207 | ui->checkBox_icon_gtk_menus->setChecked(appareance->getShowIconsInMenus()); | ||
240 | 208 | } | ||
241 | 209 | |||
242 | 210 | void tryIcon(QLabel* label, const QString& fallback, const QString& theme, const QString& iconName) | ||
243 | 211 | { | ||
244 | 212 | label->setToolTip(iconName); | ||
245 | 213 | |||
246 | 214 | QString ret; | ||
247 | 215 | if(!theme.isEmpty()) | ||
248 | 216 | ret = IconThemesModel::findIconRecursivelyByName(iconName, theme); | ||
249 | 217 | |||
250 | 218 | if(!ret.isEmpty()) { | ||
251 | 219 | QPixmap p(ret); | ||
252 | 220 | Q_ASSERT(!p.isNull()); | ||
253 | 221 | label->setPixmap(p); | ||
254 | 222 | return; | ||
255 | 223 | } | ||
256 | 224 | |||
257 | 225 | if(!fallback.isEmpty()) | ||
258 | 226 | ret = IconThemesModel::findIconRecursivelyByName(iconName, fallback); | ||
259 | 227 | |||
260 | 228 | if(!ret.isEmpty()) { | ||
261 | 229 | QPixmap p(ret); | ||
262 | 230 | Q_ASSERT(!p.isNull()); | ||
263 | 231 | label->setPixmap(p); | ||
264 | 232 | return; | ||
265 | 233 | } | ||
266 | 234 | |||
267 | 235 | KIcon notFoundIcon("application-x-zerosize"); | ||
268 | 236 | QPixmap noIcon(notFoundIcon.pixmap(48,48)); | ||
269 | 237 | label->setPixmap(noIcon); | ||
270 | 238 | |||
271 | 239 | kDebug() << "could not find icon" << iconName; | ||
272 | 240 | } | ||
273 | 241 | |||
274 | 242 | void GTKConfigKCModule::makePreviewIconTheme() | ||
275 | 243 | { | ||
276 | 244 | int icon_fallback = ui->cb_icon_fallback->currentIndex(); | ||
277 | 245 | QString path_fallback = ui->cb_icon->itemData(icon_fallback, IconThemesModel::PathRole).toString(); | ||
278 | 246 | |||
279 | 247 | int icon = ui->cb_icon->currentIndex(); | ||
280 | 248 | QString path_icon = ui->cb_icon->itemData(icon, IconThemesModel::PathRole).toString(); | ||
281 | 249 | |||
282 | 250 | tryIcon(ui->lb_prev_1, path_fallback, path_icon, "user-home"); | ||
283 | 251 | tryIcon(ui->lb_prev_2, path_fallback, path_icon, "folder"); | ||
284 | 252 | tryIcon(ui->lb_prev_3, path_fallback, path_icon, "user-trash"); | ||
285 | 253 | tryIcon(ui->lb_prev_4, path_fallback, path_icon, "document-print"); | ||
286 | 254 | tryIcon(ui->lb_prev_5, path_fallback, path_icon, "user-desktop"); | ||
287 | 255 | tryIcon(ui->lb_prev_6, path_fallback, path_icon, "network-server"); | ||
288 | 256 | tryIcon(ui->lb_prev_7, path_fallback, path_icon, "system-help"); | ||
289 | 257 | tryIcon(ui->lb_prev_8, path_fallback, path_icon, "start-here"); | ||
290 | 258 | tryIcon(ui->lb_prev_9, path_fallback, path_icon, "go-up"); | ||
291 | 259 | } | ||
292 | 260 | |||
293 | 261 | void GTKConfigKCModule::appChanged() | ||
294 | 262 | { | ||
295 | 263 | savePreviewConfig(); | ||
296 | 264 | emit changed(true); | ||
297 | 265 | } | ||
298 | 266 | |||
299 | 267 | |||
300 | 268 | void GTKConfigKCModule::savePreviewConfig() | ||
301 | 269 | { | ||
302 | 270 | if(!m_saveEnabled || !(ui->gtk2Preview->isChecked() || ui->gtk3Preview->isChecked())) | ||
303 | 271 | return; | ||
304 | 272 | kDebug() << "saving UI..."; | ||
305 | 273 | |||
306 | 274 | syncUI(); | ||
307 | 275 | |||
308 | 276 | if(ui->gtk3Preview->isChecked()) { | ||
309 | 277 | //we don't want to recursively loop between savePreviewConfig and runIfNecessary | ||
310 | 278 | m_saveEnabled = false; | ||
311 | 279 | m_p3->kill(); | ||
312 | 280 | appareance->gtk3Appearance()->saveSettings(m_tempGtk3Preview); | ||
313 | 281 | |||
314 | 282 | //need to make sure runIfNecessary() to know that it's not running | ||
315 | 283 | m_p3->waitForFinished(); | ||
316 | 284 | |||
317 | 285 | m_p3->start(); | ||
318 | 286 | ui->gtk3Preview->setChecked(true); | ||
319 | 287 | m_saveEnabled = true; | ||
320 | 288 | } else if(ui->gtk2Preview->isChecked()) | ||
321 | 289 | appareance->gtk2Appearance()->saveSettings(m_tempGtk2Preview); | ||
322 | 290 | } | ||
323 | 291 | |||
324 | 292 | void GTKConfigKCModule::runGtk2IfNecessary(bool checked) | ||
325 | 293 | { | ||
326 | 294 | KProcess* p = m_p2; | ||
327 | 295 | KProcess* np = m_p3; | ||
328 | 296 | |||
329 | 297 | if(checked) { | ||
330 | 298 | np->kill(); | ||
331 | 299 | np->waitForFinished(); | ||
332 | 300 | savePreviewConfig(); | ||
333 | 301 | if(p->state()!=KProcess::Running) | ||
334 | 302 | p->start(); | ||
335 | 303 | } else { | ||
336 | 304 | p->kill(); | ||
337 | 305 | p->waitForFinished(); | ||
338 | 306 | } | ||
339 | 307 | } | ||
340 | 308 | |||
341 | 309 | void GTKConfigKCModule::runGtk3IfNecessary(bool checked) | ||
342 | 310 | { | ||
343 | 311 | KProcess* p = m_p3; | ||
344 | 312 | KProcess* np = m_p2; | ||
345 | 313 | |||
346 | 314 | if(checked) { | ||
347 | 315 | np->kill(); | ||
348 | 316 | np->waitForFinished(); | ||
349 | 317 | savePreviewConfig(); | ||
350 | 318 | if(p->state()!=KProcess::Running) | ||
351 | 319 | p->start(); | ||
352 | 320 | } else { | ||
353 | 321 | p->kill(); | ||
354 | 322 | p->waitForFinished(); | ||
355 | 323 | } | ||
356 | 324 | } | ||
357 | 325 | |||
358 | 326 | void GTKConfigKCModule::save() | ||
359 | 327 | { | ||
360 | 328 | kDebug() << "******************************************* INSTALLATION :\n" | ||
361 | 329 | << "theme : " << appareance->getTheme() << "\n" | ||
362 | 330 | << "themeGTK3 : " << appareance->getThemeGtk3() << "\n" | ||
363 | 331 | << "icons : " << appareance->getIcon() << "\n" | ||
364 | 332 | << "fallback icons : " << appareance->getIconFallback() << "\n" | ||
365 | 333 | << "font family : " << appareance->getFont() << "\n" | ||
366 | 334 | << "toolbar style : " << appareance->getToolbarStyle() << "\n" | ||
367 | 335 | << "icons in buttons : " << appareance->getShowIconsInButtons() << "\n" | ||
368 | 336 | << "icons in menus : " << appareance->getShowIconsInMenus() << "\n" | ||
369 | 337 | << "********************************************************"; | ||
370 | 338 | syncUI(); | ||
371 | 339 | if(!appareance->saveFileConfig()) | ||
372 | 340 | QMessageBox::warning(this, "ERROR", i18n("It was not possible to save the config")); | ||
373 | 341 | } | ||
374 | 342 | |||
375 | 343 | void setComboItem(QComboBox* combo, const QStringList& texts) | ||
376 | 344 | { | ||
377 | 345 | foreach(const QString& text, texts) { | ||
378 | 346 | int pos = combo->findText(text); | ||
379 | 347 | if(pos>=0) { | ||
380 | 348 | combo->setCurrentIndex(pos); | ||
381 | 349 | return; | ||
382 | 350 | } | ||
383 | 351 | } | ||
384 | 352 | } | ||
385 | 353 | |||
386 | 354 | void GTKConfigKCModule::defaults() | ||
387 | 355 | { | ||
388 | 356 | kDebug() << "loading defaults..."; | ||
389 | 357 | m_saveEnabled = false; | ||
390 | 358 | ui->font->setFont(font()); | ||
391 | 359 | bool showIcons = !QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus); | ||
392 | 360 | ui->checkBox_icon_gtk_buttons->setChecked(showIcons); | ||
393 | 361 | ui->checkBox_icon_gtk_menus->setChecked(showIcons); | ||
394 | 362 | |||
395 | 363 | setComboItem(ui->cb_theme, QStringList("oxygen-gtk") << "Clearlooks"); | ||
396 | 364 | setComboItem(ui->cb_theme_gtk3, QStringList("oxygen-gtk") << "Adwaita"); | ||
397 | 365 | |||
398 | 366 | QStringList icons; | ||
399 | 367 | icons << KIconTheme(KIconTheme::current()).name() << "GNOME"; | ||
400 | 368 | setComboItem(ui->cb_icon, icons); | ||
401 | 369 | |||
402 | 370 | int idx = ui->cb_icon->currentIndex(); | ||
403 | 371 | if(idx>=0) { | ||
404 | 372 | setComboItem(ui->cb_icon_fallback, icons.mid(icons.indexOf(ui->cb_icon->currentText())+1)); | ||
405 | 373 | } | ||
406 | 374 | m_saveEnabled = true; | ||
407 | 375 | |||
408 | 376 | makePreviewIconTheme(); | ||
409 | 377 | appChanged(); | ||
410 | 378 | } | ||
411 | 379 | |||
412 | 380 | void GTKConfigKCModule::load() | ||
413 | 381 | { | ||
414 | 382 | m_saveEnabled = false; | ||
415 | 383 | refreshThemesUi(); | ||
416 | 384 | |||
417 | 385 | bool someCorrect = appareance->loadFileConfig(); | ||
418 | 386 | if(someCorrect) { | ||
419 | 387 | refreshLists(); | ||
420 | 388 | makePreviewIconTheme(); | ||
421 | 389 | } else | ||
422 | 390 | defaults(); | ||
423 | 391 | |||
424 | 392 | m_saveEnabled = true; | ||
425 | 393 | } | ||
426 | 394 | |||
427 | 395 | void refreshComboSameCurrentValue(QComboBox* combo, const QString& temp, const QStringList& texts) | ||
428 | 396 | { | ||
429 | 397 | combo->clear(); | ||
430 | 398 | combo->addItems(texts); | ||
431 | 399 | int idx = combo->findText(temp); | ||
432 | 400 | if(idx>=0) | ||
433 | 401 | combo->setCurrentIndex(idx); | ||
434 | 402 | } | ||
435 | 403 | |||
436 | 404 | void GTKConfigKCModule::refreshThemesUi(bool useConfig) | ||
437 | 405 | { | ||
438 | 406 | //theme gtk2 | ||
439 | 407 | bool wasenabled = m_saveEnabled; | ||
440 | 408 | m_saveEnabled = false; | ||
441 | 409 | |||
442 | 410 | refreshComboSameCurrentValue(ui->cb_theme, | ||
443 | 411 | useConfig ? appareance->getTheme() : ui->cb_theme->currentText(), | ||
444 | 412 | appareance->gtk2Appearance()->installedThemesNames()); | ||
445 | 413 | |||
446 | 414 | //theme gtk3 | ||
447 | 415 | refreshComboSameCurrentValue(ui->cb_theme_gtk3, | ||
448 | 416 | useConfig ? appareance->getThemeGtk3() : ui->cb_theme_gtk3->currentText(), | ||
449 | 417 | appareance->gtk3Appearance()->installedThemesNames()); | ||
450 | 418 | |||
451 | 419 | //icons | ||
452 | 420 | QString currentIcon = useConfig ? appareance->getIcon() : ui->cb_icon->currentText(), | ||
453 | 421 | currentFallback = useConfig ? appareance->getIconFallback() : ui->cb_icon_fallback->currentText(); | ||
454 | 422 | int currentIconIdx = ui->cb_icon->findData(currentIcon, IconThemesModel::DirNameRole); | ||
455 | 423 | int currentFallbackIdx = ui->cb_icon_fallback->findData(currentFallback, IconThemesModel::DirNameRole); | ||
456 | 424 | ui->cb_icon->setCurrentIndex(qMax(currentIconIdx, 0)); | ||
457 | 425 | ui->cb_icon_fallback->setCurrentIndex(qMax(currentFallbackIdx, 0)); | ||
458 | 426 | |||
459 | 427 | m_saveEnabled = wasenabled; | ||
460 | 428 | if(currentIconIdx<0 || currentFallbackIdx<0) | ||
461 | 429 | emit changed(true); | ||
462 | 430 | } | ||
463 | 431 | |||
464 | 432 | void GTKConfigKCModule::showDialogForInstall() | ||
465 | 433 | { | ||
466 | 434 | if(!installer) { | ||
467 | 435 | installer = new DialogInstaller(this); | ||
468 | 436 | connect(installer, SIGNAL(themeInstalled()), SLOT(refreshLists())); | ||
469 | 437 | } | ||
470 | 438 | |||
471 | 439 | installer->exec(); | ||
472 | 440 | refreshThemesUi(); | ||
473 | 441 | } | ||
474 | 442 | |||
475 | 443 | void GTKConfigKCModule::showDialogForUninstall() | ||
476 | 444 | { | ||
477 | 445 | if(!uninstaller) { | ||
478 | 446 | uninstaller = new DialogUninstaller(this, appareance); | ||
479 | 447 | connect(uninstaller, SIGNAL(themeUninstalled()), SLOT(refreshLists())); | ||
480 | 448 | } | ||
481 | 449 | |||
482 | 450 | uninstaller->refresthListsForUninstall(); | ||
483 | 451 | uninstaller->exec(); | ||
484 | 452 | |||
485 | 453 | refreshThemesUi(); | ||
486 | 454 | } | ||
487 | 455 | |||
488 | 456 | void GTKConfigKCModule::untogglePreview() | ||
489 | 457 | { | ||
490 | 458 | if(sender()==m_p2) | ||
491 | 459 | ui->gtk2Preview->setChecked(false); | ||
492 | 460 | else | ||
493 | 461 | ui->gtk3Preview->setChecked(false); | ||
494 | 462 | } | ||
495 | 463 | 0 | ||
496 | === removed directory '.pc/mirgation-from-package-src:kcm-gtk' | |||
497 | === removed directory '.pc/mirgation-from-package-src:kcm-gtk/src' | |||
498 | === removed file '.pc/mirgation-from-package-src:kcm-gtk/src/gtkconfigkcmodule.cpp' | |||
499 | --- .pc/mirgation-from-package-src:kcm-gtk/src/gtkconfigkcmodule.cpp 2012-11-07 00:35:58 +0000 | |||
500 | +++ .pc/mirgation-from-package-src:kcm-gtk/src/gtkconfigkcmodule.cpp 1970-01-01 00:00:00 +0000 | |||
501 | @@ -1,451 +0,0 @@ | |||
502 | 1 | /* KDE GTK Configuration Module | ||
503 | 2 | * | ||
504 | 3 | * Copyright 2011 José Antonio Sanchez Reynaga <joanzare@gmail.com> | ||
505 | 4 | * Copyright 2011 Aleix Pol Gonzalez <aleixpol@blue-systems.com> | ||
506 | 5 | * | ||
507 | 6 | * This library is free software; you can redistribute it and/or | ||
508 | 7 | * modify it under the terms of the GNU Lesser General Public | ||
509 | 8 | * License as published by the Free Software Foundation; either | ||
510 | 9 | * version 2.1 of the License, or (at your option) version 3, or any | ||
511 | 10 | * later version accepted by the membership of KDE e.V. (or its | ||
512 | 11 | * successor approved by the membership of KDE e.V.), which shall | ||
513 | 12 | * act as a proxy defined in Section 6 of version 3 of the license. | ||
514 | 13 | * | ||
515 | 14 | * This library is distributed in the hope that it will be useful, | ||
516 | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
517 | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
518 | 17 | * Lesser General Public License for more details. | ||
519 | 18 | * | ||
520 | 19 | * You should have received a copy of the GNU Lesser General Public | ||
521 | 20 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
522 | 21 | */ | ||
523 | 22 | |||
524 | 23 | #include "gtkconfigkcmodule.h" | ||
525 | 24 | #include <kaboutdata.h> | ||
526 | 25 | #include <KGenericFactory> | ||
527 | 26 | #include <KPluginFactory> | ||
528 | 27 | #include <KProcess> | ||
529 | 28 | #include <KStandardDirs> | ||
530 | 29 | #include <QtGui> | ||
531 | 30 | #include <QX11EmbedContainer> | ||
532 | 31 | #include "ui_gui.h" | ||
533 | 32 | #include "abstractappearance.h" | ||
534 | 33 | #include "iconthemesmodel.h" | ||
535 | 34 | #include <kicontheme.h> | ||
536 | 35 | |||
537 | 36 | K_PLUGIN_FACTORY(GTKConfigKCModuleFactory, registerPlugin<GTKConfigKCModule>();) | ||
538 | 37 | K_EXPORT_PLUGIN(GTKConfigKCModuleFactory("cgc","kde-gtk-config")) | ||
539 | 38 | |||
540 | 39 | QMap<QString, int> gtkToolbarInit() | ||
541 | 40 | { | ||
542 | 41 | QMap<QString, int> gtkToolbar; | ||
543 | 42 | gtkToolbar["GTK_TOOLBAR_ICONS"] = 0; | ||
544 | 43 | gtkToolbar["GTK_TOOLBAR_TEXT"] = 1; | ||
545 | 44 | gtkToolbar["GTK_TOOLBAR_BOTH"] = 2; | ||
546 | 45 | gtkToolbar["GTK_TOOLBAR_BOTH_HORIZ"] = 3; | ||
547 | 46 | return gtkToolbar; | ||
548 | 47 | } | ||
549 | 48 | |||
550 | 49 | static QMap<QString, int> gtkToolbar = gtkToolbarInit(); | ||
551 | 50 | |||
552 | 51 | GTKConfigKCModule::GTKConfigKCModule(QWidget* parent, const QVariantList& args ) | ||
553 | 52 | : KCModule(GTKConfigKCModuleFactory::componentData(), parent) | ||
554 | 53 | , ui(new Ui::GUI) | ||
555 | 54 | , installer(0) | ||
556 | 55 | , uninstaller(0) | ||
557 | 56 | , m_saveEnabled(true) | ||
558 | 57 | { | ||
559 | 58 | Q_UNUSED(args); | ||
560 | 59 | KAboutData *acercade = new KAboutData("cgc","kcm_cgc",ki18n("KDE GTK Config"), "2.0", | ||
561 | 60 | ki18n("Configure your GTK Applications"), | ||
562 | 61 | KAboutData::License_LGPL_V3, | ||
563 | 62 | ki18n("Copyright 2011 José Antonio Sánchez Reynaga")); | ||
564 | 63 | acercade->addAuthor(ki18n("José Antonio Sánchez Reynaga (antonioJASR)"),ki18n("Main Developer"), "joanzare@gmail.com"); | ||
565 | 64 | acercade->addAuthor(ki18n("Aleix Pol i Gonzalez"), ki18n("Feature development. Previews, code refactoring."), "aleixpol@blue-systems.com"); | ||
566 | 65 | acercade->addCredit(ki18n("Manuel Tortosa (manutortosa)"), ki18n("Ideas, tester, internationalization")); | ||
567 | 66 | acercade->addCredit(ki18n("Adrián Chaves Fernández (Gallaecio)"), ki18n("Internationalization")); | ||
568 | 67 | setAboutData(acercade); | ||
569 | 68 | |||
570 | 69 | ui->setupUi(this); | ||
571 | 70 | appareance = new AppearenceGTK; | ||
572 | 71 | m_iconsModel = new IconThemesModel(false, this); | ||
573 | 72 | ui->cb_icon->setModel(m_iconsModel); | ||
574 | 73 | ui->cb_icon_fallback->setModel(m_iconsModel); | ||
575 | 74 | |||
576 | 75 | m_tempGtk2Preview = KGlobal::dirs()->saveLocation("tmp", "gtkrc-2.0", false); | ||
577 | 76 | m_tempGtk3Preview = KGlobal::dirs()->saveLocation("tmp", ".config/gtk-3.0/settings.ini", false); | ||
578 | 77 | |||
579 | 78 | ui->gtk2Preview->setIcon(KIcon("document-preview")); //!! for some reason it doesn't work with QIcon::fromTheme | ||
580 | 79 | ui->gtk3Preview->setIcon(KIcon("document-preview")); | ||
581 | 80 | |||
582 | 81 | m_p2 = new KProcess(this); | ||
583 | 82 | m_p2->setEnv("GTK2_RC_FILES", m_tempGtk2Preview, true); | ||
584 | 83 | *m_p2 << KStandardDirs::findExe("gtk_preview"); | ||
585 | 84 | |||
586 | 85 | m_p3 = new KProcess(this); | ||
587 | 86 | m_p3->setEnv("XDG_CONFIG_HOME", KGlobal::dirs()->saveLocation("tmp", ".config")); | ||
588 | 87 | *m_p3 << KStandardDirs::findExe("gtk3_preview"); | ||
589 | 88 | |||
590 | 89 | //UI changes | ||
591 | 90 | connect(ui->cb_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); | ||
592 | 91 | connect(ui->cb_theme_gtk3, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); | ||
593 | 92 | connect(ui->cb_icon, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); | ||
594 | 93 | connect(ui->cb_icon_fallback ,SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); | ||
595 | 94 | connect(ui->font, SIGNAL(fontSelected(QFont)), this, SLOT(appChanged())); | ||
596 | 95 | connect(ui->cb_toolbar_icons, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); | ||
597 | 96 | connect(ui->checkBox_icon_gtk_menus, SIGNAL(clicked(bool)), this, SLOT(appChanged())); | ||
598 | 97 | connect(ui->checkBox_icon_gtk_buttons, SIGNAL(clicked(bool)), this, SLOT(appChanged())); | ||
599 | 98 | |||
600 | 99 | //preview updates | ||
601 | 100 | connect(ui->cb_icon_fallback, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme())); | ||
602 | 101 | connect(ui->cb_icon, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme())); | ||
603 | 102 | connect(ui->gtk2Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk2IfNecessary(bool))); | ||
604 | 103 | connect(ui->gtk3Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk3IfNecessary(bool))); | ||
605 | 104 | |||
606 | 105 | connect(m_p2, SIGNAL(finished(int)), this, SLOT(untogglePreview())); | ||
607 | 106 | connect(m_p3, SIGNAL(finished(int)), this, SLOT(untogglePreview())); | ||
608 | 107 | |||
609 | 108 | QMenu* m = new QMenu(this); | ||
610 | 109 | m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK2 themes..."), this, SLOT(showThemeGHNS())); | ||
611 | 110 | m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK3 themes..."), this, SLOT(installThemeGTK3GHNS())); | ||
612 | 111 | m->addAction(KIcon("archive-insert"), i18n("Install a local theme..."), this, SLOT(showDialogForInstall())); | ||
613 | 112 | m->addAction(KIcon("archive-remove"), i18n("Uninstall a local theme..."), this, SLOT(showDialogForUninstall())); | ||
614 | 113 | ui->newThemes->setMenu(m); | ||
615 | 114 | ui->newThemes->setIcon(KIcon("download")); | ||
616 | 115 | } | ||
617 | 116 | |||
618 | 117 | GTKConfigKCModule::~GTKConfigKCModule() | ||
619 | 118 | { | ||
620 | 119 | m_p2->kill(); | ||
621 | 120 | m_p3->kill(); | ||
622 | 121 | |||
623 | 122 | QFile::remove(m_tempGtk2Preview); | ||
624 | 123 | QFile::remove(m_tempGtk3Preview); | ||
625 | 124 | delete appareance; | ||
626 | 125 | |||
627 | 126 | m_p2->waitForFinished(); | ||
628 | 127 | m_p3->waitForFinished(); | ||
629 | 128 | delete ui; | ||
630 | 129 | } | ||
631 | 130 | |||
632 | 131 | QString fontToString(const QFont& f) | ||
633 | 132 | { | ||
634 | 133 | QString style; | ||
635 | 134 | |||
636 | 135 | if(f.bold()) | ||
637 | 136 | style += " bold"; | ||
638 | 137 | if(f.italic()) | ||
639 | 138 | style += " italic"; | ||
640 | 139 | |||
641 | 140 | return f.family() + style + ' ' + QString::number(f.pointSize()); | ||
642 | 141 | } | ||
643 | 142 | |||
644 | 143 | void GTKConfigKCModule::syncUI() | ||
645 | 144 | { | ||
646 | 145 | appareance->setThemeGtk3(ui->cb_theme_gtk3->currentText()); | ||
647 | 146 | appareance->setTheme(ui->cb_theme->currentText()); | ||
648 | 147 | appareance->setIcon(ui->cb_icon->itemData(ui->cb_icon->currentIndex(), IconThemesModel::DirNameRole).toString()); | ||
649 | 148 | appareance->setIconFallback(ui->cb_icon_fallback->itemData(ui->cb_icon_fallback->currentIndex(), IconThemesModel::DirNameRole).toString()); | ||
650 | 149 | appareance->setFont(fontToString(ui->font->font())); | ||
651 | 150 | |||
652 | 151 | appareance->setToolbarStyle(gtkToolbar.key(ui->cb_toolbar_icons->currentIndex())); | ||
653 | 152 | appareance->setShowIconsInButtons(ui->checkBox_icon_gtk_buttons->isChecked()); | ||
654 | 153 | appareance->setShowIconsInMenus(ui->checkBox_icon_gtk_menus->isChecked()); | ||
655 | 154 | } | ||
656 | 155 | |||
657 | 156 | void GTKConfigKCModule::showThemeGHNS() | ||
658 | 157 | { | ||
659 | 158 | KNS3::DownloadDialog d("cgctheme.knsrc", this); | ||
660 | 159 | if(d.exec()) { | ||
661 | 160 | refreshLists(); | ||
662 | 161 | } | ||
663 | 162 | } | ||
664 | 163 | |||
665 | 164 | void GTKConfigKCModule::installThemeGTK3GHNS() | ||
666 | 165 | { | ||
667 | 166 | KNS3::DownloadDialog d("cgcgtk3.knsrc", this); | ||
668 | 167 | if(d.exec()) { | ||
669 | 168 | refreshLists(); | ||
670 | 169 | } | ||
671 | 170 | } | ||
672 | 171 | |||
673 | 172 | QFont stringToFont(const QString& font) | ||
674 | 173 | { | ||
675 | 174 | QRegExp fontRx(QString(" (italic)? *(bold)? *([0-9]+)$")); | ||
676 | 175 | int pos = fontRx.indexIn(font); | ||
677 | 176 | QString fontFamily = font.left(pos); | ||
678 | 177 | |||
679 | 178 | bool italic = !fontRx.cap(1).isEmpty(); | ||
680 | 179 | QFont::Weight bold = fontRx.cap(2).isEmpty() ? QFont::Normal : QFont::Bold; | ||
681 | 180 | int fontSize = fontRx.cap(3).toInt(); | ||
682 | 181 | |||
683 | 182 | return QFont(fontFamily, fontSize, bold, italic); | ||
684 | 183 | } | ||
685 | 184 | |||
686 | 185 | void GTKConfigKCModule::refreshLists() | ||
687 | 186 | { | ||
688 | 187 | refreshThemesUi(true); | ||
689 | 188 | |||
690 | 189 | QString font = appareance->getFont(); | ||
691 | 190 | // Q_ASSERT(!font.isEmpty()); | ||
692 | 191 | ui->font->setFont(stringToFont(font)); | ||
693 | 192 | |||
694 | 193 | ui->cb_toolbar_icons->setCurrentIndex(gtkToolbar[appareance->getToolbarStyle()]); | ||
695 | 194 | |||
696 | 195 | ui->checkBox_icon_gtk_buttons->setChecked(appareance->getShowIconsInButtons()); | ||
697 | 196 | ui->checkBox_icon_gtk_menus->setChecked(appareance->getShowIconsInMenus()); | ||
698 | 197 | } | ||
699 | 198 | |||
700 | 199 | void tryIcon(QLabel* label, const QString& fallback, const QString& theme, const QString& iconName) | ||
701 | 200 | { | ||
702 | 201 | label->setToolTip(iconName); | ||
703 | 202 | |||
704 | 203 | QString ret; | ||
705 | 204 | if(!theme.isEmpty()) | ||
706 | 205 | ret = IconThemesModel::findIconRecursivelyByName(iconName, theme); | ||
707 | 206 | |||
708 | 207 | if(!ret.isEmpty()) { | ||
709 | 208 | QPixmap p(ret); | ||
710 | 209 | Q_ASSERT(!p.isNull()); | ||
711 | 210 | label->setPixmap(p); | ||
712 | 211 | return; | ||
713 | 212 | } | ||
714 | 213 | |||
715 | 214 | if(!fallback.isEmpty()) | ||
716 | 215 | ret = IconThemesModel::findIconRecursivelyByName(iconName, fallback); | ||
717 | 216 | |||
718 | 217 | if(!ret.isEmpty()) { | ||
719 | 218 | QPixmap p(ret); | ||
720 | 219 | Q_ASSERT(!p.isNull()); | ||
721 | 220 | label->setPixmap(p); | ||
722 | 221 | return; | ||
723 | 222 | } | ||
724 | 223 | |||
725 | 224 | KIcon notFoundIcon("application-x-zerosize"); | ||
726 | 225 | QPixmap noIcon(notFoundIcon.pixmap(48,48)); | ||
727 | 226 | label->setPixmap(noIcon); | ||
728 | 227 | |||
729 | 228 | kDebug() << "could not find icon" << iconName; | ||
730 | 229 | } | ||
731 | 230 | |||
732 | 231 | void GTKConfigKCModule::makePreviewIconTheme() | ||
733 | 232 | { | ||
734 | 233 | int icon_fallback = ui->cb_icon_fallback->currentIndex(); | ||
735 | 234 | QString path_fallback = ui->cb_icon->itemData(icon_fallback, IconThemesModel::PathRole).toString(); | ||
736 | 235 | |||
737 | 236 | int icon = ui->cb_icon->currentIndex(); | ||
738 | 237 | QString path_icon = ui->cb_icon->itemData(icon, IconThemesModel::PathRole).toString(); | ||
739 | 238 | |||
740 | 239 | tryIcon(ui->lb_prev_1, path_fallback, path_icon, "user-home"); | ||
741 | 240 | tryIcon(ui->lb_prev_2, path_fallback, path_icon, "folder"); | ||
742 | 241 | tryIcon(ui->lb_prev_3, path_fallback, path_icon, "user-trash"); | ||
743 | 242 | tryIcon(ui->lb_prev_4, path_fallback, path_icon, "document-print"); | ||
744 | 243 | tryIcon(ui->lb_prev_5, path_fallback, path_icon, "user-desktop"); | ||
745 | 244 | tryIcon(ui->lb_prev_6, path_fallback, path_icon, "network-server"); | ||
746 | 245 | tryIcon(ui->lb_prev_7, path_fallback, path_icon, "system-help"); | ||
747 | 246 | tryIcon(ui->lb_prev_8, path_fallback, path_icon, "start-here"); | ||
748 | 247 | tryIcon(ui->lb_prev_9, path_fallback, path_icon, "go-up"); | ||
749 | 248 | } | ||
750 | 249 | |||
751 | 250 | void GTKConfigKCModule::appChanged() | ||
752 | 251 | { | ||
753 | 252 | savePreviewConfig(); | ||
754 | 253 | emit changed(true); | ||
755 | 254 | } | ||
756 | 255 | |||
757 | 256 | |||
758 | 257 | void GTKConfigKCModule::savePreviewConfig() | ||
759 | 258 | { | ||
760 | 259 | if(!m_saveEnabled || !(ui->gtk2Preview->isChecked() || ui->gtk3Preview->isChecked())) | ||
761 | 260 | return; | ||
762 | 261 | kDebug() << "saving UI..."; | ||
763 | 262 | |||
764 | 263 | syncUI(); | ||
765 | 264 | |||
766 | 265 | if(ui->gtk3Preview->isChecked()) { | ||
767 | 266 | //we don't want to recursively loop between savePreviewConfig and runIfNecessary | ||
768 | 267 | m_saveEnabled = false; | ||
769 | 268 | m_p3->kill(); | ||
770 | 269 | appareance->gtk3Appearance()->saveSettings(m_tempGtk3Preview); | ||
771 | 270 | |||
772 | 271 | //need to make sure runIfNecessary() to know that it's not running | ||
773 | 272 | m_p3->waitForFinished(); | ||
774 | 273 | |||
775 | 274 | m_p3->start(); | ||
776 | 275 | ui->gtk3Preview->setChecked(true); | ||
777 | 276 | m_saveEnabled = true; | ||
778 | 277 | } else if(ui->gtk2Preview->isChecked()) | ||
779 | 278 | appareance->gtk2Appearance()->saveSettings(m_tempGtk2Preview); | ||
780 | 279 | } | ||
781 | 280 | |||
782 | 281 | void GTKConfigKCModule::runGtk2IfNecessary(bool checked) | ||
783 | 282 | { | ||
784 | 283 | KProcess* p = m_p2; | ||
785 | 284 | KProcess* np = m_p3; | ||
786 | 285 | |||
787 | 286 | if(checked) { | ||
788 | 287 | np->kill(); | ||
789 | 288 | np->waitForFinished(); | ||
790 | 289 | savePreviewConfig(); | ||
791 | 290 | if(p->state()!=KProcess::Running) | ||
792 | 291 | p->start(); | ||
793 | 292 | } else { | ||
794 | 293 | p->kill(); | ||
795 | 294 | p->waitForFinished(); | ||
796 | 295 | } | ||
797 | 296 | } | ||
798 | 297 | |||
799 | 298 | void GTKConfigKCModule::runGtk3IfNecessary(bool checked) | ||
800 | 299 | { | ||
801 | 300 | KProcess* p = m_p3; | ||
802 | 301 | KProcess* np = m_p2; | ||
803 | 302 | |||
804 | 303 | if(checked) { | ||
805 | 304 | np->kill(); | ||
806 | 305 | np->waitForFinished(); | ||
807 | 306 | savePreviewConfig(); | ||
808 | 307 | if(p->state()!=KProcess::Running) | ||
809 | 308 | p->start(); | ||
810 | 309 | } else { | ||
811 | 310 | p->kill(); | ||
812 | 311 | p->waitForFinished(); | ||
813 | 312 | } | ||
814 | 313 | } | ||
815 | 314 | |||
816 | 315 | void GTKConfigKCModule::save() | ||
817 | 316 | { | ||
818 | 317 | kDebug() << "******************************************* INSTALLATION :\n" | ||
819 | 318 | << "theme : " << appareance->getTheme() << "\n" | ||
820 | 319 | << "themeGTK3 : " << appareance->getThemeGtk3() << "\n" | ||
821 | 320 | << "icons : " << appareance->getIcon() << "\n" | ||
822 | 321 | << "fallback icons : " << appareance->getIconFallback() << "\n" | ||
823 | 322 | << "font family : " << appareance->getFont() << "\n" | ||
824 | 323 | << "toolbar style : " << appareance->getToolbarStyle() << "\n" | ||
825 | 324 | << "icons in buttons : " << appareance->getShowIconsInButtons() << "\n" | ||
826 | 325 | << "icons in menus : " << appareance->getShowIconsInMenus() << "\n" | ||
827 | 326 | << "********************************************************"; | ||
828 | 327 | syncUI(); | ||
829 | 328 | if(!appareance->saveFileConfig()) | ||
830 | 329 | QMessageBox::warning(this, "ERROR", i18n("It was not possible to save the config")); | ||
831 | 330 | } | ||
832 | 331 | |||
833 | 332 | void setComboItem(QComboBox* combo, const QStringList& texts) | ||
834 | 333 | { | ||
835 | 334 | foreach(const QString& text, texts) { | ||
836 | 335 | int pos = combo->findText(text); | ||
837 | 336 | if(pos>=0) { | ||
838 | 337 | combo->setCurrentIndex(pos); | ||
839 | 338 | return; | ||
840 | 339 | } | ||
841 | 340 | } | ||
842 | 341 | } | ||
843 | 342 | |||
844 | 343 | void GTKConfigKCModule::defaults() | ||
845 | 344 | { | ||
846 | 345 | kDebug() << "loading defaults..."; | ||
847 | 346 | m_saveEnabled = false; | ||
848 | 347 | ui->font->setFont(font()); | ||
849 | 348 | bool showIcons = !QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus); | ||
850 | 349 | ui->checkBox_icon_gtk_buttons->setChecked(showIcons); | ||
851 | 350 | ui->checkBox_icon_gtk_menus->setChecked(showIcons); | ||
852 | 351 | |||
853 | 352 | setComboItem(ui->cb_theme, QStringList("oxygen-gtk") << "Clearlooks"); | ||
854 | 353 | setComboItem(ui->cb_theme_gtk3, QStringList("oxygen-gtk") << "Adwaita"); | ||
855 | 354 | |||
856 | 355 | QStringList icons; | ||
857 | 356 | icons << KIconTheme(KIconTheme::current()).name() << "GNOME"; | ||
858 | 357 | setComboItem(ui->cb_icon, icons); | ||
859 | 358 | |||
860 | 359 | int idx = ui->cb_icon->currentIndex(); | ||
861 | 360 | if(idx>=0) { | ||
862 | 361 | setComboItem(ui->cb_icon_fallback, icons.mid(icons.indexOf(ui->cb_icon->currentText())+1)); | ||
863 | 362 | } | ||
864 | 363 | m_saveEnabled = true; | ||
865 | 364 | |||
866 | 365 | makePreviewIconTheme(); | ||
867 | 366 | appChanged(); | ||
868 | 367 | } | ||
869 | 368 | |||
870 | 369 | void GTKConfigKCModule::load() | ||
871 | 370 | { | ||
872 | 371 | m_saveEnabled = false; | ||
873 | 372 | refreshThemesUi(); | ||
874 | 373 | |||
875 | 374 | bool someCorrect = appareance->loadFileConfig(); | ||
876 | 375 | if(someCorrect) { | ||
877 | 376 | refreshLists(); | ||
878 | 377 | makePreviewIconTheme(); | ||
879 | 378 | } else | ||
880 | 379 | defaults(); | ||
881 | 380 | |||
882 | 381 | m_saveEnabled = true; | ||
883 | 382 | } | ||
884 | 383 | |||
885 | 384 | void refreshComboSameCurrentValue(QComboBox* combo, const QString& temp, const QStringList& texts) | ||
886 | 385 | { | ||
887 | 386 | combo->clear(); | ||
888 | 387 | combo->addItems(texts); | ||
889 | 388 | int idx = combo->findText(temp); | ||
890 | 389 | if(idx>=0) | ||
891 | 390 | combo->setCurrentIndex(idx); | ||
892 | 391 | } | ||
893 | 392 | |||
894 | 393 | void GTKConfigKCModule::refreshThemesUi(bool useConfig) | ||
895 | 394 | { | ||
896 | 395 | //theme gtk2 | ||
897 | 396 | bool wasenabled = m_saveEnabled; | ||
898 | 397 | m_saveEnabled = false; | ||
899 | 398 | |||
900 | 399 | refreshComboSameCurrentValue(ui->cb_theme, | ||
901 | 400 | useConfig ? appareance->getTheme() : ui->cb_theme->currentText(), | ||
902 | 401 | appareance->gtk2Appearance()->installedThemesNames()); | ||
903 | 402 | |||
904 | 403 | //theme gtk3 | ||
905 | 404 | refreshComboSameCurrentValue(ui->cb_theme_gtk3, | ||
906 | 405 | useConfig ? appareance->getThemeGtk3() : ui->cb_theme_gtk3->currentText(), | ||
907 | 406 | appareance->gtk3Appearance()->installedThemesNames()); | ||
908 | 407 | |||
909 | 408 | //icons | ||
910 | 409 | QString currentIcon = useConfig ? appareance->getIcon() : ui->cb_icon->currentText(), | ||
911 | 410 | currentFallback = useConfig ? appareance->getIconFallback() : ui->cb_icon_fallback->currentText(); | ||
912 | 411 | int currentIconIdx = ui->cb_icon->findData(currentIcon, IconThemesModel::DirNameRole); | ||
913 | 412 | int currentFallbackIdx = ui->cb_icon_fallback->findData(currentFallback, IconThemesModel::DirNameRole); | ||
914 | 413 | ui->cb_icon->setCurrentIndex(qMax(currentIconIdx, 0)); | ||
915 | 414 | ui->cb_icon_fallback->setCurrentIndex(qMax(currentFallbackIdx, 0)); | ||
916 | 415 | |||
917 | 416 | m_saveEnabled = wasenabled; | ||
918 | 417 | if(currentIconIdx<0 || currentFallbackIdx<0) | ||
919 | 418 | emit changed(true); | ||
920 | 419 | } | ||
921 | 420 | |||
922 | 421 | void GTKConfigKCModule::showDialogForInstall() | ||
923 | 422 | { | ||
924 | 423 | if(!installer) { | ||
925 | 424 | installer = new DialogInstaller(this); | ||
926 | 425 | connect(installer, SIGNAL(themeInstalled()), SLOT(refreshLists())); | ||
927 | 426 | } | ||
928 | 427 | |||
929 | 428 | installer->exec(); | ||
930 | 429 | refreshThemesUi(); | ||
931 | 430 | } | ||
932 | 431 | |||
933 | 432 | void GTKConfigKCModule::showDialogForUninstall() | ||
934 | 433 | { | ||
935 | 434 | if(!uninstaller) { | ||
936 | 435 | uninstaller = new DialogUninstaller(this, appareance); | ||
937 | 436 | connect(uninstaller, SIGNAL(themeUninstalled()), SLOT(refreshLists())); | ||
938 | 437 | } | ||
939 | 438 | |||
940 | 439 | uninstaller->refresthListsForUninstall(); | ||
941 | 440 | uninstaller->exec(); | ||
942 | 441 | |||
943 | 442 | refreshThemesUi(); | ||
944 | 443 | } | ||
945 | 444 | |||
946 | 445 | void GTKConfigKCModule::untogglePreview() | ||
947 | 446 | { | ||
948 | 447 | if(sender()==m_p2) | ||
949 | 448 | ui->gtk2Preview->setChecked(false); | ||
950 | 449 | else | ||
951 | 450 | ui->gtk3Preview->setChecked(false); | ||
952 | 451 | } | ||
953 | 452 | 0 | ||
954 | === modified file 'debian/changelog' | |||
955 | --- debian/changelog 2012-11-13 12:03:49 +0000 | |||
956 | +++ debian/changelog 2013-03-04 09:07:24 +0000 | |||
957 | @@ -1,3 +1,19 @@ | |||
958 | 1 | kde-gtk-config (3:2.1.1-1ubuntu1) raring; urgency=low | ||
959 | 2 | |||
960 | 3 | * Merge from Debian experimental (LP: #1103013) | ||
961 | 4 | |||
962 | 5 | -- Howard Chan <smartboyhw@gmail.com> Mon, 04 Mar 2013 16:52:47 +0800 | ||
963 | 6 | |||
964 | 7 | kde-gtk-config (3:2.1.1-1) experimental; urgency=low | ||
965 | 8 | |||
966 | 9 | * Update project Homepage. | ||
967 | 10 | * Update debian/control for kde-config-gtk-style-preview: | ||
968 | 11 | - add Breaks against old kde-config-gtk-style (Closes: #698285) | ||
969 | 12 | - add Recommends against kde-config-gtk-style | ||
970 | 13 | * Bump Standards-Version to 3.9.4 (was 3.9.3): no changes required. | ||
971 | 14 | |||
972 | 15 | -- Boris Pek <tehnick-8@mail.ru> Sun, 20 Jan 2013 15:21:10 +0200 | ||
973 | 16 | |||
974 | 1 | kde-gtk-config (3:2.1.1-1~exp1ubuntu1) raring; urgency=low | 17 | kde-gtk-config (3:2.1.1-1~exp1ubuntu1) raring; urgency=low |
975 | 2 | 18 | ||
976 | 3 | * Merge with Debian experimental (LP: #1077846) | 19 | * Merge with Debian experimental (LP: #1077846) |
977 | 4 | 20 | ||
978 | === modified file 'debian/control' | |||
979 | --- debian/control 2012-11-13 12:03:49 +0000 | |||
980 | +++ debian/control 2013-03-04 09:07:24 +0000 | |||
981 | @@ -6,10 +6,10 @@ | |||
982 | 6 | Uploaders: Boris Pek <tehnick-8@mail.ru> | 6 | Uploaders: Boris Pek <tehnick-8@mail.ru> |
983 | 7 | Build-Depends: debhelper (>= 8), cmake, | 7 | Build-Depends: debhelper (>= 8), cmake, |
984 | 8 | kdelibs5-dev, pkg-kde-tools, libgtk2.0-dev, libgtk-3-dev | 8 | kdelibs5-dev, pkg-kde-tools, libgtk2.0-dev, libgtk-3-dev |
986 | 9 | Homepage: https://projects.kde.org/projects/playground/base/kde-gtk-config | 9 | Homepage: https://projects.kde.org/projects/extragear/base/kde-gtk-config |
987 | 10 | Vcs-Git: git://github.com/tehnick/kde-gtk-config-debian.git | 10 | Vcs-Git: git://github.com/tehnick/kde-gtk-config-debian.git |
988 | 11 | Vcs-Browser: https://github.com/tehnick/kde-gtk-config-debian | 11 | Vcs-Browser: https://github.com/tehnick/kde-gtk-config-debian |
990 | 12 | Standards-Version: 3.9.3 | 12 | Standards-Version: 3.9.4 |
991 | 13 | 13 | ||
992 | 14 | Package: kde-config-gtk-style | 14 | Package: kde-config-gtk-style |
993 | 15 | Architecture: any | 15 | Architecture: any |
994 | @@ -30,6 +30,8 @@ | |||
995 | 30 | Package: kde-config-gtk-style-preview | 30 | Package: kde-config-gtk-style-preview |
996 | 31 | Architecture: any | 31 | Architecture: any |
997 | 32 | Depends: ${shlibs:Depends}, ${misc:Depends} | 32 | Depends: ${shlibs:Depends}, ${misc:Depends} |
998 | 33 | Recommends: kde-config-gtk-style | ||
999 | 34 | Breaks: kde-config-gtk-style (<< 3:2.1.1-1~exp1~) | ||
1000 | 33 | Description: KDE configuration module for GTK+ 2.x and GTK+ 3.x styles selection (extras) | 35 | Description: KDE configuration module for GTK+ 2.x and GTK+ 3.x styles selection (extras) |
1001 | 34 | Configuration dialog to adapt GTK+ applications appearance to your taste | 36 | Configuration dialog to adapt GTK+ applications appearance to your taste |
1002 | 35 | under KDE. Among its many features, it lets you: | 37 | under KDE. Among its many features, it lets you: |
1003 | 36 | 38 | ||
1004 | === modified file 'debian/copyright' | |||
1005 | --- debian/copyright 2012-03-13 06:57:17 +0000 | |||
1006 | +++ debian/copyright 2013-03-04 09:07:24 +0000 | |||
1007 | @@ -4,7 +4,7 @@ | |||
1008 | 4 | Upstream-Name: KDE GTK Configurator | 4 | Upstream-Name: KDE GTK Configurator |
1009 | 5 | Upstream-Contact: Jose Antonio Sánchez Reynaga <joanzare@gmail.com> | 5 | Upstream-Contact: Jose Antonio Sánchez Reynaga <joanzare@gmail.com> |
1010 | 6 | Aleix Pol Gonzalez <aleixpol@blue-systems.com> | 6 | Aleix Pol Gonzalez <aleixpol@blue-systems.com> |
1012 | 7 | Source: https://projects.kde.org/projects/playground/base/kde-gtk-config | 7 | Source: https://projects.kde.org/projects/extragear/base/kde-gtk-config |
1013 | 8 | The orig.tar.bz2 is just renamed upstream tarball (without changes). | 8 | The orig.tar.bz2 is just renamed upstream tarball (without changes). |
1014 | 9 | See section get-orig-source in debian/rules file for details. | 9 | See section get-orig-source in debian/rules file for details. |
1015 | 10 | 10 | ||
1016 | 11 | 11 | ||
1017 | === modified file 'debian/gtk3_preview.1' | |||
1018 | --- debian/gtk3_preview.1 2012-03-13 06:57:17 +0000 | |||
1019 | +++ debian/gtk3_preview.1 2013-03-04 09:07:24 +0000 | |||
1020 | @@ -24,7 +24,7 @@ | |||
1021 | 24 | .SH AUTHOR | 24 | .SH AUTHOR |
1022 | 25 | This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>. | 25 | This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>. |
1023 | 26 | .br | 26 | .br |
1025 | 27 | Homepage: \fBhttps://projects.kde.org/projects/playground/base/kde-gtk-config\fR | 27 | Homepage: \fBhttps://projects.kde.org/projects/extragear/base/kde-gtk-config\fR |
1026 | 28 | .SH "BUG REPORTS" | 28 | .SH "BUG REPORTS" |
1027 | 29 | If you find a bug in this program please report it to original author. | 29 | If you find a bug in this program please report it to original author. |
1028 | 30 | .PP | 30 | .PP |
1029 | 31 | 31 | ||
1030 | === modified file 'debian/gtk_preview.1' | |||
1031 | --- debian/gtk_preview.1 2012-03-13 06:57:17 +0000 | |||
1032 | +++ debian/gtk_preview.1 2013-03-04 09:07:24 +0000 | |||
1033 | @@ -24,7 +24,7 @@ | |||
1034 | 24 | .SH AUTHOR | 24 | .SH AUTHOR |
1035 | 25 | This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>. | 25 | This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>. |
1036 | 26 | .br | 26 | .br |
1038 | 27 | Homepage: \fBhttps://projects.kde.org/projects/playground/base/kde-gtk-config\fR | 27 | Homepage: \fBhttps://projects.kde.org/projects/extragear/base/kde-gtk-config\fR |
1039 | 28 | .SH "BUG REPORTS" | 28 | .SH "BUG REPORTS" |
1040 | 29 | If you find a bug in this program please report it to original author. | 29 | If you find a bug in this program please report it to original author. |
1041 | 30 | .PP | 30 | .PP |
1042 | 31 | 31 | ||
1043 | === modified file 'debian/reload_gtk_apps.1' | |||
1044 | --- debian/reload_gtk_apps.1 2012-03-13 06:57:17 +0000 | |||
1045 | +++ debian/reload_gtk_apps.1 2013-03-04 09:07:24 +0000 | |||
1046 | @@ -21,7 +21,7 @@ | |||
1047 | 21 | .SH AUTHOR | 21 | .SH AUTHOR |
1048 | 22 | This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>. | 22 | This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>. |
1049 | 23 | .br | 23 | .br |
1051 | 24 | Homepage: \fBhttps://projects.kde.org/projects/playground/base/kde-gtk-config\fR | 24 | Homepage: \fBhttps://projects.kde.org/projects/extragear/base/kde-gtk-config\fR |
1052 | 25 | .SH "BUG REPORTS" | 25 | .SH "BUG REPORTS" |
1053 | 26 | If you find a bug in this program please report it to original author. | 26 | If you find a bug in this program please report it to original author. |
1054 | 27 | .PP | 27 | .PP |
1055 | 28 | 28 | ||
1056 | === modified file 'src/gtkconfigkcmodule.cpp' | |||
1057 | --- src/gtkconfigkcmodule.cpp 2012-11-13 12:03:49 +0000 | |||
1058 | +++ src/gtkconfigkcmodule.cpp 2013-03-04 09:07:24 +0000 | |||
1059 | @@ -72,39 +72,19 @@ | |||
1060 | 72 | ui->cb_icon->setModel(m_iconsModel); | 72 | ui->cb_icon->setModel(m_iconsModel); |
1061 | 73 | ui->cb_icon_fallback->setModel(m_iconsModel); | 73 | ui->cb_icon_fallback->setModel(m_iconsModel); |
1062 | 74 | 74 | ||
1063 | 75 | QFile oldConfigFile(QDir::homePath()+"/.gtkrc-2.0-kde"); | ||
1064 | 76 | QFile newConfigFile(QDir::homePath()+"/.gtkrc-2.0"); | ||
1065 | 77 | if(oldConfigFile.exists()) { | ||
1066 | 78 | newConfigFile.remove(); | ||
1067 | 79 | if( !oldConfigFile.rename(newConfigFile.fileName()) ) | ||
1068 | 80 | kDebug() << "Could not rename old config: " + oldConfigFile.fileName(); | ||
1069 | 81 | else | ||
1070 | 82 | kDebug() << "Old config " + oldConfigFile.fileName() + | ||
1071 | 83 | "was successfully renamed to " + newConfigFile.fileName(); | ||
1072 | 84 | } | ||
1073 | 85 | |||
1074 | 86 | m_tempGtk2Preview = KGlobal::dirs()->saveLocation("tmp", "gtkrc-2.0", false); | 75 | m_tempGtk2Preview = KGlobal::dirs()->saveLocation("tmp", "gtkrc-2.0", false); |
1075 | 87 | m_tempGtk3Preview = KGlobal::dirs()->saveLocation("tmp", ".config/gtk-3.0/settings.ini", false); | 76 | m_tempGtk3Preview = KGlobal::dirs()->saveLocation("tmp", ".config/gtk-3.0/settings.ini", false); |
1076 | 88 | 77 | ||
1077 | 89 | ui->gtk2Preview->setIcon(KIcon("document-preview")); //!! for some reason it doesn't work with QIcon::fromTheme | 78 | ui->gtk2Preview->setIcon(KIcon("document-preview")); //!! for some reason it doesn't work with QIcon::fromTheme |
1078 | 90 | ui->gtk3Preview->setIcon(KIcon("document-preview")); | 79 | ui->gtk3Preview->setIcon(KIcon("document-preview")); |
1079 | 91 | 80 | ||
1080 | 92 | ui->gtk2Preview->hide(); | ||
1081 | 93 | ui->gtk3Preview->hide(); | ||
1082 | 94 | |||
1083 | 95 | m_p2 = new KProcess(this); | 81 | m_p2 = new KProcess(this); |
1084 | 96 | m_p2->setEnv("GTK2_RC_FILES", m_tempGtk2Preview, true); | 82 | m_p2->setEnv("GTK2_RC_FILES", m_tempGtk2Preview, true); |
1089 | 97 | if (KStandardDirs::findExe("gtk_preview") != QString::null) { | 83 | *m_p2 << KStandardDirs::findExe("gtk_preview"); |
1086 | 98 | *m_p2 << KStandardDirs::findExe("gtk_preview"); | ||
1087 | 99 | ui->gtk2Preview->show(); | ||
1088 | 100 | } | ||
1090 | 101 | 84 | ||
1091 | 102 | m_p3 = new KProcess(this); | 85 | m_p3 = new KProcess(this); |
1092 | 103 | m_p3->setEnv("XDG_CONFIG_HOME", KGlobal::dirs()->saveLocation("tmp", ".config")); | 86 | m_p3->setEnv("XDG_CONFIG_HOME", KGlobal::dirs()->saveLocation("tmp", ".config")); |
1097 | 104 | if (KStandardDirs::findExe("gtk3_preview") != QString::null) { | 87 | *m_p3 << KStandardDirs::findExe("gtk3_preview"); |
1094 | 105 | *m_p3 << KStandardDirs::findExe("gtk3_preview"); | ||
1095 | 106 | ui->gtk3Preview->show(); | ||
1096 | 107 | } | ||
1098 | 108 | 88 | ||
1099 | 109 | //UI changes | 89 | //UI changes |
1100 | 110 | connect(ui->cb_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); | 90 | connect(ui->cb_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); |