sbPropertyManager.h
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2011 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
25 #ifndef __SBPROPERTYMANAGER_H__
26 #define __SBPROPERTYMANAGER_H__
27 
28 #include <sbIPropertyManager.h>
29 #include <nsIObserver.h>
30 
31 #include <nsCOMPtr.h>
32 #include <nsStringGlue.h>
33 
34 #include <nsTArray.h>
35 #include <nsInterfaceHashtable.h>
36 
37 struct nsModuleComponentInfo;
38 class nsIComponentManager;
39 class nsIFile;
42 
44 {
45 public:
47  NS_DECL_SBIPROPERTYMANAGER
48 
50  virtual ~sbPropertyManager();
51 
52  NS_METHOD Init();
53  NS_METHOD CreateSystemProperties();
54 private:
55 
56  nsresult RegisterFilterListPickerProperties();
57 
58  nsresult RegisterDateTime(const nsAString& aPropertyID,
59  const nsAString& aDisplayKey,
60  PRInt32 aType,
61  nsIStringBundle* aStringBundle,
62  PRBool aUserViewable,
63  PRBool aUserEditable,
64  PRBool aRemoteReadable,
65  PRBool aRemoteWritable);
66 
67  nsresult RegisterDuration(const nsAString& aPropertyID,
68  const nsAString& aDisplayKey,
69  nsIStringBundle* aStringBundle,
70  PRBool aUserViewable,
71  PRBool aUserEditable,
72  PRBool aRemoteReadable,
73  PRBool aRemoteWritable);
74 
75  nsresult RegisterNumber(const nsAString& aPropertyID,
76  const nsAString& aDisplayKey,
77  nsIStringBundle* aStringBundle,
78  PRBool aUserViewable,
79  PRBool aUserEditable,
80  PRInt32 aMinValue,
81  PRBool aHasMinValue,
82  PRInt32 aMaxValue,
83  PRBool aHasMaxValue,
84  PRBool aRemoteReadable,
85  PRBool aRemoteWritable,
86  sbIPropertyUnitConverter *aConverter,
87  sbIPropertyArray* aSecondarySort = nsnull);
88 
89  nsresult RegisterProgress(const nsAString& aValuePropertyID,
90  const nsAString& aValueDisplayKey,
91  const nsAString& aModePropertyID,
92  const nsAString& aModeDisplayKey,
93  nsIStringBundle* aStringBundle,
94  PRBool aUserViewable,
95  PRBool aUserEditable,
96  PRBool aRemoteReadable,
97  PRBool aRemoteWritable);
98 
99  // Register a property for the sbIPropertyInfo interface. Use this
100  // registration for:
101  // 1. Text properties in the top-level media items table
102  // 2. Any text-based property where the collation transforms provided
103  // by sbITextPropertyInfo are not desired.
104  nsresult RegisterBlob(const nsAString& aPropertyID,
105  const nsAString& aDisplayKey,
106  nsIStringBundle* aStringBundle,
107  PRBool aUserViewable,
108  PRBool aUserEditable,
109  PRBool aUsedInIdentity,
110  PRUint32 aNullSort,
111  PRBool aHasNullSort,
112  PRBool aRemoteReadable,
113  PRBool aRemoteWritable);
114 
115  nsresult RegisterText(const nsAString& aPropertyID,
116  const nsAString& aDisplayKey,
117  nsIStringBundle* aStringBundle,
118  PRBool aUserViewable,
119  PRBool aUserEditable,
120  PRBool aUsedInIdentity,
121  PRUint32 aNullSort,
122  PRBool aHasNullSort,
123  PRBool aRemoteReadable,
124  PRBool aRemoteWritable,
125  PRBool aCompressWhitespace = PR_TRUE,
126  sbIPropertyArray* aSecondarySort = nsnull);
127 
128  nsresult RegisterURI(const nsAString& aPropertyID,
129  const nsAString& aDisplayKey,
130  nsIStringBundle* aStringBundle,
131  PRBool aUserViewable,
132  PRBool aUserEditable,
133  PRBool aRemoteReadable,
134  PRBool aRemoteWritable);
135 
136  nsresult RegisterImage(const nsAString& aPropertyID,
137  const nsAString& aDisplayKey,
138  nsIStringBundle* aStringBundle,
139  PRBool aUserViewable,
140  PRBool aUserEditable,
141  PRBool aRemoteReadable,
142  PRBool aRemoteWritable);
143 
144  nsresult RegisterBoolean(const nsAString &aPropertyID,
145  const nsAString &aDisplayKey,
146  nsIStringBundle* aStringBundle,
147  PRBool aUserViewable,
148  PRBool aUserEditable,
149  PRBool aRemoteReadable,
150  PRBool aRemoteWritable,
151  PRBool aShouldSuppress = PR_TRUE);
152 
153  nsresult RegisterImageLink(const nsAString &aPropertyID,
154  const nsAString &aDisplayKey,
155  nsIStringBundle* aStringBundle,
156  PRBool aUserViewable,
157  PRBool aUserEditable,
158  PRBool aRemoteReadable,
159  PRBool aRemoteWritable,
160  const nsAString &aUrlPropertyID);
161 
162  nsresult RegisterTrackTypeImageLabel(const nsAString& aPropertyID,
163  const nsAString& aDisplayKey,
164  nsIStringBundle* aStringBundle,
165  PRBool aUserViewable,
166  PRBool aUserEditable,
167  PRBool aRemoteReadable,
168  PRBool aRemoteWritable,
169  const nsAString &aUrlPropertyID);
170 
171  nsresult RegisterDummy(sbDummyPropertyInfo *aDummyProperty,
172  const nsAString &aPropertyID,
173  const nsAString &aDisplayKey,
174  nsIStringBundle* aStringBundle);
175 
176  nsresult SetRemoteAccess(sbIPropertyInfo* aProperty,
177  PRBool aRemoteReadable,
178  PRBool aRemoteWritable);
179 protected:
180  nsInterfaceHashtableMT<nsStringHashKey, sbIPropertyInfo> mPropInfoHashtable;
181 
182  // Maps property ID to all properties that depend on that ID in some way
183  nsInterfaceHashtableMT<nsStringHashKey, sbIPropertyArray> mPropDependencyMap;
184 
185  PRLock* mPropIDsLock;
186  nsTArray<nsString> mPropIDs;
187 };
188 
189 #endif /* __SBPROPERTYMANAGER_H__ */
nsTArray< nsString > mPropIDs
nsInterfaceHashtableMT< nsStringHashKey, sbIPropertyArray > mPropDependencyMap
An interface used to describe a metadata property for use by the UI and other sbILibrary interfaces (...
NS_DECL_ISUPPORTS NS_DECL_SBIPROPERTYMANAGER sbPropertyManager()
Property unit converter interface This is an interface songbird property converter, used to convert a property value between its various units representations.
NS_METHOD CreateSystemProperties()
nsInterfaceHashtableMT< nsStringHashKey, sbIPropertyInfo > mPropInfoHashtable
An interface to carry around arrays of nsIProperty instances. Users of this interface should only QI ...
Manager for system wide metadata properties.