30
|
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: video collection view plugin's ui utils class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef __VIDEOCOLLECTIONVIEWUTILS_H__
|
|
19 |
#define __VIDEOCOLLECTIONVIEWUTILS_H__
|
|
20 |
|
|
21 |
#include <qobject.h>
|
44
|
22 |
#include <qvariant.h>
|
36
|
23 |
#include "videocollectioncommon.h"
|
30
|
24 |
|
34
|
25 |
class HbListView;
|
|
26 |
class VideoSortFilterProxyModel;
|
|
27 |
|
30
|
28 |
class VideoCollectionViewUtils : public QObject
|
|
29 |
{
|
|
30 |
Q_OBJECT
|
|
31 |
|
|
32 |
public:
|
|
33 |
/**
|
|
34 |
* Returns singleton instance for this class.
|
|
35 |
*
|
|
36 |
* WARNING! Not safe to call this from destructor of another function scope static object!
|
|
37 |
*
|
|
38 |
* @return The singleton instance.
|
|
39 |
*/
|
|
40 |
static VideoCollectionViewUtils& instance();
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Saves the sorting role and order to cenrep.
|
|
44 |
*
|
|
45 |
* @param role The sorting role.
|
|
46 |
* @param order The sorting order (e.g. ascending or descending).
|
|
47 |
* @return Zero if operation succeeded, less than zero in error cases.
|
|
48 |
*/
|
36
|
49 |
int saveSortingValues(int role, Qt::SortOrder order, VideoCollectionCommon::TCollectionLevels target);
|
30
|
50 |
|
|
51 |
/**
|
|
52 |
* Loads the sorting role and order from cenrep.
|
|
53 |
*
|
|
54 |
* @param role On return contains the sorting role.
|
|
55 |
* @param order On return contains the sorting order
|
|
56 |
* @return Zero if operation succeeded, less than zero in error cases.
|
|
57 |
*/
|
36
|
58 |
int loadSortingValues(int& role, Qt::SortOrder& order, VideoCollectionCommon::TCollectionLevels target);
|
30
|
59 |
|
|
60 |
/**
|
44
|
61 |
* Get string value for a key from central repository.
|
30
|
62 |
*
|
44
|
63 |
* @param key Video collection central repository key.
|
|
64 |
* @return String stored in central repository. Empty string in error cases.
|
30
|
65 |
*/
|
44
|
66 |
QString getCenRepStringValue(int key);
|
30
|
67 |
|
|
68 |
/**
|
44
|
69 |
* Get int value for a key from central repository.
|
30
|
70 |
*
|
44
|
71 |
* @param key Video collection central repository key.
|
|
72 |
* @param value Contains the read integer from cenrep at return.
|
|
73 |
* @return Application UID if operation succeeded, less than zero in error cases.
|
30
|
74 |
*/
|
44
|
75 |
int getCenRepIntValue(int key);
|
|
76 |
|
34
|
77 |
public:
|
|
78 |
/**
|
|
79 |
* Initializes list view for collection and selection dialog with common
|
|
80 |
* properties.
|
|
81 |
*/
|
|
82 |
static void initListView(HbListView *view);
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Initilizes model sort values.
|
|
86 |
*/
|
36
|
87 |
static void sortModel(VideoSortFilterProxyModel *model, bool async, VideoCollectionCommon::TCollectionLevels target);
|
39
|
88 |
|
|
89 |
/**
|
41
|
90 |
* Method saves the latest videolist widget level into local activity manager
|
|
91 |
* data container.
|
|
92 |
*
|
|
93 |
* Note that collection id will be cleared in activity data in case level is
|
|
94 |
* all videos or collection list.
|
39
|
95 |
*
|
41
|
96 |
* @param level collection level
|
39
|
97 |
*/
|
41
|
98 |
static void setWidgetActivityLevel(const VideoCollectionCommon::TCollectionLevels &level);
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Method gets the latest videolist widget level from local activity manager
|
|
102 |
* data container.
|
|
103 |
*
|
|
104 |
* @param level, reference to level variable where value is saved
|
|
105 |
*/
|
|
106 |
static void getActivityWidgetLevel(VideoCollectionCommon::TCollectionLevels &level);
|
39
|
107 |
|
|
108 |
/**
|
41
|
109 |
* method saves provided id and string into local activity
|
|
110 |
* manager data container.
|
39
|
111 |
*
|
41
|
112 |
* @param id. Id to save
|
39
|
113 |
*/
|
41
|
114 |
static void setCollectionActivityData(const TMPXItemId &id, const QString &name);
|
|
115 |
|
|
116 |
/**
|
|
117 |
* method reads id and string from from local activity manager data
|
|
118 |
* container and prepares MPX item id.
|
|
119 |
*
|
|
120 |
* @param id. Id to return
|
|
121 |
*/
|
|
122 |
static void getCollectionActivityData(TMPXItemId &id, QString &name);
|
34
|
123 |
|
30
|
124 |
public slots:
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Shows status msgs
|
|
128 |
*
|
|
129 |
* @param statusCode status code
|
|
130 |
* @param additional additional data gotten from the status
|
|
131 |
*/
|
|
132 |
void showStatusMsgSlot(int statusCode, QVariant &additional);
|
|
133 |
|
|
134 |
private:
|
|
135 |
|
|
136 |
/**
|
|
137 |
* disables copy-constructor and assingment operator
|
|
138 |
*/
|
|
139 |
Q_DISABLE_COPY(VideoCollectionViewUtils)
|
|
140 |
|
|
141 |
/**
|
|
142 |
* constructor
|
|
143 |
*/
|
|
144 |
VideoCollectionViewUtils();
|
|
145 |
|
|
146 |
/**
|
|
147 |
* destructor
|
|
148 |
*/
|
|
149 |
virtual ~VideoCollectionViewUtils();
|
|
150 |
|
34
|
151 |
private:
|
|
152 |
/** current sorting role */
|
36
|
153 |
int mVideosSortRole;
|
|
154 |
int mCollectionsSortRole;
|
30
|
155 |
|
34
|
156 |
/** current sorting order */
|
36
|
157 |
Qt::SortOrder mVideosSortOrder;
|
|
158 |
Qt::SortOrder mCollectionsSortOrder;
|
30
|
159 |
};
|
|
160 |
|
|
161 |
#endif //__VIDEOCOLLECTIONUIUTILS_H__
|
|
162 |
|