13 * |
13 * |
14 * Description: VideoCollectionViewPlugin class implementation |
14 * Description: VideoCollectionViewPlugin class implementation |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 // Version : %version: % |
|
19 |
18 // INCLUDE FILES |
20 // INCLUDE FILES |
19 #include <xqplugin.h> |
21 #include <xqplugin.h> |
20 #include <xqserviceutil.h> |
22 #include <xqserviceutil.h> |
21 #include <hbaction.h> |
23 #include <hbaction.h> |
22 #include <hbapplication.h> |
24 #include <hbapplication.h> |
23 #include <hbinstance.h> |
25 #include <hbinstance.h> |
24 |
26 #include <mpxitemid.h> |
|
27 |
|
28 #include "videoservices.h" |
|
29 #include "vcxmyvideosdefs.h" |
25 #include "videocollectionviewplugin.h" |
30 #include "videocollectionviewplugin.h" |
26 #include "videolistview.h" |
31 #include "videolistview.h" |
27 #include "videocollectionuiloader.h" |
32 #include "videocollectionuiloader.h" |
28 #include "mpxhbvideocommondefs.h" |
33 #include "mpxhbvideocommondefs.h" |
|
34 #include "videocollectiontrace.h" |
29 |
35 |
30 // --------------------------------------------------------------------------- |
36 // --------------------------------------------------------------------------- |
31 // Constructor |
37 // Constructor |
32 // --------------------------------------------------------------------------- |
38 // --------------------------------------------------------------------------- |
33 // |
39 // |
34 VideoCollectionViewPlugin::VideoCollectionViewPlugin() |
40 VideoCollectionViewPlugin::VideoCollectionViewPlugin() |
35 : mUiLoader(0), |
41 : mUiLoader( 0 ) |
36 mView(0), |
42 , mView( 0 ) |
37 mActivated(false), |
43 , mActivated( false ) |
38 mIsService(false) |
44 , mIsService( false ) |
39 { |
45 { |
|
46 FUNC_LOG; |
40 } |
47 } |
41 |
48 |
42 // --------------------------------------------------------------------------- |
49 // --------------------------------------------------------------------------- |
43 // Destructor |
50 // Destructor |
44 // --------------------------------------------------------------------------- |
51 // --------------------------------------------------------------------------- |
45 // |
52 // |
46 VideoCollectionViewPlugin::~VideoCollectionViewPlugin() |
53 VideoCollectionViewPlugin::~VideoCollectionViewPlugin() |
47 { |
54 { |
|
55 FUNC_LOG; |
48 destroyView(); |
56 destroyView(); |
49 } |
57 } |
50 |
58 |
51 // --------------------------------------------------------------------------- |
59 // --------------------------------------------------------------------------- |
52 // Create view |
60 // Create view |
53 // --------------------------------------------------------------------------- |
61 // --------------------------------------------------------------------------- |
54 // |
62 // |
55 void VideoCollectionViewPlugin::createView() |
63 void VideoCollectionViewPlugin::createView() |
56 { |
64 { |
|
65 FUNC_LOG; |
57 mActivated = false; |
66 mActivated = false; |
58 if ( !mView ) { |
67 if ( !mView ) { |
59 |
68 |
60 if(!mUiLoader) |
69 if(!mUiLoader) |
61 { |
70 { |
64 |
73 |
65 mUiLoader->reset(); |
74 mUiLoader->reset(); |
66 |
75 |
67 if (XQServiceUtil::isService()) |
76 if (XQServiceUtil::isService()) |
68 { |
77 { |
69 mIsService = true; |
78 INFO("VideoCollectionViewPlugin::createView() service flag set to true."); |
|
79 mIsService = true; |
70 } |
80 } |
71 |
81 |
72 mUiLoader->setIsService(mIsService); |
82 mUiLoader->setIsService(mIsService); |
73 |
83 |
74 bool ok(false); |
84 bool ok(false); |
75 |
85 |
76 QList<QObject *> objects = mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok); |
86 mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok); |
77 |
87 |
78 if (!ok) |
88 if (!ok) |
79 { |
89 { |
80 return; |
90 return; |
81 } |
91 } |
82 |
92 |
83 mView = mUiLoader->findObject<VideoListView>( DOCML_NAME_VIEW ); |
93 mView = mUiLoader->findObject<VideoListView>( DOCML_NAME_VIEW ); |
84 |
94 |
85 if(!mView) |
95 if(!mView) |
86 { |
96 { |
87 // TODO: handle error: creating view |
97 ERROR(-1, "VideoCollectionViewPlugin::createView() failed to create view."); |
88 return; |
98 return; |
89 } |
99 } |
90 |
100 |
91 if(!connect( mView, SIGNAL(command(int)), this, SIGNAL(command(int)) ) || |
101 if(!connect( mView, SIGNAL(command(int)), this, SIGNAL(command(int)) ) || |
92 !connect( this, SIGNAL(doDelayeds()), mView, SLOT(doDelayedsSlot()) )) { |
102 !connect( this, SIGNAL(doDelayeds()), mView, SLOT(doDelayedsSlot()) )) { |
93 // TODO: handle error: connecting signal |
103 ERROR(-1, "VideoCollectionViewPlugin::createView() failed to connect signals."); |
94 delete mView; |
104 delete mView; |
95 mView = 0; |
105 mView = 0; |
96 return; |
106 return; |
97 } |
107 } |
98 mTimerId = startTimer(DELAYED_LOAD_TIMEOUT); |
108 mTimerId = startTimer(DELAYED_LOAD_TIMEOUT); |
139 // Activate view |
151 // Activate view |
140 // --------------------------------------------------------------------------- |
152 // --------------------------------------------------------------------------- |
141 // |
153 // |
142 void VideoCollectionViewPlugin::activateView() |
154 void VideoCollectionViewPlugin::activateView() |
143 { |
155 { |
144 if ( !mActivated ) { |
156 FUNC_LOG; |
|
157 if (!mActivated) |
|
158 { |
145 HbMainWindow *wnd = mView->mainWindow(); |
159 HbMainWindow *wnd = mView->mainWindow(); |
146 if(wnd) |
160 if(wnd) |
147 { |
161 { |
148 mView->activateView(); |
162 TMPXItemId itemId = TMPXItemId::InvalidId(); |
|
163 bool isService = XQServiceUtil::isService(); |
|
164 if (isService) |
|
165 { |
|
166 VideoServices *videoServices = VideoServices::instance(); |
|
167 if (videoServices) |
|
168 { |
|
169 VideoServices::TVideoService serviceType = |
|
170 videoServices->currentService(); |
|
171 if (serviceType == VideoServices::EBrowse) |
|
172 { |
|
173 // activate browsing service |
|
174 itemId.iId1 = videoServices->getBrowseCategory(); |
|
175 itemId.iId2 = KVcxMvcMediaTypeCategory; |
|
176 } |
|
177 } |
|
178 } |
|
179 int err = mView->activateView(itemId); |
|
180 if (err != 0) |
|
181 { |
|
182 // TODO: what to do if error? |
|
183 return; |
|
184 } |
149 mActivated = true; |
185 mActivated = true; |
150 } |
186 } |
151 } |
187 } |
152 } |
188 } |
153 |
189 |
167 // Get view |
204 // Get view |
168 // --------------------------------------------------------------------------- |
205 // --------------------------------------------------------------------------- |
169 // |
206 // |
170 QGraphicsWidget* VideoCollectionViewPlugin::getView() |
207 QGraphicsWidget* VideoCollectionViewPlugin::getView() |
171 { |
208 { |
|
209 FUNC_LOG; |
172 return mView; |
210 return mView; |
173 } |
211 } |
174 |
212 |
175 // --------------------------------------------------------------------------- |
213 // --------------------------------------------------------------------------- |
176 // Slot: Orientation change |
214 // Slot: Orientation change |
177 // // TODO: can be removed |
215 // --------------------------------------------------------------------------- |
178 // --------------------------------------------------------------------------- |
216 // |
179 // |
217 void VideoCollectionViewPlugin::orientationChange( Qt::Orientation orientation) |
180 void VideoCollectionViewPlugin::orientationChange( Qt::Orientation /* orientation */ ) |
218 { |
181 { |
219 FUNC_LOG; |
182 // view handles orientation individually |
220 // view handles orientation individually |
|
221 Q_UNUSED(orientation); |
183 } |
222 } |
184 |
223 |
185 // --------------------------------------------------------------------------- |
224 // --------------------------------------------------------------------------- |
186 // Slot: back |
225 // Slot: back |
187 // --------------------------------------------------------------------------- |
226 // --------------------------------------------------------------------------- |
188 // |
227 // |
189 void VideoCollectionViewPlugin::back() |
228 void VideoCollectionViewPlugin::back() |
190 { |
229 { |
|
230 FUNC_LOG; |
191 if ( mActivated ) { |
231 if ( mActivated ) { |
192 mView->back(); |
232 mView->back(); |
193 } |
233 } |
194 } |
234 } |
195 |
235 |