30
|
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 |
*
|
|
14 |
* Description: VideoCollectionViewPlugin class implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
37
|
18 |
// Version : %version: 23 %
|
36
|
19 |
|
30
|
20 |
// INCLUDE FILES
|
|
21 |
#include <xqplugin.h>
|
35
|
22 |
#include <xqserviceutil.h>
|
30
|
23 |
#include <hbaction.h>
|
|
24 |
#include <hbapplication.h>
|
|
25 |
#include <hbinstance.h>
|
36
|
26 |
#include <mpxitemid.h>
|
30
|
27 |
|
36
|
28 |
#include "videoservices.h"
|
|
29 |
#include "vcxmyvideosdefs.h"
|
30
|
30 |
#include "videocollectionviewplugin.h"
|
|
31 |
#include "videolistview.h"
|
|
32 |
#include "videocollectionuiloader.h"
|
35
|
33 |
#include "mpxhbvideocommondefs.h"
|
36
|
34 |
#include "videocollectiontrace.h"
|
30
|
35 |
|
|
36 |
// ---------------------------------------------------------------------------
|
|
37 |
// Constructor
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
VideoCollectionViewPlugin::VideoCollectionViewPlugin()
|
36
|
41 |
: mUiLoader( 0 )
|
|
42 |
, mView( 0 )
|
|
43 |
, mActivated( false )
|
|
44 |
, mIsService( false )
|
30
|
45 |
{
|
36
|
46 |
FUNC_LOG;
|
30
|
47 |
}
|
|
48 |
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
// Destructor
|
|
51 |
// ---------------------------------------------------------------------------
|
|
52 |
//
|
|
53 |
VideoCollectionViewPlugin::~VideoCollectionViewPlugin()
|
|
54 |
{
|
36
|
55 |
FUNC_LOG;
|
30
|
56 |
destroyView();
|
|
57 |
}
|
|
58 |
|
|
59 |
// ---------------------------------------------------------------------------
|
|
60 |
// Create view
|
|
61 |
// ---------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
void VideoCollectionViewPlugin::createView()
|
|
64 |
{
|
36
|
65 |
FUNC_LOG;
|
30
|
66 |
mActivated = false;
|
|
67 |
if ( !mView ) {
|
|
68 |
|
|
69 |
if(!mUiLoader)
|
|
70 |
{
|
|
71 |
mUiLoader = new VideoCollectionUiLoader();
|
|
72 |
}
|
|
73 |
|
|
74 |
mUiLoader->reset();
|
|
75 |
|
35
|
76 |
if (XQServiceUtil::isService())
|
|
77 |
{
|
36
|
78 |
INFO("VideoCollectionViewPlugin::createView() service flag set to true.");
|
|
79 |
mIsService = true;
|
35
|
80 |
}
|
|
81 |
|
|
82 |
mUiLoader->setIsService(mIsService);
|
|
83 |
|
30
|
84 |
bool ok(false);
|
|
85 |
|
36
|
86 |
mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok);
|
|
87 |
|
|
88 |
if (!ok)
|
30
|
89 |
{
|
|
90 |
return;
|
|
91 |
}
|
|
92 |
|
|
93 |
mView = mUiLoader->findObject<VideoListView>( DOCML_NAME_VIEW );
|
|
94 |
|
|
95 |
if(!mView)
|
|
96 |
{
|
36
|
97 |
ERROR(-1, "VideoCollectionViewPlugin::createView() failed to create view.");
|
30
|
98 |
return;
|
|
99 |
}
|
|
100 |
|
35
|
101 |
if(!connect( mView, SIGNAL(command(int)), this, SIGNAL(command(int)) ) ||
|
37
|
102 |
!connect( this, SIGNAL(doDelayeds()), mView, SLOT(doDelayedsSlot()) ) ||
|
|
103 |
!connect( mView, SIGNAL(viewReady()), this, SLOT(viewReadySlot()) ) ) {
|
36
|
104 |
ERROR(-1, "VideoCollectionViewPlugin::createView() failed to connect signals.");
|
30
|
105 |
delete mView;
|
|
106 |
mView = 0;
|
|
107 |
return;
|
|
108 |
}
|
|
109 |
mView->initializeView();
|
35
|
110 |
}
|
|
111 |
}
|
30
|
112 |
|
35
|
113 |
|
|
114 |
// ---------------------------------------------------------------------------
|
|
115 |
// timerEvent
|
|
116 |
// ---------------------------------------------------------------------------
|
|
117 |
//
|
|
118 |
void VideoCollectionViewPlugin::timerEvent(QTimerEvent *event)
|
|
119 |
{
|
36
|
120 |
FUNC_LOG;
|
35
|
121 |
if (event)
|
|
122 |
{
|
|
123 |
if (event->timerId() == mTimerId)
|
|
124 |
{
|
|
125 |
killTimer(mTimerId);
|
|
126 |
mTimerId = 0;
|
|
127 |
|
|
128 |
emit command(MpxHbVideoCommon::DoDelayedLoad);
|
|
129 |
emit doDelayeds();
|
|
130 |
}
|
30
|
131 |
}
|
|
132 |
}
|
|
133 |
|
|
134 |
// ---------------------------------------------------------------------------
|
|
135 |
// Destroy view
|
|
136 |
// ---------------------------------------------------------------------------
|
|
137 |
//
|
|
138 |
void VideoCollectionViewPlugin::destroyView()
|
|
139 |
{
|
36
|
140 |
FUNC_LOG;
|
30
|
141 |
deactivateView();
|
|
142 |
disconnect();
|
|
143 |
|
|
144 |
delete mView;
|
|
145 |
mView = 0;
|
|
146 |
delete mUiLoader;
|
|
147 |
mUiLoader = 0;
|
|
148 |
}
|
|
149 |
|
|
150 |
// ---------------------------------------------------------------------------
|
|
151 |
// Activate view
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
//
|
|
154 |
void VideoCollectionViewPlugin::activateView()
|
|
155 |
{
|
36
|
156 |
FUNC_LOG;
|
|
157 |
if (!mActivated)
|
|
158 |
{
|
30
|
159 |
HbMainWindow *wnd = mView->mainWindow();
|
|
160 |
if(wnd)
|
|
161 |
{
|
36
|
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 |
return;
|
|
183 |
}
|
30
|
184 |
mActivated = true;
|
|
185 |
}
|
|
186 |
}
|
|
187 |
}
|
|
188 |
|
|
189 |
// ---------------------------------------------------------------------------
|
|
190 |
// Deactivate view
|
|
191 |
// ---------------------------------------------------------------------------
|
|
192 |
//
|
|
193 |
void VideoCollectionViewPlugin::deactivateView()
|
|
194 |
{
|
36
|
195 |
FUNC_LOG;
|
30
|
196 |
if ( mActivated ) {
|
|
197 |
mView->deactivateView();
|
|
198 |
mActivated = false;
|
|
199 |
}
|
|
200 |
}
|
|
201 |
|
|
202 |
// ---------------------------------------------------------------------------
|
|
203 |
// Get view
|
|
204 |
// ---------------------------------------------------------------------------
|
|
205 |
//
|
|
206 |
QGraphicsWidget* VideoCollectionViewPlugin::getView()
|
|
207 |
{
|
36
|
208 |
FUNC_LOG;
|
30
|
209 |
return mView;
|
|
210 |
}
|
|
211 |
|
|
212 |
// ---------------------------------------------------------------------------
|
|
213 |
// Slot: Orientation change
|
|
214 |
// ---------------------------------------------------------------------------
|
|
215 |
//
|
36
|
216 |
void VideoCollectionViewPlugin::orientationChange( Qt::Orientation orientation)
|
30
|
217 |
{
|
36
|
218 |
FUNC_LOG;
|
30
|
219 |
// view handles orientation individually
|
36
|
220 |
Q_UNUSED(orientation);
|
30
|
221 |
}
|
|
222 |
|
|
223 |
// ---------------------------------------------------------------------------
|
|
224 |
// Slot: back
|
|
225 |
// ---------------------------------------------------------------------------
|
|
226 |
//
|
|
227 |
void VideoCollectionViewPlugin::back()
|
|
228 |
{
|
36
|
229 |
FUNC_LOG;
|
30
|
230 |
if ( mActivated ) {
|
|
231 |
mView->back();
|
|
232 |
}
|
|
233 |
}
|
|
234 |
|
37
|
235 |
// ---------------------------------------------------------------------------
|
|
236 |
// Slot: viewReadySlot
|
|
237 |
// ---------------------------------------------------------------------------
|
|
238 |
//
|
|
239 |
void VideoCollectionViewPlugin::viewReadySlot()
|
|
240 |
{
|
|
241 |
FUNC_LOG;
|
|
242 |
mTimerId = startTimer(DELAYED_LOAD_TIMEOUT);
|
|
243 |
}
|
|
244 |
|
30
|
245 |
XQ_EXPORT_PLUGIN2( videocollectionview, VideoCollectionViewPlugin );
|
|
246 |
|
|
247 |
// end of file
|