sbDeviceLibrarySyncSettings.h
Go to the documentation of this file.
1 /* vim: set sw=2 :miv */
2 /*
3  *=BEGIN SONGBIRD GPL
4  *
5  * This file is part of the Songbird web player.
6  *
7  * Copyright(c) 2005-2011 POTI, Inc.
8  * http://www.songbirdnest.com
9  *
10  * This file may be licensed under the terms of of the
11  * GNU General Public License Version 2 (the ``GPL'').
12  *
13  * Software distributed under the License is distributed
14  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
15  * express or implied. See the GPL for the specific language
16  * governing rights and limitations.
17  *
18  * You should have received a copy of the GPL along with this
19  * program. If not, go to http://www.gnu.org/licenses/gpl.html
20  * or write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22  *
23  *=END SONGBIRD GPL
24  */
25 #ifndef SBDEVICELIBRARYSYNCSETTINGS_H_
26 #define SBDEVICELIBRARYSYNCSETTINGS_H_
27 
28 // Mozilla includes
29 #include <nsAutoLock.h>
30 #include <nsAutoPtr.h>
31 #include <nsIArray.h>
32 #include <nsInterfaceHashtable.h>
33 #include <nsTArray.h>
34 
35 // Songbird includes
36 #include <sbIDeviceLibrary.h>
37 #include <sbIDeviceLibrarySyncSettings.h>
38 #include <sbIDeviceLibraryMediaSyncSettings.h>
39 
41 class sbDeviceLibrary;
42 
44 {
45 public:
47  NS_DECL_SBIDEVICELIBRARYSYNCSETTINGS
48 
49  nsresult Assign(sbDeviceLibrarySyncSettings * aSource);
50  nsresult CreateCopy(sbDeviceLibrarySyncSettings ** aSettings);
51  PRLock * GetLock()
52  {
53  return mLock;
54  }
55 
62  nsresult Read(sbIDevice * aDevice,
63  sbIDeviceLibrary * aDeviceLibrary);
64 
66  nsID const & aDeviceID,
67  nsAString const & aDeviceLibraryGuid);
68 private:
69  sbDeviceLibrarySyncSettings(nsID const & aDeviceID,
70  nsAString const & aDeviceLibraryGuid);
71 
73  nsresult GetMediaSettingsNoLock(
74  PRUint32 aMediaType,
75  sbIDeviceLibraryMediaSyncSettings ** aMediaSettings);
76 
77  nsresult GetMgmtTypePref(sbIDevice * aDevice,
78  PRUint32 aContentType,
79  PRUint32 & aMgmtTypes);
80 
89  nsresult GetImportPref(sbIDevice * aDevice,
90  PRUint32 aMediaType,
91  PRBool & aImport);
92 
93  static nsresult ReadAString(sbIDevice * aDevice,
94  nsAString const & aPrefKey,
95  nsAString & aString,
96  nsAString const & aDefault);
97 
98  template <class T>
99  nsresult WritePref(sbIDevice * aDevice,
100  nsAString const & aPrefKey,
101  T aValue);
102 
103  nsresult WriteMediaSyncSettings(
104  sbIDevice * aDevice,
105  PRUint32 aMediaType,
106  sbDeviceLibraryMediaSyncSettings * aMediaSyncSettings);
107 
108  nsresult ReadMediaSyncSettings(
109  sbIDevice * aDevice,
110  sbIDeviceLibrary * aDeviceLibrary,
111  PRUint32 aMediaType,
112  sbDeviceLibraryMediaSyncSettings ** aMediaSyncSettings);
113 
114  nsresult GetMgmtTypePrefKey(PRUint32 aContentType, nsAString& aPrefKey);
115 
122  nsresult GetImportPrefKey(PRUint32 aMediaType,
123  nsAString& aPrefKey);
124 
125  nsresult GetSyncListsPrefKey(PRUint32 aContentType, nsAString& aPrefKey);
126 
127  nsresult GetSyncFromFolderPrefKey(PRUint32 aContentType, nsAString& aPrefKey);
128 
129  nsresult GetSyncFolderPrefKey(PRUint32 aContentType, nsAString& aPrefKey);
130 
131  nsTArray<nsRefPtr<sbDeviceLibraryMediaSyncSettings> > mMediaSettings;
132 
133  nsID mDeviceID;
134  nsString mDeviceLibraryGuid;
135  PRLock * mLock;
136 };
137 
138 #endif /* SBDEVICELIBRARYSYNCSETTINGS_H_ */
nsresult CreateCopy(sbDeviceLibrarySyncSettings **aSettings)
onPageChanged aValue
Definition: FeedWriter.js:1395
NS_DECL_ISUPPORTS NS_DECL_SBIDEVICELIBRARYSYNCSETTINGS nsresult Assign(sbDeviceLibrarySyncSettings *aSource)
static sbDeviceLibrarySyncSettings * New(nsID const &aDeviceID, nsAString const &aDeviceLibraryGuid)
nsresult Read(sbIDevice *aDevice, sbIDeviceLibrary *aDeviceLibrary)