BACKENDS: Add progress to MassAdd dialog

This commit is contained in:
Littleboy 2011-03-31 06:35:43 -04:00 committed by Julien
parent cd7822a29f
commit 2be35013f1
2 changed files with 10 additions and 0 deletions

View file

@ -24,6 +24,7 @@
#include "common/config-manager.h" #include "common/config-manager.h"
#include "common/debug.h" #include "common/debug.h"
#include "common/system.h" #include "common/system.h"
#include "common/taskbar.h"
#include "common/translation.h" #include "common/translation.h"
#include "gui/launcher.h" // For addGameToConf() #include "gui/launcher.h" // For addGameToConf()
@ -60,6 +61,7 @@ MassAddDialog::MassAddDialog(const Common::FSNode &startDir)
: Dialog("MassAdd"), : Dialog("MassAdd"),
_dirsScanned(0), _dirsScanned(0),
_oldGamesCount(0), _oldGamesCount(0),
_dirTotal(0),
_okButton(0), _okButton(0),
_dirProgressText(0), _dirProgressText(0),
_gameProgressText(0) { _gameProgressText(0) {
@ -130,6 +132,9 @@ struct GameDescLess {
void MassAddDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { void MassAddDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
// Remove progress bar from taskbar
g_system->getTaskbarManager()->setProgressState(Common::TaskbarManager::kTaskbarNoProgress);
// FIXME: It's a really bad thing that we use two arbitrary constants // FIXME: It's a really bad thing that we use two arbitrary constants
if (cmd == kOkCmd) { if (cmd == kOkCmd) {
// Sort the detected games. This is not strictly necessary, but nice for // Sort the detected games. This is not strictly necessary, but nice for
@ -226,10 +231,14 @@ void MassAddDialog::handleTickle() {
for (Common::FSList::const_iterator file = files.begin(); file != files.end(); ++file) { for (Common::FSList::const_iterator file = files.begin(); file != files.end(); ++file) {
if (file->isDirectory()) { if (file->isDirectory()) {
_scanStack.push(*file); _scanStack.push(*file);
_dirTotal++;
} }
} }
_dirsScanned++; _dirsScanned++;
g_system->getTaskbarManager()->setProgressValue(_dirsScanned, _dirTotal);
} }

View file

@ -60,6 +60,7 @@ private:
int _dirsScanned; int _dirsScanned;
int _oldGamesCount; int _oldGamesCount;
int _dirTotal;
Widget *_okButton; Widget *_okButton;
StaticTextWidget *_dirProgressText; StaticTextWidget *_dirProgressText;