author | mapo |
Thu, 07 Oct 2010 12:37:16 +0200 | |
branch | podcatcher_qt_symbian4 |
changeset 224 | 9db1c2928b15 |
parent 202 | e1dedb07817d |
child 368 | b131f7696342 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
2 |
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB |
|
3 |
* |
|
4 |
* All rights reserved. |
|
5 |
* This component and the accompanying materials are made available |
|
6 |
* under the terms of the License "Eclipse Public License v1.0" |
|
7 |
* which accompanies this distribution, and is available |
|
8 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 |
* |
|
10 |
* Initial Contributors: |
|
11 |
* EmbedDev AB - initial contribution. |
|
12 |
* |
|
13 |
* Contributors: |
|
14 |
* |
|
15 |
* Description: |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
#ifndef SHOWENGINE_H_ |
|
20 |
#define SHOWENGINE_H_ |
|
21 |
||
22 |
#include <e32base.h> |
|
23 |
#include <APGCLI.H> |
|
24 |
#include "constants.h" |
|
25 |
#include "ShowInfo.h" |
|
26 |
#include "PodcastModel.h" |
|
27 |
#include "HttpClient.h" |
|
28 |
#include "ShowEngineObserver.h" |
|
29 |
#include "MetaDataReader.h" |
|
116 | 30 |
#include <sqlite3.h> |
200
79076725bab9
Added #define to enable/disable MPX integration, since it requires capabilities that can't be granted when self signed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
151
diff
changeset
|
31 |
#ifdef ENABLE_MPX_INTEGRATION |
202
e1dedb07817d
Tweaks to capabilities in DLL to enable self signing; Opening RCL_3 branch.
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
200
diff
changeset
|
32 |
#include <mpxcollectionhelper.h> |
e1dedb07817d
Tweaks to capabilities in DLL to enable self signing; Opening RCL_3 branch.
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
200
diff
changeset
|
33 |
#include <mpxcollectionhelperobserver.h> |
200
79076725bab9
Added #define to enable/disable MPX integration, since it requires capabilities that can't be granted when self signed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
151
diff
changeset
|
34 |
#endif |
2 | 35 |
|
151 | 36 |
struct TDownload |
37 |
{ |
|
38 |
TUint iIndex; |
|
39 |
TUint iUid; |
|
40 |
}; |
|
202
e1dedb07817d
Tweaks to capabilities in DLL to enable self signing; Opening RCL_3 branch.
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
200
diff
changeset
|
41 |
|
200
79076725bab9
Added #define to enable/disable MPX integration, since it requires capabilities that can't be granted when self signed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
151
diff
changeset
|
42 |
#ifdef ENABLE_MPX_INTEGRATION |
126 | 43 |
class CShowEngine : public CBase, public MHttpClientObserver, public MMetaDataReaderObserver, |
44 |
public MMPXCollectionHelperObserver |
|
200
79076725bab9
Added #define to enable/disable MPX integration, since it requires capabilities that can't be granted when self signed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
151
diff
changeset
|
45 |
#else |
79076725bab9
Added #define to enable/disable MPX integration, since it requires capabilities that can't be granted when self signed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
151
diff
changeset
|
46 |
class CShowEngine : public CBase, public MHttpClientObserver, public MMetaDataReaderObserver |
79076725bab9
Added #define to enable/disable MPX integration, since it requires capabilities that can't be granted when self signed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
151
diff
changeset
|
47 |
#endif |
2 | 48 |
{ |
49 |
public: |
|
50 |
IMPORT_C static CShowEngine* NewL(CPodcastModel& aPodcastModel); |
|
51 |
IMPORT_C virtual ~CShowEngine(); |
|
52 |
||
53 |
public: |
|
54 |
IMPORT_C void AddDownloadL(CShowInfo& info); |
|
111 | 55 |
IMPORT_C void RemoveDownloadL(TUint aUid); |
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
2
diff
changeset
|
56 |
IMPORT_C void RemoveAllDownloadsL(); |
2 | 57 |
|
58 |
IMPORT_C void SuspendDownloads(); |
|
59 |
IMPORT_C void ResumeDownloadsL(); |
|
60 |
||
61 |
IMPORT_C TInt GetNumDownloadingShows(); |
|
62 |
IMPORT_C CShowInfo* ShowDownloading(); |
|
63 |
IMPORT_C CShowInfo* GetShowByUidL(TUint aShowUid); |
|
64 |
IMPORT_C CShowInfo* GetNextShowByTrackL(CShowInfo* aShowInfo); |
|
65 |
||
66 |
// show access methods |
|
67 |
IMPORT_C void GetAllShowsL(RShowInfoArray &aArray); |
|
68 |
IMPORT_C void GetShowsByFeedL(RShowInfoArray &aArray, TUint aFeedUid); |
|
69 |
IMPORT_C void GetShowsDownloadedL(RShowInfoArray &aArray); |
|
70 |
IMPORT_C void GetNewShowsL(RShowInfoArray &aArray); |
|
71 |
IMPORT_C void GetShowsDownloadingL(RShowInfoArray &aArray); |
|
72 |
IMPORT_C CShowInfo* DBGetShowByFileNameL(TFileName aFileName); |
|
73 |
||
111 | 74 |
IMPORT_C void AddShowL(const CShowInfo& item); |
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
2
diff
changeset
|
75 |
IMPORT_C void DeletePlayedShowsL(RShowInfoArray &aShowInfoArray); |
2 | 76 |
IMPORT_C void DeleteAllShowsByFeedL(TUint aFeedUid,TBool aDeleteFiles=ETrue); |
77 |
IMPORT_C void DeleteShowL(TUint aShowUid, TBool aRemoveFile=ETrue); |
|
111 | 78 |
IMPORT_C void DeleteOldShowsByFeedL(TUint aFeedUid); |
2 | 79 |
|
80 |
IMPORT_C void AddObserver(MShowEngineObserver *observer); |
|
81 |
IMPORT_C void RemoveObserver(MShowEngineObserver *observer); |
|
82 |
||
83 |
IMPORT_C void NotifyShowListUpdatedL(); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
2
diff
changeset
|
84 |
IMPORT_C void UpdateShowL(CShowInfo& aInfo); |
2 | 85 |
|
86 |
IMPORT_C void GetMimeType(const TDesC& aFileName, TDes& aMimeType); |
|
87 |
||
118
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
116
diff
changeset
|
88 |
IMPORT_C void CheckForDeletedShows(TUint aFeedUid); |
2 | 89 |
IMPORT_C CMetaDataReader& MetaDataReader(); |
151 | 90 |
IMPORT_C void MoveDownloadUpL(TUint aUid); |
91 |
IMPORT_C void MoveDownloadDownL(TUint aUid); |
|
2 | 92 |
|
93 |
private: |
|
94 |
// from HttpClientObserver, dont have to be public |
|
95 |
void Connected(CHttpClient* aClient); |
|
96 |
void Disconnected(CHttpClient* aClient); |
|
97 |
void CompleteL(CHttpClient* aClient, TInt aError); |
|
98 |
void Progress(CHttpClient* aHttpClient, int aBytes, int aTotalBytes); |
|
99 |
void DownloadInfo(CHttpClient* aClient, int aSize); |
|
100 |
void FileError(TUint aError); |
|
101 |
// from MetaDataReaderObserver |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
2
diff
changeset
|
102 |
void ReadMetaDataL(CShowInfo& aShowInfo); |
2 | 103 |
void ReadMetaDataCompleteL(); |
126 | 104 |
// from MMPXCollectionHelperObserver |
105 |
void HandleAddFileCompleteL( TInt /*aErr*/ ) {} |
|
106 |
||
2 | 107 |
private: |
108 |
CShowEngine(CPodcastModel& aPodcastModel); |
|
109 |
void ConstructL(); |
|
110 |
||
111 | 111 |
void GetShowL(CShowInfo *info); |
2 | 112 |
|
113 |
void NotifyDownloadQueueUpdatedL(); |
|
114 |
void NotifyShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt aBytesTotal); |
|
115 |
void NotifyShowFinishedL(TInt aError); |
|
116 |
void DownloadNextShowL(); |
|
117 |
||
118 |
static TInt CompareShowsByDate(const CShowInfo &a, const CShowInfo &b); |
|
119 |
static TBool CompareShowsByUid(const CShowInfo &a, const CShowInfo &b); |
|
120 |
static TInt CompareShowsByTitle(const CShowInfo &a, const CShowInfo &b); |
|
121 |
static TInt CompareShowsByTrackNo(const CShowInfo &a, const CShowInfo &b); |
|
122 |
||
123 |
void AddShowToMpxCollection(CShowInfo &aShowInfo); |
|
124 |
||
125 |
private: |
|
126 |
// DB methods |
|
127 |
CShowInfo* DBGetShowByUidL(TUint aUid); |
|
128 |
void DBFillShowInfoFromStmtL(sqlite3_stmt *st, CShowInfo* showInfo); |
|
111 | 129 |
void DBAddShowL(const CShowInfo& aItem); |
130 |
void DBUpdateShowL(CShowInfo& aItem); |
|
2 | 131 |
void DBGetShowsByFeedL(RShowInfoArray& aShowArray, TUint aFeedUid); |
132 |
void DBGetAllShowsL(RShowInfoArray& aShowArray); |
|
133 |
void DBGetNewShowsL(RShowInfoArray& aShowArray); |
|
134 |
void DBGetDownloadedShowsL(RShowInfoArray& aShowArray); |
|
111 | 135 |
void DBDeleteAllShowsByFeedL(TUint aFeedUid); |
136 |
void DBDeleteOldShowsByFeedL(TUint aFeedUid); |
|
137 |
void DBDeleteShowL(TUint aUid); |
|
138 |
void DBRemoveAllDownloadsL(); |
|
139 |
void DBRemoveDownloadL(TUint aUid); |
|
2 | 140 |
void DBGetAllDownloadsL(RShowInfoArray& aShowArray); |
111 | 141 |
TUint DBGetDownloadsCountL(); |
142 |
void DBAddDownloadL(TUint aUid); |
|
2 | 143 |
CShowInfo* DBGetNextDownloadL(); |
151 | 144 |
void DBSwapDownloadsL(TDownload aFirstDL, TDownload aSecondDL); |
2 | 145 |
|
146 |
private: |
|
147 |
CHttpClient* iShowClient; |
|
148 |
||
149 |
CPodcastModel& iPodcastModel; |
|
150 |
||
151 |
// observers that will receive callbacks |
|
152 |
RArray<MShowEngineObserver*> iObservers; |
|
153 |
||
154 |
// The show we are currently downloading |
|
155 |
CShowInfo* iShowDownloading; |
|
156 |
TUint iDownloadErrors; |
|
157 |
||
158 |
CMetaDataReader* iMetaDataReader; |
|
159 |
||
160 |
RApaLsSession iApaSession; |
|
161 |
TBuf8<512> iRecogBuffer; |
|
162 |
||
163 |
sqlite3& iDB; |
|
164 |
TBuf<KDefaultSQLDataBufferLength> iSqlBuffer; |
|
200
79076725bab9
Added #define to enable/disable MPX integration, since it requires capabilities that can't be granted when self signed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
151
diff
changeset
|
165 |
#ifdef ENABLE_MPX_INTEGRATION |
126 | 166 |
MMPXCollectionHelper* iCollectionHelper; |
200
79076725bab9
Added #define to enable/disable MPX integration, since it requires capabilities that can't be granted when self signed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
151
diff
changeset
|
167 |
#endif |
2 | 168 |
}; |
169 |
||
170 |
#endif /*SHOWENGINE_H_*/ |
|
171 |