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 #include <vector>
9 
10 namespace openmsx {
11 
12 class GlobalCommandController;
13 class IntegerSetting;
14 class BooleanSetting;
15 class StringSetting;
16 class ThrottleManager;
17 class Setting;
18 template <class T> class EnumSetting;
19 
25 class GlobalSettings final : private Observer<Setting>, private noncopyable
26 {
27 public:
28  explicit GlobalSettings(GlobalCommandController& commandController);
30 
32  return *speedSetting;
33  }
35  return *pauseSetting;
36  }
38  return *powerSetting;
39  }
41  return *autoSaveSetting;
42  }
44  return *pauseOnLostFocusSetting;
45  }
47  return *umrCallBackSetting;
48  }
50  return *invalidPsgDirectionsSetting;
51  }
53  return *resampleSetting;
54  }
56  return *deadzoneSettings[i];
57  }
59  return *throttleManager;
60  }
61 
62 private:
63  // Observer<Setting>
64  void update(const Setting& setting) override;
65 
66  GlobalCommandController& commandController;
67 
68  std::unique_ptr<IntegerSetting> speedSetting;
69  std::unique_ptr<BooleanSetting> pauseSetting;
70  std::unique_ptr<BooleanSetting> powerSetting;
71  std::unique_ptr<BooleanSetting> autoSaveSetting;
72  std::unique_ptr<BooleanSetting> pauseOnLostFocusSetting;
73  std::unique_ptr<StringSetting> umrCallBackSetting;
74  std::unique_ptr<StringSetting> invalidPsgDirectionsSetting;
75  std::unique_ptr<EnumSetting<ResampledSoundDevice::ResampleType>> resampleSetting;
76  std::vector<std::unique_ptr<IntegerSetting>> deadzoneSettings;
77  std::unique_ptr<ThrottleManager> throttleManager;
78 };
79 
80 } // namespace openmsx
81 
82 #endif
ThrottleManager & getThrottleManager() const
BooleanSetting & getAutoSaveSetting() const
IntegerSetting & getJoyDeadzoneSetting(int i) 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)...