camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp
changeset 56 01e205c615b9
parent 48 42ba2d16bf40
child 60 a289dde0a1d6
equal deleted inserted replaced
48:42ba2d16bf40 56:01e205c615b9
    30 #include <hbmessagebox.h>
    30 #include <hbmessagebox.h>
    31 #include <hbaction.h>
    31 #include <hbaction.h>
    32 #include <hbstyle.h>
    32 #include <hbstyle.h>
    33 #include <hbframeitem.h>
    33 #include <hbframeitem.h>
    34 #include <hbwidget.h>
    34 #include <hbwidget.h>
       
    35 #include <hbeffect.h>
       
    36 #include <hbinstance.h>
    35 
    37 
    36 #include "cxeengine.h"
    38 #include "cxeengine.h"
    37 #include "cxeviewfindercontrol.h"
    39 #include "cxeviewfindercontrol.h"
    38 #include "cxezoomcontrol.h"
    40 #include "cxezoomcontrol.h"
    39 #include "cxecameradevicecontrol.h"
    41 #include "cxecameradevicecontrol.h"
   164     }
   166     }
   165 
   167 
   166     OstTrace0(camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT_2, "msg: e_CX_PRECAPVIEW_CONSTRUCT 0");
   168     OstTrace0(camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT_2, "msg: e_CX_PRECAPVIEW_CONSTRUCT 0");
   167 
   169 
   168     QCoreApplication::instance()->installEventFilter(this);
   170     QCoreApplication::instance()->installEventFilter(this);
       
   171 
       
   172     HbEffect::add("toolbarextension", "camera_toolbarextension_appear", "toolbarextension_appear");
       
   173     HbEffect::add("toolbarextension", "camera_toolbarextension_disappear", "toolbarextension_disappear");
       
   174 
   169     CX_DEBUG_EXIT_FUNCTION();
   175     CX_DEBUG_EXIT_FUNCTION();
   170 }
   176 }
   171 
   177 
   172 /*!
   178 /*!
   173 * Is standby mode supported / needed by this view.
   179 * Is standby mode supported / needed by this view.
   571 
   577 
   572     mSettingsDialogList = qobject_cast<CxuiSettingRadioButtonList *>(
   578     mSettingsDialogList = qobject_cast<CxuiSettingRadioButtonList *>(
   573                                     documentLoader->findWidget(SETTINGS_DIALOG_CONTENT_WIDGET));
   579                                     documentLoader->findWidget(SETTINGS_DIALOG_CONTENT_WIDGET));
   574     CX_ASSERT_ALWAYS(mSettingsDialogList);
   580     CX_ASSERT_ALWAYS(mSettingsDialogList);
   575 
   581 
       
   582 	// The radio button size policy defaults to "Expanding" which makes it
       
   583 	// always full screen. Let's override the policy here to make the layout
       
   584 	// reasonable.
       
   585     mSettingsDialogList->setSizePolicy(QSizePolicy(QSizePolicy::Ignored,
       
   586 	                                               QSizePolicy::Maximum));
       
   587 
   576     QObject *object = documentLoader->findObject(SETTINGS_DIALOG_OK_ACTION);
   588     QObject *object = documentLoader->findObject(SETTINGS_DIALOG_OK_ACTION);
   577     mSettingsDialogOkAction = qobject_cast<HbAction *>(object);
   589     mSettingsDialogOkAction = qobject_cast<HbAction *>(object);
   578     CX_DEBUG_ASSERT(mSettingsDialogOkAction);
   590     CX_DEBUG_ASSERT(mSettingsDialogOkAction);
   579 
   591 
   580     CX_DEBUG_EXIT_FUNCTION();
   592     CX_DEBUG_EXIT_FUNCTION();
   783     // Show grid modally.
   795     // Show grid modally.
   784     // This call will still not block until grid is dismissed.
   796     // This call will still not block until grid is dismissed.
   785     if(mSettingsGrid) {
   797     if(mSettingsGrid) {
   786         mSettingsGrid->setModal(true);
   798         mSettingsGrid->setModal(true);
   787         mSettingsGrid->show();
   799         mSettingsGrid->show();
       
   800         HbEffect::start(mSettingsGrid, "toolbarextension", "toolbarextension_appear");
   788     }
   801     }
   789 
   802 
   790     CX_DEBUG_EXIT_FUNCTION();
   803     CX_DEBUG_EXIT_FUNCTION();
   791 }
   804 }
   792 
   805 
   795 */
   808 */
   796 void CxuiPrecaptureView::hideSettingsGrid()
   809 void CxuiPrecaptureView::hideSettingsGrid()
   797 {
   810 {
   798     CX_DEBUG_ENTER_FUNCTION();
   811     CX_DEBUG_ENTER_FUNCTION();
   799     if (mSettingsGrid) {
   812     if (mSettingsGrid) {
   800         mSettingsGrid->hide();
   813         // Hiding of the settingsgrid will be done after effect has finished
       
   814         HbEffect::start(mSettingsGrid, "toolbarextension", "toolbarextension_disappear", this, "toolbarExtensionDisappearEffectFinished");
   801     }
   815     }
   802     CX_DEBUG_EXIT_FUNCTION();
   816     CX_DEBUG_EXIT_FUNCTION();
   803 }
   817 }
   804 
   818 
   805 /*!
   819 /*!
   806 * Returns dialogs bottom right corner
   820 * Returns dialogs bottom right corner
   807 */
   821 */
   808 QPointF CxuiPrecaptureView::getDialogPosition()
   822 QPointF CxuiPrecaptureView::getDialogPosition()
   809 {
   823 {
   810     HbStyle *style = new HbStyle();
   824     HbStyle *style = HbInstance::instance()->style();
   811     qreal bottomMargin;
   825 
   812     qreal rightMargin;
   826     if (style) {
   813     bool ok = style->parameter("hb-param-margin-gene-bottom", bottomMargin);
   827         qreal bottomMargin = 0.0f;
   814     CX_ASSERT_ALWAYS(ok);
   828         qreal rightMargin = 0.0f;
   815     ok = style->parameter("hb-param-margin-gene-right", rightMargin);
   829         bool ok = style->parameter("hb-param-margin-gene-bottom",
   816     CX_ASSERT_ALWAYS(ok);
   830                                    bottomMargin);
   817 
   831         CX_DEBUG_ASSERT(ok);
   818     // calculate dialog's bottom right position
   832         ok = style->parameter("hb-param-margin-gene-right",
   819     QSize deviceRes = mEngine->viewfinderControl().deviceDisplayResolution();
   833                               rightMargin);
   820     QPointF point(deviceRes.width() - rightMargin, deviceRes.height() - bottomMargin);
   834         CX_DEBUG_ASSERT(ok);
   821 
   835 
   822     delete style;
   836         // calculate dialog's bottom right position
   823 
   837         QSize deviceRes =
   824     return point;
   838             mEngine->viewfinderControl().deviceDisplayResolution();
       
   839         QPointF point(deviceRes.width() - rightMargin,
       
   840                       deviceRes.height() - bottomMargin);
       
   841 
       
   842         style = NULL; // owned by HbInstance
       
   843         return point;
       
   844     } else {
       
   845         return QPointF(); // (0, 0)
       
   846     }
   825 }
   847 }
   826 
   848 
   827 
   849 
   828 /*!
   850 /*!
   829     Get setting item icon for given value.
   851     Get setting item icon for given value.
   880 
   902 
   881     CX_DEBUG_EXIT_FUNCTION();
   903     CX_DEBUG_EXIT_FUNCTION();
   882 }
   904 }
   883 
   905 
   884 
   906 
       
   907 void CxuiPrecaptureView::toolbarExtensionDisappearEffectFinished(const HbEffect::EffectStatus &status) {
       
   908     if (mSettingsGrid) {
       
   909         mSettingsGrid->hide();
       
   910     }
       
   911 }
       
   912 
       
   913 void CxuiPrecaptureView::toolbarExtensionAppearEffectFinished(const HbEffect::EffectStatus &status) {
       
   914 }
       
   915 
       
   916 
       
   917 
   885 /*!
   918 /*!
   886 * Lauches "Geotagging first-time use" notification to the user
   919 * Lauches "Geotagging first-time use" notification to the user
   887 */
   920 */
   888 void CxuiPrecaptureView::launchGeoTaggingDisclaimerDialog()
   921 void CxuiPrecaptureView::launchGeoTaggingDisclaimerDialog()
   889 {
   922 {