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: Videolist selection dialog
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef VIDEOLISTSELECTIONDIALOG_H
|
|
19 |
#define VIDEOLISTSELECTIONDIALOG_H
|
|
20 |
|
|
21 |
#include <hbdialog.h>
|
|
22 |
#include <qlist.h>
|
|
23 |
#include <qitemselectionmodel.h>
|
|
24 |
|
|
25 |
class QGraphicItem;
|
|
26 |
class QItemSelection;
|
|
27 |
class HbLabel;
|
|
28 |
class HbCheckBox;
|
|
29 |
class HbStackedWidget;
|
|
30 |
class VideoListWidget;
|
|
31 |
class VideoCollectionUiLoader;
|
|
32 |
class VideoSortFilterProxyModel;
|
|
33 |
|
|
34 |
class VideoListSelectionDialog: public HbDialog
|
|
35 |
{
|
|
36 |
/**
|
|
37 |
* definition required for emitting / connecting signals
|
|
38 |
*/
|
|
39 |
Q_OBJECT
|
|
40 |
|
|
41 |
/**
|
|
42 |
* disable copy-constructor and assignment operator
|
|
43 |
*/
|
|
44 |
Q_DISABLE_COPY(VideoListSelectionDialog)
|
|
45 |
|
|
46 |
|
|
47 |
public:
|
|
48 |
|
|
49 |
/**
|
|
50 |
* Constructor
|
|
51 |
*
|
|
52 |
* @param uiLoader used to load UI components from docml
|
|
53 |
* @param parent item's parent component
|
|
54 |
*/
|
|
55 |
VideoListSelectionDialog(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent=0);
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Destructor
|
|
59 |
*/
|
|
60 |
~VideoListSelectionDialog();
|
|
61 |
|
|
62 |
/**
|
|
63 |
* Method setups provided title and videolist content widget.
|
|
64 |
* Prepares dialog for showing.
|
|
65 |
* If either provided title is empty or widget is NULL, dialog
|
|
66 |
* is in invalid state and cannot be shown using exec.
|
|
67 |
*
|
|
68 |
* @param title title of the dialog
|
|
69 |
* @param videoList videolist widget.
|
|
70 |
*/
|
|
71 |
void setContent(const QString &title, VideoListWidget *videoList);
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Returns selection (mSelection). Selection will be empty in case
|
|
75 |
* dialog is closed using cancell button,
|
|
76 |
*
|
|
77 |
* @return HbAction primary action if "OK" iis pressed
|
|
78 |
*/
|
|
79 |
const QItemSelection& getSelection() const;
|
|
80 |
|
|
81 |
public slots:
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Shows modal dialog build from the provided Videolistwidget.
|
|
85 |
*
|
|
86 |
* @return HbAction primary action if "OK" iis pressed
|
|
87 |
*/
|
|
88 |
HbAction* exec();
|
|
89 |
|
|
90 |
private slots:
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Slot connected to mCheckBox's stateChanged -signal.
|
|
94 |
* Selects or deselects all items if mForcedCheck -flag is false.
|
|
95 |
*
|
|
96 |
* If Forcedcehck is true, it indeicates that we want to change the checked state
|
|
97 |
* only, not slect or deselect anything. This is needed for example if after
|
|
98 |
* all items are marked, user manually deselects item's. In that case all is not
|
|
99 |
* marked, so checked state needs to be changed.
|
|
100 |
*
|
|
101 |
* @param state Qt::Checked everything should be set as selected.
|
|
102 |
*/
|
|
103 |
void markAllStateChangedSlot(int state);
|
|
104 |
|
|
105 |
/**
|
|
106 |
* disables or enables popup's primary action in case selection changes
|
|
107 |
*
|
|
108 |
* @param selected item selection list containing selected
|
|
109 |
* @param deselected item selection list containing not selected (not used in this scope)
|
|
110 |
*/
|
|
111 |
void selectionChangedSlot(const QItemSelection &selected, const QItemSelection &deselected);
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Changes the counter value. Sets the checkbutton state based on selection count.
|
|
115 |
*
|
|
116 |
*/
|
|
117 |
void updateCounterSlot();
|
|
118 |
|
|
119 |
private:
|
|
120 |
|
|
121 |
/**
|
|
122 |
* connects all required signals into appropriate slots
|
|
123 |
* for selection mode
|
|
124 |
*/
|
|
125 |
void connectSignals();
|
|
126 |
|
|
127 |
/**
|
|
128 |
* disconnects all signals
|
|
129 |
*/
|
|
130 |
void disconnectSignals();
|
|
131 |
|
|
132 |
private:
|
|
133 |
|
|
134 |
/**
|
|
135 |
* docml UI loader, not owned
|
|
136 |
*/
|
|
137 |
VideoCollectionUiLoader *mUiLoader;
|
|
138 |
|
|
139 |
/**
|
|
140 |
* content videolist, not owned
|
|
141 |
*/
|
|
142 |
VideoListWidget *mVideoList;
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Selection
|
|
146 |
*/
|
|
147 |
QItemSelection mSelection;
|
|
148 |
|
|
149 |
/**
|
|
150 |
* header label
|
|
151 |
*/
|
|
152 |
HbLabel *mHeading;
|
|
153 |
|
|
154 |
/**
|
|
155 |
* counter label from docml
|
|
156 |
*/
|
|
157 |
HbLabel *mItemCount;
|
|
158 |
|
|
159 |
/**
|
|
160 |
* mark all checkbox
|
|
161 |
*/
|
|
162 |
HbCheckBox *mCheckBox;
|
|
163 |
|
|
164 |
/**
|
|
165 |
* videolist container in dialog
|
|
166 |
*/
|
|
167 |
HbStackedWidget *mListContainer;
|
|
168 |
|
|
169 |
/**
|
|
170 |
* flag indicating that we've changed check-btn state
|
|
171 |
* explicitly and don't wanna handle selection based on that
|
|
172 |
*/
|
|
173 |
bool mForcedCheck;
|
|
174 |
|
|
175 |
};
|
|
176 |
|
|
177 |
#endif //VIDEOLISTSELECTIONDIALOG_H
|