34
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
58
|
14 |
* Description: VideoCollectionWrapperPrivate class definition
|
34
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef __VIDEOCOLLECTIONWRAPPERPRIVATE_H__
|
|
19 |
#define __VIDEOCOLLECTIONWRAPPERPRIVATE_H__
|
|
20 |
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <QObject>
|
|
24 |
#include <QPointer>
|
|
25 |
#include <qabstractitemmodel.h>
|
36
|
26 |
#include "videocollectioncommon.h"
|
34
|
27 |
|
|
28 |
// FORWARD DECLARATIONS
|
|
29 |
class CMPXMediaArray;
|
|
30 |
class CMPXMedia;
|
|
31 |
class VideoListDataModel;
|
58
|
32 |
class VideoProxyModelGeneric;
|
|
33 |
class VideoProxyModelAllVideos;
|
|
34 |
class VideoProxyModelCollections;
|
|
35 |
class VideoProxyModelContent;
|
34
|
36 |
|
|
37 |
class VideoCollectionWrapperPrivate : public QObject
|
|
38 |
{
|
|
39 |
Q_DISABLE_COPY(VideoCollectionWrapperPrivate)
|
|
40 |
|
|
41 |
/**
|
|
42 |
* define to be able to use signals and slots
|
|
43 |
*/
|
|
44 |
Q_OBJECT
|
|
45 |
|
|
46 |
public: // Constructor
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Default constructor
|
|
50 |
*/
|
|
51 |
VideoCollectionWrapperPrivate();
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Destructor
|
|
55 |
*/
|
|
56 |
~VideoCollectionWrapperPrivate();
|
58
|
57 |
|
|
58 |
/**
|
|
59 |
* Returns the pointer into generic video model. Creates the model if it doesn't
|
|
60 |
* exist yet.
|
|
61 |
*
|
|
62 |
* Noter that if application has signaled aboutToQuit -signal indicating closing, all
|
|
63 |
* previously created models have been removed and new ones will not be created
|
|
64 |
* anymore
|
|
65 |
*
|
|
66 |
* @return address of model, NULL if creation did not succeed or if application is closing.
|
|
67 |
*/
|
|
68 |
VideoProxyModelGeneric* getGenericModel();
|
34
|
69 |
|
|
70 |
/**
|
58
|
71 |
* Returns the pointer into all videos model. Creates the model if it doesn't exist yet.
|
34
|
72 |
*
|
40
|
73 |
* Noter that if application has signaled aboutToQuit -signal indicating closing, all
|
|
74 |
* previously created models have been removed and new ones will not be created
|
|
75 |
* anymore
|
58
|
76 |
*
|
|
77 |
* @return address of model, NULL if creation did not succeed or if application is closing.
|
|
78 |
*/
|
|
79 |
|
|
80 |
VideoProxyModelGeneric* getAllVideosModel();
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Returns the pointer into collections model. Creates the model if it doesn't exist yet.
|
|
84 |
*
|
|
85 |
* Noter that if application has signaled aboutToQuit -signal indicating closing, all
|
|
86 |
* previously created models have been removed and new ones will not be created
|
|
87 |
* anymore
|
|
88 |
*
|
40
|
89 |
* @return address of model, NULL if creation did not succeed or if application is closing.
|
34
|
90 |
*/
|
58
|
91 |
|
|
92 |
VideoProxyModelGeneric* getCollectionsModel();
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Returns the pointer into collection content model. Creates the model if it doesn't
|
|
96 |
* exist yet.
|
|
97 |
*
|
|
98 |
* Noter that if application has signaled aboutToQuit -signal indicating closing, all
|
|
99 |
* previously created models have been removed and new ones will not be created
|
|
100 |
* anymore
|
|
101 |
*
|
|
102 |
* @return address of model, NULL if creation did not succeed or if application is closing.
|
|
103 |
*/
|
|
104 |
VideoProxyModelGeneric* getCollectionContentModel();
|
34
|
105 |
|
|
106 |
private slots:
|
58
|
107 |
|
34
|
108 |
/**
|
|
109 |
* Signaled when UI environment is about to be destroyed.
|
40
|
110 |
* All models needs to be cleaned up before of that.
|
34
|
111 |
*
|
|
112 |
*/
|
|
113 |
void aboutToQuitSlot();
|
58
|
114 |
|
34
|
115 |
private:
|
|
116 |
|
58
|
117 |
/**
|
|
118 |
* Creates proxy model and returns the pointer.
|
|
119 |
*
|
|
120 |
* Noter that if application has signaled aboutToQuit -signal indicating closing, all
|
|
121 |
* previously created models have been removed and new ones will not be created
|
|
122 |
* anymore.
|
|
123 |
*
|
|
124 |
* @return address of model, NULL if creation did not succeed or if application is closing.
|
|
125 |
*/
|
|
126 |
template<class T>
|
|
127 |
T *initProxyModelModel()
|
|
128 |
{
|
|
129 |
if(mAboutToClose)
|
|
130 |
{
|
|
131 |
return 0;
|
|
132 |
}
|
|
133 |
|
|
134 |
if(!initSourceModel())
|
|
135 |
{
|
|
136 |
return 0;
|
|
137 |
}
|
|
138 |
|
|
139 |
T *model = 0;
|
|
140 |
|
|
141 |
model = new T();
|
|
142 |
|
|
143 |
if(model->initialize(mSourceModel) ||
|
|
144 |
!connect(model, SIGNAL(shortDetailsReady(TMPXItemId)),
|
|
145 |
mSourceModel, SIGNAL(shortDetailsReady(TMPXItemId))))
|
|
146 |
{
|
|
147 |
delete model;
|
|
148 |
model = 0;
|
|
149 |
}
|
|
150 |
|
|
151 |
return model;
|
|
152 |
}
|
|
153 |
|
|
154 |
private:
|
|
155 |
|
|
156 |
/**
|
|
157 |
* Initializes source model.
|
|
158 |
*
|
|
159 |
* @return true if initialization succeeds, otherwise false.
|
|
160 |
*/
|
|
161 |
bool initSourceModel();
|
|
162 |
|
|
163 |
private:
|
|
164 |
|
|
165 |
/**
|
|
166 |
* data model for collection content
|
|
167 |
*/
|
|
168 |
QPointer<VideoProxyModelGeneric> mGenericModel;
|
|
169 |
|
34
|
170 |
/**
|
|
171 |
* data model for all videos
|
|
172 |
*/
|
58
|
173 |
QPointer<VideoProxyModelAllVideos> mAllVideosModel;
|
34
|
174 |
|
|
175 |
/**
|
|
176 |
* data model for collections
|
|
177 |
*/
|
58
|
178 |
QPointer<VideoProxyModelCollections> mCollectionsModel;
|
34
|
179 |
|
|
180 |
/**
|
|
181 |
* data model for collection content
|
|
182 |
*/
|
58
|
183 |
QPointer<VideoProxyModelContent> mCollectionContentModel;
|
34
|
184 |
|
|
185 |
/**
|
|
186 |
* source model
|
|
187 |
*/
|
58
|
188 |
QPointer<VideoListDataModel> mSourceModel;
|
40
|
189 |
|
|
190 |
/**
|
|
191 |
* flag to indicate, that object is to be deallocated, so no
|
|
192 |
* models are to be returned anymore
|
|
193 |
*/
|
|
194 |
bool mAboutToClose;
|
34
|
195 |
|
|
196 |
};
|
|
197 |
#endif // __VIDEOCOLLECTIONWRAPPERPRIVATE_H__
|
|
198 |
|
|
199 |
// End of file
|