19 #include <qset.h> |
19 #include <qset.h> |
20 #include <qstring.h> |
20 #include <qstring.h> |
21 #include <hblistview.h> |
21 #include <hblistview.h> |
22 #include <hbmenu.h> |
22 #include <hbmenu.h> |
23 |
23 |
|
24 #include "videocollectioncommon.h" |
24 #include "videocollectionuiloader.h" |
25 #include "videocollectionuiloader.h" |
|
26 #include "videocollectionuiloaderdef.h" |
25 #include "videolistview.h" |
27 #include "videolistview.h" |
26 #include "videolistwidget.h" |
28 #include "videolistwidget.h" |
27 #include "videohintwidget.h" |
29 #include "videohintwidget.h" |
28 #include "videolistselectiondialog.h" |
30 #include "videolistselectiondialog.h" |
|
31 #include "videocollectionwrapper.h" |
29 |
32 |
30 #include "videocollectionuiloaderdata.h" |
33 #include "videocollectionuiloaderdata.h" |
31 |
34 |
32 bool VideoCollectionUiLoaderData::mFindFailure = false; |
35 bool VideoCollectionUiLoaderData::mFindFailure = false; |
33 bool VideoCollectionUiLoaderData::mFailDialogLoad = false; |
36 bool VideoCollectionUiLoaderData::mFailDialogLoad = false; |
34 QStringList VideoCollectionUiLoaderData::mFindFailureNameList; |
37 QStringList VideoCollectionUiLoaderData::mFindFailureNameList; |
|
38 QMap<VideoCollectionUiLoader::ActionIds, HbAction*> VideoCollectionUiLoaderData::mMenuActions; |
|
39 int VideoCollectionUiLoaderData::mLastLoadPhasedData = -1; |
35 |
40 |
36 VideoCollectionUiLoader::VideoCollectionUiLoader(): |
41 VideoCollectionUiLoader::VideoCollectionUiLoader(): |
37 HbDocumentLoader(), |
42 HbDocumentLoader(), |
38 mTimerId(0) |
43 mTimerId(0), |
|
44 mIsService(0) |
39 { |
45 { |
40 // not stubbed |
46 // not stubbed |
41 } |
47 } |
42 |
48 |
43 VideoCollectionUiLoader::~VideoCollectionUiLoader() |
49 VideoCollectionUiLoader::~VideoCollectionUiLoader() |
44 { |
50 { |
45 VideoCollectionUiLoaderData::reset(); |
51 VideoCollectionUiLoaderData::reset(); |
46 } |
52 } |
47 |
53 |
48 void VideoCollectionUiLoader::startLoading(QSet<QString> uiSections, |
54 void VideoCollectionUiLoader::loadPhase(int loadPhase) |
|
55 { |
|
56 VideoCollectionUiLoaderData::mLastLoadPhasedData = loadPhase; |
|
57 } |
|
58 |
|
59 void VideoCollectionUiLoader::addData(QList<VideoCollectionUiLoaderParam> params, |
49 QObject *receiver, |
60 QObject *receiver, |
50 const char *widgetSlot, |
61 const char *slot) |
51 const char *objectSlot) |
62 { |
52 { |
63 Q_UNUSED(params); |
53 Q_UNUSED(uiSections); |
|
54 Q_UNUSED(receiver); |
64 Q_UNUSED(receiver); |
55 Q_UNUSED(widgetSlot); |
65 Q_UNUSED(slot); |
56 Q_UNUSED(objectSlot); |
66 } |
57 // not stubbed |
67 |
|
68 void VideoCollectionUiLoader::removeOrphanFromList(QObject *object) |
|
69 { |
|
70 if (mOrphans.contains(object)) |
|
71 { |
|
72 mOrphans.removeOne(object); |
|
73 } |
|
74 |
|
75 const QString &name = mObjects.key(object); |
|
76 if (!name.isEmpty()) |
|
77 { |
|
78 // found from list, remove |
|
79 mObjects.remove(name); |
|
80 } |
58 } |
81 } |
59 |
82 |
60 void VideoCollectionUiLoader::setIsService(bool isService) |
83 void VideoCollectionUiLoader::setIsService(bool isService) |
61 { |
84 { |
62 Q_UNUSED(isService); |
85 mIsService = isService; |
63 // not stubbed |
86 } |
|
87 |
|
88 void VideoCollectionUiLoader::load(const QString &fileName, bool *ok) |
|
89 { |
|
90 QObjectList list = HbDocumentLoader::load(fileName, ok); |
|
91 storeOrphans(list); |
|
92 } |
|
93 |
|
94 void VideoCollectionUiLoader::load(const QString &fileName, const QString §ion , bool *ok) |
|
95 { |
|
96 QObjectList list = HbDocumentLoader::load(fileName, section, ok); |
|
97 storeOrphans(list); |
64 } |
98 } |
65 |
99 |
66 QGraphicsWidget* VideoCollectionUiLoader::doFindWidget(const QString &name) |
100 QGraphicsWidget* VideoCollectionUiLoader::doFindWidget(const QString &name) |
67 { |
101 { |
68 QGraphicsWidget *widget = 0; |
102 QGraphicsWidget *widget = 0; |
89 object = HbDocumentLoader::findObject(name); |
123 object = HbDocumentLoader::findObject(name); |
90 } |
124 } |
91 return object; |
125 return object; |
92 } |
126 } |
93 |
127 |
94 void VideoCollectionUiLoader::addToQueue(Params ¶ms) |
|
95 { |
|
96 Q_UNUSED(params); |
|
97 // not stubbed |
|
98 } |
|
99 |
|
100 void VideoCollectionUiLoader::initWidget(QGraphicsWidget *widget, |
|
101 const QString &name) |
|
102 { |
|
103 Q_UNUSED(widget); |
|
104 Q_UNUSED(name); |
|
105 // not stubbed |
|
106 } |
|
107 |
|
108 void VideoCollectionUiLoader::initObject(QObject *object, |
128 void VideoCollectionUiLoader::initObject(QObject *object, |
109 const QString &name) |
129 const QString &name) |
110 { |
130 { |
111 Q_UNUSED(object); |
131 VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance(); |
112 Q_UNUSED(name); |
132 |
113 // not stubbed |
133 if (name == DOCML_NAME_VC_VIDEOLISTWIDGET || |
|
134 name == DOCML_NAME_VC_COLLECTIONWIDGET || |
|
135 name == DOCML_NAME_VC_COLLECTIONCONTENTWIDGET) |
|
136 { |
|
137 VideoCollectionCommon::TModelType type = VideoCollectionCommon::EModelTypeAllVideos; |
|
138 if(name == DOCML_NAME_VC_COLLECTIONWIDGET) { |
|
139 type = VideoCollectionCommon::EModelTypeCollections; |
|
140 } else if (name == DOCML_NAME_VC_COLLECTIONCONTENTWIDGET) { |
|
141 type = VideoCollectionCommon::EModelTypeCollectionContent; |
|
142 } |
|
143 VideoListWidget *videoList = qobject_cast<VideoListWidget*>(object); |
|
144 VideoSortFilterProxyModel *model = wrapper.getModel(type); |
|
145 videoList->initialize(*model, 0); |
|
146 } |
|
147 else if (name == DOCML_NAME_DIALOG) |
|
148 { |
|
149 |
|
150 } |
|
151 else if (name == DOCML_NAME_VC_VIDEOHINTWIDGET) |
|
152 { |
|
153 |
|
154 } |
|
155 else if (name == DOCML_NAME_OPTIONS_MENU) |
|
156 { |
|
157 |
|
158 } |
|
159 else if (name == DOCML_NAME_SORT_MENU) |
|
160 { |
|
161 VideoCollectionUiLoaderData::mMenuActions[EActionSortBy] = qobject_cast<HbAction*>(object); |
|
162 } |
|
163 else if(name == DOCML_NAME_ADD_TO_COLLECTION) |
|
164 { |
|
165 VideoCollectionUiLoaderData::mMenuActions[EActionAddToCollection] = qobject_cast<HbAction*>(object); |
|
166 } |
|
167 else if(name == DOCML_NAME_CREATE_COLLECTION) |
|
168 { |
|
169 VideoCollectionUiLoaderData::mMenuActions[EActionNewCollection] = qobject_cast<HbAction*>(object); |
|
170 } |
|
171 else if(name == DOCML_NAME_DELETE_MULTIPLE) |
|
172 { |
|
173 VideoCollectionUiLoaderData::mMenuActions[EActionDelete] = qobject_cast<HbAction*>(object); |
|
174 } |
|
175 else if(name == DOCML_NAME_SORT_BY_DATE) |
|
176 { |
|
177 VideoCollectionUiLoaderData::mMenuActions[EActionSortByDate] = qobject_cast<HbAction*>(object); |
|
178 } |
|
179 else if(name == DOCML_NAME_SORT_BY_NAME) |
|
180 { |
|
181 VideoCollectionUiLoaderData::mMenuActions[EActionSortByName] = qobject_cast<HbAction*>(object); |
|
182 } |
|
183 else if(name == DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS) |
|
184 { |
|
185 VideoCollectionUiLoaderData::mMenuActions[EACtionSortByItemCount] = qobject_cast<HbAction*>(object); |
|
186 } |
|
187 else if(name == DOCML_NAME_SORT_BY_SIZE) |
|
188 { |
|
189 VideoCollectionUiLoaderData::mMenuActions[EActionSortBySize] = qobject_cast<HbAction*>(object); |
|
190 } |
114 } |
191 } |
115 |
192 |
116 void VideoCollectionUiLoader::timerEvent(QTimerEvent *event) |
193 void VideoCollectionUiLoader::timerEvent(QTimerEvent *event) |
117 { |
194 { |
118 Q_UNUSED(event); |
195 Q_UNUSED(event); |
132 else if (name == DOCML_NAME_VC_COLLECTIONWIDGET || |
209 else if (name == DOCML_NAME_VC_COLLECTIONWIDGET || |
133 name == DOCML_NAME_VC_COLLECTIONCONTENTWIDGET || |
210 name == DOCML_NAME_VC_COLLECTIONCONTENTWIDGET || |
134 name == DOCML_NAME_VC_VIDEOLISTWIDGET) |
211 name == DOCML_NAME_VC_VIDEOLISTWIDGET) |
135 { |
212 { |
136 object = new VideoListWidget(this); |
213 object = new VideoListWidget(this); |
|
214 initObject(qobject_cast<QGraphicsWidget*>(object), name); |
137 } |
215 } |
138 else if (name == DOCML_NAME_DIALOG) |
216 else if (name == DOCML_NAME_DIALOG) |
139 { |
217 { |
140 if(!VideoCollectionUiLoaderData::mFailDialogLoad) |
218 if(!VideoCollectionUiLoaderData::mFailDialogLoad) |
141 { |
219 { |
151 object = new VideoHintWidget(this); |
229 object = new VideoHintWidget(this); |
152 } |
230 } |
153 if (object) |
231 if (object) |
154 { |
232 { |
155 object->setObjectName(name); |
233 object->setObjectName(name); |
156 |
|
157 |
|
158 return object; |
234 return object; |
159 } |
235 } |
160 object = HbDocumentLoader::createObject(type, name); |
236 object = HbDocumentLoader::createObject(type, name); |
|
237 initObject(object, name); |
161 } |
238 } |
162 |
239 |
163 return object; |
240 return object; |
164 } |
241 } |
165 |
242 |
166 void VideoCollectionUiLoader::runNext() |
243 void VideoCollectionUiLoader::runNext() |
167 { |
244 { |
168 // not stubbed |
245 // not stubbed |
169 } |
246 } |
170 |
247 |
171 bool VideoCollectionUiLoader::isValid(const Params ¶ms) |
248 bool VideoCollectionUiLoader::isValid(const VideoCollectionUiLoaderParam ¶m) |
172 { |
249 { |
173 Q_UNUSED(params); |
250 Q_UNUSED(param); |
174 // not stubbed |
251 // not stubbed |
175 return true; |
252 return true; |
176 } |
253 } |
|
254 |
|
255 // --------------------------------------------------------------------------- |
|
256 // storeOrphans |
|
257 // --------------------------------------------------------------------------- |
|
258 // |
|
259 void VideoCollectionUiLoader::storeOrphans(const QObjectList &list) |
|
260 { |
|
261 foreach (QObject *object, list) |
|
262 { |
|
263 if (!mOrphans.contains(object)) |
|
264 { |
|
265 // add to list |
|
266 mOrphans.append(object); |
|
267 |
|
268 // connect to "destroyed" signal |
|
269 connect( |
|
270 object, SIGNAL(destroyed(QObject*)), |
|
271 this, SLOT(removeOrphanFromList(QObject*))); |
|
272 } |
|
273 } |
|
274 } |
|
275 |
|
276 // end of file |