34
|
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: video collection view plugin's ui utils class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "videocollectionviewutils.h"
|
|
19 |
#include "videocollectionviewutilsdata.h"
|
|
20 |
|
|
21 |
int VideoCollectionViewUtilsData::mLastError = 0;
|
|
22 |
bool VideoCollectionViewUtilsData::mLoadSortingValuesFails = false;
|
|
23 |
bool VideoCollectionViewUtilsData::mGetServiceIconStringsFails = false;
|
36
|
24 |
int VideoCollectionViewUtilsData::mVideoSortRole = -1;
|
|
25 |
int VideoCollectionViewUtilsData::mCollectionSortRole = -1;
|
|
26 |
Qt::SortOrder VideoCollectionViewUtilsData::mVideoSortOrder = Qt::AscendingOrder;
|
|
27 |
Qt::SortOrder VideoCollectionViewUtilsData::mCollectionSortOrder = Qt::AscendingOrder;
|
34
|
28 |
QString VideoCollectionViewUtilsData::mIconString = "";
|
|
29 |
QString VideoCollectionViewUtilsData::mPressedString = "";
|
35
|
30 |
QVariant VideoCollectionViewUtilsData::mLastStatusAdditional = QVariant();
|
34
|
31 |
|
|
32 |
VideoCollectionViewUtils& VideoCollectionViewUtils::instance()
|
|
33 |
{
|
|
34 |
static VideoCollectionViewUtils _popupInstance;
|
|
35 |
return _popupInstance;
|
|
36 |
}
|
|
37 |
|
|
38 |
VideoCollectionViewUtils::VideoCollectionViewUtils():
|
36
|
39 |
mVideosSortRole(-1),
|
|
40 |
mCollectionsSortRole(-1),
|
|
41 |
mVideosSortOrder(Qt::AscendingOrder),
|
|
42 |
mCollectionsSortOrder(Qt::AscendingOrder)
|
34
|
43 |
{
|
|
44 |
// not stubbed
|
|
45 |
}
|
|
46 |
|
|
47 |
VideoCollectionViewUtils::~VideoCollectionViewUtils()
|
|
48 |
{
|
|
49 |
VideoCollectionViewUtilsData::reset();
|
|
50 |
}
|
|
51 |
|
36
|
52 |
int VideoCollectionViewUtils::saveSortingValues(int role, Qt::SortOrder order, VideoCollectionCommon::TCollectionLevels target)
|
34
|
53 |
{
|
36
|
54 |
int status(0);
|
|
55 |
if(target == VideoCollectionCommon::ELevelCategory )
|
|
56 |
{
|
|
57 |
VideoCollectionViewUtilsData::mCollectionSortRole = role;
|
|
58 |
mCollectionsSortRole = role;
|
|
59 |
VideoCollectionViewUtilsData::mCollectionSortOrder = order;
|
|
60 |
mCollectionsSortOrder = order;
|
|
61 |
}
|
|
62 |
else if(target > VideoCollectionCommon::ELevelCategory &&
|
|
63 |
target <= VideoCollectionCommon::ELevelAlbum)
|
|
64 |
{
|
|
65 |
VideoCollectionViewUtilsData::mVideoSortRole = role;
|
|
66 |
mVideosSortRole = role;
|
|
67 |
VideoCollectionViewUtilsData::mVideoSortOrder = order;
|
|
68 |
mVideosSortOrder = order;
|
|
69 |
}
|
|
70 |
else
|
|
71 |
{
|
|
72 |
status = -1;
|
|
73 |
}
|
|
74 |
return status;
|
34
|
75 |
}
|
|
76 |
|
36
|
77 |
int VideoCollectionViewUtils::loadSortingValues(int &role, Qt::SortOrder &order, VideoCollectionCommon::TCollectionLevels target)
|
34
|
78 |
{
|
|
79 |
if (VideoCollectionViewUtilsData::mLoadSortingValuesFails)
|
|
80 |
{
|
|
81 |
return -1;
|
|
82 |
}
|
36
|
83 |
if(target == VideoCollectionCommon::ELevelCategory )
|
|
84 |
{
|
|
85 |
role = VideoCollectionViewUtilsData::mCollectionSortRole;
|
|
86 |
order = VideoCollectionViewUtilsData::mCollectionSortOrder;
|
|
87 |
}
|
|
88 |
else if(target > VideoCollectionCommon::ELevelCategory &&
|
|
89 |
target <= VideoCollectionCommon::ELevelAlbum)
|
|
90 |
{
|
|
91 |
role = VideoCollectionViewUtilsData::mVideoSortRole;
|
|
92 |
order = VideoCollectionViewUtilsData::mVideoSortOrder;
|
|
93 |
}
|
|
94 |
else
|
|
95 |
{
|
|
96 |
return -1;
|
|
97 |
}
|
34
|
98 |
return 0;
|
|
99 |
}
|
|
100 |
|
|
101 |
int VideoCollectionViewUtils::getServiceIconStrings(QString& icon,
|
|
102 |
QString& iconPressed)
|
|
103 |
{
|
|
104 |
if (VideoCollectionViewUtilsData::mGetServiceIconStringsFails)
|
|
105 |
{
|
|
106 |
return -1;
|
|
107 |
}
|
|
108 |
|
|
109 |
icon = VideoCollectionViewUtilsData::mIconString;
|
|
110 |
iconPressed = VideoCollectionViewUtilsData::mPressedString;
|
|
111 |
|
|
112 |
return 0;
|
|
113 |
}
|
|
114 |
|
|
115 |
QString VideoCollectionViewUtils::getServiceUriString()
|
|
116 |
{
|
|
117 |
// not stubbed
|
|
118 |
return QString();
|
|
119 |
}
|
|
120 |
|
|
121 |
void VideoCollectionViewUtils::initListView(HbListView *view)
|
|
122 |
{
|
|
123 |
Q_UNUSED(view);
|
|
124 |
// not stubbed
|
|
125 |
}
|
|
126 |
|
|
127 |
void VideoCollectionViewUtils::sortModel(VideoSortFilterProxyModel *model,
|
36
|
128 |
bool async, VideoCollectionCommon::TCollectionLevels target)
|
34
|
129 |
{
|
|
130 |
Q_UNUSED(model);
|
|
131 |
Q_UNUSED(async);
|
36
|
132 |
Q_UNUSED(target);
|
34
|
133 |
// not stubbed
|
|
134 |
}
|
|
135 |
|
|
136 |
void VideoCollectionViewUtils::showStatusMsgSlot(int statusCode, QVariant &additional)
|
|
137 |
{
|
35
|
138 |
VideoCollectionViewUtilsData::mLastStatusAdditional = additional;
|
34
|
139 |
VideoCollectionViewUtilsData::mLastError = statusCode;
|
|
140 |
}
|