3 * Copyright (C) 2013 Team XBMC
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
25 #include "settings/lib/ISettingCallback.h"
26 #include "settings/lib/ISubSettings.h"
27 #include "settings/VideoSettings.h"
28 #include "threads/CriticalSection.h"
30 #define VOLUME_DRC_MINIMUM 0 // 0dB
31 #define VOLUME_DRC_MAXIMUM 6000 // 60dB
41 class CMediaSettings : public ISettingCallback, public ISubSettings
44 static CMediaSettings& Get();
46 virtual bool Load(const TiXmlNode *settings);
47 virtual bool Save(TiXmlNode *settings) const;
49 virtual void OnSettingAction(const CSetting *setting);
51 const CVideoSettings& GetDefaultVideoSettings() const { return m_defaultVideoSettings; }
52 CVideoSettings& GetDefaultVideoSettings() { return m_defaultVideoSettings; }
53 const CVideoSettings& GetCurrentVideoSettings() const { return m_currentVideoSettings; }
54 CVideoSettings& GetCurrentVideoSettings() { return m_currentVideoSettings; }
56 /*! \brief Retreive the watched mode for the given content type
57 \param content Current content type
58 \return the current watch mode for this content type, WATCH_MODE_ALL if the content type is unknown.
61 int GetWatchedMode(const std::string &content) const;
63 /*! \brief Set the watched mode for the given content type
64 \param content Current content type
65 \param value Watched mode to set
68 void SetWatchedMode(const std::string &content, WatchedMode mode);
70 /*! \brief Cycle the watched mode for the given content type
71 \param content Current content type
72 \sa GetWatchMode, SetWatchMode
74 void CycleWatchedMode(const std::string &content);
76 bool DoesMusicPlaylistRepeat() const { return m_musicPlaylistRepeat; }
77 void SetMusicPlaylistRepeat(bool repeats) { m_musicPlaylistRepeat = repeats; }
78 bool IsMusicPlaylistShuffled() const { return m_musicPlaylistShuffle; }
79 void SetMusicPlaylistShuffled(bool shuffled) { m_musicPlaylistShuffle = shuffled; }
81 bool DoesVideoPlaylistRepeat() const { return m_videoPlaylistRepeat; }
82 void SetVideoPlaylistRepeat(bool repeats) { m_videoPlaylistRepeat = repeats; }
83 bool IsVideoPlaylistShuffled() const { return m_videoPlaylistShuffle; }
84 void SetVideoPlaylistShuffled(bool shuffled) { m_videoPlaylistShuffle = shuffled; }
86 bool DoesVideoStartWindowed() const { return m_videoStartWindowed; }
87 void SetVideoStartWindowed(bool windowed) { m_videoStartWindowed = windowed; }
88 int GetAdditionalSubtitleDirectoryChecked() const { return m_additionalSubtitleDirectoryChecked; }
89 void SetAdditionalSubtitleDirectoryChecked(int checked) { m_additionalSubtitleDirectoryChecked = checked; }
91 int GetMusicNeedsUpdate() const { return m_musicNeedsUpdate; }
92 void SetMusicNeedsUpdate(int version) { m_musicNeedsUpdate = version; }
93 int GetVideoNeedsUpdate() const { return m_videoNeedsUpdate; }
94 void SetVideoNeedsUpdate(int version) { m_videoNeedsUpdate = version; }
98 CMediaSettings(const CMediaSettings&);
99 CMediaSettings& operator=(CMediaSettings const&);
100 virtual ~CMediaSettings();
102 static std::string GetWatchedContent(const std::string &content);
105 CVideoSettings m_defaultVideoSettings;
106 CVideoSettings m_currentVideoSettings;
108 typedef std::map<std::string, WatchedMode> WatchedModes;
109 WatchedModes m_watchedModes;
111 bool m_musicPlaylistRepeat;
112 bool m_musicPlaylistShuffle;
113 bool m_videoPlaylistRepeat;
114 bool m_videoPlaylistShuffle;
116 bool m_videoStartWindowed;
117 int m_additionalSubtitleDirectoryChecked;
119 int m_musicNeedsUpdate; ///< if a database update means an update is required (set to the version number of the db)
120 int m_videoNeedsUpdate; ///< if a database update means an update is required (set to the version number of the db)
122 CCriticalSection m_critical;