openMSX
GlobalSettings.hh
Go to the documentation of this file.
1 #ifndef GLOBALSETTINGS_HH
2 #define GLOBALSETTINGS_HH
3 
4 #include "Observer.hh"
5 #include "noncopyable.hh"
7 #include <memory>
8 
9 namespace openmsx {
10 
11 class GlobalCommandController;
12 class IntegerSetting;
13 class BooleanSetting;
14 class StringSetting;
15 class ThrottleManager;
16 class Setting;
17 template <class T> class EnumSetting;
18 
24 class GlobalSettings final : private Observer<Setting>, private noncopyable
25 {
26 public:
27  explicit GlobalSettings(GlobalCommandController& commandController);
29 
31  return *speedSetting;
32  }
34  return *pauseSetting;
35  }
37  return *powerSetting;
38  }
40  return *autoSaveSetting;
41  }
43  return *pauseOnLostFocusSetting;
44  }
46  return *umrCallBackSetting;
47  }
49  return *invalidPsgDirectionsSetting;
50  }
52  return * resampleSetting;
53  }
55  return *throttleManager;
56  }
57 
58 private:
59  // Observer<Setting>
60  void update(const Setting& setting) override;
61 
62  GlobalCommandController& commandController;
63 
64  std::unique_ptr<IntegerSetting> speedSetting;
65  std::unique_ptr<BooleanSetting> pauseSetting;
66  std::unique_ptr<BooleanSetting> powerSetting;
67  std::unique_ptr<BooleanSetting> autoSaveSetting;
68  std::unique_ptr<BooleanSetting> pauseOnLostFocusSetting;
69  std::unique_ptr<StringSetting> umrCallBackSetting;
70  std::unique_ptr<StringSetting> invalidPsgDirectionsSetting;
71  std::unique_ptr<EnumSetting<ResampledSoundDevice::ResampleType>> resampleSetting;
72  std::unique_ptr<ThrottleManager> throttleManager;
73 };
74 
75 } // namespace openmsx
76 
77 #endif
ThrottleManager & getThrottleManager() const
BooleanSetting & getAutoSaveSetting() const
BooleanSetting & getPauseSetting() const
StringSetting & getUMRCallBackSetting() const
GlobalSettings(GlobalCommandController &commandController)
BooleanSetting & getPauseOnLostFocusSetting() const
A Setting with an integer value.
StringSetting & getInvalidPsgDirectionsSetting() const
EnumSetting< ResampledSoundDevice::ResampleType > & getResampleSetting() const
BooleanSetting & getPowerSetting() const
IntegerSetting & getSpeedSetting() const
Manages the throttle state of openMSX.
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:9
Based on boost::noncopyable, see boost documentation: http://www.boost.org/libs/utility.
Definition: noncopyable.hh:12
This class contains settings that are used by several other class (including some singletons)...