Merge lp:~jakuje/wallpaper-changer/unbundle-unity into lp:wallpaper-changer
- unbundle-unity
- Merge into trunk
Proposed by
Jakuje
Status: | Needs review |
---|---|
Proposed branch: | lp:~jakuje/wallpaper-changer/unbundle-unity |
Merge into: | lp:wallpaper-changer |
Diff against target: |
855 lines (+118/-102) 9 files modified
src/gui/mainwindow.cpp (+43/-39) src/gui/mainwindow.h (+5/-3) src/gui/preferences.cpp (+5/-3) src/gui/preferences.h (+1/-1) src/tools/glob.cpp (+2/-2) src/tools/glob.h (+7/-5) src/tools/nonguimanager.cpp (+44/-43) src/tools/nonguimanager.h (+5/-5) wallch.pro (+6/-1) |
To merge this branch: | bzr merge lp:~jakuje/wallpaper-changer/unbundle-unity |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alex Solanos | Approve | ||
Review via email: mp+281513@code.launchpad.net |
Commit message
Remove compile time dependency on Unity
Description of the change
Remove compile time dependency on Unity
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 | === modified file 'src/gui/mainwindow.cpp' |
2 | --- src/gui/mainwindow.cpp 2015-08-25 17:06:39 +0000 |
3 | +++ src/gui/mainwindow.cpp 2016-01-04 13:58:41 +0000 |
4 | @@ -286,9 +286,11 @@ |
5 | gv.potdOnlineUrlB = settings->value("potd_online_urlB", POTD_ONLINE_URL_B).toString(); |
6 | gv.liveEarthOnlineUrl = settings->value("line_earth_online_url", LIVEARTH_ONLINE_URL).toString(); |
7 | gv.liveEarthOnlineUrlB = settings->value("live_earth_online_urlB", LIVEARTH_ONLINE_URL_B).toString(); |
8 | -#ifdef Q_OS_UNIX |
9 | +#ifdef WITH_UNITY |
10 | gv.unityProgressbarEnabled = settings->value("unity_progressbar_enabled", false).toBool(); |
11 | -#endif |
12 | +#else |
13 | + gv.unityProgressbarEnabled = false; |
14 | +#endif //#ifdef WITH_UNITY |
15 | |
16 | gv.independentIntervalEnabled = settings->value("independent_interval_enabled", true).toBool(); |
17 | gv.rotateImages = settings->value("rotation", false).toBool(); |
18 | @@ -542,11 +544,11 @@ |
19 | globalParser_->resetSleepProtection(secondsLeft_); |
20 | updateSeconds(); |
21 | stopButtonsSetEnabled(true); |
22 | -#ifdef Q_OS_UNIX |
23 | +#ifdef WITH_UNITY |
24 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
25 | dbusmenu_menuitem_property_set_bool(gv.unityPauseAction, DBUSMENU_MENUITEM_PROP_VISIBLE, false); |
26 | } |
27 | -#endif |
28 | +#endif //#ifdef WITH_UNITY |
29 | previousAndNextButtonsSetEnabled(false); |
30 | ui->timeForNext->setFormat(ui->timeForNext->format()+" - Paused."); |
31 | } |
32 | @@ -709,11 +711,11 @@ |
33 | updateSecondsTimer_->start(1000); |
34 | if(ui->timeForNext->isHidden()){ |
35 | ui->timeForNext->show(); |
36 | -#ifdef Q_OS_UNIX |
37 | +#ifdef WITH_UNITY |
38 | if(gv.currentDE == DesktopEnvironment::UnityGnome && gv.unityProgressbarEnabled){ |
39 | globalParser_->setUnityProgressBarEnabled(true); |
40 | } |
41 | -#endif |
42 | +#endif //#ifdef WITH_UNITY |
43 | } |
44 | } |
45 | |
46 | @@ -734,11 +736,11 @@ |
47 | |
48 | void MainWindow::setProgressbarsValue(short value){ |
49 | ui->timeForNext->setValue(value); |
50 | -#ifdef Q_OS_UNIX |
51 | +#ifdef WITH_UNITY |
52 | if(gv.currentDE == DesktopEnvironment::UnityGnome && gv.unityProgressbarEnabled){ |
53 | globalParser_->setUnityProgressbarValue((float)(value/100.0)); |
54 | } |
55 | -#endif |
56 | +#endif //#ifdef WITH_UNITY |
57 | } |
58 | |
59 | void MainWindow::imageTransition(bool wallpaperClock, const QString &filename /*=QString()*/) |
60 | @@ -1219,11 +1221,11 @@ |
61 | hideProgress_->start(400); |
62 | } |
63 | |
64 | -#ifdef Q_OS_UNIX |
65 | +#ifdef WITH_UNITY |
66 | if(gv.currentDE == DesktopEnvironment::UnityGnome && gv.unityProgressbarEnabled){ |
67 | globalParser_->setUnityProgressBarEnabled(show); |
68 | } |
69 | -#endif //#ifdef Q_OS_UNIX |
70 | +#endif //#ifdef WITH_UNITY |
71 | |
72 | ui->timeForNext->setGraphicsEffect(opacityEffect_); |
73 | QPropertyAnimation* anim = new QPropertyAnimation(this); |
74 | @@ -2203,7 +2205,7 @@ |
75 | ui->screen_label_text->setText(text); |
76 | } |
77 | |
78 | -#ifdef Q_OS_UNIX |
79 | +#ifdef WITH_UNITY |
80 | void MainWindow::unityProgressbarSetEnabled(bool enabled){ |
81 | if(gv.wallpapersRunning || gv.liveEarthRunning || gv.potdRunning || gv.wallpaperClocksRunning || gv.liveWebsiteRunning ){ |
82 | globalParser_->setUnityProgressBarEnabled(enabled); |
83 | @@ -2213,7 +2215,7 @@ |
84 | } |
85 | } |
86 | |
87 | -#endif //#ifdef Q_OS_UNIX |
88 | +#endif //#ifdef WITH_UNITY |
89 | |
90 | void MainWindow::updateColorButton(QImage image) |
91 | { |
92 | @@ -2318,12 +2320,12 @@ |
93 | } |
94 | gv.processPaused=false; |
95 | |
96 | -#ifdef Q_OS_UNIX |
97 | +#ifdef WITH_UNITY |
98 | if(gv.currentDE == DesktopEnvironment::UnityGnome && gv.unityProgressbarEnabled){ |
99 | dbusmenu_menuitem_property_set_bool(gv.unityPauseAction, DBUSMENU_MENUITEM_PROP_VISIBLE, true); |
100 | globalParser_->setUnityProgressBarEnabled(true); |
101 | } |
102 | -#endif //#ifdef Q_OS_UNIX |
103 | +#endif //#ifdef WITH_UNITY |
104 | Q_EMIT signalRecreateTray(); |
105 | |
106 | if(gv.pauseOnBattery){ |
107 | @@ -2352,7 +2354,7 @@ |
108 | stoppedBecauseOnBattery_=false; |
109 | ui->startButton->setText(tr("&Start")); |
110 | ui->startButton->setIcon(QIcon::fromTheme("media-playback-start", QIcon(":/images/media-playback-start.png"))); |
111 | -#ifdef Q_OS_UNIX |
112 | +#ifdef WITH_UNITY |
113 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
114 | dbusmenu_menuitem_property_set_bool(gv.unityPauseAction, DBUSMENU_MENUITEM_PROP_VISIBLE, false); |
115 | } |
116 | @@ -2397,12 +2399,14 @@ |
117 | gv.wallpapersRunning=false; |
118 | globalParser_->updateStartup(); |
119 | #ifdef Q_OS_UNIX |
120 | +#ifdef WITH_UNITY |
121 | if(gv.currentDE == DesktopEnvironment::UnityGnome && gv.unityLauncherEntry){ |
122 | dbusmenu_menuitem_property_set_bool(gv.unityPauseAction, DBUSMENU_MENUITEM_PROP_VISIBLE, false); |
123 | } |
124 | if(gv.currentDE == DesktopEnvironment::UnityGnome && gv.unityProgressbarEnabled){ |
125 | globalParser_->setUnityProgressBarEnabled(false); |
126 | } |
127 | +#endif //#ifdef WITH_UNITY |
128 | if(gv.pauseOnBattery){ |
129 | if(batteryStatusChecker_->isActive()){ |
130 | batteryStatusChecker_->stop(); |
131 | @@ -3013,34 +3017,34 @@ |
132 | void MainWindow::startButtonsSetEnabled(bool enabled) |
133 | { |
134 | ui->startButton->setEnabled(enabled); |
135 | -#ifdef Q_OS_UNIX |
136 | +#ifdef WITH_UNITY |
137 | if(gv.currentDE == DesktopEnvironment::UnityGnome && gv.unityLauncherEntry){ |
138 | dbusmenu_menuitem_property_set_bool(gv.unityPauseAction, DBUSMENU_MENUITEM_PROP_VISIBLE, !enabled); |
139 | } |
140 | -#endif //#ifdef Q_OS_UNIX |
141 | +#endif //#ifdef WITH_UNITY |
142 | } |
143 | |
144 | void MainWindow::stopButtonsSetEnabled(bool enabled) |
145 | { |
146 | ui->stopButton->setEnabled(enabled); |
147 | |
148 | -#ifdef Q_OS_UNIX |
149 | +#ifdef WITH_UNITY |
150 | if(gv.currentDE == DesktopEnvironment::UnityGnome && gv.unityLauncherEntry){ |
151 | dbusmenu_menuitem_property_set_bool(gv.unityStopAction, DBUSMENU_MENUITEM_PROP_VISIBLE, enabled && !gv.wallpapersRunning); |
152 | dbusmenu_menuitem_property_set_bool(gv.unityPauseAction, DBUSMENU_MENUITEM_PROP_VISIBLE, enabled); |
153 | } |
154 | -#endif //#ifdef Q_OS_UNIX |
155 | +#endif //#ifdef WITH_UNITY |
156 | } |
157 | |
158 | void MainWindow::previousAndNextButtonsSetEnabled(bool enabled){ |
159 | ui->next_Button->setEnabled(enabled); ui->previous_Button->setEnabled(enabled); |
160 | |
161 | -#ifdef Q_OS_UNIX |
162 | +#ifdef WITH_UNITY |
163 | if(gv.currentDE == DesktopEnvironment::UnityGnome && gv.unityLauncherEntry){ |
164 | dbusmenu_menuitem_property_set_bool(gv.unityNextAction, DBUSMENU_MENUITEM_PROP_VISIBLE, enabled); |
165 | dbusmenu_menuitem_property_set_bool(gv.unityPreviousAction, DBUSMENU_MENUITEM_PROP_VISIBLE, enabled); |
166 | } |
167 | -#endif //#ifdef Q_OS_UNIX |
168 | +#endif //#ifdef WITH_UNITY |
169 | } |
170 | |
171 | void MainWindow::monitor(const QStringList &finalListOfPaths){ |
172 | @@ -3692,11 +3696,11 @@ |
173 | ui->deactivate_livearth->setEnabled(true); |
174 | gv.liveEarthRunning=true; |
175 | globalParser_->updateStartup(); |
176 | -#ifdef Q_OS_UNIX |
177 | +#ifdef WITH_UNITY |
178 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
179 | dbusmenu_menuitem_property_set_bool(gv.unityStopAction, DBUSMENU_MENUITEM_PROP_VISIBLE, true); |
180 | } |
181 | -#endif //#ifdef Q_OS_UNIX |
182 | +#endif //#ifdef WITH_UNITY |
183 | Q_EMIT signalRecreateTray(); |
184 | setProgressbarsValue(100); |
185 | startUpdateSeconds(); |
186 | @@ -3726,11 +3730,11 @@ |
187 | ui->activate_livearth->setEnabled(true); |
188 | stoppedBecauseOnBattery_=false; |
189 | |
190 | -#ifdef Q_OS_UNIX |
191 | +#ifdef WITH_UNITY |
192 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
193 | dbusmenu_menuitem_property_set_bool(gv.unityStopAction, DBUSMENU_MENUITEM_PROP_VISIBLE, false); |
194 | } |
195 | -#endif //#ifdef Q_OS_UNIX |
196 | +#endif //#ifdef WITH_UNITY |
197 | Q_EMIT signalUncheckRunningFeatureOnTray(); |
198 | } |
199 | |
200 | @@ -3781,11 +3785,11 @@ |
201 | } |
202 | animateProgressbarOpacity(1); |
203 | |
204 | -#ifdef Q_OS_UNIX |
205 | +#ifdef WITH_UNITY |
206 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
207 | dbusmenu_menuitem_property_set_bool(gv.unityStopAction, DBUSMENU_MENUITEM_PROP_VISIBLE, true); |
208 | } |
209 | -#endif //#ifdef Q_OS_UNIX |
210 | +#endif //#ifdef WITH_UNITY |
211 | Q_EMIT signalRecreateTray(); |
212 | startUpdateSeconds(); |
213 | updatePotdProgress(); |
214 | @@ -3810,11 +3814,11 @@ |
215 | ui->deactivate_potd->setEnabled(false); |
216 | stoppedBecauseOnBattery_=false; |
217 | |
218 | -#ifdef Q_OS_UNIX |
219 | +#ifdef WITH_UNITY |
220 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
221 | dbusmenu_menuitem_property_set_bool(gv.unityStopAction, DBUSMENU_MENUITEM_PROP_VISIBLE, false); |
222 | } |
223 | -#endif //#ifdef Q_OS_UNIX |
224 | +#endif //#ifdef WITH_UNITY |
225 | Q_EMIT signalUncheckRunningFeatureOnTray(); |
226 | } |
227 | |
228 | @@ -4151,11 +4155,11 @@ |
229 | |
230 | gv.wallpaperClocksRunning=true; |
231 | globalParser_->updateStartup(); |
232 | -#ifdef Q_OS_UNIX |
233 | +#ifdef WITH_UNITY |
234 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
235 | dbusmenu_menuitem_property_set_bool(gv.unityStopAction, DBUSMENU_MENUITEM_PROP_VISIBLE, true); |
236 | } |
237 | -#endif //#ifdef Q_OS_UNIX |
238 | +#endif //#ifdef WITH_UNITY |
239 | Q_EMIT signalRecreateTray(); |
240 | |
241 | calculateSecondsLeftForWallClocks(); |
242 | @@ -4196,11 +4200,11 @@ |
243 | ui->activate_clock->setEnabled(true); |
244 | stoppedBecauseOnBattery_=false; |
245 | |
246 | -#ifdef Q_OS_UNIX |
247 | +#ifdef WITH_UNITY |
248 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
249 | dbusmenu_menuitem_property_set_bool(gv.unityStopAction, DBUSMENU_MENUITEM_PROP_VISIBLE, false); |
250 | } |
251 | -#endif //#ifdef Q_OS_UNIX |
252 | +#endif //#ifdef WITH_UNITY |
253 | Q_EMIT signalUncheckRunningFeatureOnTray(); |
254 | } |
255 | |
256 | @@ -4473,11 +4477,11 @@ |
257 | |
258 | gv.liveWebsiteRunning=true; |
259 | globalParser_->updateStartup(); |
260 | -#ifdef Q_OS_UNIX |
261 | +#ifdef WITH_UNITY |
262 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
263 | dbusmenu_menuitem_property_set_bool(gv.unityStopAction, DBUSMENU_MENUITEM_PROP_VISIBLE, true); |
264 | } |
265 | -#endif //#ifdef Q_OS_UNIX |
266 | +#endif //#ifdef WITH_UNITY |
267 | Q_EMIT signalRecreateTray(); |
268 | setProgressbarsValue(100); |
269 | animateProgressbarOpacity(1); |
270 | @@ -4507,11 +4511,11 @@ |
271 | } |
272 | ui->live_website_login_widget->setEnabled(true); |
273 | animateProgressbarOpacity(0); |
274 | -#ifdef Q_OS_UNIX |
275 | +#ifdef WITH_UNITY |
276 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
277 | dbusmenu_menuitem_property_set_bool(gv.unityStopAction, DBUSMENU_MENUITEM_PROP_VISIBLE, false); |
278 | } |
279 | -#endif //#ifdef Q_OS_UNIX |
280 | +#endif //#ifdef WITH_UNITY |
281 | Q_EMIT signalUncheckRunningFeatureOnTray(); |
282 | disconnect(websiteSnapshot_->asQObject(), SIGNAL(resultedImage(QImage*,short)), this, SLOT(liveWebsiteImageCreated(QImage*,short))); |
283 | ui->deactivate_website->setEnabled(false); ui->activate_website->setEnabled(true); |
284 | @@ -5449,9 +5453,9 @@ |
285 | connect(preferences_, SIGNAL(intervalTypeChanged()), this, SLOT(intervalTypeChanged())); |
286 | connect(preferences_, SIGNAL(changeThemeTo(QString)), this, SLOT(changeCurrentThemeTo(const QString&))); |
287 | connect(preferences_, SIGNAL(maxCacheChanged(qint64)), cacheManager_, SLOT(setMaxCache(qint64))); |
288 | -#ifdef Q_OS_UNIX |
289 | +#ifdef WITH_UNITY |
290 | connect(preferences_, SIGNAL(unityProgressbarChanged(bool)), this, SLOT(unityProgressbarSetEnabled(bool))); |
291 | -#endif //#ifdef Q_OS_UNIX |
292 | +#endif //#ifdef WITH_UNITY |
293 | preferences_->setWindowFlags(Qt::Dialog | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint); |
294 | preferences_->show(); |
295 | preferences_->activateWindow(); |
296 | |
297 | === modified file 'src/gui/mainwindow.h' |
298 | --- src/gui/mainwindow.h 2015-08-25 17:06:39 +0000 |
299 | +++ src/gui/mainwindow.h 2016-01-04 13:58:41 +0000 |
300 | @@ -65,7 +65,9 @@ |
301 | |
302 | #include <glib-object.h> |
303 | #include <gtk/gtk.h> |
304 | -#include <unity/unity/unity.h> |
305 | +# ifdef WITH_UNITY |
306 | +# include <unity/unity/unity.h> |
307 | +# endif //#ifdef WITH_UNITY |
308 | |
309 | #else |
310 | |
311 | @@ -371,9 +373,9 @@ |
312 | void strongShowApp(); |
313 | void hideOrShow(); |
314 | void picturesLocationsChanged(); |
315 | -#ifdef Q_OS_UNIX |
316 | +#ifdef WITH_UNITY |
317 | void unityProgressbarSetEnabled(bool enabled); |
318 | -#endif //#ifdef Q_OS_UNIX |
319 | +#endif //#ifdef WITH_UNITY |
320 | void preferencesDestroyed(); |
321 | void statisticsDestroyed(); |
322 | void lePointDestroyed(); |
323 | |
324 | === modified file 'src/gui/preferences.cpp' |
325 | --- src/gui/preferences.cpp 2015-08-24 14:22:52 +0000 |
326 | +++ src/gui/preferences.cpp 2016-01-04 13:58:41 +0000 |
327 | @@ -66,7 +66,7 @@ |
328 | ui->showPreview_checkBox->setChecked(gv.previewImagesOnScreen); |
329 | ui->startup_timeout_spinbox->setValue(settings->value("startup_timeout", 3).toInt()); |
330 | |
331 | -#ifdef Q_OS_UNIX |
332 | +#ifdef WITH_UNITY |
333 | ui->unity_prog_checkbox->setChecked(settings->value("unity_progressbar_enabled", false).toBool()); |
334 | short curDe = settings->value("de", 0).toInt(); |
335 | if(curDe>=ui->de_combo->count()){ |
336 | @@ -283,11 +283,13 @@ |
337 | } |
338 | |
339 | #ifdef Q_OS_UNIX |
340 | +#ifdef WITH_UNITY |
341 | if(gv.unityProgressbarEnabled!=ui->unity_prog_checkbox->isChecked()){ |
342 | gv.unityProgressbarEnabled=ui->unity_prog_checkbox->isChecked(); |
343 | Q_EMIT unityProgressbarChanged(gv.unityProgressbarEnabled); |
344 | } |
345 | settings->setValue("unity_progressbar_enabled", gv.unityProgressbarEnabled); |
346 | +#endif //#ifdef WITH_UNITY |
347 | settings->setValue("de", ui->de_combo->currentIndex()); |
348 | |
349 | #endif |
350 | @@ -400,7 +402,7 @@ |
351 | //Integration |
352 | ui->theme_combo->setCurrentIndex(2); |
353 | ui->de_combo->setCurrentIndex(0); |
354 | -#ifdef Q_OS_UNIX |
355 | +#ifdef WITH_UNITY |
356 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
357 | ui->unity_prog_checkbox->setChecked(false); |
358 | } |
359 | @@ -527,7 +529,7 @@ |
360 | return QString::number(niceData, 'f', 2)+" "+dataTypes.at(counter); |
361 | } |
362 | |
363 | -#ifdef Q_OS_UNIX |
364 | +#ifdef WITH_UNITY |
365 | void Preferences::on_de_combo_currentIndexChanged(int index) |
366 | { |
367 | DesktopEnvironment::Value curEnv = static_cast<DesktopEnvironment::Value>(index); |
368 | |
369 | === modified file 'src/gui/preferences.h' |
370 | --- src/gui/preferences.h 2015-08-23 16:51:21 +0000 |
371 | +++ src/gui/preferences.h 2016-01-04 13:58:41 +0000 |
372 | @@ -63,7 +63,7 @@ |
373 | void on_page_3_advanced_clicked(); |
374 | void on_theme_combo_currentIndexChanged(int index); |
375 | void on_rotate_checkBox_clicked(bool checked); |
376 | -#ifdef Q_OS_UNIX |
377 | +#ifdef WITH_UNITY |
378 | void on_de_combo_currentIndexChanged(int index); |
379 | #endif |
380 | void on_startupCheckBox_clicked(bool checked); |
381 | |
382 | === modified file 'src/tools/glob.cpp' |
383 | --- src/tools/glob.cpp 2015-08-25 14:34:01 +0000 |
384 | +++ src/tools/glob.cpp 2016-01-04 13:58:41 +0000 |
385 | @@ -58,7 +58,7 @@ |
386 | Global::Global(){} |
387 | Global::~Global(){} |
388 | |
389 | -#ifdef Q_OS_UNIX |
390 | +#ifdef WITH_UNITY |
391 | void Global::setUnityProgressBarEnabled(bool state){ |
392 | if(!gv.unityLauncherEntry){ |
393 | gv.unityLauncherEntry = unity_launcher_entry_get_for_desktop_id(APP_DESKTOP_NAME); |
394 | @@ -73,7 +73,7 @@ |
395 | } |
396 | unity_launcher_entry_set_progress(gv.unityLauncherEntry, percent); |
397 | } |
398 | -#endif //#ifdef Q_OS_UNIX |
399 | +#endif //#ifdef WITH_UNITY |
400 | |
401 | bool Global::runsOnBattery(){ |
402 | #ifdef Q_OS_UNIX |
403 | |
404 | === modified file 'src/tools/glob.h' |
405 | --- src/tools/glob.h 2015-08-24 17:15:53 +0000 |
406 | +++ src/tools/glob.h 2016-01-04 13:58:41 +0000 |
407 | @@ -38,7 +38,7 @@ |
408 | |
409 | #include "time.h" |
410 | |
411 | -#ifdef Q_OS_UNIX |
412 | +#ifdef WITH_UNITY |
413 | #include "unity/unity/unity.h" |
414 | #endif //#ifdef Q_OS_UNIX |
415 | |
416 | @@ -196,19 +196,19 @@ |
417 | QDateTime runningTimeOfProcess; |
418 | QDateTime timeToFinishProcessInterval; |
419 | |
420 | -#ifdef Q_OS_UNIX |
421 | +#ifdef WITH_UNITY |
422 | //unity launcher shortcuts |
423 | UnityLauncherEntry *unityLauncherEntry; |
424 | DbusmenuMenuitem *unityStopAction, *unityNextAction, *unityPreviousAction, *unityPauseAction; |
425 | -#endif //#ifdef Q_OS_UNIX |
426 | +#endif //#ifdef WITH_UNITY |
427 | |
428 | //variable initialization |
429 | |
430 | GlobalVar() : homePath(QDir::homePath()), currentTheme("ambiance"), preferencesDialogShown(false), independentIntervalEnabled(true), |
431 | typeOfInterval(0), randomImagesEnabled(false), firstTimeout(false), symlinks(false), processPaused(false), |
432 | -#ifdef Q_OS_UNIX |
433 | +#ifdef WITH_UNITY |
434 | unityProgressbarEnabled(false), currentDE(DesktopEnvironment::UnityGnome), unacceptedDesktopValues(QStringList() << "" << "default.desktop" << "X-Cinnamon" << "default"), |
435 | -#endif |
436 | +#endif //#ifdef WITH_UNITY |
437 | saveHistory(true), randomTimeFrom(300), randomTimeTo(1200), doNotToggleRadiobuttonFallback(false), previewImagesOnScreen(true), pauseOnBattery(false), amPmEnabled(false), |
438 | mainwindowLoaded(false), setAverageColor(false), websiteLoginEnabled(false), websiteCropEnabled(false), wallpapersChangedCurrentSession(0), timeLaunched(QDateTime::currentDateTime()), |
439 | showNotification(false), wallpaperClocksRunning(false), liveWebsiteRunning(false), potdRunning(false), liveEarthRunning(false), wallpapersRunning(false), |
440 | @@ -256,8 +256,10 @@ |
441 | static void debug(const QString &message); |
442 | static QString getPrimaryColor(); |
443 | #ifdef Q_OS_UNIX |
444 | +# ifdef WITH_UNITY |
445 | static void setUnityProgressBarEnabled(bool state); |
446 | static void setUnityProgressbarValue(float percent); |
447 | +# endif // #ifdef WITH_UNITY |
448 | static QString gsettingsGet(const QString &schema, const QString &key); |
449 | static QString getSecondaryColor(); |
450 | static void setPrimaryColor(const QString &colorName); |
451 | |
452 | === modified file 'src/tools/nonguimanager.cpp' |
453 | --- src/tools/nonguimanager.cpp 2015-08-25 14:34:01 +0000 |
454 | +++ src/tools/nonguimanager.cpp 2016-01-04 13:58:41 +0000 |
455 | @@ -263,7 +263,7 @@ |
456 | exit(exitCode); |
457 | } |
458 | |
459 | -#ifdef Q_OS_UNIX |
460 | +#ifdef WITH_UNITY |
461 | static void stop_fake_callback_main(DbusmenuMenuitem *, guint, gpointer){ |
462 | nongui->doAction("--stop"); |
463 | } |
464 | @@ -320,16 +320,16 @@ |
465 | dbusmenu_menuitem_property_set_bool(gv.unityPreviousAction, DBUSMENU_MENUITEM_PROP_VISIBLE, previousState); |
466 | } |
467 | } |
468 | -#endif //#ifdef Q_OS_UNIX |
469 | +#endif //#ifdef WITH_UNITY |
470 | |
471 | void NonGuiManager::waitForInternetConnection(){ |
472 | Global::debug("Checking for internet connection..."); |
473 | -#ifdef Q_OS_UNIX |
474 | +#ifdef WITH_UNITY |
475 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
476 | setupUnityShortcuts(); |
477 | setUnityShortcutsState(true, false, false, false); |
478 | } |
479 | -#endif |
480 | +#endif //#ifdef WITH_UNITY |
481 | if(gv.potdRunning){ |
482 | continueWithPotd(); |
483 | } |
484 | @@ -414,11 +414,11 @@ |
485 | } |
486 | } |
487 | } |
488 | -#ifdef Q_OS_UNIX |
489 | +#ifdef WITH_UNITY |
490 | if(gv.unityProgressbarEnabled && gv.currentDE == DesktopEnvironment::UnityGnome){ |
491 | Global::setUnityProgressbarValue((float) secondsLeft_/totalSeconds_); |
492 | } |
493 | -#endif |
494 | +#endif //#ifdef WITH_UNITY |
495 | secondsLeft_--; |
496 | } |
497 | |
498 | @@ -453,18 +453,18 @@ |
499 | generalTimer_->start(59500); |
500 | } |
501 | } |
502 | -#ifdef Q_OS_UNIX |
503 | +#ifdef WITH_UNITY |
504 | updatePotdProgressMain(); |
505 | #endif |
506 | } |
507 | |
508 | -#ifdef Q_OS_UNIX |
509 | +#ifdef WITH_UNITY |
510 | void NonGuiManager::updatePotdProgressMain(){ |
511 | if(gv.currentDE == DesktopEnvironment::UnityGnome && gv.unityProgressbarEnabled){ |
512 | Global::setUnityProgressbarValue((float) (Global::getSecondsTillHour("00:00")/86400.0)); |
513 | } |
514 | } |
515 | -#endif //#ifdef Q_OS_UNIX |
516 | +#endif //#ifdef WITH_UNITY |
517 | |
518 | void NonGuiManager::connectToUpdateSecondsSlot(){ |
519 | if(generalTimer_ == NULL){ |
520 | @@ -477,11 +477,11 @@ |
521 | { |
522 | connect(generalTimer_, SIGNAL(timeout()), this, SLOT(updateSeconds())); |
523 | } |
524 | -#ifdef Q_OS_UNIX |
525 | +#ifdef WITH_UNITY |
526 | if(gv.currentDE == DesktopEnvironment::UnityGnome && gv.unityProgressbarEnabled){ |
527 | Global::setUnityProgressBarEnabled(true); |
528 | } |
529 | -#endif |
530 | +#endif //#ifdef WITH_UNITY |
531 | } |
532 | |
533 | void NonGuiManager::disconnectFromSlot(){ |
534 | @@ -679,13 +679,13 @@ |
535 | } |
536 | this->disconnectFromSlot(); |
537 | this->connectToUpdateSecondsSlot(); |
538 | -#ifdef Q_OS_UNIX |
539 | +#ifdef WITH_UNITY |
540 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
541 | if(gv.unityProgressbarEnabled){ |
542 | Global::setUnityProgressBarEnabled(true); |
543 | } |
544 | } |
545 | -#endif //#ifdef Q_OS_UNIX |
546 | +#endif //#ifdef WITH_UNITY |
547 | generalTimer_->start(1000); |
548 | return true; |
549 | } |
550 | @@ -707,10 +707,10 @@ |
551 | { |
552 | potdSetSameImage(); |
553 | } |
554 | -#ifdef Q_OS_UNIX |
555 | +#ifdef WITH_UNITY |
556 | updatePotdProgressMain(); |
557 | gv.doNotToggleRadiobuttonFallback=false; |
558 | -#endif //#ifdef Q_OS_UNIX |
559 | +#endif //#ifdef WITH_UNITY |
560 | generalTimer_->start(59500); |
561 | } |
562 | |
563 | @@ -949,6 +949,7 @@ |
564 | nongui->doAction("--stop"); |
565 | } |
566 | |
567 | +# ifdef WITH_UNITY |
568 | void NonGuiManager::unityProgressbarSetEnabled(bool enabled){ |
569 | if(generalTimer_->isActive()){ |
570 | Global::setUnityProgressBarEnabled(enabled); |
571 | @@ -957,6 +958,7 @@ |
572 | } |
573 | } |
574 | } |
575 | +# endif |
576 | #endif //#ifdef Q_OS_UNIX |
577 | |
578 | //System tray icon Code |
579 | @@ -1375,14 +1377,14 @@ |
580 | secondsLeft_=totalSeconds_=LIVEARTH_INTERVAL; |
581 | Global::resetSleepProtection(secondsLeft_); |
582 | generalTimer_->start(1000); |
583 | -#ifdef Q_OS_UNIX |
584 | +#ifdef WITH_UNITY |
585 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
586 | if(gv.unityProgressbarEnabled){ |
587 | Global::setUnityProgressBarEnabled(true); |
588 | } |
589 | setUnityShortcutsState(true, false, false, false); |
590 | } |
591 | -#endif //#ifdef Q_OS_UNIX |
592 | +#endif //#ifdef WITH_UNITY |
593 | } |
594 | else if(message == "--potd"){ |
595 | if(mainWindowLaunched_){ |
596 | @@ -1422,11 +1424,11 @@ |
597 | } |
598 | this->disconnectFromSlot(); |
599 | this->continueWithPotd(); |
600 | -#ifdef Q_OS_UNIX |
601 | +#ifdef WITH_UNITY |
602 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
603 | setUnityShortcutsState(true, false, false, false); |
604 | } |
605 | -#endif //#ifdef Q_OS_UNIX |
606 | +#endif //#ifdef WITH_UNITY |
607 | } |
608 | else if(message == "--clock") |
609 | { |
610 | @@ -1465,11 +1467,11 @@ |
611 | } |
612 | } |
613 | |
614 | -#ifdef Q_OS_UNIX |
615 | +#ifdef WITH_UNITY |
616 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
617 | setUnityShortcutsState(true, false, false, false); |
618 | } |
619 | -#endif //#ifdef Q_OS_UNIX |
620 | +#endif //#ifdef WITH_UNITY |
621 | } |
622 | else if(message == "--website"){ |
623 | if(mainWindowLaunched_){ |
624 | @@ -1508,14 +1510,14 @@ |
625 | this->disconnectFromSlot(); |
626 | secondsLeft_=0; |
627 | this->continueWithWebsite(); |
628 | -#ifdef Q_OS_UNIX |
629 | +#ifdef WITH_UNITY |
630 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
631 | if(gv.unityProgressbarEnabled){ |
632 | Global::setUnityProgressBarEnabled(true); |
633 | } |
634 | setUnityShortcutsState(true, false, false, false); |
635 | } |
636 | -#endif //#ifdef Q_OS_UNIX |
637 | +#endif //#ifdef WITH_UNITY |
638 | } |
639 | else if(message == "--start"){ |
640 | |
641 | @@ -1569,7 +1571,7 @@ |
642 | secondsLeft_=0; |
643 | Global::resetSleepProtection(secondsLeft_); |
644 | generalTimer_->start(1000); |
645 | -#ifdef Q_OS_UNIX |
646 | +#ifdef WITH_UNITY |
647 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
648 | if(gv.unityProgressbarEnabled){ |
649 | Global::setUnityProgressBarEnabled(true); |
650 | @@ -1577,7 +1579,7 @@ |
651 | |
652 | setUnityShortcutsState(true, true, true, true); |
653 | } |
654 | -#endif //#ifdef Q_OS_UNIX |
655 | +#endif //#ifdef WITH_UNITY |
656 | } |
657 | } |
658 | else if(message == "--change"){ |
659 | @@ -1619,19 +1621,18 @@ |
660 | Global::debug("Pausing the Wallpapers process."); |
661 | generalTimer_->stop(); |
662 | gv.processPaused=true; |
663 | -#ifdef Q_OS_UNIX |
664 | +#ifdef WITH_UNITY |
665 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
666 | setUnityShortcutsState(true, false, false, false); |
667 | } |
668 | -#endif //#ifdef Q_OS_UNIX |
669 | +#endif //#ifdef WITH_UNITY |
670 | } |
671 | else |
672 | { |
673 | Global::resetSleepProtection(secondsLeft_); |
674 | Global::debug("Continuing from the pause..."); |
675 | gv.processPaused=false; |
676 | -#ifdef Q_OS_UNIX |
677 | - |
678 | +#ifdef WITH_UNITY |
679 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
680 | setUnityShortcutsState(true, true, true, true); |
681 | } |
682 | @@ -1645,7 +1646,7 @@ |
683 | return; |
684 | } |
685 | |
686 | -#ifdef Q_OS_UNIX |
687 | +#ifdef WITH_UNITY |
688 | if(gv.currentDE == DesktopEnvironment::UnityGnome && gv.unityProgressbarEnabled){ |
689 | Global::setUnityProgressBarEnabled(false); |
690 | } |
691 | @@ -1687,7 +1688,7 @@ |
692 | |
693 | gv.wallpapersRunning=gv.liveEarthRunning=gv.potdRunning=gv.wallpaperClocksRunning=gv.liveWebsiteRunning=false; |
694 | Global::updateStartup(); |
695 | -#ifdef Q_OS_UNIX |
696 | +#ifdef WITH_UNITY |
697 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
698 | setUnityShortcutsState(false, false, false, false); |
699 | } |
700 | @@ -1755,7 +1756,7 @@ |
701 | preferences_->setModal(true); |
702 | preferences_->setAttribute(Qt::WA_DeleteOnClose); |
703 | connect(preferences_, SIGNAL(destroyed()), this, SLOT(preferencesDestroyed())); |
704 | -#ifdef Q_OS_UNIX |
705 | +#ifdef WITH_UNITY |
706 | connect(preferences_, SIGNAL(unityProgressbarChanged(bool)), this, SLOT(unityProgressbarSetEnabled(bool))); |
707 | #endif |
708 | preferences_->show(); |
709 | @@ -1950,7 +1951,7 @@ |
710 | //checks all needed settings |
711 | gv.pauseOnBattery=settings->value("pause_on_battery", false).toBool(); |
712 | |
713 | -#ifdef Q_OS_UNIX |
714 | +#ifdef WITH_UNITY |
715 | gv.unityProgressbarEnabled=settings->value("unity_progressbar_enabled", false).toBool(); |
716 | #endif |
717 | |
718 | @@ -1960,7 +1961,7 @@ |
719 | gv.potdDescriptionFont = settings->value("potd_description_font", "Ubuntu").toString(); |
720 | gv.potdDescriptionColor = settings->value("potd_text_color", "#FFFFFF").toString(); |
721 | gv.potdDescriptionBackgroundColor = settings->value("potd_background_color", "#000000").toString(); |
722 | -#ifdef Q_OS_UNIX |
723 | +#ifdef WITH_UNITY |
724 | gv.potdDescriptionLeftMargin = settings->value("potd_description_left_margin", (gv.currentDE == DesktopEnvironment::UnityGnome ? 60 : 0)).toInt(); |
725 | #else |
726 | gv.potdDescriptionLeftMargin = settings->value("potd_description_left_margin", (0)).toInt(); |
727 | @@ -2286,11 +2287,11 @@ |
728 | connectToServer(); |
729 | |
730 | setupTray(); |
731 | -#ifdef Q_OS_UNIX |
732 | +#ifdef WITH_UNITY |
733 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
734 | setupUnityShortcuts(); |
735 | } |
736 | -#endif //#ifdef Q_OS_UNIX |
737 | +#endif //#ifdef WITH_UNITY |
738 | mainWindowLaunched_=true; |
739 | MainWindow *mainWindow = new MainWindow(alreadyRunsMem_, globalParser_, imageFetcher_, websiteSnapshot_, wallpaperManager_, 0, 0); |
740 | connectMainwindowWithExternalActions(mainWindow); |
741 | @@ -2339,7 +2340,7 @@ |
742 | } |
743 | connectToServer(); |
744 | setupTray(); |
745 | -#ifdef Q_OS_UNIX |
746 | +#ifdef WITH_UNITY |
747 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
748 | setupUnityShortcuts(); |
749 | if(gotPicLocation){ |
750 | @@ -2350,7 +2351,7 @@ |
751 | setUnityShortcutsState(false, false, false, false); |
752 | } |
753 | } |
754 | -#endif //#ifdef Q_OS_UNIX |
755 | +#endif //#ifdef WITH_UNITY |
756 | if(gotPicLocation){ |
757 | generalTimer_->start(1000); |
758 | } |
759 | @@ -2377,7 +2378,7 @@ |
760 | connectToServer(); |
761 | setupTray(); |
762 | |
763 | -#ifdef Q_OS_UNIX |
764 | +#ifdef WITH_UNITY |
765 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
766 | setupUnityShortcuts(); |
767 | setUnityShortcutsState(true, false, false, false); |
768 | @@ -2405,12 +2406,12 @@ |
769 | connectToServer(); |
770 | setupTray(); |
771 | |
772 | -#ifdef Q_OS_UNIX |
773 | +#ifdef WITH_UNITY |
774 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
775 | setupUnityShortcuts(); |
776 | setUnityShortcutsState(true, false, false, false); |
777 | } |
778 | -#endif //#ifdef Q_OS_UNIX |
779 | +#endif //#ifdef WITH_UNITY |
780 | |
781 | continueWithClock(); |
782 | startStatisticsTimer(); |
783 | @@ -2433,7 +2434,7 @@ |
784 | |
785 | checkSettings(true); |
786 | |
787 | -#ifdef Q_OS_UNIX |
788 | +#ifdef WITH_UNITY |
789 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
790 | setupUnityShortcuts(); |
791 | setUnityShortcutsState(true, false, false, false); |
792 | @@ -2465,7 +2466,7 @@ |
793 | |
794 | websiteSnapshot_ = new WebsiteSnapshot(); |
795 | |
796 | -#ifdef Q_OS_UNIX |
797 | +#ifdef WITH_UNITY |
798 | if(gv.currentDE == DesktopEnvironment::UnityGnome){ |
799 | setupUnityShortcuts(); |
800 | setUnityShortcutsState(true, false, false, false); |
801 | |
802 | === modified file 'src/tools/nonguimanager.h' |
803 | --- src/tools/nonguimanager.h 2015-08-24 17:15:53 +0000 |
804 | +++ src/tools/nonguimanager.h 2016-01-04 13:58:41 +0000 |
805 | @@ -97,9 +97,9 @@ |
806 | bool propertiesShown_ = false; |
807 | bool justUpdatedPotd_ = false; |
808 | bool currentFolderIsAList_ = false; |
809 | -#ifdef Q_OS_UNIX |
810 | +#ifdef WITH_UNITY |
811 | DbusmenuMenuitem *unityMenu_; |
812 | -#endif //#ifdef Q_OS_UNIX |
813 | +#endif //#ifdef WITH_UNITY |
814 | |
815 | QSystemTrayIcon *trayIcon_; |
816 | QMenu *trayIconMenu_; |
817 | @@ -127,7 +127,7 @@ |
818 | QTimer *doubleClick_; |
819 | void setupTray(); |
820 | |
821 | -#ifdef Q_OS_UNIX |
822 | +#ifdef WITH_UNITY |
823 | void updatePotdProgressMain(); |
824 | void setUnityShortcutsState(bool stopState, bool pauseState, bool nextState, bool previousState); |
825 | void setupUnityShortcuts(); |
826 | @@ -169,9 +169,9 @@ |
827 | void dirChanged(); |
828 | void researchDirs(); |
829 | void onlineBackgroundReady(QString image); |
830 | -#ifdef Q_OS_UNIX |
831 | +#ifdef WITH_UNITY |
832 | void unityProgressbarSetEnabled(bool enabled); |
833 | -#endif //#ifdef Q_OS_UNIX |
834 | +#endif //#ifdef WITH_UNITY |
835 | |
836 | void trayActionShowWindow(); |
837 | void trayActionCopyPath(); |
838 | |
839 | === modified file 'wallch.pro' |
840 | --- wallch.pro 2015-08-25 14:34:01 +0000 |
841 | +++ wallch.pro 2016-01-04 13:58:41 +0000 |
842 | @@ -19,7 +19,12 @@ |
843 | QMAKE_TARGET_COPYRIGHT = "GNU General Public License" |
844 | } else { |
845 | CONFIG += link_pkgconfig |
846 | - PKGCONFIG += unity libnotify libexif gtk+-2.0 |
847 | + PKGCONFIG += libnotify libexif gtk+-2.0 |
848 | + UNAME = $$system(uname -a) |
849 | + contains(UNAME, "Ubuntu"): { |
850 | + PKGCONFIG += unity |
851 | + DEFINES += "WITH_UNITY=1" |
852 | + } |
853 | } |
854 | |
855 | isEmpty(PREFIX) { |