From c030858cf130a20179368fb231371ae348d8fda4 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Thu, 22 Jul 2010 17:59:59 +0000 Subject: TESTBED: added deselect capabilty in GUI, removed redundant code, testsuites now all enabled by default svn-id: r51155 --- engines/testbed/config.h | 48 ++++++++++++++++-------------------------------- 1 file changed, 16 insertions(+), 32 deletions(-) (limited to 'engines/testbed/config.h') diff --git a/engines/testbed/config.h b/engines/testbed/config.h index b141330b3b..bbb591d337 100644 --- a/engines/testbed/config.h +++ b/engines/testbed/config.h @@ -40,7 +40,8 @@ namespace Testbed { enum { kTestbedQuitCmd = 'Quit', - kTestbedSelectAll = 'sAll' + kTestbedSelectAll = 'sAll', + kTestbedDeselectAll = 'dAll' }; class TestbedConfigManager { @@ -48,46 +49,29 @@ public: TestbedConfigManager(Common::Array &tList) : _testsuiteList(tList) {} ~TestbedConfigManager() {} void selectTestsuites(); - Testsuite *getTestsuiteByName(const Common::String &name); - bool isEnabled(const Common::String &tsName); private: Common::Array &_testsuiteList; - void enableTestsuite(const Common::String &name, bool enable); void parseConfigFile() {} }; class TestbedListWidget : public GUI::ListWidget { public: - TestbedListWidget(GUI::Dialog *boss, const Common::String &name, Common::StringArray &tsDescArr) : GUI::ListWidget(boss, name), _testSuiteDescArray(tsDescArr) {} + TestbedListWidget(GUI::Dialog *boss, const Common::String &name, Common::Array tsArray) : GUI::ListWidget(boss, name), _testSuiteArray(tsArray) {} - void changeColor() { - // Using Font Color Mechanism to highlight selected entries. - // Might not be detectable with some themes - if (_listColors.size() >= 2) { - if (GUI::ThemeEngine::kFontColorNormal == _listColors[_selectedItem]) { - _listColors[_selectedItem] = GUI::ThemeEngine::kFontColorAlternate; - } else if (GUI::ThemeEngine::kFontColorAlternate == _listColors[_selectedItem]) { - _listColors[_selectedItem] = GUI::ThemeEngine::kFontColorNormal; - } - } - - // Also append (selected) to each selected entry - if (_list[_selectedItem].contains("selected")) { - _list[_selectedItem] = _testSuiteDescArray[_selectedItem]; - } else { - _list[_selectedItem] += " (selected)"; + void markAsSelected(int i) { + if (!_list[i].contains("selected")) { + _list[i] += " (selected)"; } + _listColors[i] = GUI::ThemeEngine::kFontColorNormal; draw(); } - - void setColorAll(GUI::ThemeEngine::FontColor color) { - for (uint i = 0; i < _listColors.size(); i++) { - if (!_list[i].contains("selected")) { - _listColors[i] = color; - _list[i] += " (selected)"; - } + + void markAsDeselected(int i) { + if (_list[i].contains("selected")) { + _list[i] = _testSuiteArray[i]->getDescription(); } - draw();; + _listColors[i] = GUI::ThemeEngine::kFontColorAlternate; + draw(); } void setColor(uint32 indx, GUI::ThemeEngine::FontColor color) { @@ -97,7 +81,7 @@ public: } private: - const Common::StringArray _testSuiteDescArray; + Common::Array _testSuiteArray; }; class TestbedOptionsDialog : public GUI::Dialog { @@ -108,10 +92,10 @@ public: private: GUI::ListWidget::ColorList _colors; - Common::StringArray _testSuiteArray; + GUI::ButtonWidget *_selectButton; + Common::Array _testSuiteArray; Common::StringArray _testSuiteDescArray; TestbedListWidget *_testListDisplay; - TestbedConfigManager *_testbedConfMan; }; } // End of namespace Testbed -- cgit v1.2.3