From 0887aee8c54d0ed51bb2031431e2bcdafebb4c6e Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:23:19 +0200 Subject: 5.13 --- ui/taskbar.cpp | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) (limited to 'ui/taskbar.cpp') diff --git a/ui/taskbar.cpp b/ui/taskbar.cpp index 311a7bee..8613643e 100644 --- a/ui/taskbar.cpp +++ b/ui/taskbar.cpp @@ -3,18 +3,21 @@ // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * // * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** -// + #include "taskbar.h" #ifdef FFS_WIN -#include //includes "windows.h" #include -#include #include #include "Taskbar_Seven/taskbar.h" #elif defined HAVE_UBUNTU_UNITY #include + +#elif defined FFS_MAC +#include +#include +#include "osx_dock.h" #endif using namespace zen; @@ -39,16 +42,13 @@ public: throw TaskbarNotAvailable(); } - ~Pimpl() { setStatus(STATUS_NOPROGRESS); } + ~Pimpl() { setStatus_(assocWindow, tbseven::STATUS_NOPROGRESS); } void setStatus(Status status) { TaskBarStatus tbSevenStatus = tbseven::STATUS_NORMAL; switch (status) { - case Taskbar::STATUS_NOPROGRESS: - tbSevenStatus = tbseven::STATUS_NOPROGRESS; - break; case Taskbar::STATUS_INDETERMINATE: tbSevenStatus = tbseven::STATUS_INDETERMINATE; break; @@ -94,7 +94,7 @@ public: throw TaskbarNotAvailable(); } - ~Pimpl() { setStatus(STATUS_NOPROGRESS); } //it seems UnityLauncherEntry* does not need destruction + ~Pimpl() { setStatus(STATUS_INDETERMINATE); } //it seems UnityLauncherEntry* does not need destruction void setStatus(Status status) { @@ -104,7 +104,6 @@ public: unity_launcher_entry_set_urgent(tbEntry, true); break; - case Taskbar::STATUS_NOPROGRESS: case Taskbar::STATUS_INDETERMINATE: unity_launcher_entry_set_urgent(tbEntry, false); unity_launcher_entry_set_progress_visible(tbEntry, false); @@ -116,7 +115,7 @@ public: break; case Taskbar::STATUS_PAUSED: - unity_launcher_entry_set_urgent (tbEntry, false); + unity_launcher_entry_set_urgent(tbEntry, false); break; } } @@ -130,20 +129,46 @@ private: UnityLauncherEntry* tbEntry; }; +#elif defined FFS_MAC +class Taskbar::Pimpl +{ +public: + Pimpl(const wxTopLevelWindow& window) {} -#else //no taskbar support yet + ~Pimpl() { setDockText(""); } + + void setStatus(Status status) {} + + void setProgress(double fraction) + { + //no decimal places to make output less noisy + setDockText((numberTo(numeric::round(fraction * 100.0)) + '%').c_str()); //no need to internationalize fraction!? + } + +private: + void setDockText(const char* str) + { + try + { + osx::dockIconSetText(str); //throw OsxError + } + catch (const osx::OsxError& e) { assert(false); } + } +}; + + +#else //no taskbar support class Taskbar::Pimpl { public: Pimpl(const wxTopLevelWindow& window) { throw TaskbarNotAvailable(); } void setStatus(Status status) {} void setProgress(double fraction) {} - }; #endif - //######################################################################################################## + Taskbar::Taskbar(const wxTopLevelWindow& window) : pimpl_(new Pimpl(window)) {} //throw TaskbarNotAvailable Taskbar::~Taskbar() {} -- cgit