camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp
changeset 24 2094593137f5
parent 21 fa6d9f75d6a6
child 29 699651f2666f
equal deleted inserted replaced
21:fa6d9f75d6a6 24:2094593137f5
    99     mIndicators(NULL),
    99     mIndicators(NULL),
   100     mSettingsDialogHeading(NULL),
   100     mSettingsDialogHeading(NULL),
   101     mSliderSettingsDialog(NULL),
   101     mSliderSettingsDialog(NULL),
   102     mSliderSettingsDialogHeading(NULL),
   102     mSliderSettingsDialogHeading(NULL),
   103     mSettingsSlider(NULL),
   103     mSettingsSlider(NULL),
   104     mSettingsInfo(NULL)
   104     mSettingsInfo(NULL),
       
   105     mSettingsDialogOkAction(NULL),
       
   106     mSliderSettingsDialogOkAction(NULL)
   105 {
   107 {
   106     CX_DEBUG_ENTER_FUNCTION();
   108     CX_DEBUG_ENTER_FUNCTION();
   107     mDisplayHandler = new CxuiDisplayPropertyHandler();
   109     mDisplayHandler = new CxuiDisplayPropertyHandler();
   108     CX_DEBUG_EXIT_FUNCTION();
   110     CX_DEBUG_EXIT_FUNCTION();
   109 }
   111 }
   464 //
   466 //
   465 // ---------------------------------------------------------------------------
   467 // ---------------------------------------------------------------------------
   466 //
   468 //
   467 void CxuiPrecaptureView::mousePressEvent(QGraphicsSceneMouseEvent *event)
   469 void CxuiPrecaptureView::mousePressEvent(QGraphicsSceneMouseEvent *event)
   468 {
   470 {
   469     if (event->type() == QEvent::GraphicsSceneMousePress) {
   471     //! @todo temporary workaround for title bar mouse event handling bug
       
   472     if (event->type() == QEvent::GraphicsSceneMousePress && event->scenePos().y() > 70) {
   470         toggleControls();
   473         toggleControls();
   471         event->accept();
   474         event->accept();
   472     }
   475     }
   473 }
   476 }
   474 
   477 
   718 
   721 
   719     mSettingsDialogList = qobject_cast<CxuiSettingRadioButtonList *>(
   722     mSettingsDialogList = qobject_cast<CxuiSettingRadioButtonList *>(
   720                                     documentLoader->findWidget(SETTINGS_DIALOG_CONTENT_WIDGET));
   723                                     documentLoader->findWidget(SETTINGS_DIALOG_CONTENT_WIDGET));
   721     CX_ASSERT_ALWAYS(mSettingsDialogList);
   724     CX_ASSERT_ALWAYS(mSettingsDialogList);
   722 
   725 
       
   726     QObject *object = documentLoader->findObject(SETTINGS_DIALOG_OK_ACTION);
       
   727     mSettingsDialogOkAction = qobject_cast<HbAction *>(object);
       
   728     CX_DEBUG_ASSERT(mSettingsDialogOkAction);
   723 
   729 
   724     CX_DEBUG_EXIT_FUNCTION();
   730     CX_DEBUG_EXIT_FUNCTION();
   725 
   731 
   726     delete documentLoader;
   732     delete documentLoader;
   727     documentLoader = NULL;
   733     documentLoader = NULL;
   771             // Store action that starts the dialog.
   777             // Store action that starts the dialog.
   772             // Dialog passes this along with it's signals,
   778             // Dialog passes this along with it's signals,
   773             // so we can easily decide if we show grid again or not.
   779             // so we can easily decide if we show grid again or not.
   774             mSettingsDialog->setStarterAction(qobject_cast<HbAction *>(action));
   780             mSettingsDialog->setStarterAction(qobject_cast<HbAction *>(action));
   775 
   781 
   776             HbAction *okAction = mSettingsDialog->primaryAction();
   782             if (mSettingsDialogOkAction) {
   777             if (okAction) {
   783                 // disconnect ok action from dialog so that dialog won't be closed
   778                 // disconnect primary action from dialog so that dialog won't be closed
       
   779                 // automatically when action is triggered. handleSelectionAccepted
   784                 // automatically when action is triggered. handleSelectionAccepted
   780                 // is called instead
   785                 // is called instead
   781                 okAction->disconnect(mSettingsDialog);
   786                 mSettingsDialogOkAction->disconnect(mSettingsDialog);
   782                 connect(okAction, SIGNAL(triggered()), mSettingsDialogList, SLOT(handleSelectionAccepted()));
   787                 connect(mSettingsDialogOkAction, SIGNAL(triggered()), mSettingsDialogList, SLOT(handleSelectionAccepted()));
   783 
   788 
   784                 // Close the dialog when new setting value is committed
   789                 // Close the dialog when new setting value is committed
   785                 connect(mSettingsDialogList, SIGNAL(selectionCommitted()), mSettingsDialog, SLOT(close()));
   790                 connect(mSettingsDialogList, SIGNAL(selectionCommitted()), mSettingsDialog, SLOT(close()));
   786 
   791 
   787                 connect(mSettingsDialog, SIGNAL(aboutToClose()), mSettingsDialogList, SLOT(handleClose()));
   792                 connect(mSettingsDialog, SIGNAL(aboutToClose()), mSettingsDialogList, SLOT(handleClose()));
   826 
   831 
   827     mSettingsSlider = qobject_cast<CxuiSettingSlider *>(
   832     mSettingsSlider = qobject_cast<CxuiSettingSlider *>(
   828                                     documentLoader->findWidget(SETTINGS_SLIDER_DIALOG_CONTENT_WIDGET));
   833                                     documentLoader->findWidget(SETTINGS_SLIDER_DIALOG_CONTENT_WIDGET));
   829     CX_ASSERT_ALWAYS(mSettingsSlider);
   834     CX_ASSERT_ALWAYS(mSettingsSlider);
   830 
   835 
       
   836     QObject *object = documentLoader->findObject(SETTINGS_DIALOG_OK_ACTION);
       
   837     mSliderSettingsDialogOkAction = qobject_cast<HbAction *>(object);
       
   838     CX_DEBUG_ASSERT(mSliderSettingsDialogOkAction);
   831 
   839 
   832     CX_DEBUG_EXIT_FUNCTION();
   840     CX_DEBUG_EXIT_FUNCTION();
   833 
   841 
   834     delete documentLoader;
   842     delete documentLoader;
   835     documentLoader = NULL;
   843     documentLoader = NULL;
   877             // Store action that starts the dialog.
   885             // Store action that starts the dialog.
   878             // Dialog passes this along with it's signals,
   886             // Dialog passes this along with it's signals,
   879             // so we can easily decide if we show grid again or not.
   887             // so we can easily decide if we show grid again or not.
   880             mSliderSettingsDialog->setStarterAction(qobject_cast<HbAction *>(action));
   888             mSliderSettingsDialog->setStarterAction(qobject_cast<HbAction *>(action));
   881 
   889 
   882             HbAction *okAction = mSliderSettingsDialog->primaryAction();
   890             if (mSliderSettingsDialogOkAction) {
   883             if (okAction) {
   891                 // disconnect ok action from dialog so that dialog won't be closed
   884                 // disconnect primary action from dialog so that dialog won't be closed
       
   885                 // automatically when action is triggered. handleSelectionAccepted
   892                 // automatically when action is triggered. handleSelectionAccepted
   886                 // is called instead
   893                 // is called instead
   887                 okAction->disconnect(mSliderSettingsDialog);
   894                 mSliderSettingsDialogOkAction->disconnect(mSliderSettingsDialog);
   888                 connect(okAction, SIGNAL(triggered()), mSettingsSlider, SLOT(handleSelectionAccepted()));
   895                 connect(mSliderSettingsDialogOkAction, SIGNAL(triggered()), mSettingsSlider, SLOT(handleSelectionAccepted()));
   889 
   896 
   890                 // Close the dialog when new setting value is committed
   897                 // Close the dialog when new setting value is committed
   891                 connect(mSettingsSlider, SIGNAL(selectionCommitted()), mSliderSettingsDialog, SLOT(close()));
   898                 connect(mSettingsSlider, SIGNAL(selectionCommitted()), mSliderSettingsDialog, SLOT(close()));
   892 
   899 
   893                 connect(mSliderSettingsDialog, SIGNAL(aboutToClose()), mSettingsSlider, SLOT(handleClose()));
   900                 connect(mSliderSettingsDialog, SIGNAL(aboutToClose()), mSettingsSlider, SLOT(handleClose()));
   925 * Show "not supported" notification.
   932 * Show "not supported" notification.
   926 */
   933 */
   927 void CxuiPrecaptureView::launchNotSupportedNotification()
   934 void CxuiPrecaptureView::launchNotSupportedNotification()
   928 {
   935 {
   929     CX_DEBUG_ENTER_FUNCTION();
   936     CX_DEBUG_ENTER_FUNCTION();
   930 
   937     HbNotificationDialog::launchDialog("Notification", "Not supported yet");
   931     // Instantiate a popup
       
   932     HbNotificationDialog note;
       
   933     note.setTitle("Notification");
       
   934     note.setText("Not supported yet");
       
   935     note.exec();
       
   936 
       
   937     CX_DEBUG_EXIT_FUNCTION();
   938     CX_DEBUG_EXIT_FUNCTION();
   938 }
   939 }
   939 
   940 
   940 /*!
   941 /*!
   941 * Show "Disk full" notification.
   942 * Show "Disk full" notification.
  1014 * \param slider Pointer to the slider object, where the buttons will be added
  1015 * \param slider Pointer to the slider object, where the buttons will be added
  1015 */
  1016 */
  1016 void CxuiPrecaptureView::addIncreaseDecreaseButtons(CxuiZoomSlider *slider)
  1017 void CxuiPrecaptureView::addIncreaseDecreaseButtons(CxuiZoomSlider *slider)
  1017 {
  1018 {
  1018     // get current slider elements
  1019     // get current slider elements
  1019     QList<HbSlider::SliderElement> elements = slider->elements();
  1020     QList<QVariant> elements = slider->sliderElements();
       
  1021 
  1020     // add increase and decrease elements to the slider
  1022     // add increase and decrease elements to the slider
  1021     elements << HbSlider::IncreaseElement << HbSlider::DecreaseElement;
  1023     elements << HbSlider::IncreaseElement << HbSlider::DecreaseElement;
  1022     slider->setElements(elements);
  1024     slider->setSliderElements(elements);
       
  1025 
  1023     // set icons for the increase and decrease element
  1026     // set icons for the increase and decrease element
  1024     slider->setIcon(HbSlider::DecreaseElement , HbIcon("qtg_mono_minus"));
  1027     slider->setElementIcon(HbSlider::DecreaseElement , HbIcon("qtg_mono_minus"));
  1025     slider->setIcon(HbSlider::IncreaseElement , HbIcon("qtg_mono_plus"));
  1028     slider->setElementIcon(HbSlider::IncreaseElement , HbIcon("qtg_mono_plus"));
  1026 }
  1029 }
  1027 
  1030 
  1028 
  1031 
  1029 /*!
  1032 /*!
  1030 * Function can be used to create a graphics item and setting it as a background
  1033 * Function can be used to create a graphics item and setting it as a background
  1036                                                        const QString &graphicName,
  1039                                                        const QString &graphicName,
  1037                                                        HbFrameDrawer::FrameType frameType)
  1040                                                        HbFrameDrawer::FrameType frameType)
  1038 {
  1041 {
  1039     if (widget) {
  1042     if (widget) {
  1040         HbFrameDrawer *drawer = new HbFrameDrawer(graphicName, frameType);
  1043         HbFrameDrawer *drawer = new HbFrameDrawer(graphicName, frameType);
  1041     
  1044 
  1042         if (drawer) {
  1045         if (drawer) {
  1043             HbFrameItem *backgroundItem = new HbFrameItem(drawer, widget);
  1046             HbFrameItem *backgroundItem = new HbFrameItem(drawer, widget);
  1044             if (backgroundItem) {
  1047             if (backgroundItem) {
  1045                 // set item to fill the whole widget
  1048                 // set item to fill the whole widget
  1046                 backgroundItem->setGeometry(QRectF(QPointF(0, 0), widget->size()));
  1049                 backgroundItem->setGeometry(QRectF(QPointF(0, 0), widget->size()));