Merge pull request #4591 from amet/subs_fixes
[vuplus_xbmc] / xbmc / MediaSource.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-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 "utils/StdString.h"
23 #include <vector>
24 #include "GUIPassword.h"
25
26 /*!
27 \ingroup windows
28 \brief Represents a share.
29 \sa VECMediaSource, IVECSOURCES
30 */
31 class CMediaSource
32 {
33 public:
34   enum SourceType
35   {
36     SOURCE_TYPE_UNKNOWN      = 0,
37     SOURCE_TYPE_LOCAL        = 1,
38     SOURCE_TYPE_DVD          = 2,
39     SOURCE_TYPE_VIRTUAL_DVD  = 3,
40     SOURCE_TYPE_REMOTE       = 4,
41     SOURCE_TYPE_VPATH        = 5,
42     SOURCE_TYPE_REMOVABLE    = 6
43   };
44   CMediaSource() { m_iDriveType=SOURCE_TYPE_UNKNOWN; m_iLockMode=LOCK_MODE_EVERYONE; m_iBadPwdCount=0; m_iHasLock=0; m_ignore=false; m_allowSharing=true; };
45   virtual ~CMediaSource() {};
46
47   bool operator==(const CMediaSource &right) const;
48
49   void FromNameAndPaths(const CStdString &category, const CStdString &name, const std::vector<CStdString> &paths);
50   bool IsWritable() const;
51   CStdString strName; ///< Name of the share, can be choosen freely.
52   CStdString strStatus; ///< Status of the share (eg has disk etc.)
53   CStdString strDiskUniqueId; ///< removable:// + DVD Label + DVD ID for resume point storage, if available
54   CStdString strPath; ///< Path of the share, eg. iso9660:// or F:
55
56   /*!
57   \brief The type of the media source.
58
59   Value can be:
60   - SOURCE_TYPE_UNKNOWN \n
61   Unknown source, maybe a wrong path.
62   - SOURCE_TYPE_LOCAL \n
63   Harddisk source.
64   - SOURCE_TYPE_DVD \n
65   DVD-ROM source of the build in drive, strPath may vary.
66   - SOURCE_TYPE_VIRTUAL_DVD \n
67   DVD-ROM source, strPath is fix.
68   - SOURCE_TYPE_REMOTE \n
69   Network source.
70   */
71   SourceType m_iDriveType;
72
73   /*!
74   \brief The type of Lock UI to show when accessing the media source.
75
76   Value can be:
77   - CMediaSource::LOCK_MODE_EVERYONE \n
78   Default value.  No lock UI is shown, user can freely access the source.
79   - LOCK_MODE_NUMERIC \n
80   Lock code is entered via OSD numpad or IrDA remote buttons.
81   - LOCK_MODE_GAMEPAD \n
82   Lock code is entered via XBOX gamepad buttons.
83   - LOCK_MODE_QWERTY \n
84   Lock code is entered via OSD keyboard or PC USB keyboard.
85   - LOCK_MODE_SAMBA \n
86   Lock code is entered via OSD keyboard or PC USB keyboard and passed directly to SMB for authentication.
87   - LOCK_MODE_EEPROM_PARENTAL \n
88   Lock code is retrieved from XBOX EEPROM and entered via XBOX gamepad or remote.
89   - LOCK_MODE_UNKNOWN \n
90   Value is unknown or unspecified.
91   */
92   LockType m_iLockMode;
93   CStdString m_strLockCode;  ///< Input code for Lock UI to verify, can be chosen freely.
94   int m_iHasLock;
95   int m_iBadPwdCount; ///< Number of wrong passwords user has entered since share was last unlocked
96
97   CStdString m_strThumbnailImage; ///< Path to a thumbnail image for the share, or blank for default
98
99   std::vector<CStdString> vecPaths;
100   bool m_ignore; /// <Do not store in xml
101   bool m_allowSharing; /// <Allow browsing of source from UPnP / WebServer
102 };
103
104 /*!
105 \ingroup windows
106 \brief A vector to hold CMediaSource objects.
107 \sa CMediaSource, IVECSOURCES
108 */
109 typedef std::vector<CMediaSource> VECSOURCES;
110
111 /*!
112 \ingroup windows
113 \brief Iterator of VECSOURCES.
114 \sa CMediaSource, VECSOURCES
115 */
116 typedef std::vector<CMediaSource>::iterator IVECSOURCES;
117 typedef std::vector<CMediaSource>::const_iterator CIVECSOURCES;
118
119 void AddOrReplace(VECSOURCES& sources, const VECSOURCES& extras);
120 void AddOrReplace(VECSOURCES& sources, const CMediaSource& source);