File: Preferences.h

package info (click to toggle)
endless-sky 0.10.16-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 414,608 kB
  • sloc: cpp: 73,435; python: 893; xml: 666; sh: 271; makefile: 28
file content (261 lines) | stat: -rw-r--r-- 6,319 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
/* Preferences.h
Copyright (c) 2014 by Michael Zahniser

Endless Sky is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later version.

Endless Sky is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>.
*/

#pragma once

#include <cstdint>
#include <string>
#include <vector>



class Preferences {
public:
	enum class VSync : int_fast8_t {
		off = 0,
		on,
		adaptive,
	};

	enum class CameraAccel : int_fast8_t {
		OFF = 0,
		ON,
		REVERSED,
	};

	enum class DateFormat : int_fast8_t {
		DMY = 0, ///< Day-first format. (Sat, 4 Oct 1941)
		MDY,     ///< Month-first format. (Sat, Oct 4, 1941)
		YMD      ///< All-numeric ISO 8601. (1941-10-04)
	};

	enum class NotificationSetting : int_fast8_t {
		OFF = 0,
		MESSAGE,
		BOTH
	};

	enum class OverlayState : int_fast8_t {
		OFF = 0,
		ON,
		DAMAGED,
		DISABLED,
		ON_HIT,
	};

	enum class OverlayType : int_fast8_t {
		ALL = 0,
		FLAGSHIP,
		ESCORT,
		ENEMY,
		NEUTRAL
	};

	enum class TurretOverlays : int_fast8_t {
		OFF = 0,
		ALWAYS_ON,
		BLINDSPOTS_ONLY
	};

	enum class AutoAim : int_fast8_t {
		OFF = 0,
		ALWAYS_ON,
		WHEN_FIRING
	};

	enum class AutoFire : int_fast8_t {
		OFF = 0,
		ON,
		GUNS_ONLY,
		TURRETS_ONLY
	};

	enum class BoardingPriority : int_fast8_t {
		PROXIMITY = 0,
		VALUE,
		MIXED
	};

	enum class FlotsamCollection : int_fast8_t {
		OFF = 0,
		ON,
		FLAGSHIP,
		ESCORT
	};

	enum class BackgroundParallax : int {
		OFF = 0,
		FANCY,
		FAST
	};

	enum class ExtendedJumpEffects : int {
		OFF = 0,
		MEDIUM,
		HEAVY
	};

	enum class AlertIndicator : int_fast8_t {
		NONE = 0,
		AUDIO,
		VISUAL,
		BOTH
	};

	enum class MinimapDisplay : int_fast8_t {
		OFF = 0,
		WHEN_JUMPING,
		ALWAYS_ON
	};

	enum class FlagshipSpacePriority : int_fast8_t {
		NONE = 0,
		PASSENGERS,
		CARGO,
		BOTH
	};

#ifdef _WIN32
	enum class TitleBarTheme : int_fast8_t {
		DEFAULT,
		LIGHT,
		DARK
	};

	enum class WindowRounding : int_fast8_t {
		DEFAULT,
		OFF,
		LARGE,
		SMALL
	};
#endif


public:
	static void Load();
	static void Save();

	static bool Has(const std::string &name);
	static void Set(const std::string &name, bool on = true);

	/// Toggle the ammo usage preferences, cycling between "never," "frugally," and "always."
	static void ToggleAmmoUsage();
	static std::string AmmoUsage();

	/// Date format preferences.
	static void ToggleDateFormat();
	static DateFormat GetDateFormat();
	static const std::string &DateFormatSetting();

	// Notification preferences.
	static void ToggleNotificationSetting();
	static NotificationSetting GetNotificationSetting();
	static const std::string &NotificationSettingString();

	// Scroll speed preference.
	static int ScrollSpeed();
	static void SetScrollSpeed(int speed);

	static int TooltipActivation();
	static void SetTooltipActivation(int steps);

	static double ViewZoom();
	static bool ZoomViewIn();
	static bool ZoomViewOut();
	static double MinViewZoom();
	static double MaxViewZoom();
	static const std::vector<double> &Zooms();

	static void ToggleScreenMode();
	static const std::string &ScreenModeSetting();

	/// VSync setting, either "on", "off", or "adaptive".
	static bool ToggleVSync();
	static VSync VSyncState();
	static const std::string &VSyncSetting();

	static void ToggleCameraAcceleration();
	static CameraAccel CameraAcceleration();
	static const std::string &CameraAccelerationSetting();

	static void CycleStatusOverlays(OverlayType type);
	static OverlayState StatusOverlaysState(OverlayType type);
	static const std::string &StatusOverlaysSetting(OverlayType type);

	/// Turret overlays setting, either "off", "always on", or "blindspots only".
	static void ToggleTurretOverlays();
	static TurretOverlays GetTurretOverlays();
	static const std::string &TurretOverlaysSetting();

	/// Auto aim setting, either "off", "always on", or "when firing".
	static void ToggleAutoAim();
	static AutoAim GetAutoAim();
	static const std::string &AutoAimSetting();

	/// Auto fire setting, either "off", "on", "guns only", or "turrets only".
	static void ToggleAutoFire();
	static AutoFire GetAutoFire();
	static const std::string &AutoFireSetting();

	/// Background parallax setting, either "fast", "fancy", or "off".
	static void ToggleParallax();
	static BackgroundParallax GetBackgroundParallax();
	static const std::string &ParallaxSetting();

	/// Extended jump effects setting, either "off", "medium", or "heavy".
	static void ToggleExtendedJumpEffects();
	static ExtendedJumpEffects GetExtendedJumpEffects();
	static const std::string &ExtendedJumpEffectsSetting();

	/// Boarding target setting, either "proximity", "value" or "mixed".
	static void ToggleBoarding();
	static BoardingPriority GetBoardingPriority();
	static const std::string &BoardingSetting();

	/// Flotsam setting, either "off", "on", "flagship only", or "escorts only".
	static void ToggleFlotsam();
	static FlotsamCollection GetFlotsamCollection();
	static const std::string &FlotsamSetting();

	/// Red alert siren and symbol.
	static void ToggleAlert();
	static AlertIndicator GetAlertIndicator();
	static const std::string &AlertSetting();
	static bool PlayAudioAlert();
	static bool DisplayVisualAlert();
	static bool DoAlertHelper(AlertIndicator toDo);

	/// Minimap display settings.
	static void ToggleMinimapDisplay();
	static MinimapDisplay GetMinimapDisplay();
	static const std::string &MinimapSetting();

	/// Flagship space priority setting.
	static void ToggleFlagshipSpacePriority();
	static FlagshipSpacePriority GetFlagshipSpacePriority();
	static const std::string &FlagshipSpacePrioritySetting();

	static int GetPreviousSaveCount();

#ifdef _WIN32
	static void ToggleTitleBarTheme();
	static TitleBarTheme GetTitleBarTheme();
	static const std::string &TitleBarThemeSetting();

	static void ToggleWindowRounding();
	static WindowRounding GetWindowRounding();
	static const std::string &WindowRoundingSetting();
#endif
};