|
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 hint widget |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef VIDEOHINTWIDGET_H |
|
20 #define VIDEOHINTWIDGET_H |
|
21 |
|
22 #include <hbwidget.h> |
|
23 #include <hbicon.h> |
|
24 |
|
25 class HbPushButton; |
|
26 class HbLabel; |
|
27 class VideoCollectionUiLoader; |
|
28 class QGraphicsItem; |
|
29 |
|
30 /** |
|
31 * Widget for displaying no videos text and possible hint and button for user |
|
32 * find where to download new videos. |
|
33 */ |
|
34 class VideoHintWidget : public HbWidget |
|
35 { |
|
36 Q_OBJECT |
|
37 |
|
38 public: |
|
39 |
|
40 enum HintLevel { |
|
41 AllVideos, |
|
42 Collection |
|
43 }; |
|
44 |
|
45 /** |
|
46 * Contructor. |
|
47 * |
|
48 * @param parent parent of this widget |
|
49 */ |
|
50 VideoHintWidget(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent = 0); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 * |
|
55 */ |
|
56 ~VideoHintWidget(); |
|
57 |
|
58 /** |
|
59 * Method creates colleciton wrapper, grid and list views, |
|
60 * layout and activates correct view based on the current orientation |
|
61 * |
|
62 * @return int 0 initialization ok, < 0 if fails. |
|
63 */ |
|
64 int initialize(); |
|
65 |
|
66 /** |
|
67 * Sets the level where the hint is correctly. Hint displays differently in |
|
68 * for example collection level, than in allVideos level. |
|
69 * |
|
70 * @param level The current level. |
|
71 */ |
|
72 void setLevel(HintLevel level); |
|
73 |
|
74 /** |
|
75 * Adjusts if the button is shown in landscape. |
|
76 */ |
|
77 void setButtonShown(bool shown); |
|
78 |
|
79 /** |
|
80 * Method enables and displays this widget. |
|
81 */ |
|
82 void activate(); |
|
83 |
|
84 /** |
|
85 * Method disables and hides this widget. |
|
86 */ |
|
87 void deactivate(); |
|
88 |
|
89 private slots: |
|
90 |
|
91 /** |
|
92 * Method activates correct view based on the given orientation. |
|
93 */ |
|
94 void orientationChangedSlot(Qt::Orientation orientation); |
|
95 |
|
96 private: |
|
97 |
|
98 /** |
|
99 * Shows/hides the correct UI components for current state. |
|
100 */ |
|
101 void updateUiComponents(); |
|
102 |
|
103 private: |
|
104 |
|
105 Q_DISABLE_COPY(VideoHintWidget) |
|
106 |
|
107 /** |
|
108 * Pointer to the XML UI (DocML) loader, not owned |
|
109 */ |
|
110 VideoCollectionUiLoader *mUiLoader; |
|
111 |
|
112 /** |
|
113 * Service icon resource string. |
|
114 */ |
|
115 QString mServiceIconString; |
|
116 |
|
117 /** |
|
118 * Service icon pressed resource string. |
|
119 */ |
|
120 QString mServiceIconPressedString; |
|
121 |
|
122 /** |
|
123 * Service icon. |
|
124 */ |
|
125 HbIcon *mServiceIcon; |
|
126 |
|
127 /** |
|
128 * Add videos icon. |
|
129 */ |
|
130 HbIcon *mAddVideosIcon; |
|
131 |
|
132 /** |
|
133 * Current hint level. |
|
134 */ |
|
135 HintLevel mCurrentLevel; |
|
136 |
|
137 /** |
|
138 * If button is shown in landscape at all. |
|
139 */ |
|
140 bool mButtonShown; |
|
141 |
|
142 /** |
|
143 * true if widget has been activated. |
|
144 */ |
|
145 bool mActivated; |
|
146 |
|
147 }; |
|
148 |
|
149 #endif // VIDEOHINTWIDGET_H |