xref: /haiku/src/apps/mediaplayer/settings/Settings.h (revision cbe0a0c436162d78cc3f92a305b64918c839d079)
1 /*
2  * Copyright 2008-2011, 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 #ifndef SETTINGS_H
9 #define SETTINGS_H
10 
11 
12 #include <Entry.h>
13 #include <Locker.h>
14 #include <SettingsMessage.h>
15 
16 #include "Notifier.h"
17 
18 
19 #define SETTINGS_FILENAME "MediaPlayer"
20 
21 
22 struct mpSettings {
23 			enum {
24 				SUBTITLE_SIZE_SMALL = 0,
25 				SUBTITLE_SIZE_MEDIUM = 1,
26 				SUBTITLE_SIZE_LARGE = 2
27 			};
28 			enum {
29 				SUBTITLE_PLACEMENT_BOTTOM_OF_VIDEO = 0,
30 				SUBTITLE_PLACEMENT_BOTTOM_OF_SCREEN = 1
31 			};
32 			enum {
33 				BG_MOVIES_FULL_VOLUME = 0,
34 				BG_MOVIES_HALF_VLUME = 1,
35 				BG_MOVIES_MUTED = 2
36 			};
37 			enum {
38 				RESUME_NEVER = 0,
39 				RESUME_ASK = 1,
40 				RESUME_ALWAYS = 2
41 			};
42 
43 			bool				autostart;
44 			bool				closeWhenDonePlayingMovie;
45 			bool				closeWhenDonePlayingSound;
46 			bool				loopMovie;
47 			bool				loopSound;
48 			bool				useOverlays;
49 			bool				scaleBilinear;
50 			bool				scaleFullscreenControls;
51 			uint32				resume;
52 			uint32				subtitleSize;
53 			uint32				subtitlePlacement;
54 			uint32				backgroundMovieVolumeMode;
55 			entry_ref			filePanelFolder;
56 
57 			bool				operator!=(const mpSettings& other) const;
58 
59 			BRect				audioPlayerWindowFrame;
60 };
61 
62 
63 class Settings : public BLocker, public Notifier {
64 public:
65 								Settings(
66 									const char* filename = SETTINGS_FILENAME);
67 
68 			void				Get(mpSettings& settings) const;
69 			void				Update(const mpSettings& settings);
70 
71 			entry_ref			FilePanelFolder() const;
72 			void				SetFilePanelFolder(const entry_ref& ref);
73 
74 			BRect				AudioPlayerWindowFrame() const;
75 			void				SetAudioPlayerWindowFrame(BRect frame);
76 
77 	static	Settings*			Default();
78 
79 private:
80 			SettingsMessage		fSettingsMessage;
81 			BList				fListeners;
82 
83 	static	Settings			sGlobalInstance;
84 };
85 
86 
87 #endif  // SETTINGS_H
88