79 INSTALL_TRACE_MSG_HANDLER; |
77 INSTALL_TRACE_MSG_HANDLER; |
80 DPRINT; |
78 DPRINT; |
81 |
79 |
82 // Localization file loading |
80 // Localization file loading |
83 installTranslator(TS_FILE_OPERATOR_WIDGET); |
81 installTranslator(TS_FILE_OPERATOR_WIDGET); |
84 installTranslator(TS_FILE_COMMON); |
|
85 |
82 |
86 // Create layout & child-widget manager |
83 // Create layout & child-widget manager |
87 m_layoutManager.reset(new InfoWidgetLayoutManager); |
84 m_layoutManager.reset(new InfoWidgetLayoutManager); |
88 |
85 |
89 // Create widget engine |
86 // Create widget engine |
212 Handles timer events. |
209 Handles timer events. |
213 */ |
210 */ |
214 void InfoWidget::timerEvent(QTimerEvent *event) |
211 void InfoWidget::timerEvent(QTimerEvent *event) |
215 { |
212 { |
216 Q_UNUSED(event); |
213 Q_UNUSED(event); |
217 |
|
218 if (m_animationState == AnimationStarting) { |
214 if (m_animationState == AnimationStarting) { |
219 // Execute delayed start of marquee animation |
215 // Execute delayed start of marquee animation |
220 if (m_animatingItem) { |
216 if (m_animatingItem) { |
221 m_animationState = AnimationOngoing; |
217 m_animationState = AnimationOngoing; |
222 m_animatingItem->startAnimation(); |
218 m_animatingItem->startAnimation(); |
319 Update item visibility based on display preferences. |
313 Update item visibility based on display preferences. |
320 */ |
314 */ |
321 void InfoWidget::updateItemsVisibility() |
315 void InfoWidget::updateItemsVisibility() |
322 { |
316 { |
323 DPRINT; |
317 DPRINT; |
324 int layoutRows = 0; |
|
325 |
|
326 // Update layout according to item visibility settings |
|
327 if (m_preferences->preference(InfoWidgetPreferences::DisplaySpn).compare( |
318 if (m_preferences->preference(InfoWidgetPreferences::DisplaySpn).compare( |
328 DISPLAY_SETTING_ON) == 0) { |
319 DISPLAY_SETTING_OFF) == 0) { |
329 layoutRows++; |
|
330 } else { |
|
331 m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleSpnMarqueeItem); |
320 m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleSpnMarqueeItem); |
332 m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleSpnIcon); |
321 m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleSpnIcon); |
333 } |
322 } |
334 |
323 |
335 if (m_preferences->preference(InfoWidgetPreferences::DisplayMcn).compare( |
324 if (m_preferences->preference(InfoWidgetPreferences::DisplayMcn).compare( |
336 DISPLAY_SETTING_ON) == 0) { |
325 DISPLAY_SETTING_OFF) == 0) { |
337 layoutRows++; |
|
338 } else { |
|
339 m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleMcnMarqueeItem); |
326 m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleMcnMarqueeItem); |
340 m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleMcnIcon); |
327 m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleMcnIcon); |
341 } |
328 } |
342 |
329 |
343 if (m_preferences->preference(InfoWidgetPreferences::DisplaySatText).compare( |
330 if (m_preferences->preference(InfoWidgetPreferences::DisplaySatText).compare( |
344 DISPLAY_SETTING_ON) == 0) { |
331 DISPLAY_SETTING_OFF) == 0) { |
345 layoutRows++; |
|
346 } else { |
|
347 m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleSatMarqueeItem); |
332 m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleSatMarqueeItem); |
348 m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleSatTextIcon); |
333 m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleSatTextIcon); |
349 } |
334 } |
350 |
|
351 if (m_animatingItems.count() == 0) { |
|
352 m_animatingItem = NULL; |
|
353 } |
|
354 |
|
355 m_layoutManager->setLayoutRows(layoutRows); |
|
356 } |
335 } |
357 |
336 |
358 /*! |
337 /*! |
359 Layout info display. |
338 Layout info display. |
360 */ |
339 */ |
361 void InfoWidget::layoutInfoDisplay() |
340 void InfoWidget::layoutInfoDisplay() |
362 { |
341 { |
363 DPRINT; |
342 DPRINT; |
364 QGraphicsLayout *infoDisplayLayout = |
343 QGraphicsWidget *infoDisplay = |
365 m_layoutManager->layoutInfoDisplay(); |
344 m_layoutManager->layoutInfoDisplay(); |
366 |
345 if ((!m_layout->count()) && infoDisplay) { |
367 if (!m_layout->count()) { |
346 m_layout->addItem(infoDisplay); |
368 QGraphicsWidget *contentWidget = |
347 } |
369 m_layoutManager->contentWidget(); |
348 |
370 if (contentWidget) { |
|
371 // Add content widget to main layout |
|
372 m_layout->addItem(contentWidget); |
|
373 } |
|
374 } |
|
375 updateItemsVisibility(); |
349 updateItemsVisibility(); |
376 endChanges(); |
350 endChanges(); |
377 } |
351 } |
378 |
352 |
379 /*! |
353 /*! |
381 */ |
355 */ |
382 void InfoWidget::layoutSettingsDialog() |
356 void InfoWidget::layoutSettingsDialog() |
383 { |
357 { |
384 DPRINT; |
358 DPRINT; |
385 startChanges(); |
359 startChanges(); |
386 |
360 HbDialog *settingsDialog = |
387 m_layoutManager->reloadWidgets(InfoWidgetLayoutManager::SettingsDialog); |
361 qobject_cast<HbDialog *>( |
388 QGraphicsLayout *settingDialogLayout = |
362 m_layoutManager->layoutSettingsDialog()); |
389 m_layoutManager->layoutSettingsDialog(); |
363 |
390 |
364 if (settingsDialog) { |
391 if (settingDialogLayout) { |
365 initializeSettingsDialogItems(); |
392 HbDialog *settingsDialog = qobject_cast<HbDialog *>( |
366 settingsDialog->setDismissPolicy(HbDialog::NoDismiss); |
393 m_layoutManager->getWidget(InfoWidgetLayoutManager:: |
367 settingsDialog->setTimeout(HbDialog::NoTimeout); |
394 RoleSettingsDialog)); |
368 settingsDialog->open(this, |
395 |
369 SLOT(settingsDialogClosed(HbAction *))); |
396 if (settingsDialog) { |
370 } |
397 initializeSettingsDialogItems(); |
|
398 settingsDialog->setDismissPolicy(HbDialog::NoDismiss); |
|
399 settingsDialog->setTimeout(HbDialog::NoTimeout); |
|
400 settingsDialog->open(this, |
|
401 SLOT(settingsDialogClosed(HbAction *))); |
|
402 } |
|
403 } |
|
404 } |
371 } |
405 |
372 |
406 /*! |
373 /*! |
407 Set up initial check box states |
374 Set up initial check box states |
408 and connect signals to local slots. |
375 and connect signals to local slots. |
457 QString text) |
424 QString text) |
458 { |
425 { |
459 DPRINT; |
426 DPRINT; |
460 HbMarqueeItem *marqueeItem = qobject_cast<HbMarqueeItem *>( |
427 HbMarqueeItem *marqueeItem = qobject_cast<HbMarqueeItem *>( |
461 m_layoutManager->getWidget(itemRole)); |
428 m_layoutManager->getWidget(itemRole)); |
462 |
|
463 if (marqueeItem) { |
429 if (marqueeItem) { |
464 marqueeItem->setText(text); |
430 marqueeItem->setText(text); |
465 marqueeItem->setTextColor( HbColorScheme::color( |
431 marqueeItem->setTextColor( HbColorScheme::color( |
466 "qtc_hs_list_item_title_normal")); |
432 "qtc_hs_list_item_title_normal")); |
467 |
433 |
795 when the settings dialog is closed with Ok action. |
761 when the settings dialog is closed with Ok action. |
796 */ |
762 */ |
797 void InfoWidget::settingsEditingFinished() |
763 void InfoWidget::settingsEditingFinished() |
798 { |
764 { |
799 DPRINT; |
765 DPRINT; |
800 |
|
801 if (m_preferences->validate()) { |
766 if (m_preferences->validate()) { |
802 |
767 |
803 // Signal HS framework to store Meta-object |
768 // Signal HS framework to store Meta-object |
804 // preferences if preferences have changed. |
769 // preferences if preferences have changed. |
805 if (m_preferences->storePreferences()) { |
770 if (m_preferences->storePreferences()) { |
807 m_preferences->preferenceNames()); |
772 m_preferences->preferenceNames()); |
808 } |
773 } |
809 |
774 |
810 // Visible item configuration changed, reload |
775 // Visible item configuration changed, reload |
811 // widgets. Restores deleted items. |
776 // widgets. Restores deleted items. |
812 m_layoutManager->reloadWidgets( |
777 m_layoutManager->loadWidgets( |
813 InfoWidgetLayoutManager::InfoDisplay); |
778 InfoWidgetLayoutManager::InfoDisplay); |
814 m_layoutManager->removeWidget( |
779 m_layoutManager->removeWidget( |
815 InfoWidgetLayoutManager::RoleSettingsDialog, |
780 InfoWidgetLayoutManager::RoleSettingsDialog, |
816 true); |
781 true); |
817 |
782 |
832 void InfoWidget::settingsEditingCancelled() |
797 void InfoWidget::settingsEditingCancelled() |
833 { |
798 { |
834 DPRINT; |
799 DPRINT; |
835 m_preferences->restorePreferences(); |
800 m_preferences->restorePreferences(); |
836 |
801 |
837 m_layoutManager->reloadWidgets( |
802 m_layoutManager->loadWidgets( |
838 InfoWidgetLayoutManager::InfoDisplay); |
803 InfoWidgetLayoutManager::InfoDisplay); |
839 m_layoutManager->removeWidget( |
804 m_layoutManager->removeWidget( |
840 InfoWidgetLayoutManager::RoleSettingsDialog, |
805 InfoWidgetLayoutManager::RoleSettingsDialog, |
841 true); |
806 true); |
842 } |
807 } |