44
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: VideoOperatorService class implementation.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// Version :
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
|
|
22 |
#include "videooperatorservice.h"
|
|
23 |
#include "videooperatorservicedata.h"
|
|
24 |
#include "videocollectionviewutils.h"
|
|
25 |
#include "videocollectioncenrepdefs.h"
|
55
|
26 |
#define private public
|
|
27 |
#include "videooperatorservice_p.h"
|
|
28 |
#undef private
|
44
|
29 |
|
|
30 |
QList<QString> VideoOperatorServiceData::mTitles;
|
|
31 |
QList<QString> VideoOperatorServiceData::mIcons;
|
|
32 |
QList<QString> VideoOperatorServiceData::mUris;
|
|
33 |
QList<int> VideoOperatorServiceData::mUids;
|
|
34 |
|
|
35 |
int VideoOperatorServiceData::mLoadCallCount = 0;
|
|
36 |
int VideoOperatorServiceData::mTitleCallCount = 0;
|
|
37 |
int VideoOperatorServiceData::mIconResourceCallCount = 0;
|
|
38 |
int VideoOperatorServiceData::mLaunchServiceCallCount = 0;
|
|
39 |
|
|
40 |
// ---------------------------------------------------------------------------
|
|
41 |
// Constructor
|
|
42 |
// ---------------------------------------------------------------------------
|
|
43 |
//
|
|
44 |
VideoOperatorService::VideoOperatorService(QObject *parent) :
|
55
|
45 |
QObject(parent), d_ptr(new VideoOperatorServicePrivate())
|
44
|
46 |
{
|
55
|
47 |
}
|
|
48 |
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
// Destructor
|
|
51 |
// ---------------------------------------------------------------------------
|
|
52 |
//
|
|
53 |
VideoOperatorService::~VideoOperatorService()
|
|
54 |
{
|
|
55 |
delete d_ptr;
|
44
|
56 |
}
|
|
57 |
|
|
58 |
// ---------------------------------------------------------------------------
|
|
59 |
// load
|
|
60 |
// ---------------------------------------------------------------------------
|
|
61 |
//
|
|
62 |
bool VideoOperatorService::load(int titleKey, int iconKey, int serviceUriKey, int appUidKey)
|
|
63 |
{
|
55
|
64 |
Q_UNUSED(titleKey);
|
|
65 |
Q_UNUSED(iconKey);
|
|
66 |
Q_UNUSED(serviceUriKey);
|
|
67 |
Q_UNUSED(appUidKey);
|
|
68 |
if(d_ptr)
|
44
|
69 |
{
|
55
|
70 |
if(!VideoOperatorServiceData::mTitles.isEmpty())
|
|
71 |
{
|
|
72 |
d_ptr->mTitle = VideoOperatorServiceData::mTitles.takeFirst();
|
|
73 |
}
|
|
74 |
|
|
75 |
if(!VideoOperatorServiceData::mUris.isEmpty())
|
|
76 |
{
|
|
77 |
d_ptr->mServiceUri = VideoOperatorServiceData::mUris.takeFirst();
|
|
78 |
}
|
|
79 |
|
|
80 |
if(!VideoOperatorServiceData::mIcons.isEmpty())
|
|
81 |
{
|
|
82 |
d_ptr->mIconResource = VideoOperatorServiceData::mIcons.takeFirst();
|
|
83 |
}
|
44
|
84 |
}
|
55
|
85 |
VideoOperatorServiceData::mLoadCallCount++;
|
44
|
86 |
|
|
87 |
// Icon is required, either service uri or application uid is required.
|
55
|
88 |
if(d_ptr->mIconResource.isEmpty() || (d_ptr->mServiceUri.isEmpty() && d_ptr->mApplicationUid <= 0))
|
44
|
89 |
{
|
|
90 |
return false;
|
55
|
91 |
}
|
44
|
92 |
return true;
|
|
93 |
}
|
|
94 |
|
|
95 |
// ---------------------------------------------------------------------------
|
|
96 |
// title
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
//
|
|
99 |
const QString VideoOperatorService::title() const
|
|
100 |
{
|
|
101 |
VideoOperatorServiceData::mTitleCallCount++;
|
55
|
102 |
return d_ptr->mTitle;
|
44
|
103 |
}
|
|
104 |
|
|
105 |
// ---------------------------------------------------------------------------
|
|
106 |
// iconResource
|
|
107 |
// ---------------------------------------------------------------------------
|
|
108 |
//
|
|
109 |
const QString VideoOperatorService::iconResource() const
|
|
110 |
{
|
|
111 |
VideoOperatorServiceData::mIconResourceCallCount++;
|
55
|
112 |
return d_ptr->mIconResource;
|
44
|
113 |
}
|
|
114 |
|
|
115 |
// ---------------------------------------------------------------------------
|
|
116 |
// launchService
|
|
117 |
// ---------------------------------------------------------------------------
|
|
118 |
//
|
|
119 |
void VideoOperatorService::launchService()
|
|
120 |
{
|
|
121 |
VideoOperatorServiceData::mLaunchServiceCallCount++;
|
|
122 |
}
|
|
123 |
|
|
124 |
// End of file.
|