Merge pull request #4630 from Red-F/gotham-resume-pvr-lastplayedposition
[vuplus_xbmc] / xbmc / settings / MediaSettings.h
1 #pragma once
2 /*
3  *      Copyright (C) 2013 Team XBMC
4  *      http://xbmc.org
5  *
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)
9  *  any later version.
10  *
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.
15  *
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/>.
19  *
20  */
21
22 #include <map>
23 #include <string>
24
25 #include "settings/lib/ISettingCallback.h"
26 #include "settings/lib/ISubSettings.h"
27 #include "settings/VideoSettings.h"
28 #include "threads/CriticalSection.h"
29
30 #define VOLUME_DRC_MINIMUM 0    // 0dB
31 #define VOLUME_DRC_MAXIMUM 6000 // 60dB
32
33 class TiXmlNode;
34
35 typedef enum {
36   WatchedModeAll        = 0,
37   WatchedModeUnwatched,
38   WatchedModeWatched
39 } WatchedMode;
40
41 class CMediaSettings : public ISettingCallback, public ISubSettings
42 {
43 public:
44   static CMediaSettings& Get();
45
46   virtual bool Load(const TiXmlNode *settings);
47   virtual bool Save(TiXmlNode *settings) const;
48
49   virtual void OnSettingAction(const CSetting *setting);
50
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; }
55
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.
59    \sa SetWatchMode
60    */
61   int GetWatchedMode(const std::string &content) const;
62
63   /*! \brief Set the watched mode for the given content type
64    \param content Current content type
65    \param value Watched mode to set
66    \sa GetWatchMode
67    */
68   void SetWatchedMode(const std::string &content, WatchedMode mode);
69
70   /*! \brief Cycle the watched mode for the given content type
71    \param content Current content type
72    \sa GetWatchMode, SetWatchMode
73    */
74   void CycleWatchedMode(const std::string &content);
75
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; }
80
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; }
85
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; }
90
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; }
95
96 protected:
97   CMediaSettings();
98   CMediaSettings(const CMediaSettings&);
99   CMediaSettings& operator=(CMediaSettings const&);
100   virtual ~CMediaSettings();
101
102   static std::string GetWatchedContent(const std::string &content);
103
104 private:
105   CVideoSettings m_defaultVideoSettings;
106   CVideoSettings m_currentVideoSettings;
107
108   typedef std::map<std::string, WatchedMode> WatchedModes;
109   WatchedModes m_watchedModes;
110
111   bool m_musicPlaylistRepeat;
112   bool m_musicPlaylistShuffle;
113   bool m_videoPlaylistRepeat;
114   bool m_videoPlaylistShuffle;
115
116   bool m_videoStartWindowed;
117   int m_additionalSubtitleDirectoryChecked;
118
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)
121
122   CCriticalSection m_critical;
123 };