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 15 #include "Notifier.h" 16 #include "SettingsMessage.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 38 bool autostart; 39 bool closeWhenDonePlayingMovie; 40 bool closeWhenDonePlayingSound; 41 bool loopMovie; 42 bool loopSound; 43 bool useOverlays; 44 bool scaleBilinear; 45 bool scaleFullscreenControls; 46 uint32 subtitleSize; 47 uint32 subtitlePlacement; 48 uint32 backgroundMovieVolumeMode; 49 entry_ref filePanelFolder; 50 51 bool operator!=(const mpSettings& other) const; 52 53 BRect audioPlayerWindowFrame; 54 }; 55 56 57 class Settings : public BLocker, public Notifier { 58 public: 59 Settings( 60 const char* filename = SETTINGS_FILENAME); 61 62 void Get(mpSettings& settings) const; 63 void Update(const mpSettings& settings); 64 65 entry_ref FilePanelFolder() const; 66 void SetFilePanelFolder(const entry_ref& ref); 67 68 BRect AudioPlayerWindowFrame() const; 69 void SetAudioPlayerWindowFrame(BRect frame); 70 71 static Settings* Default(); 72 73 private: 74 SettingsMessage fSettingsMessage; 75 BList fListeners; 76 77 static Settings sGlobalInstance; 78 }; 79 80 81 #endif // SETTINGS_H 82