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 
37 namespace Testbed {
38 
39 enum {
40  kTestbedQuitCmd = 'Quit',
41  kTestbedSelectAll = 'sAll',
42  kTestbedDeselectAll = 'dAll'
43 };
44 
45 
46 
48 public:
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  void initDefaultConfiguration();
60  int getNumSuitesEnabled();
61 
62 private:
63  Common::Array<Testsuite *> &_testsuiteList;
64  Common::String _configFileName;
65  Common::INIFile _configFileInterface;
66  void parseConfigFile();
67 };
68 
70 public:
72  ~TestbedOptionsDialog() override;
73  void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
74  void reflowLayout() override;
75 
76 private:
77  GUI::ButtonWidget *_selectButton;
78  GUI::ButtonWidget *_runTestButton;
79  GUI::ButtonWidget *_quitButton;
80  GUI::StaticTextWidget *_messageText;
81  GUI::ScrollContainerWidget *_testContainerDisplay;
82  Common::Array<GUI::CheckboxWidget *> _testSuiteCheckboxArray;
83 
84  Common::Array<Testsuite *> _testSuiteArray;
85  Common::U32StringArray _testSuiteDescArray;
86 
87  TestbedConfigManager *_testbedConfMan;
88 };
89 
91 public:
92  TestbedInteractionDialog(uint x, uint y, uint w, uint h) : GUI::Dialog(x, y, w, h, true), _xOffset(0), _yOffset(0) {}
93  ~TestbedInteractionDialog() override {}
94  void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
95  void addButton(uint w, uint h, const Common::String name, uint32 cmd, uint xOffset = 0, uint yPadding = 8);
96  void addButtonXY(uint x, uint y, uint w, uint h, const Common::String name, uint32 cmd);
97  void addText(uint w, uint h, const Common::String text, Graphics::TextAlign textAlign, uint xOffset, uint yPadding = 8);
98  void addList(uint x, uint y, uint w, uint h, const Common::Array<Common::U32String> &strArray, uint yPadding = 8);
99 protected:
101  uint _xOffset;
102  uint _yOffset;
103 
104 };
105 
106 } // End of namespace Testbed
107 
108 #endif // TESTBED_CONFIG_H
Definition: config.h:47
Definition: str.h:59
TextAlign
Definition: font.h:48
Definition: stream.h:77
Definition: array.h:52
Definition: scrollcontainer.h:31
Definition: cloud.h:30
Definition: widget.h:205
Definition: stream.h:745
Definition: testsuite.h:90
Definition: config.h:90
Definition: config.h:69
Definition: dialog.h:49
Definition: ini-file.h:58
Definition: widget.h:233
Definition: object.h:40