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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef TESTBED_CONFIG_PARAMS_H
24 #define TESTBED_CONFIG_PARAMS_H
25 
26 #include "common/singleton.h"
27 #include "common/stream.h"
28 #include "graphics/fontman.h"
29 
30 class TestbedConfigManager;
31 
32 namespace Testbed {
33 
34 class ConfigParams : public Common::Singleton<ConfigParams> {
35 private:
36 	friend class Common::Singleton<SingletonBaseType>;
37 	ConfigParams();
38 
39 	/**
40 	 * Private variables related to log files.
41 	 */
42 	Common::String _logDirectory;
43 	Common::String _logFilename;
44 	Common::WriteStream *_ws;
45 
46 	/**
47 	 * Private variable used for font.
48 	 */
49 	Graphics::FontManager::FontUsage _displayFont;
50 
51 	/**
52 	 * Determines if the user initiated testing session is interactive or not.
53 	 * Used by various tests to respond accordingly.
54 	 */
55 	bool _isInteractive;
56 	bool _isGameDataFound;
57 #ifdef USE_LIBCURL
58 	bool _isCloudTestCallbackCalled;
59 	bool _isCloudTestErrorCallbackCalled;
60 #endif
61 	bool _rerunTests;
62 	TestbedConfigManager *_testbedConfMan;
63 
64 public:
65 
66 	bool isRerunRequired();
setRerunFlag(bool flag)67 	void setRerunFlag(bool flag) { _rerunTests = flag; }
68 
isSessionInteractive()69 	bool isSessionInteractive() { return _isInteractive; }
setSessionAsInteractive(bool status)70 	void setSessionAsInteractive(bool status) { _isInteractive = status; }
71 
isGameDataFound()72 	bool isGameDataFound() { return _isGameDataFound; }
setGameDataFound(bool status)73 	void setGameDataFound(bool status) { _isGameDataFound = status; }
74 
75 #ifdef USE_LIBCURL
isCloudTestCallbackCalled()76 	bool isCloudTestCallbackCalled() const { return _isCloudTestCallbackCalled; }
setCloudTestCallbackCalled(bool status)77 	void setCloudTestCallbackCalled(bool status) { _isCloudTestCallbackCalled = status; }
78 
isCloudTestErrorCallbackCalled()79 	bool isCloudTestErrorCallbackCalled() const { return _isCloudTestErrorCallbackCalled; }
setCloudTestErrorCallbackCalled(bool status)80 	void setCloudTestErrorCallbackCalled(bool status) { _isCloudTestErrorCallbackCalled = status; }
81 #endif
82 
getTestbedConfigManager()83 	TestbedConfigManager *getTestbedConfigManager() { return _testbedConfMan; }
setTestbedConfigManager(TestbedConfigManager * confMan)84 	void setTestbedConfigManager(TestbedConfigManager* confMan) { _testbedConfMan = confMan; }
85 
getLogDirectory()86 	Common::String &getLogDirectory() {	return _logDirectory; }
setLogDirectory(const Common::String & dirname)87 	void setLogDirectory(const Common::String &dirname) { _logDirectory = dirname; }
getLogFilename()88 	Common::String &getLogFilename() { return _logFilename; }
setLogFilename(const Common::String & filename)89 	void setLogFilename(const Common::String &filename) { _logFilename = filename; }
90 
getLogWriteStream()91 	Common::WriteStream *getLogWriteStream() { return _ws; }
getCurrentFontUsageType()92 	Graphics::FontManager::FontUsage getCurrentFontUsageType() { return _displayFont; }
setCurrentFontUsageType(Graphics::FontManager::FontUsage f)93 	void setCurrentFontUsageType(Graphics::FontManager::FontUsage f) { _displayFont = f; }
94 
95 	/**
96 	 * Note: To enable logging, this function must be called once first.
97 	 */
98 	void initLogging(const char *dirname, const char *filename, bool enable = true);
99 	void initLogging(bool enable = true);
100 
101 	void deleteWriteStream();
102 };
103 
104 /** Shortcut for accessing ConfigParams */
105 #define ConfParams ConfigParams::instance()
106 
107 } // End of Namespace Testbed
108 
109 #endif
110