2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2007-02-18 18:23:52 +00:00
|
|
|
*
|
2021-12-26 17:47:58 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2007-02-18 18:23:52 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 17:47:58 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2014-02-18 01:34:20 +00:00
|
|
|
*
|
2007-02-18 18:23:52 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MASSADD_DIALOG_H
|
|
|
|
#define MASSADD_DIALOG_H
|
|
|
|
|
|
|
|
#include "gui/dialog.h"
|
2018-02-04 07:46:12 +00:00
|
|
|
#include "gui/widgets/list.h"
|
2007-02-18 18:23:52 +00:00
|
|
|
#include "common/fs.h"
|
2008-06-11 06:22:02 +00:00
|
|
|
#include "common/hashmap.h"
|
2007-02-18 18:23:52 +00:00
|
|
|
#include "common/stack.h"
|
2008-06-11 06:22:02 +00:00
|
|
|
#include "common/str.h"
|
2007-02-18 18:23:52 +00:00
|
|
|
|
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
class StaticTextWidget;
|
2024-05-10 04:16:40 +00:00
|
|
|
class MassAddListWidget;
|
2007-02-18 18:23:52 +00:00
|
|
|
|
|
|
|
class MassAddDialog : public Dialog {
|
|
|
|
public:
|
2008-10-02 16:58:59 +00:00
|
|
|
MassAddDialog(const Common::FSNode &startDir);
|
2007-02-18 18:23:52 +00:00
|
|
|
|
|
|
|
//void open();
|
2020-01-05 16:48:04 +00:00
|
|
|
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
|
|
|
|
void handleTickle() override;
|
2007-02-18 18:23:52 +00:00
|
|
|
|
2009-12-15 12:56:10 +00:00
|
|
|
Common::String getFirstAddedTarget() const {
|
2009-12-15 08:19:34 +00:00
|
|
|
if (!_games.empty())
|
2017-12-03 11:19:08 +00:00
|
|
|
return _games.front().gameId;
|
2009-12-15 08:19:34 +00:00
|
|
|
return Common::String();
|
|
|
|
}
|
|
|
|
|
2007-02-18 18:23:52 +00:00
|
|
|
private:
|
2008-10-02 16:58:59 +00:00
|
|
|
Common::Stack<Common::FSNode> _scanStack;
|
2018-05-06 13:51:03 +00:00
|
|
|
DetectedGames _games;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2024-03-03 16:09:07 +00:00
|
|
|
void updateGameList();
|
|
|
|
|
2008-06-11 06:22:02 +00:00
|
|
|
/**
|
2024-05-10 04:16:40 +00:00
|
|
|
* Map each path occurring in the config file to the target(s) using that path.
|
2008-06-11 06:22:02 +00:00
|
|
|
* Used to detect whether a potential new target is already present in the
|
|
|
|
* config manager.
|
|
|
|
*/
|
2023-09-10 10:38:48 +00:00
|
|
|
Common::HashMap<Common::Path, Common::StringArray,
|
|
|
|
Common::Path::IgnoreCase_Hash, Common::Path::IgnoreCase_EqualTo> _pathToTargets;
|
2008-06-11 06:22:02 +00:00
|
|
|
|
2007-02-18 18:23:52 +00:00
|
|
|
int _dirsScanned;
|
2011-05-02 11:39:34 +00:00
|
|
|
int _oldGamesCount;
|
2011-03-31 10:35:43 +00:00
|
|
|
int _dirTotal;
|
2007-02-18 18:23:52 +00:00
|
|
|
|
|
|
|
Widget *_okButton;
|
|
|
|
StaticTextWidget *_dirProgressText;
|
|
|
|
StaticTextWidget *_gameProgressText;
|
2009-06-06 17:49:59 +00:00
|
|
|
|
2024-05-10 04:16:40 +00:00
|
|
|
MassAddListWidget *_list;
|
2007-02-18 18:23:52 +00:00
|
|
|
};
|
|
|
|
|
2024-05-10 04:16:40 +00:00
|
|
|
class MassAddListWidget : public ListWidget {
|
|
|
|
public:
|
|
|
|
MassAddListWidget(Dialog *boss, const Common::String &name)
|
|
|
|
: ListWidget(boss, name) { }
|
|
|
|
|
|
|
|
void appendToSelectedList(bool selected) { _listSelected.push_back(selected); }
|
|
|
|
void clearSelectedList() { _listSelected.clear(); }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
ThemeEngine::WidgetStateInfo getItemState(int item) const override {
|
|
|
|
// Display selected/unselected games in mass detection as enabled/disabled items.
|
|
|
|
if (item < (signed int)_listSelected.size() && _listSelected[item]) {
|
|
|
|
return ThemeEngine::kStateEnabled;
|
|
|
|
} else {
|
|
|
|
return ThemeEngine::kStateDisabled;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Common::Array<bool> _listSelected;
|
|
|
|
};
|
2007-02-18 18:23:52 +00:00
|
|
|
|
|
|
|
} // End of namespace GUI
|
|
|
|
|
|
|
|
#endif
|