ScummVM API documentation
config.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef TESTBED_CONFIG_H
23#define TESTBED_CONFIG_H
24
25
26#include "common/array.h"
27#include "common/formats/ini-file.h"
28#include "common/str-array.h"
29#include "common/tokenizer.h"
30
31#include "gui/widgets/list.h"
32#include "gui/dialog.h"
33#include "gui/ThemeEngine.h"
34
35#include "testbed/testsuite.h"
36
37namespace Testbed {
38
39enum {
40 kTestbedQuitCmd = 'Quit',
41 kTestbedSelectAll = 'sAll',
42 kTestbedDeselectAll = 'dAll'
43};
44
45
46
48public:
49 TestbedConfigManager(Common::Array<Testsuite *> &tList, const Common::String &fName) : _testsuiteList(tList), _configFileName(fName) {}
51 void selectTestsuites();
52 void setConfigFile(const Common::String &fName) { _configFileName = fName; }
53 Common::SeekableReadStream *getConfigReadStream() const;
54 Common::WriteStream *getConfigWriteStream() const;
55 void writeTestbedConfigToStream(Common::WriteStream *ws);
56 Testsuite *getTestsuiteByName(const Common::String &name);
57 bool stringToBool(const Common::String &str) { return str.equalsIgnoreCase("true") ? true : false; }
58 Common::String boolToString(bool val) { return val ? "true" : "false"; }
59 int getNumSuitesEnabled();
60
61private:
62 Common::Array<Testsuite *> &_testsuiteList;
63 Common::String _configFileName;
64 Common::INIFile _configFileInterface;
65 void parseConfigFile();
66};
67
69public:
71 ~TestbedOptionsDialog() override;
72 void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
73 void reflowLayout() override;
74
75private:
76 GUI::ButtonWidget *_selectButton;
77 GUI::ButtonWidget *_runTestButton;
78 GUI::ButtonWidget *_quitButton;
79 GUI::StaticTextWidget *_messageText;
80 GUI::ScrollContainerWidget *_testContainerDisplay;
81 Common::Array<GUI::CheckboxWidget *> _testSuiteCheckboxArray;
82
83 Common::Array<Testsuite *> _testSuiteArray;
84 Common::U32StringArray _testSuiteDescArray;
85
86 TestbedConfigManager *_testbedConfMan;
87};
88
90public:
91 TestbedInteractionDialog(uint x, uint y, uint w, uint h) : GUI::Dialog(x, y, w, h, true), _xOffset(0), _yOffset(0) {}
92 ~TestbedInteractionDialog() override {}
93 void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
94 void addButton(uint w, uint h, const Common::String &name, uint32 cmd, uint xOffset = 0, uint yPadding = 8);
95 void addButtonXY(uint x, uint y, uint w, uint h, const Common::String &name, uint32 cmd);
96 void addText(uint w, uint h, const Common::String &text, Graphics::TextAlign textAlign, uint xOffset, uint yPadding = 8);
97 void addList(uint x, uint y, uint w, uint h, const Common::Array<Common::U32String> &strArray, uint yPadding = 8);
98protected:
100 uint _xOffset;
101 uint _yOffset;
102
103};
104
105} // End of namespace Testbed
106
107#endif // TESTBED_CONFIG_H
Definition: array.h:52
Definition: ini-file.h:58
Definition: stream.h:745
Definition: str.h:59
Definition: stream.h:77
Definition: widget.h:285
Definition: object.h:40
Definition: dialog.h:49
Definition: scrollcontainer.h:32
Definition: widget.h:257
Definition: config.h:47
Definition: config.h:89
Definition: config.h:68
Definition: testsuite.h:96
TextAlign
Definition: font.h:48