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 PODCASTMODEL_H
|
|
20 |
#define PODCASTMODEL_H
|
|
21 |
#include <e32base.h>
|
|
22 |
#include <eikenv.h>
|
|
23 |
#include <commdb.h>
|
|
24 |
#include <CommDbConnPref.h>
|
|
25 |
#include <es_sock.h>
|
|
26 |
#include <http/rhttpsession.h>
|
|
27 |
#include <cmmanager.h>
|
|
28 |
|
|
29 |
#include "FeedInfo.h"
|
|
30 |
#include "ShowInfo.h"
|
|
31 |
#include "debug.h"
|
60
|
32 |
#include <sqlite3.h>
|
2
|
33 |
#include "ImageHandler.h"
|
|
34 |
|
|
35 |
// SQLite leaks memory when sorting, so to test our own memory leaks we need to disable this
|
|
36 |
//#define DONT_SORT_SQL
|
|
37 |
class RCmManager;
|
|
38 |
class CFeedEngine;
|
|
39 |
class CShowEngine;
|
|
40 |
class CSettingsEngine;
|
|
41 |
class CCommsDatabase;
|
|
42 |
class CConnectionEngine;
|
|
43 |
|
|
44 |
class TPodcastIAPItem
|
|
45 |
{
|
|
46 |
public:
|
|
47 |
TUint32 iIapId;
|
|
48 |
TBuf<KCommsDbSvrMaxFieldLength> iServiceType;
|
|
49 |
TBuf<KCommsDbSvrMaxFieldLength> iBearerType;
|
|
50 |
};
|
|
51 |
|
|
52 |
/**
|
|
53 |
* This class handles application storage needs and ownership of audioplayer, resource lists etc.
|
|
54 |
*/
|
|
55 |
class CPodcastModel : public CBase, public MImageHandlerCallback
|
|
56 |
{
|
|
57 |
public:
|
|
58 |
IMPORT_C static CPodcastModel* NewL();
|
|
59 |
IMPORT_C ~CPodcastModel();
|
|
60 |
IMPORT_C CFeedEngine& FeedEngine();
|
|
61 |
IMPORT_C CShowEngine& ShowEngine();
|
|
62 |
IMPORT_C CSettingsEngine& SettingsEngine();
|
|
63 |
IMPORT_C CConnectionEngine& ConnectionEngine();
|
|
64 |
IMPORT_C CShowInfo* PlayingPodcast();
|
|
65 |
IMPORT_C void SetPlayingPodcast(CShowInfo* aPodcast);
|
|
66 |
IMPORT_C void PlayPausePodcastL(CShowInfo * aPodcast, TBool aPlayOnInit = EFalse);
|
|
67 |
IMPORT_C CFeedInfo* ActiveFeedInfo();
|
|
68 |
IMPORT_C void SetActiveFeedInfo(CFeedInfo* aFeedInfo);
|
|
69 |
|
|
70 |
RFs& FsSession();
|
|
71 |
|
|
72 |
IMPORT_C RShowInfoArray& ActiveShowList();
|
|
73 |
|
|
74 |
void SetActiveShowList(RShowInfoArray& aShowArray);
|
|
75 |
|
|
76 |
IMPORT_C void UpdateIAPListL();
|
|
77 |
IMPORT_C void UpdateSNAPListL();
|
|
78 |
IMPORT_C CDesCArrayFlat* IAPNames();
|
|
79 |
IMPORT_C RArray<TPodcastIAPItem>& IAPIds();
|
|
80 |
IMPORT_C CDesCArrayFlat* SNAPNames();
|
|
81 |
IMPORT_C RArray<TPodcastIAPItem>& SNAPIds();
|
|
82 |
|
|
83 |
void SetProxyUsageIfNeededL(RHTTPSession& aSession);
|
|
84 |
void GetProxyInformationForConnectionL(TBool& aIsUsed, HBufC*& aServerName, TUint32& aPort);
|
|
85 |
TInt GetIapId();
|
|
86 |
|
|
87 |
sqlite3* DB();
|
60
|
88 |
IMPORT_C void DropDB();
|
2
|
89 |
|
8
|
90 |
IMPORT_C void GetShowsDownloadingL();
|
|
91 |
IMPORT_C void GetShowsByFeedL(TUint aFeedUid);
|
60
|
92 |
IMPORT_C void MarkSelectionPlayedL();
|
2
|
93 |
|
|
94 |
TInt FindActiveShowByUid(TUint aUid);
|
|
95 |
IMPORT_C TBool IsFirstStartup();
|
|
96 |
IMPORT_C CImageHandler& ImageHandler();
|
|
97 |
protected:
|
|
98 |
CPodcastModel();
|
|
99 |
void ConstructL();
|
60
|
100 |
void ResetDB();
|
|
101 |
void OpenDBL();
|
2
|
102 |
// From ImageHandler
|
60
|
103 |
void ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& aPodcastModel);
|
2
|
104 |
private:
|
|
105 |
CShowInfo* iPlayingPodcast;
|
|
106 |
|
|
107 |
CFeedEngine* iFeedEngine;
|
|
108 |
CShowEngine* iShowEngine;
|
|
109 |
CSettingsEngine *iSettingsEngine;
|
|
110 |
CConnectionEngine* iConnectionEngine;
|
|
111 |
RShowInfoArray iActiveShowList;
|
|
112 |
CFeedInfo *iActiveFeed;
|
|
113 |
|
|
114 |
RFs iFsSession;
|
|
115 |
RArray<TPodcastIAPItem> iIapIdArray;
|
|
116 |
CDesCArrayFlat* iIapNameArray;
|
|
117 |
|
|
118 |
RArray<TPodcastIAPItem> iSNAPIdArray;
|
|
119 |
CDesCArrayFlat* iSNAPNameArray;
|
|
120 |
CCommsDatabase* iCommDB;
|
|
121 |
|
|
122 |
sqlite3* iDB;
|
|
123 |
RCmManager iCmManager;
|
|
124 |
TBool iIsFirstStartup;
|
|
125 |
CImageHandler* iImageHandler;
|
|
126 |
};
|
|
127 |
|
|
128 |
#endif // PODCASTMODEL_H
|