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 content widget implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
44
|
18 |
// Version : %version: 15 %
|
36
|
19 |
|
|
20 |
// INCLUDE FILES
|
30
|
21 |
#include <hbpushbutton.h>
|
|
22 |
#include <hblabel.h>
|
|
23 |
#include <qgraphicsitem.h>
|
|
24 |
#include <hbinstance.h>
|
|
25 |
|
|
26 |
#include "videohintwidget.h"
|
|
27 |
#include "videocollectionuiloader.h"
|
|
28 |
#include "videocollectionviewutils.h"
|
44
|
29 |
#include "videocollectioncenrepdefs.h"
|
36
|
30 |
#include "videocollectiontrace.h"
|
30
|
31 |
|
|
32 |
// ---------------------------------------------------------------------------
|
|
33 |
// Constructor
|
|
34 |
// ---------------------------------------------------------------------------
|
|
35 |
//
|
36
|
36 |
VideoHintWidget::VideoHintWidget( VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent )
|
|
37 |
: HbWidget( parent )
|
|
38 |
, mUiLoader( uiLoader )
|
|
39 |
, mCurrentLevel( AllVideos )
|
|
40 |
, mButtonShown( false )
|
|
41 |
, mActivated( false )
|
30
|
42 |
{
|
41
|
43 |
FUNC_LOG;
|
30
|
44 |
// NOP
|
|
45 |
}
|
|
46 |
|
|
47 |
// ---------------------------------------------------------------------------
|
|
48 |
// Destructor
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
VideoHintWidget::~VideoHintWidget()
|
|
52 |
{
|
41
|
53 |
FUNC_LOG;
|
30
|
54 |
}
|
|
55 |
|
|
56 |
// ---------------------------------------------------------------------------
|
|
57 |
// initialize
|
|
58 |
// ---------------------------------------------------------------------------
|
|
59 |
//
|
44
|
60 |
void VideoHintWidget::initialize()
|
30
|
61 |
{
|
41
|
62 |
FUNC_LOG;
|
30
|
63 |
VideoCollectionViewUtils& utils = VideoCollectionViewUtils::instance();
|
44
|
64 |
|
|
65 |
QString textId = utils.getCenRepStringValue(KVideoCollectionViewCenrepServiceItem1Text);
|
|
66 |
if(!textId.isEmpty())
|
|
67 |
{
|
|
68 |
mHintText = hbTrId(textId.toLatin1().constData());
|
|
69 |
}
|
30
|
70 |
}
|
|
71 |
|
|
72 |
// ---------------------------------------------------------------------------
|
|
73 |
// setLevel
|
|
74 |
// ---------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
void VideoHintWidget::setLevel(HintLevel level)
|
|
77 |
{
|
41
|
78 |
FUNC_LOG;
|
|
79 |
INFO_1("VideoHintWidget::setLevel() level: %d", level);
|
30
|
80 |
mCurrentLevel = level;
|
34
|
81 |
if(mActivated) {
|
30
|
82 |
updateUiComponents();
|
|
83 |
}
|
|
84 |
}
|
|
85 |
|
|
86 |
// ---------------------------------------------------------------------------
|
34
|
87 |
// setButtonShown
|
30
|
88 |
// ---------------------------------------------------------------------------
|
|
89 |
//
|
34
|
90 |
void VideoHintWidget::setButtonShown(bool shown)
|
30
|
91 |
{
|
41
|
92 |
FUNC_LOG;
|
|
93 |
INFO_1("VideoHintWidget::setButtonShown() shown: %d", shown);
|
|
94 |
mButtonShown = shown;
|
34
|
95 |
if(mActivated) {
|
|
96 |
updateUiComponents();
|
30
|
97 |
}
|
|
98 |
}
|
|
99 |
|
|
100 |
// ---------------------------------------------------------------------------
|
|
101 |
// orientationChanged
|
|
102 |
// ---------------------------------------------------------------------------
|
|
103 |
//
|
34
|
104 |
void VideoHintWidget::orientationChangedSlot(Qt::Orientation targetOrientation)
|
30
|
105 |
{
|
41
|
106 |
FUNC_LOG;
|
34
|
107 |
Q_UNUSED(targetOrientation);
|
30
|
108 |
updateUiComponents();
|
|
109 |
}
|
|
110 |
|
|
111 |
// ---------------------------------------------------------------------------
|
|
112 |
// activate
|
|
113 |
// ---------------------------------------------------------------------------
|
|
114 |
//
|
|
115 |
void VideoHintWidget::activate()
|
|
116 |
{
|
41
|
117 |
FUNC_LOG;
|
34
|
118 |
if (!mActivated)
|
30
|
119 |
{
|
34
|
120 |
HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
|
|
121 |
connect(
|
|
122 |
mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
|
|
123 |
this, SLOT(orientationChangedSlot(Qt::Orientation)));
|
|
124 |
|
|
125 |
updateUiComponents();
|
|
126 |
|
|
127 |
setVisible(true);
|
|
128 |
|
|
129 |
mActivated = true;
|
30
|
130 |
}
|
|
131 |
}
|
|
132 |
|
|
133 |
// ---------------------------------------------------------------------------
|
|
134 |
// deactivate
|
|
135 |
// ---------------------------------------------------------------------------
|
|
136 |
//
|
|
137 |
void VideoHintWidget::deactivate()
|
|
138 |
{
|
41
|
139 |
FUNC_LOG;
|
34
|
140 |
if (mActivated)
|
|
141 |
{
|
|
142 |
mActivated = false;
|
|
143 |
|
|
144 |
setVisible(false);
|
|
145 |
|
|
146 |
HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
|
|
147 |
disconnect(
|
|
148 |
mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
|
|
149 |
this, SLOT(orientationChangedSlot(Qt::Orientation)));
|
30
|
150 |
}
|
|
151 |
}
|
|
152 |
|
|
153 |
// ---------------------------------------------------------------------------
|
|
154 |
// updateUiComponents
|
|
155 |
// ---------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
void VideoHintWidget::updateUiComponents()
|
|
158 |
{
|
41
|
159 |
FUNC_LOG;
|
30
|
160 |
HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
|
34
|
161 |
if (mainWnd)
|
|
162 |
{
|
44
|
163 |
HbPushButton *hintButton =
|
34
|
164 |
mUiLoader->findWidget<HbPushButton>(
|
|
165 |
DOCML_NAME_HINT_BUTTON);
|
|
166 |
HbLabel *noVideosLabel =
|
|
167 |
mUiLoader->findWidget<HbLabel>(
|
|
168 |
DOCML_NAME_NO_VIDEOS_LABEL);
|
44
|
169 |
if (hintButton && noVideosLabel)
|
34
|
170 |
{
|
|
171 |
noVideosLabel->setVisible(true);
|
44
|
172 |
|
|
173 |
if (mCurrentLevel == AllVideos && !mHintText.isEmpty())
|
41
|
174 |
{
|
44
|
175 |
hintButton->setText(mHintText);
|
|
176 |
hintButton->setVisible(mButtonShown);
|
41
|
177 |
}
|
|
178 |
else
|
34
|
179 |
{
|
44
|
180 |
hintButton->setVisible(false);
|
34
|
181 |
}
|
|
182 |
}
|
30
|
183 |
}
|
|
184 |
}
|
|
185 |
|
|
186 |
// end of file
|