36
|
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: Implementation of VideoServiceUriFetch
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
38
|
18 |
// Version : %version: 4 %
|
36
|
19 |
|
|
20 |
#include <hbapplication.h>
|
|
21 |
|
|
22 |
#include "videoservices.h"
|
|
23 |
#include "videoservicebrowse.h"
|
|
24 |
#include "mpxhbvideocommondefs.h"
|
|
25 |
#include "mpxvideo_debug.h"
|
38
|
26 |
#include <xqaiwdecl.h>
|
36
|
27 |
|
|
28 |
// -------------------------------------------------------------------------------------------------
|
|
29 |
// VideoServiceBrowse()
|
|
30 |
// -------------------------------------------------------------------------------------------------
|
|
31 |
//
|
38
|
32 |
VideoServiceBrowse::VideoServiceBrowse(VideoServices* parent, QLatin1String service)
|
|
33 |
: XQServiceProvider( service, parent )
|
36
|
34 |
, mRequestIndex( 0 )
|
|
35 |
, mServiceApp( parent )
|
37
|
36 |
, mCategory( 0 )
|
|
37 |
, mTitle( "" )
|
|
38 |
, mSortRole( 0 )
|
36
|
39 |
{
|
|
40 |
MPX_ENTER_EXIT(_L("VideoServiceBrowse::VideoServiceBrowse()"));
|
|
41 |
|
|
42 |
publishAll();
|
|
43 |
}
|
|
44 |
|
|
45 |
// -------------------------------------------------------------------------------------------------
|
|
46 |
// ~VideoServiceBrowse()
|
|
47 |
// -------------------------------------------------------------------------------------------------
|
|
48 |
//
|
|
49 |
VideoServiceBrowse::~VideoServiceBrowse()
|
|
50 |
{
|
|
51 |
MPX_DEBUG(_L("VideoServiceBrowse::~VideoServiceBrowse()"));
|
|
52 |
}
|
|
53 |
|
|
54 |
// -------------------------------------------------------------------------------------------------
|
|
55 |
// complete()
|
|
56 |
// -------------------------------------------------------------------------------------------------
|
|
57 |
//
|
|
58 |
void VideoServiceBrowse::complete()
|
|
59 |
{
|
|
60 |
MPX_ENTER_EXIT(_L("VideoServiceBrowse::complete()"));
|
|
61 |
|
|
62 |
if ( mRequestIndex )
|
|
63 |
{
|
|
64 |
QStringList filesList;
|
|
65 |
connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit()));
|
|
66 |
bool ok = completeRequest(mRequestIndex, filesList);
|
|
67 |
mRequestIndex = 0;
|
|
68 |
|
|
69 |
//
|
|
70 |
// double check that request was completed succesfully, otherwise
|
|
71 |
// videos application cannot be exited at all
|
|
72 |
//
|
|
73 |
if ( ! ok )
|
|
74 |
{
|
|
75 |
MPX_DEBUG(_L("VideoServiceBrowse::complete() : completeRequest FAILED !"));
|
|
76 |
qApp->quit();
|
|
77 |
}
|
|
78 |
}
|
|
79 |
}
|
|
80 |
|
|
81 |
// -------------------------------------------------------------------------------------------------
|
|
82 |
// getBrowseCategory()
|
|
83 |
// -------------------------------------------------------------------------------------------------
|
|
84 |
//
|
|
85 |
int VideoServiceBrowse::getBrowseCategory() const
|
|
86 |
{
|
|
87 |
MPX_DEBUG(_L("VideoServiceBrowse::getBrowseCategory() ret %d"), mCategory);
|
|
88 |
return mCategory;
|
|
89 |
}
|
|
90 |
|
|
91 |
// -------------------------------------------------------------------------------------------------
|
|
92 |
// contextTitle()
|
|
93 |
// -------------------------------------------------------------------------------------------------
|
|
94 |
//
|
|
95 |
QString VideoServiceBrowse::contextTitle() const
|
|
96 |
{
|
|
97 |
MPX_DEBUG(_L("VideoServiceBrowse::contextTitle() ret %s"), mTitle.data() );
|
|
98 |
return mTitle;
|
|
99 |
}
|
|
100 |
|
|
101 |
// -------------------------------------------------------------------------------------------------
|
37
|
102 |
// sortRole()
|
|
103 |
// -------------------------------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
int VideoServiceBrowse::sortRole() const
|
|
106 |
{
|
|
107 |
MPX_DEBUG(_L("VideoServiceBrowse::getBrowseCategory() ret %d"), mSortRole);
|
|
108 |
return mSortRole;
|
|
109 |
}
|
|
110 |
|
|
111 |
// -------------------------------------------------------------------------------------------------
|
36
|
112 |
// browseVideos()
|
|
113 |
// -------------------------------------------------------------------------------------------------
|
|
114 |
//
|
37
|
115 |
void VideoServiceBrowse::browseVideos(const QString &title,
|
|
116 |
int category,
|
|
117 |
int sortRole)
|
36
|
118 |
{
|
|
119 |
MPX_ENTER_EXIT(_L("VideoServiceBrowse::browseVideos()"));
|
|
120 |
|
|
121 |
// set application title
|
|
122 |
QString appTitle(title);
|
|
123 |
if (appTitle.isEmpty())
|
|
124 |
{
|
|
125 |
appTitle = hbTrId("txt_videos_title_videos");
|
|
126 |
}
|
|
127 |
|
|
128 |
mTitle = appTitle;
|
|
129 |
mCategory = category;
|
37
|
130 |
mSortRole = sortRole;
|
36
|
131 |
|
38
|
132 |
// store async request id
|
|
133 |
mRequestIndex = setCurrentRequestAsync();
|
|
134 |
|
36
|
135 |
// start service
|
|
136 |
mServiceApp->setCurrentService(VideoServices::EBrowse);
|
|
137 |
emit mServiceApp->titleReady(appTitle);
|
|
138 |
emit mServiceApp->activated(MpxHbVideoCommon::ActivateCollectionView);
|
|
139 |
|
|
140 |
MPX_DEBUG(_L("VideoServiceBrowse::browseVideos() : mRequestIndex = %d"), mRequestIndex );
|
|
141 |
}
|
|
142 |
|
38
|
143 |
// ----------------------------------------------------------------------------
|
|
144 |
// isActive()
|
|
145 |
// ----------------------------------------------------------------------------
|
|
146 |
//
|
|
147 |
bool VideoServiceBrowse::isActive()
|
|
148 |
{
|
|
149 |
MPX_DEBUG(_L("VideoServiceBrowse::isActive() ret %d"), mRequestIndex );
|
|
150 |
|
|
151 |
return (mRequestIndex > 0);
|
|
152 |
}
|
|
153 |
|
|
154 |
// -------------------------------------------------------------------------------------------------
|
|
155 |
// browseVideos()
|
|
156 |
// -------------------------------------------------------------------------------------------------
|
|
157 |
//
|
|
158 |
void VideoServiceBrowse::browseVideos(int category, int sortRole)
|
|
159 |
{
|
|
160 |
MPX_ENTER_EXIT(_L("VideoServiceBrowse::browseVideos()"));
|
|
161 |
|
|
162 |
// set application title
|
|
163 |
XQRequestInfo info = requestInfo();
|
|
164 |
|
|
165 |
QVariant variant = info.info("WindowTitle");
|
|
166 |
|
|
167 |
QString appTitle;
|
|
168 |
|
|
169 |
if(variant.isValid())
|
|
170 |
{
|
|
171 |
appTitle = variant.toString();
|
|
172 |
}
|
|
173 |
|
|
174 |
if (appTitle.isEmpty())
|
|
175 |
{
|
|
176 |
appTitle = hbTrId("txt_videos_title_videos");
|
|
177 |
}
|
|
178 |
|
|
179 |
mTitle = appTitle;
|
|
180 |
mCategory = category;
|
|
181 |
mSortRole = sortRole;
|
|
182 |
|
|
183 |
// store async request id
|
|
184 |
mRequestIndex = setCurrentRequestAsync();
|
|
185 |
|
|
186 |
// start service
|
|
187 |
mServiceApp->setCurrentService(VideoServices::EBrowse);
|
|
188 |
emit mServiceApp->titleReady(appTitle);
|
|
189 |
emit mServiceApp->activated(MpxHbVideoCommon::ActivateCollectionView);
|
|
190 |
|
|
191 |
MPX_DEBUG(_L("VideoServiceBrowse::browseVideos() : mRequestIndex = %d"), mRequestIndex );
|
|
192 |
}
|
|
193 |
|
|
194 |
|
36
|
195 |
// End of file
|