xref: /haiku/src/apps/mediaplayer/settings/Settings.h (revision 922e7ba1f3228e6f28db69b0ded8f86eb32dea17)
1 /*
2  * Copyright 2008, Haiku. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Fredrik Modéen <fredrik@modeen.se>
7  */
8 
9 #ifndef SETTINGS_H
10 #define SETTINGS_H
11 
12 #include <Entry.h>
13 #include <Locker.h>
14 
15 #include "Notifier.h"
16 #include "SettingsMessage.h"
17 
18 struct mpSettings {
19 			enum {
20 				SUBTITLE_SIZE_SMALL = 0,
21 				SUBTITLE_SIZE_MEDIUM = 1,
22 				SUBTITLE_SIZE_LARGE = 2
23 			};
24 			enum {
25 				SUBTITLE_PLACEMENT_BOTTOM_OF_VIDEO = 0,
26 				SUBTITLE_PLACEMENT_BOTTOM_OF_SCREEN = 1
27 			};
28 			enum {
29 				BG_MOVIES_FULL_VOLUME = 0,
30 				BG_MOVIES_HALF_VLUME = 1,
31 				BG_MOVIES_MUTED = 2
32 			};
33 
34 			bool				autostart;
35 			bool				closeWhenDonePlayingMovie;
36 			bool				closeWhenDonePlayingSound;
37 			bool				loopMovie;
38 			bool				loopSound;
39 			bool				useOverlays;
40 			bool				scaleBilinear;
41 			bool				scaleFullscreenControls;
42 			uint32				subtitleSize;
43 			uint32				subtitlePlacement;
44 			uint32				backgroundMovieVolumeMode;
45 			entry_ref			filePanelFolder;
46 
47 			bool				operator!=(const mpSettings& other) const;
48 
49 			BRect				audioPlayerWindowFrame;
50 };
51 
52 #define SETTINGS_FILENAME "MediaPlayer"
53 
54 class Settings : public BLocker, public Notifier {
55 public:
56 								Settings(
57 									const char* filename = SETTINGS_FILENAME);
58 
59 			void				LoadSettings(mpSettings& settings) const;
60 			void				SaveSettings(const mpSettings& settings);
61 
62 	static	mpSettings			CurrentSettings();
63 	static	Settings*			Default();
64 
65 private:
66 			SettingsMessage		fSettingsMessage;
67 			BList				fListeners;
68 
69 	static	Settings			sGlobalInstance;
70 };
71 
72 #endif  // SETTINGS_H
73