sbiTunesImporterJob.h
Go to the documentation of this file.
1 /*
2  //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2009 POTI, Inc.
8 // http://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  */
26 
27 #ifndef SBITUNESIMPORTERJOB_H_
28 #define SBITUNESIMPORTERJOB_H_
29 
30 #include <nsStringAPI.h>
31 #include <nsCOMPtr.h>
32 #include <nsCOMArray.h>
33 #include <nsTArray.h>
34 
35 #include <sbIJobProgress.h>
36 #include <sbIJobCancelable.h>
37 
38 class nsIThread;
39 
44  public sbIJobCancelable
45 {
46 public:
48  NS_DECL_SBIJOBPROGRESS
49  NS_DECL_SBIJOBCANCELABLE
50 
54  static sbiTunesImporterJob * New();
58  PRBool CancelRequested() const {
59  return mCancelRequested;
60  }
64  nsresult SetStatus(PRUint32 aStatus);
68  nsresult SetStatusText(nsAString const & aStatusText);
72  nsresult SetTitleText(nsAString const & aTitleText);
77  nsresult SetProgress(PRUint32 aProgress);
81  nsresult SetTotal(PRUint32 aTotal);
85  nsresult AddErrorMessage(nsAString const & aErrorMessage);
86 protected:
94  virtual ~sbiTunesImporterJob();
95 private:
96  // Useful typedefs
97  typedef nsTArray<nsString> StringArray;
98  typedef nsCOMArray<sbIJobProgressListener> ListenerArray;
99 
103  PRBool mCanCancel;
107  PRBool mCancelRequested;
111  StringArray mErrorMessages;
115  ListenerArray mListeners;
119  PRUint32 mStatus;
123  nsString mStatusText;
127  nsString mTitleText;
131  PRUint32 mProgress;
135  PRUint32 mTotal;
139  nsresult UpdateProgress();
140 
141  // Prevent copying and assignment
143  sbiTunesImporterJob & operator = (sbiTunesImporterJob const);
144 };
145 
146 #endif /* SBITUNESIMPORTERJOB_H_ */
Generic interface for exposing long running jobs to the UI.
nsresult AddErrorMessage(nsAString const &aErrorMessage)
nsresult SetStatusText(nsAString const &aStatusText)
NS_DECL_ISUPPORTS NS_DECL_SBIJOBPROGRESS static NS_DECL_SBIJOBCANCELABLE sbiTunesImporterJob * New()
nsresult SetStatus(PRUint32 aStatus)
nsresult SetTitleText(nsAString const &aTitleText)
PRBool CancelRequested() const
nsresult SetProgress(PRUint32 aProgress)
nsresult SetTotal(PRUint32 aTotal)