~ubuntu-branches/debian/squeeze/f-spot/squeeze

« back to all changes in this revision

Viewing changes to extensions/FlickrExport/FlickrNet/PhotoSearchOptions.cs

  • Committer: Bazaar Package Importer
  • Author(s): Iain Lane, Mirco Bauer, Iain Lane
  • Date: 2009-02-07 20:23:32 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20090207202332-oc93rfjo1st0571s
Tags: 0.5.0.3-2
[ Mirco Bauer]
* Upload to unstable.
* debian/control:
  + Lowered GNOME# build-deps to 2.0 ABI as that transition didn't happen
    yet in unstable.

[ Iain Lane ]
* debian/patches/svn-r4545_locales-import.dpatch: Patch backported from SVN
  trunk revision 4545 - initialize the translation catalog earlier (LP: #293305)
  (Closes: #514457). Thanks to Florian Heinle for finding the patch and to
  Chris Coulson for preparing the update.
* debian/control: Build-depend on libmono-dev (>= 1.2.4) to match configure
  checks.
* debian/rules: Pass CSC=/usr/bin/csc to configure for gio-sharp to fix FTBFS

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
using System;
2
 
 
3
 
namespace FlickrNet
4
 
{
5
 
        /// <summary>
6
 
        /// Summary description for PhotoSearchOptions.
7
 
        /// </summary>
8
 
        public class PhotoSearchOptions
9
 
        {
10
 
                private string _userId;
11
 
                private string _tags;
12
 
                private TagMode _tagMode = TagMode.None;
13
 
                private string _text;
14
 
                private DateTime _minUploadDate = DateTime.MinValue;
15
 
                private DateTime _maxUploadDate = DateTime.MinValue;
16
 
                private DateTime _minTakenDate = DateTime.MinValue;
17
 
                private DateTime _maxTakenDate = DateTime.MinValue;
18
 
                private System.Collections.ArrayList _licenses = new System.Collections.ArrayList();
19
 
                private PhotoSearchExtras _extras = PhotoSearchExtras.None;
20
 
                private int _perPage = 0;
21
 
                private int _page = 0;
22
 
                private PhotoSearchSortOrder _sort = PhotoSearchSortOrder.None;
23
 
                private PrivacyFilter _privacyFilter = PrivacyFilter.None;
24
 
                private BoundaryBox _boundaryBox = new BoundaryBox();
25
 
 
26
 
                /// <summary>
27
 
                /// Creates a new instance of the search options.
28
 
                /// </summary>
29
 
                public PhotoSearchOptions()
30
 
                {
31
 
                }
32
 
 
33
 
                /// <summary>
34
 
                /// Creates a new instance of the search options, setting the UserId property to the parameter 
35
 
                /// passed in.
36
 
                /// </summary>
37
 
                /// <param name="userId">The ID of the User to search for.</param>
38
 
                public PhotoSearchOptions(string userId) : this(userId, null, TagMode.AllTags, null)
39
 
                {
40
 
                }
41
 
 
42
 
                /// <summary>
43
 
                /// Create an instance of the <see cref="PhotoSearchOptions"/> for a given user ID and tag list.
44
 
                /// </summary>
45
 
                /// <param name="userId">The ID of the User to search for.</param>
46
 
                /// <param name="tags">The tags (comma delimited) to search for. Will match all tags.</param>
47
 
                public PhotoSearchOptions(string userId, string tags) : this( userId, tags, TagMode.AllTags, null)
48
 
                {
49
 
                }
50
 
 
51
 
                /// <summary>
52
 
                /// Create an instance of the <see cref="PhotoSearchOptions"/> for a given user ID and tag list,
53
 
                /// with the selected tag mode.
54
 
                /// </summary>
55
 
                /// <param name="userId">The ID of the User to search for.</param>
56
 
                /// <param name="tags">The tags (comma delimited) to search for.</param>
57
 
                /// <param name="tagMode">The <see cref="TagMode"/> to use to search.</param>
58
 
                public PhotoSearchOptions(string userId, string tags, TagMode tagMode) : this( userId, tags, tagMode, null)
59
 
                {
60
 
                }
61
 
 
62
 
                /// <summary>
63
 
                /// Create an instance of the <see cref="PhotoSearchOptions"/> for a given user ID and tag list,
64
 
                /// with the selected tag mode, and containing the selected text.
65
 
                /// </summary>
66
 
                /// <param name="userId">The ID of the User to search for.</param>
67
 
                /// <param name="tags">The tags (comma delimited) to search for.</param>
68
 
                /// <param name="tagMode">The <see cref="TagMode"/> to use to search.</param>
69
 
                /// <param name="text">The text to search for in photo title and descriptions.</param>
70
 
                public PhotoSearchOptions(string userId, string tags, TagMode tagMode, string text)
71
 
                {
72
 
                        this.UserId = userId;
73
 
                        this.Tags = tags;
74
 
                        this.TagMode = tagMode;
75
 
                        this.Text = text;
76
 
                }
77
 
 
78
 
                /// <summary>
79
 
                /// The user Id of the user to search on. Defaults to null for no specific user.
80
 
                /// </summary>
81
 
                public string UserId
82
 
                {
83
 
                        get { return _userId; }
84
 
                        set { _userId = value; }
85
 
                }
86
 
 
87
 
                /// <summary>
88
 
                /// A comma delimited list of tags
89
 
                /// </summary>
90
 
                public string Tags
91
 
                {
92
 
                        get { return _tags; }
93
 
                        set { _tags = value; }
94
 
                }
95
 
        
96
 
                /// <summary>
97
 
                /// Tag mode can either be 'all', or 'any'. Defaults to <see cref="FlickrNet.TagMode.AllTags"/>
98
 
                /// </summary>
99
 
                public TagMode TagMode
100
 
                {
101
 
                        get { return _tagMode; }
102
 
                        set { _tagMode = value; }
103
 
                }
104
 
 
105
 
                internal string TagModeString
106
 
                {
107
 
                        get
108
 
                        {
109
 
                                switch(_tagMode)
110
 
                                {
111
 
                                        case TagMode.None:
112
 
                                                return "";
113
 
                                        case TagMode.AllTags:
114
 
                                                return "all";
115
 
                                        case TagMode.AnyTag:
116
 
                                                return "any";
117
 
                                        case TagMode.Boolean:
118
 
                                                return "bool";
119
 
                                        default:
120
 
                                                return "all";
121
 
                                }
122
 
                        }
123
 
                }
124
 
        
125
 
                /// <summary>
126
 
                /// Search for the given text in photo titles and descriptions.
127
 
                /// </summary>
128
 
                public string Text
129
 
                {
130
 
                        get { return _text; }
131
 
                        set { _text = value; }
132
 
                }
133
 
        
134
 
                /// <summary>
135
 
                /// Minimum date uploaded. Defaults to <see cref="DateTime.MinValue"/> which
136
 
                /// signifies that the value is not to be used.
137
 
                /// </summary>
138
 
                public DateTime MinUploadDate
139
 
                {
140
 
                        get { return _minUploadDate; }
141
 
                        set { _minUploadDate = value; }
142
 
                }
143
 
        
144
 
                /// <summary>
145
 
                /// Maximum date uploaded. Defaults to <see cref="DateTime.MinValue"/> which
146
 
                /// signifies that the value is not to be used.
147
 
                /// </summary>
148
 
                public DateTime MaxUploadDate
149
 
                {
150
 
                        get { return _maxUploadDate; }
151
 
                        set { _maxUploadDate = value; }
152
 
                }
153
 
        
154
 
                /// <summary>
155
 
                /// Minimum date taken. Defaults to <see cref="DateTime.MinValue"/> which
156
 
                /// signifies that the value is not to be used.
157
 
                /// </summary>
158
 
                public DateTime MinTakenDate
159
 
                {
160
 
                        get { return _minTakenDate; }
161
 
                        set { _minTakenDate = value; }
162
 
                }
163
 
        
164
 
                /// <summary>
165
 
                /// Maximum date taken. Defaults to <see cref="DateTime.MinValue"/> which
166
 
                /// signifies that the value is not to be used.
167
 
                /// </summary>
168
 
                public DateTime MaxTakenDate
169
 
                {
170
 
                        get { return _maxTakenDate; }
171
 
                        set { _maxTakenDate = value; }
172
 
                }
173
 
 
174
 
                /// <summary>
175
 
                /// Only return licenses with the selected license number.
176
 
                /// See http://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html
177
 
                /// for more details on the numbers to use.
178
 
                /// </summary>
179
 
                [Obsolete("Use AddLicense/RemoveLicense to add/remove licenses")]
180
 
                public int License
181
 
                {
182
 
                        get 
183
 
                        {
184
 
                                if( _licenses.Count == 0 )
185
 
                                        return 0;
186
 
                                else
187
 
                                        return (int)_licenses[0];
188
 
                        }
189
 
                        set 
190
 
                        {
191
 
                                if( _licenses.Count == 0 )
192
 
                                        _licenses.Add(value);
193
 
                                else
194
 
                                        _licenses[0] = value;
195
 
                        }
196
 
                }
197
 
 
198
 
                /// <summary>
199
 
                /// Returns a copy of the licenses to be searched for.
200
 
                /// </summary>
201
 
                public int[] Licenses
202
 
                {
203
 
                        get 
204
 
                        {
205
 
                                return (int[])_licenses.ToArray(typeof(int));
206
 
                        }
207
 
                }
208
 
 
209
 
                /// <summary>
210
 
                /// Adds a new license to the list of licenses to be searched for.
211
 
                /// </summary>
212
 
                /// <param name="license">The number of the license to search for.</param>
213
 
                public void AddLicense(int license)
214
 
                {
215
 
                        if( !_licenses.Contains(license) ) _licenses.Add(license);
216
 
                }
217
 
 
218
 
                /// <summary>
219
 
                /// Removes a license from the list of licenses to be searched for.
220
 
                /// </summary>
221
 
                /// <param name="license">The number of the license to remove.</param>
222
 
                public void RemoveLicense(int license)
223
 
                {
224
 
                        if( _licenses.Contains(license) ) _licenses.Remove(license);
225
 
                }
226
 
 
227
 
                /// <summary>
228
 
                /// Optional extras to return, defaults to all. See <see cref="PhotoSearchExtras"/> for more details.
229
 
                /// </summary>
230
 
                public PhotoSearchExtras Extras
231
 
                {
232
 
                        get { return _extras; }
233
 
                        set { _extras = value; }
234
 
                }
235
 
 
236
 
                /// <summary>
237
 
                /// Number of photos to return per page. Defaults to 100.
238
 
                /// </summary>
239
 
                public int PerPage
240
 
                {
241
 
                        get { return _perPage; }
242
 
                        set { _perPage = value; }
243
 
                }
244
 
 
245
 
                /// <summary>
246
 
                /// The page to return. Defaults to page 1.
247
 
                /// </summary>
248
 
                public int Page
249
 
                {
250
 
                        get { return _page; }
251
 
                        set 
252
 
                        {
253
 
                                if( value < 0 ) throw new ArgumentOutOfRangeException("Page", value, "Must be greater than 0");
254
 
                                _page = value; 
255
 
                        }
256
 
                }
257
 
 
258
 
                /// <summary>
259
 
                /// The sort order of the returned list. Default is <see cref="PhotoSearchSortOrder.None"/>.
260
 
                /// </summary>
261
 
                public PhotoSearchSortOrder SortOrder
262
 
                {
263
 
                        get { return _sort; }
264
 
                        set { _sort = value; }
265
 
                }
266
 
 
267
 
                /// <summary>
268
 
                /// The privacy fitler to filter the search on.
269
 
                /// </summary>
270
 
                public PrivacyFilter PrivacyFilter
271
 
                {
272
 
                        get { return _privacyFilter; }
273
 
                        set { _privacyFilter = value; }
274
 
                }
275
 
 
276
 
                /// <summary>
277
 
                /// The boundary box for which to search for geo location photos.
278
 
                /// </summary>
279
 
                public BoundaryBox BoundaryBox
280
 
                {
281
 
                        get { return _boundaryBox; }
282
 
                        set 
283
 
                        {
284
 
                                if( value == null )
285
 
                                          _boundaryBox = new BoundaryBox();
286
 
                                  else 
287
 
                                          _boundaryBox = value; 
288
 
                        }
289
 
                }
290
 
 
291
 
                /// <summary>
292
 
                /// The accuracy of the search for geo location photos.
293
 
                /// </summary>
294
 
                /// <remarks>
295
 
                /// Can also be set as a property of the <see cref="BoundaryBox"/> property.
296
 
                /// </remarks>
297
 
                public GeoAccuracy Accuracy
298
 
                {
299
 
                        get { return _boundaryBox==null?GeoAccuracy.None:_boundaryBox.Accuracy; }
300
 
                        set 
301
 
                        { 
302
 
                                if (_boundaryBox==null) { _boundaryBox = new BoundaryBox(); }
303
 
                                _boundaryBox.Accuracy = value;
304
 
                        }
305
 
                
306
 
                }
307
 
 
308
 
                internal string ExtrasString
309
 
                {
310
 
                        get { return Utils.ExtrasToString(Extras); }
311
 
                }
312
 
 
313
 
                internal string SortOrderString
314
 
                {
315
 
                        get     { return Utils.SortOrderToString(_sort); }
316
 
                }
317
 
        }
318
 
 
319
 
}