BACKENDS/COMMON/GUI: Remove complete support for TaskbarManager when taskbar integration is not enabled

This commit is contained in:
Littleboy 2011-04-29 12:15:49 -04:00 committed by Julien
parent 79fb0ff223
commit 9614834548
7 changed files with 32 additions and 3 deletions

View file

@ -33,10 +33,11 @@
ModularBackend::ModularBackend()
:
_mutexManager(0),
_taskbarManager(0),
_graphicsManager(0),
_mixer(0) {
#if defined(USE_TASKBAR)
_taskbarManager = 0;
#endif
}
ModularBackend::~ModularBackend() {
@ -44,8 +45,10 @@ ModularBackend::~ModularBackend() {
_graphicsManager = 0;
delete _mixer;
_mixer = 0;
#if defined(USE_TASKBAR)
delete _taskbarManager;
_taskbarManager = 0;
#endif
delete _mutexManager;
_mutexManager = 0;
}
@ -239,7 +242,10 @@ void ModularBackend::quit() {
exit(0);
}
#if defined(USE_TASKBAR)
Common::TaskbarManager *ModularBackend::getTaskbarManager() {
assert(_taskbarManager);
return _taskbarManager;
}
#endif

View file

@ -134,7 +134,9 @@ public:
//@{
virtual void quit();
#if defined(USE_TASKBAR)
virtual TaskbarManager *getTaskbarManager();
#endif
virtual void displayMessageOnOSD(const char *msg);
//@}
@ -143,7 +145,9 @@ protected:
/** @name Managers variables */
//@{
#if defined(USE_TASKBAR)
TaskbarManager *_taskbarManager;
#endif
MutexManager *_mutexManager;
GraphicsManager *_graphicsManager;
Audio::Mixer *_mixer;

View file

@ -126,8 +126,10 @@ void OSystem_SDL::init() {
if (_timerManager == 0)
_timerManager = new SdlTimerManager();
#if defined(USE_TASKBAR)
if (_taskbarManager == 0)
_taskbarManager = new Common::TaskbarManager();
#endif
#ifdef USE_OPENGL
// Setup a list with both SDL and OpenGL graphics modes
@ -213,6 +215,7 @@ void OSystem_SDL::initBackend() {
ModularBackend::initBackend();
}
#if defined(USE_TASKBAR)
void OSystem_SDL::engineInit() {
// Add the started engine to the list of recent tasks
_taskbarManager->addRecent(ConfMan.getActiveDomainName(), ConfMan.get("description"));
@ -225,6 +228,7 @@ void OSystem_SDL::engineDone() {
// Remove overlay icon
_taskbarManager->setOverlayIcon("", "");
}
#endif
void OSystem_SDL::initSDL() {
// Check if SDL has not been initialized

View file

@ -54,8 +54,10 @@ public:
// Override functions from ModularBackend and OSystem
virtual void initBackend();
#if defined(USE_TASKBAR)
virtual void engineInit();
virtual void engineDone();
#endif
virtual Common::HardwareKeySet *getHardwareKeySet();
virtual void quit();
virtual void fatalError();

View file

@ -42,7 +42,9 @@ struct Rect;
class SaveFileManager;
class SearchSet;
class String;
class TaskbarManager;
#if defined(USE_TASKBAR)
class TaskbarManager;
#endif
class TimerManager;
class SeekableReadStream;
class WriteStream;
@ -1048,6 +1050,7 @@ public:
return _savefileManager;
}
#if defined(USE_TASKBAR)
/**
* Returns the TaskbarManager, used to handle progress bars,
* icon overlay, tasks and recent items list on the taskbar.
@ -1055,6 +1058,7 @@ public:
* @return the TaskbarManager for the current architecture
*/
virtual Common::TaskbarManager *getTaskbarManager() = 0;
#endif
/**
* Returns the FilesystemFactory object, depending on the current architecture.

View file

@ -25,8 +25,11 @@
#ifndef COMMON_TASKBAR_MANAGER_H
#define COMMON_TASKBAR_MANAGER_H
#include "common/scummsys.h"
#include "common/str.h"
#if defined(USE_TASKBAR)
namespace Common {
/**
@ -125,4 +128,6 @@ public:
} // End of namespace Common
#endif
#endif // COMMON_TASKBAR_MANAGER_H

View file

@ -132,9 +132,11 @@ struct GameDescLess {
void MassAddDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
#if defined(USE_TASKBAR)
// Remove progress bar and count from taskbar
g_system->getTaskbarManager()->setProgressState(Common::TaskbarManager::kTaskbarNoProgress);
g_system->getTaskbarManager()->setCount(0);
#endif
// FIXME: It's a really bad thing that we use two arbitrary constants
if (cmd == kOkCmd) {
@ -239,8 +241,10 @@ void MassAddDialog::handleTickle() {
_dirsScanned++;
#if defined(USE_TASKBAR)
g_system->getTaskbarManager()->setProgressValue(_dirsScanned, _dirTotal);
g_system->getTaskbarManager()->setCount(_games.size());
#endif
}