26 #include <HbEvent> |
26 #include <HbEvent> |
27 |
27 |
28 // User includes |
28 // User includes |
29 #include "irhswidgetmetadatarow.h" |
29 #include "irhswidgetmetadatarow.h" |
30 #include "irhswidgetuiloader.h" |
30 #include "irhswidgetuiloader.h" |
|
31 #include "irqlogger.h" |
31 |
32 |
32 // Constants |
33 // Constants |
33 static const QString KIrHsWidgetMetaDataRowDocML = ":/resource/irhswidgetmetadatarow.docml"; |
34 static const QString KIrHsWidgetMetaDataRowDocML = ":/resource/irhswidgetmetadatarow.docml"; |
34 static const QString KIrHsWidgetMetaDataRowContainer = "metadatarow_layout"; |
35 static const QString KIrHsWidgetMetaDataRowContainer = "metadatarow_layout"; |
35 static const QString KIrHsWidgetMetaDataLayout = "metadata_layout"; |
36 static const QString KIrHsWidgetMetaDataLayout = "metadata_layout"; |
55 HbWidget(aParent, aFlags), |
56 HbWidget(aParent, aFlags), |
56 mMetaData(NULL), |
57 mMetaData(NULL), |
57 mControlLayout(NULL), |
58 mControlLayout(NULL), |
58 mControlLabel(NULL) |
59 mControlLabel(NULL) |
59 { |
60 { |
|
61 LOG_METHOD; |
60 HbStyleLoader::registerFilePath(KIrHsWidgetCss); |
62 HbStyleLoader::registerFilePath(KIrHsWidgetCss); |
61 |
63 |
62 loadUi(); |
64 loadUi(); |
63 createLoadingIcon(); |
65 createLoadingIcon(); |
64 grabGesture(Qt::TapGesture); |
66 grabGesture(Qt::TapGesture); |
65 } |
67 } |
66 |
68 |
67 |
69 |
68 IrHsWidgetMetaDataRow::~IrHsWidgetMetaDataRow() |
70 IrHsWidgetMetaDataRow::~IrHsWidgetMetaDataRow() |
69 { |
71 { |
|
72 LOG_METHOD; |
70 HbStyleLoader::unregisterFilePath(KIrHsWidgetCss); |
73 HbStyleLoader::unregisterFilePath(KIrHsWidgetCss); |
71 } |
74 } |
72 |
75 |
73 void IrHsWidgetMetaDataRow::loadUi() |
76 void IrHsWidgetMetaDataRow::loadUi() |
74 { |
77 { |
|
78 LOG_METHOD; |
75 IRHsWidgetUiLoader loader; |
79 IRHsWidgetUiLoader loader; |
76 loader.load(KIrHsWidgetMetaDataRowDocML); |
80 loader.load(KIrHsWidgetMetaDataRowDocML); |
77 |
81 |
78 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); |
82 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); |
79 layout->setContentsMargins(KIrHsWidgetContentsMargin, KIrHsWidgetContentsMargin, |
83 layout->setContentsMargins(KIrHsWidgetContentsMargin, KIrHsWidgetContentsMargin, |
91 mControlLayout = static_cast<HbLabel*> (loader.findWidget(KNmHsWidgetControlLayout)); |
95 mControlLayout = static_cast<HbLabel*> (loader.findWidget(KNmHsWidgetControlLayout)); |
92 mControlLabel = static_cast<HbLabel*> (loader.findWidget(KNmHsWidgetControlLabel)); |
96 mControlLabel = static_cast<HbLabel*> (loader.findWidget(KNmHsWidgetControlLabel)); |
93 } |
97 } |
94 |
98 |
95 void IrHsWidgetMetaDataRow::setMetaData(const QString &aMetaData) |
99 void IrHsWidgetMetaDataRow::setMetaData(const QString &aMetaData) |
96 { |
100 { |
|
101 LOG_METHOD; |
|
102 LOG_FORMAT("aMetaData = %s", STRING2CHAR(aMetaData)); |
97 if (mMetaData->text() != aMetaData) |
103 if (mMetaData->text() != aMetaData) |
98 { |
104 { |
99 mMetaData->setText(aMetaData); |
105 mMetaData->setText(aMetaData); |
100 if (aMetaData.isEmpty()) |
106 if (aMetaData.isEmpty()) |
101 { |
107 { |
108 } |
114 } |
109 } |
115 } |
110 |
116 |
111 void IrHsWidgetMetaDataRow::startMetaDataMarquee() |
117 void IrHsWidgetMetaDataRow::startMetaDataMarquee() |
112 { |
118 { |
|
119 LOG_METHOD; |
113 if (!mMetaData->text().isEmpty()) |
120 if (!mMetaData->text().isEmpty()) |
114 { |
121 { |
115 mMetaData->startAnimation(); |
122 mMetaData->startAnimation(); |
116 } |
123 } |
117 } |
124 } |
118 |
125 |
119 void IrHsWidgetMetaDataRow::stopMetaDataMarquee() |
126 void IrHsWidgetMetaDataRow::stopMetaDataMarquee() |
120 { |
127 { |
|
128 LOG_METHOD; |
121 mMetaData->stopAnimation(); |
129 mMetaData->stopAnimation(); |
122 } |
130 } |
123 |
131 |
124 void IrHsWidgetMetaDataRow::setPlayIcon() |
132 void IrHsWidgetMetaDataRow::setPlayIcon() |
125 { |
133 { |
|
134 LOG_METHOD; |
126 mControlLabel->setIcon(KPlayButtonIcon); |
135 mControlLabel->setIcon(KPlayButtonIcon); |
127 } |
136 } |
128 |
137 |
129 void IrHsWidgetMetaDataRow::setStopIcon() |
138 void IrHsWidgetMetaDataRow::setStopIcon() |
130 { |
139 { |
|
140 LOG_METHOD; |
131 mControlLabel->setIcon(KStopButtonIcon); |
141 mControlLabel->setIcon(KStopButtonIcon); |
132 } |
142 } |
133 |
143 |
134 void IrHsWidgetMetaDataRow::setLoadingIcon() |
144 void IrHsWidgetMetaDataRow::setLoadingIcon() |
135 { |
145 { |
|
146 LOG_METHOD; |
136 mControlLabel->setIcon(mLoadingIcon); |
147 mControlLabel->setIcon(mLoadingIcon); |
137 } |
148 } |
138 |
149 |
139 void IrHsWidgetMetaDataRow::createLoadingIcon() |
150 void IrHsWidgetMetaDataRow::createLoadingIcon() |
140 { |
151 { |
|
152 LOG_METHOD; |
141 HbIconAnimationManager *animationManager = HbIconAnimationManager::global(); |
153 HbIconAnimationManager *animationManager = HbIconAnimationManager::global(); |
142 HbIconAnimationDefinition animationDefinition; |
154 HbIconAnimationDefinition animationDefinition; |
143 HbIconAnimationDefinition::AnimationFrame animationFrame; |
155 HbIconAnimationDefinition::AnimationFrame animationFrame; |
144 QList<HbIconAnimationDefinition::AnimationFrame> animationFrameList; |
156 QList<HbIconAnimationDefinition::AnimationFrame> animationFrameList; |
145 |
157 |
173 { |
186 { |
174 QPointF tapScenePoint = tapGesture->scenePosition(); |
187 QPointF tapScenePoint = tapGesture->scenePosition(); |
175 QPointF tapLocalPoint = mControlLayout->sceneTransform().inverted().map(tapScenePoint); |
188 QPointF tapLocalPoint = mControlLayout->sceneTransform().inverted().map(tapScenePoint); |
176 if (mControlLayout->contains(tapLocalPoint)) |
189 if (mControlLayout->contains(tapLocalPoint)) |
177 { |
190 { |
|
191 LOG("emit controlAreaClicked()"); |
178 emit controlAreaClicked(); |
192 emit controlAreaClicked(); |
179 } |
193 } |
180 else |
194 else |
181 { |
195 { |
|
196 LOG("emit metaDataAreaClicked()"); |
182 emit metaDataAreaClicked(); |
197 emit metaDataAreaClicked(); |
183 } |
198 } |
184 } |
199 } |
185 } |
200 } |
186 |
201 |
187 //Implemented to receive theme change event |
202 //Implemented to receive theme change event |
188 //@param QEvent, The change events to be received |
203 //@param QEvent, The change events to be received |
189 // |
204 // |
190 void IrHsWidgetMetaDataRow::changeEvent(QEvent *event) |
205 void IrHsWidgetMetaDataRow::changeEvent(QEvent *event) |
191 { |
206 { |
|
207 LOG_METHOD; |
192 if (HbEvent::ThemeChanged == event->type()) |
208 if (HbEvent::ThemeChanged == event->type()) |
193 { |
209 { |
194 // get the text color from theme and |
210 // get the text color from theme and |
195 // set it to meta data and control label |
211 // set it to meta data and control label |
196 mMetaData->setTextColor(HbColorScheme::color(KMetaDataColor)); |
212 mMetaData->setTextColor(HbColorScheme::color(KMetaDataColor)); |