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;
|
36
|
23 |
int VideoCollectionViewUtilsData::mVideoSortRole = -1;
|
|
24 |
int VideoCollectionViewUtilsData::mCollectionSortRole = -1;
|
|
25 |
Qt::SortOrder VideoCollectionViewUtilsData::mVideoSortOrder = Qt::AscendingOrder;
|
|
26 |
Qt::SortOrder VideoCollectionViewUtilsData::mCollectionSortOrder = Qt::AscendingOrder;
|
34
|
27 |
QString VideoCollectionViewUtilsData::mIconString = "";
|
|
28 |
QString VideoCollectionViewUtilsData::mPressedString = "";
|
35
|
29 |
QVariant VideoCollectionViewUtilsData::mLastStatusAdditional = QVariant();
|
41
|
30 |
VideoCollectionCommon::TCollectionLevels VideoCollectionViewUtilsData::mWidgetLevel = VideoCollectionCommon::ELevelVideos;
|
|
31 |
TMPXItemId VideoCollectionViewUtilsData::mActivityCollectionId = TMPXItemId::InvalidId();
|
|
32 |
QString VideoCollectionViewUtilsData::mActivityCollectionName = "";
|
44
|
33 |
QList<QString> VideoCollectionViewUtilsData::mCenRepStringValues;
|
|
34 |
QList<int> VideoCollectionViewUtilsData::mCenRepIntValues;
|
34
|
35 |
|
|
36 |
VideoCollectionViewUtils& VideoCollectionViewUtils::instance()
|
|
37 |
{
|
|
38 |
static VideoCollectionViewUtils _popupInstance;
|
|
39 |
return _popupInstance;
|
|
40 |
}
|
|
41 |
|
|
42 |
VideoCollectionViewUtils::VideoCollectionViewUtils():
|
36
|
43 |
mVideosSortRole(-1),
|
|
44 |
mCollectionsSortRole(-1),
|
|
45 |
mVideosSortOrder(Qt::AscendingOrder),
|
|
46 |
mCollectionsSortOrder(Qt::AscendingOrder)
|
34
|
47 |
{
|
|
48 |
// not stubbed
|
|
49 |
}
|
|
50 |
|
|
51 |
VideoCollectionViewUtils::~VideoCollectionViewUtils()
|
|
52 |
{
|
|
53 |
VideoCollectionViewUtilsData::reset();
|
|
54 |
}
|
|
55 |
|
36
|
56 |
int VideoCollectionViewUtils::saveSortingValues(int role, Qt::SortOrder order, VideoCollectionCommon::TCollectionLevels target)
|
34
|
57 |
{
|
36
|
58 |
int status(0);
|
|
59 |
if(target == VideoCollectionCommon::ELevelCategory )
|
|
60 |
{
|
|
61 |
VideoCollectionViewUtilsData::mCollectionSortRole = role;
|
|
62 |
mCollectionsSortRole = role;
|
|
63 |
VideoCollectionViewUtilsData::mCollectionSortOrder = order;
|
|
64 |
mCollectionsSortOrder = order;
|
|
65 |
}
|
|
66 |
else if(target > VideoCollectionCommon::ELevelCategory &&
|
|
67 |
target <= VideoCollectionCommon::ELevelAlbum)
|
|
68 |
{
|
|
69 |
VideoCollectionViewUtilsData::mVideoSortRole = role;
|
|
70 |
mVideosSortRole = role;
|
|
71 |
VideoCollectionViewUtilsData::mVideoSortOrder = order;
|
|
72 |
mVideosSortOrder = order;
|
|
73 |
}
|
|
74 |
else
|
|
75 |
{
|
|
76 |
status = -1;
|
|
77 |
}
|
|
78 |
return status;
|
34
|
79 |
}
|
|
80 |
|
36
|
81 |
int VideoCollectionViewUtils::loadSortingValues(int &role, Qt::SortOrder &order, VideoCollectionCommon::TCollectionLevels target)
|
34
|
82 |
{
|
|
83 |
if (VideoCollectionViewUtilsData::mLoadSortingValuesFails)
|
|
84 |
{
|
|
85 |
return -1;
|
|
86 |
}
|
36
|
87 |
if(target == VideoCollectionCommon::ELevelCategory )
|
|
88 |
{
|
|
89 |
role = VideoCollectionViewUtilsData::mCollectionSortRole;
|
|
90 |
order = VideoCollectionViewUtilsData::mCollectionSortOrder;
|
|
91 |
}
|
|
92 |
else if(target > VideoCollectionCommon::ELevelCategory &&
|
|
93 |
target <= VideoCollectionCommon::ELevelAlbum)
|
|
94 |
{
|
|
95 |
role = VideoCollectionViewUtilsData::mVideoSortRole;
|
|
96 |
order = VideoCollectionViewUtilsData::mVideoSortOrder;
|
|
97 |
}
|
|
98 |
else
|
|
99 |
{
|
|
100 |
return -1;
|
|
101 |
}
|
34
|
102 |
return 0;
|
|
103 |
}
|
|
104 |
|
44
|
105 |
QString VideoCollectionViewUtils::getCenRepStringValue(int key)
|
34
|
106 |
{
|
44
|
107 |
Q_UNUSED(key);
|
|
108 |
if(VideoCollectionViewUtilsData::mCenRepStringValues.count() > 0)
|
34
|
109 |
{
|
44
|
110 |
return VideoCollectionViewUtilsData::mCenRepStringValues.takeFirst();;
|
34
|
111 |
}
|
44
|
112 |
return -1;
|
34
|
113 |
}
|
|
114 |
|
44
|
115 |
int VideoCollectionViewUtils::getCenRepIntValue(int key)
|
34
|
116 |
{
|
44
|
117 |
Q_UNUSED(key);
|
|
118 |
if(VideoCollectionViewUtilsData::mCenRepIntValues.count() > 0)
|
|
119 |
{
|
|
120 |
return VideoCollectionViewUtilsData::mCenRepIntValues.takeFirst();;
|
|
121 |
}
|
|
122 |
return -1;
|
34
|
123 |
}
|
|
124 |
|
|
125 |
void VideoCollectionViewUtils::initListView(HbListView *view)
|
|
126 |
{
|
|
127 |
Q_UNUSED(view);
|
|
128 |
// not stubbed
|
|
129 |
}
|
|
130 |
|
41
|
131 |
void VideoCollectionViewUtils::setWidgetActivityLevel(const VideoCollectionCommon::TCollectionLevels &level)
|
39
|
132 |
{
|
41
|
133 |
VideoCollectionViewUtilsData::mWidgetLevel = level;
|
39
|
134 |
}
|
|
135 |
|
41
|
136 |
void VideoCollectionViewUtils::getActivityWidgetLevel(VideoCollectionCommon::TCollectionLevels &level)
|
|
137 |
{
|
|
138 |
level = VideoCollectionViewUtilsData::mWidgetLevel;
|
|
139 |
}
|
|
140 |
|
|
141 |
void VideoCollectionViewUtils::setCollectionActivityData(const TMPXItemId &id, const QString &name)
|
39
|
142 |
{
|
41
|
143 |
VideoCollectionViewUtilsData::mActivityCollectionId = id;
|
|
144 |
VideoCollectionViewUtilsData::mActivityCollectionName = name;
|
39
|
145 |
}
|
41
|
146 |
|
|
147 |
void VideoCollectionViewUtils::getCollectionActivityData(TMPXItemId &id, QString &name)
|
|
148 |
{
|
|
149 |
id = VideoCollectionViewUtilsData::mActivityCollectionId;
|
|
150 |
name = VideoCollectionViewUtilsData::mActivityCollectionName;
|
|
151 |
}
|
|
152 |
|
39
|
153 |
|
34
|
154 |
void VideoCollectionViewUtils::sortModel(VideoSortFilterProxyModel *model,
|
36
|
155 |
bool async, VideoCollectionCommon::TCollectionLevels target)
|
34
|
156 |
{
|
|
157 |
Q_UNUSED(model);
|
|
158 |
Q_UNUSED(async);
|
36
|
159 |
Q_UNUSED(target);
|
34
|
160 |
// not stubbed
|
|
161 |
}
|
|
162 |
|
|
163 |
void VideoCollectionViewUtils::showStatusMsgSlot(int statusCode, QVariant &additional)
|
|
164 |
{
|
35
|
165 |
VideoCollectionViewUtilsData::mLastStatusAdditional = additional;
|
34
|
166 |
VideoCollectionViewUtilsData::mLastError = statusCode;
|
|
167 |
}
|