34
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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 |
*
|
|
14 |
* Description: VideoCollectionWrapper class implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "videocollectionwrapper.h"
|
|
19 |
#include "videocollectionwrapperdata.h"
|
58
|
20 |
/*
|
|
21 |
bool VideoCollectionWrapperData::mGetGenericModelFails = false;
|
|
22 |
bool VideoCollectionWrapperData::mGetAllVideosModelFails = false;
|
|
23 |
bool VideoCollectionWrapperData::mGetCollectionsModelFails = false;
|
|
24 |
bool VideoCollectionWrapperData::mGetCollectionContentModelFails = false;
|
34
|
25 |
VideoListDataModel *VideoCollectionWrapperData::mSourceModel = 0;
|
58
|
26 |
QPointer<VideoProxyModelGeneric> VideoCollectionWrapperData::mAllVideosModel = 0;
|
|
27 |
QPointer<VideoProxyModelGeneric> VideoCollectionWrapperData::mCollectionsModel = 0;
|
|
28 |
QPointer<VideoProxyModelGeneric> VideoCollectionWrapperData::mCollectionContentModel = 0;
|
|
29 |
QPointer<VideoProxyModelGeneric> VideoCollectionWrapperData::mGenericModel = 0;*/
|
34
|
30 |
|
|
31 |
VideoCollectionWrapper &VideoCollectionWrapper::instance()
|
|
32 |
{
|
|
33 |
static VideoCollectionWrapper _staticWrapper;
|
|
34 |
return _staticWrapper;
|
|
35 |
}
|
|
36 |
|
|
37 |
VideoCollectionWrapper::VideoCollectionWrapper()
|
|
38 |
{
|
|
39 |
// nop
|
|
40 |
}
|
|
41 |
|
|
42 |
VideoCollectionWrapper::~VideoCollectionWrapper()
|
|
43 |
{
|
|
44 |
VideoCollectionWrapperData::reset();
|
|
45 |
}
|
|
46 |
|
58
|
47 |
VideoProxyModelGeneric* VideoCollectionWrapper::getGenericModel()
|
34
|
48 |
{
|
58
|
49 |
VideoProxyModelGeneric *model = 0;
|
|
50 |
if (!VideoCollectionWrapperData::mGetGenericModelFails)
|
|
51 |
{
|
|
52 |
VideoListDataModel *sourceModel = VideoCollectionWrapperData::mSourceModel;
|
|
53 |
if (!sourceModel)
|
|
54 |
{
|
|
55 |
sourceModel = new VideoListDataModel;
|
|
56 |
sourceModel->initialize();
|
|
57 |
VideoCollectionWrapperData::mSourceModel = sourceModel;
|
|
58 |
}
|
|
59 |
|
|
60 |
model = VideoCollectionWrapperData::mGenericModel;
|
|
61 |
if(!model && VideoCollectionWrapperData::mSourceModel)
|
|
62 |
{
|
|
63 |
model = new VideoProxyModelGeneric();
|
|
64 |
model->initialize(VideoCollectionWrapperData::mSourceModel);
|
|
65 |
VideoCollectionWrapperData::mGenericModel = model;
|
|
66 |
}
|
|
67 |
}
|
|
68 |
|
|
69 |
return model;
|
|
70 |
}
|
|
71 |
|
|
72 |
VideoProxyModelGeneric* VideoCollectionWrapper::getAllVideosModel()
|
|
73 |
{
|
|
74 |
VideoProxyModelGeneric *model = 0;
|
|
75 |
if (!VideoCollectionWrapperData::mGetAllVideosModelFails)
|
34
|
76 |
{
|
|
77 |
VideoListDataModel *sourceModel = VideoCollectionWrapperData::mSourceModel;
|
|
78 |
if (!sourceModel)
|
|
79 |
{
|
|
80 |
sourceModel = new VideoListDataModel;
|
58
|
81 |
sourceModel->initialize();
|
|
82 |
VideoCollectionWrapperData::mSourceModel = sourceModel;
|
|
83 |
}
|
|
84 |
|
|
85 |
model = VideoCollectionWrapperData::mAllVideosModel;
|
|
86 |
if (!model)
|
|
87 |
{
|
|
88 |
model = new VideoProxyModelAllVideos();
|
|
89 |
model->initialize(VideoCollectionWrapperData::mSourceModel);
|
|
90 |
VideoCollectionWrapperData::mAllVideosModel = model;
|
34
|
91 |
}
|
58
|
92 |
}
|
|
93 |
|
|
94 |
return model;
|
|
95 |
}
|
|
96 |
|
|
97 |
VideoProxyModelGeneric* VideoCollectionWrapper::getCollectionsModel()
|
|
98 |
{
|
|
99 |
VideoProxyModelGeneric *model = 0;
|
|
100 |
if (!VideoCollectionWrapperData::mGetCollectionsModelFails)
|
|
101 |
{
|
|
102 |
VideoListDataModel *sourceModel = VideoCollectionWrapperData::mSourceModel;
|
|
103 |
if (!sourceModel)
|
34
|
104 |
{
|
58
|
105 |
sourceModel = new VideoListDataModel;
|
|
106 |
sourceModel->initialize();
|
|
107 |
VideoCollectionWrapperData::mSourceModel = sourceModel;
|
|
108 |
}
|
|
109 |
|
|
110 |
model = VideoCollectionWrapperData::mCollectionsModel;
|
|
111 |
if (!model)
|
|
112 |
{
|
|
113 |
model = new VideoProxyModelCollections();
|
|
114 |
model->initialize(VideoCollectionWrapperData::mSourceModel);
|
|
115 |
VideoCollectionWrapperData::mCollectionsModel = model;
|
|
116 |
}
|
|
117 |
}
|
|
118 |
|
|
119 |
return model;
|
|
120 |
}
|
|
121 |
|
|
122 |
VideoProxyModelGeneric* VideoCollectionWrapper::getCollectionContentModel()
|
|
123 |
{
|
|
124 |
VideoProxyModelGeneric *model = 0;
|
|
125 |
if (!VideoCollectionWrapperData::mGetCollectionContentModelFails)
|
|
126 |
{
|
|
127 |
VideoListDataModel *sourceModel = VideoCollectionWrapperData::mSourceModel;
|
|
128 |
if (!sourceModel)
|
|
129 |
{
|
|
130 |
sourceModel = new VideoListDataModel;
|
|
131 |
sourceModel->initialize();
|
|
132 |
VideoCollectionWrapperData::mSourceModel = sourceModel;
|
|
133 |
}
|
|
134 |
|
|
135 |
model = VideoCollectionWrapperData::mCollectionContentModel;
|
|
136 |
if (!model)
|
|
137 |
{
|
|
138 |
model = new VideoProxyModelContent();
|
|
139 |
model->initialize(VideoCollectionWrapperData::mSourceModel);
|
|
140 |
VideoCollectionWrapperData::mCollectionContentModel = model;
|
34
|
141 |
}
|
|
142 |
}
|
|
143 |
|
|
144 |
return model;
|
|
145 |
}
|
|
146 |
|
|
147 |
void VideoCollectionWrapper::sendAsyncStatus(int statusCode,
|
|
148 |
QVariant &additional)
|
|
149 |
{
|
|
150 |
Q_UNUSED(statusCode);
|
|
151 |
Q_UNUSED(additional);
|
|
152 |
// not stubbed
|
|
153 |
}
|
|
154 |
|
|
155 |
// end of file
|