[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / settings / Profile.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2013 Team XBMC
4  *      http://www.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 "utils/StdString.h"
23 #include "GUIPassword.h"
24
25 #include <vector>
26
27 class TiXmlNode;
28
29 class CProfile
30 {
31 public:
32   /*! \brief Class for handling lock status
33    */
34   class CLock
35   {
36   public:
37     CLock(LockType type = LOCK_MODE_EVERYONE, const CStdString &password = "");
38     void Validate();
39
40     LockType mode;
41     CStdString code;
42     bool addonManager;
43     bool settings;
44     bool music;
45     bool video;
46     bool files;
47     bool pictures;
48     bool programs;
49   };
50
51   CProfile(const CStdString &directory = "", const CStdString &name = "", const int id = -1);
52   ~CProfile(void);
53   
54   void Load(const TiXmlNode *node, int nextIdProfile);
55   void Save(TiXmlNode *root) const;
56
57   const CStdString& getDate() const { return m_date;}
58   const int getId() const { return m_id; }
59   const CStdString& getName() const { return m_name;}
60   const CStdString& getDirectory() const { return m_directory;}
61   const CStdString& getThumb() const { return m_thumb;}
62   const CStdString& getLockCode() const { return m_locks.code;}
63   LockType getLockMode() const { return m_locks.mode; }
64
65   bool hasDatabases() const { return m_bDatabases; }
66   bool canWriteDatabases() const { return m_bCanWrite; }
67   bool hasSources() const { return m_bSources; }
68   bool canWriteSources() const { return m_bCanWriteSources; }
69   bool hasAddons() const { return m_bAddons; }
70   bool settingsLocked() const { return m_locks.settings; }
71   bool addonmanagerLocked() const { return m_locks.addonManager; }
72   bool musicLocked() const { return m_locks.music; }
73   bool videoLocked() const { return m_locks.video; }
74   bool picturesLocked() const { return m_locks.pictures; }
75   bool filesLocked() const { return m_locks.files; }
76   bool programsLocked() const { return m_locks.programs; }
77   const CLock &GetLocks() const { return m_locks; }
78
79   void setName(const CStdString& name) {m_name = name;}
80   void setDirectory(const CStdString& directory) {m_directory = directory;}
81   void setDate(const CStdString& strDate) { m_date = strDate;}
82   void setDate();
83   void setThumb(const CStdString& thumb) {m_thumb = thumb;}
84   void setDatabases(bool bHas) { m_bDatabases = bHas; }
85   void setWriteDatabases(bool bCan) { m_bCanWrite = bCan; }
86   void setSources(bool bHas) { m_bSources = bHas; }
87   void setWriteSources(bool bCan) { m_bCanWriteSources = bCan; }
88   void SetLocks(const CLock &locks);
89
90 private:
91   CStdString m_directory;
92   int m_id;
93   CStdString m_name;
94   CStdString m_date;
95   CStdString m_thumb;
96   bool m_bDatabases;
97   bool m_bCanWrite;
98   bool m_bSources;
99   bool m_bCanWriteSources;
100   bool m_bAddons;
101   CLock m_locks;
102 };