diff options
author | Littleboy | 2011-04-04 12:49:49 -0400 |
---|---|---|
committer | Julien | 2011-06-16 14:23:12 -0400 |
commit | e1dc9cdc0b89609753d3558f9603bef1cc12f1d8 (patch) | |
tree | 58802cb0ee464fdd4e63787162ba5ef4f963ee29 | |
parent | 6c14d8a95052b68c9f076d32e520c6befac3d959 (diff) | |
download | scummvm-rg350-e1dc9cdc0b89609753d3558f9603bef1cc12f1d8.tar.gz scummvm-rg350-e1dc9cdc0b89609753d3558f9603bef1cc12f1d8.tar.bz2 scummvm-rg350-e1dc9cdc0b89609753d3558f9603bef1cc12f1d8.zip |
BACKENDS: Add support for count status to TaskbarManager
- Show the number of found games when using the massadd dialog
-rw-r--r-- | backends/taskbar/unity/unity-taskbar.cpp | 9 | ||||
-rw-r--r-- | backends/taskbar/unity/unity-taskbar.h | 1 | ||||
-rw-r--r-- | common/taskbar.h | 74 | ||||
-rw-r--r-- | gui/massadd.cpp | 12 |
4 files changed, 59 insertions, 37 deletions
diff --git a/backends/taskbar/unity/unity-taskbar.cpp b/backends/taskbar/unity/unity-taskbar.cpp index 24347e382f..0de2167a83 100644 --- a/backends/taskbar/unity/unity-taskbar.cpp +++ b/backends/taskbar/unity/unity-taskbar.cpp @@ -88,6 +88,15 @@ void UnityTaskbarManager::addRecent(const Common::String &name, const Common::St warning("[UnityTaskbarManager::addRecent] Not implemented"); } +void UnityTaskbarManager::setCount(int count) { + if (_launcher == NULL) + return; + + unity_launcher_entry_set_count(_launcher, count); + + unity_launcher_entry_set_count_visible(_launcher, (count == 0) ? FALSE : TRUE); +} + // Unity requires the glib event loop to the run to function properly // as events are sent asynchronously bool UnityTaskbarManager::pollEvent(Common::Event &event) { diff --git a/backends/taskbar/unity/unity-taskbar.h b/backends/taskbar/unity/unity-taskbar.h index d8a68a4101..48f403a849 100644 --- a/backends/taskbar/unity/unity-taskbar.h +++ b/backends/taskbar/unity/unity-taskbar.h @@ -43,6 +43,7 @@ public: virtual void setProgressValue(int completed, int total); virtual void setProgressState(TaskbarProgressState state); virtual void addRecent(const Common::String &name, const Common::String &description); + virtual void setCount(int count); // Implementation of the EventSource interface virtual bool pollEvent(Common::Event &event); diff --git a/common/taskbar.h b/common/taskbar.h index ea1d218724..2219e6e04f 100644 --- a/common/taskbar.h +++ b/common/taskbar.h @@ -32,7 +32,7 @@ namespace Common { class TaskbarManager { public: /** - * Values representing the taskbar progress state + * Values representing the taskbar progress state */ enum TaskbarProgressState { kTaskbarNoProgress = 0, @@ -46,51 +46,61 @@ public: virtual ~TaskbarManager() {} /** - * Sets an overlay icon on the taskbar icon. + * Sets an overlay icon on the taskbar icon * * When an empty name is given, no icon is shown * and the current overlay icon (if any) is removed * - * @param name Path to the icon - * @param description The description + * @param name Path to the icon + * @param description The description * * @note on Windows, the icon should be an ICO file */ - virtual void setOverlayIcon(const String &name, const String &description) {} + virtual void setOverlayIcon(const String &name, const String &description) {} - /** - * Sets a progress value on the taskbar icon - * - * @param completed The current progress value. - * @param total The maximum progress value. - */ - virtual void setProgressValue(int completed, int total) {} + /** + * Sets a progress value on the taskbar icon + * + * @param completed The current progress value. + * @param total The maximum progress value. + */ + virtual void setProgressValue(int completed, int total) {} - /** - * Sets the progress state on the taskbar icon - * - * State can be any of the following: - * - NoProgress: disable display of progress state + /** + * Sets the progress state on the taskbar icon + * + * State can be any of the following: + * - NoProgress: disable display of progress state * - Indeterminate * - Normal * - Error * - Paused - * - * @param state The progress state - */ - virtual void setProgressState(TaskbarProgressState state) {} + * + * @param state The progress state + */ + virtual void setProgressState(TaskbarProgressState state) {} + + /** + * Sets the count number associated with the icon as an overlay + * + * @param count The count + * + * @note Setting a count of 0 will hide the count + */ + virtual void setCount(int count) {} + + /** + * Adds an engine to the recent items list + * + * Path is automatically set to the current executable path, + * an icon name is generated (with fallback to default icon) + * and the command line is set to start the engine on click. + * + * @param name The target name. + * @param description The description. + */ + virtual void addRecent(const String &name, const String &description) {} - /** - * Adds an engine to the recent items list - * - * Path is automatically set to the current executable path, - * an icon name is generated (with fallback to default icon) - * and the command line is set to start the engine on click. - * - * @param name The target name. - * @param description The description. - */ - virtual void addRecent(const String &name, const String &description) {} }; } // End of namespace Common diff --git a/gui/massadd.cpp b/gui/massadd.cpp index 1578e75b25..29a2b1886a 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -71,14 +71,14 @@ MassAddDialog::MassAddDialog(const Common::FSNode &startDir) // The dir we start our scan at _scanStack.push(startDir); -// Removed for now... Why would you put a title on mass add dialog called "Mass Add Dialog"? -// new StaticTextWidget(this, "massadddialog_caption", "Mass Add Dialog"); + // Removed for now... Why would you put a title on mass add dialog called "Mass Add Dialog"? + // new StaticTextWidget(this, "massadddialog_caption", "Mass Add Dialog"); _dirProgressText = new StaticTextWidget(this, "MassAdd.DirProgressText", - _("... progress ...")); + _("... progress ...")); _gameProgressText = new StaticTextWidget(this, "MassAdd.GameProgressText", - _("... progress ...")); + _("... progress ...")); _dirProgressText->setAlign(Graphics::kTextAlignCenter); _gameProgressText->setAlign(Graphics::kTextAlignCenter); @@ -132,8 +132,9 @@ struct GameDescLess { void MassAddDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { - // Remove progress bar from taskbar + // Remove progress bar and count from taskbar g_system->getTaskbarManager()->setProgressState(Common::TaskbarManager::kTaskbarNoProgress); + g_system->getTaskbarManager()->setCount(0); // FIXME: It's a really bad thing that we use two arbitrary constants if (cmd == kOkCmd) { @@ -239,6 +240,7 @@ void MassAddDialog::handleTickle() { _dirsScanned++; g_system->getTaskbarManager()->setProgressValue(_dirsScanned, _dirTotal); + g_system->getTaskbarManager()->setCount(_games.size()); } |