camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h
changeset 43 0e652f8f1fbd
parent 28 3075d9b614e6
equal deleted inserted replaced
28:3075d9b614e6 43:0e652f8f1fbd
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    23 #include <hbview.h>
    23 #include <hbview.h>
    24 #include <hbradiobuttonlist.h>
    24 #include <hbradiobuttonlist.h>
    25 #include <hbframedrawer.h>
    25 #include <hbframedrawer.h>
    26 
    26 
    27 #include "cxezoomcontrol.h"
    27 #include "cxezoomcontrol.h"
       
    28 #include "cxegeotaggingtrail.h"
    28 #include "cxeviewfindercontrol.h"
    29 #include "cxeviewfindercontrol.h"
    29 #include "cxuidisplaypropertyhandler.h"
    30 #include "cxuidisplaypropertyhandler.h"
       
    31 #include "cxuiview.h"
    30 
    32 
    31 
    33 
    32 class HbAction;
    34 class HbAction;
    33 class HbLabel;
    35 class HbLabel;
    34 class HbSlider;
    36 class HbSlider;
    44 class CxuiSettingRadioButtonList;
    46 class CxuiSettingRadioButtonList;
    45 class CxuiSettingSlider;
    47 class CxuiSettingSlider;
    46 class HbToolBarExtension;
    48 class HbToolBarExtension;
    47 class HbWidget;
    49 class HbWidget;
    48 class CxuiZoomSlider;
    50 class CxuiZoomSlider;
       
    51 class CxuiFullScreenPopup;
       
    52 
    49 
    53 
    50 /**
    54 /**
    51  * Pre-capture view
    55  * Pre-capture view
    52  */
    56  */
    53 class CxuiPrecaptureView : public HbView
    57 class CxuiPrecaptureView : public CxuiView
    54 {
    58 {
    55     Q_OBJECT
    59     Q_OBJECT
    56 
    60 
    57 public:
    61 public:
    58     CxuiPrecaptureView(QGraphicsItem *parent = 0);
    62     CxuiPrecaptureView(QGraphicsItem *parent = 0);
    59 
    63 
    60     virtual ~CxuiPrecaptureView();
    64     virtual ~CxuiPrecaptureView();
    61 
    65 
    62 public:
    66 public:
    63 
    67 
       
    68     virtual void construct(HbMainWindow *mainWindow,
       
    69                            CxeEngine *engine,
       
    70                            CxuiDocumentLoader *documentLoader,
       
    71                            CxuiCaptureKeyHandler *keyHandler,
       
    72                            HbActivityManager *activityManager);
       
    73 
       
    74     virtual bool isStandbyModeSupported() const;
    64     /**
    75     /**
    65      * Construct-method handles initialisation tasks for this class.
    76     * Loads widgets that are not part of the default section in layouts xml.
    66      * @param mainwindow
    77     * Widgets are created at the time they are first loaded.
    67      * @param engine
    78     */
    68      * @param documentLoader
       
    69      * @param keyHandler
       
    70      */
       
    71     virtual void construct(HbMainWindow *mainWindow, CxeEngine *engine,
       
    72                            CxuiDocumentLoader *documentLoader,
       
    73                            CxuiCaptureKeyHandler *keyHandler);
       
    74 
       
    75     /**
       
    76      * Loads widgets that are not part of the default section in layouts xml.
       
    77      * Widgets are created at the time they are first loaded.
       
    78      */
       
    79     virtual void loadWidgets() = 0;
    79     virtual void loadWidgets() = 0;
    80     void prepareWindow();
       
    81     virtual void updateOrientation(Qt::Orientation orient) = 0;
       
    82 
       
    83 public slots:
       
    84 
       
    85     void releaseCamera();
       
    86     void initCamera();
       
    87     void requestCameraSwitch();
       
    88 
       
    89     // whenever a setting is changed on the engine side, an icon might need updating
       
    90     // connects to the settingValueChanged signal of CxeSettings
       
    91     virtual void handleSettingValueChanged(const QString& key, QVariant newValue);
       
    92 
       
    93 protected slots:
       
    94 
       
    95     // Key events
       
    96     virtual void handleAutofocusKeyPressed();
       
    97 
       
    98     // Camera / Engine
       
    99     void handleEngineZoomStateChange(CxeZoomControl::State newState, CxeError::Id error);
       
   100     void handleZoomLevelChange(int);
       
   101     void handleVfStateChanged(CxeViewfinderControl::State newState, CxeError::Id error);
       
   102     virtual void handleFocusGained();
       
   103     virtual void handleFocusLost() = 0;
       
   104     // UI: Zoom slider change notification
       
   105     void zoomTo(int value);
       
   106 
       
   107     // Control visibility of all UI items at the same time: toolbar, zoom and titlepane items
       
   108     virtual void hideControls();
       
   109     virtual void showControls();
       
   110     void toggleControls();
       
   111 
       
   112     void disableControlsTimeout();
       
   113 
       
   114     void toggleZoom();
       
   115     void hideToolbar();
       
   116 
       
   117     void launchPhotosApp();
       
   118     void launchVideosApp();
       
   119 
       
   120     // Settings related
       
   121     void launchNotSupportedNotification();
       
   122     void launchDiskFullNotification();
       
   123     void showSettingsGrid();
       
   124     void hideSettingsGrid();
       
   125     void launchSliderSetting();
       
   126     void prepareToShowDialog(HbAction *action);
       
   127     void prepareToCloseDialog(HbAction *action);
       
   128 
       
   129 protected:
       
   130 
       
   131    virtual void initializeSettingsGrid() = 0;
       
   132 
       
   133     void hideZoom();
       
   134     void showZoom();
       
   135     void hideIndicators();
       
   136     void showIndicators();
       
   137     void showEvent(QShowEvent *event);
       
   138     void hideEvent(QHideEvent *event);
       
   139     void mousePressEvent(QGraphicsSceneMouseEvent *event);
       
   140     virtual void showToolbar();
       
   141     bool eventFilter(QObject *object, QEvent *event);
       
   142     void launchSettingsDialog(QObject *action);
       
   143     bool isPostcaptureOn() const;
       
   144     void addIncreaseDecreaseButtons(CxuiZoomSlider *slider);
       
   145     QString getSettingItemIcon(const QString &key, QVariant value);
       
   146     void updateQualityIcon();
       
   147     void createWidgetBackgroundGraphic(HbWidget *widget,
       
   148                                        const QString &graphicName,
       
   149                                        HbFrameDrawer::FrameType frameType =
       
   150                                        HbFrameDrawer::NinePieces);
       
   151 
    80 
   152 signals:
    81 signals:
       
    82 
       
    83     /*!
       
    84     * Signal that view is ready to be used.
       
    85     */
       
    86     void viewReady();
   153 
    87 
   154     // signals to switch to post/pre-capture view.
    88     // signals to switch to post/pre-capture view.
   155     void changeToPostcaptureView();
    89     void changeToPostcaptureView();
   156     void changeToPrecaptureView();
    90     void changeToPrecaptureView();
   157 
    91 
   161     // signals to start and stop standby timer
    95     // signals to start and stop standby timer
   162     void startStandbyTimer();
    96     void startStandbyTimer();
   163     void stopStandbyTimer();
    97     void stopStandbyTimer();
   164 
    98 
   165     // signal to report error to ErrorManager for further actions.
    99     // signal to report error to ErrorManager for further actions.
   166     void reportError(CxeError::Id errorId);
   100     void errorEncountered(CxeError::Id id);
   167     void showScenesView();
   101 
       
   102 public slots:
       
   103 
       
   104     void initCamera();
       
   105     void requestCameraSwitch();
       
   106 
       
   107     // whenever a setting is changed on the engine side, an icon might need updating
       
   108     // connects to the settingValueChanged signal of CxeSettings
       
   109     virtual void handleSettingValueChanged(const QString& key, QVariant newValue);
       
   110 
       
   111     // From CxuiView
       
   112     virtual void enterStandby();
       
   113     virtual void exitStandby();
       
   114 
       
   115 protected slots:
       
   116 
       
   117     // Key events
       
   118     virtual void handleAutofocusKeyPressed();
       
   119 
       
   120     // Camera / Engine
       
   121     void handleEngineZoomStateChange(CxeZoomControl::State newState, CxeError::Id error);
       
   122     void handleZoomLevelChange(int);
       
   123     void handleVfStateChanged(CxeViewfinderControl::State newState, CxeError::Id error);
       
   124     // UI: Zoom slider change notification
       
   125     void zoomTo(int value);
       
   126 
       
   127     void disableControlsTimeout();
       
   128 
       
   129     void toggleZoom();
       
   130 
       
   131     // Settings related
       
   132     void showSettingsGrid();
       
   133     void hideSettingsGrid();
       
   134     void launchSliderSetting();
       
   135     void prepareToShowDialog(HbAction *action);
       
   136     void prepareToCloseDialog(HbAction *action);
       
   137     void updateLocationIndicator(CxeGeoTaggingTrail::State newState, CxeError::Id error);
       
   138 
       
   139 private slots:
       
   140     void disableGeotaggingDisclaimer();
       
   141     void launchGeoTaggingSetting();
   168 
   142 
   169 protected:
   143 protected:
   170     CxeEngine *mEngine; // not own
   144     void toggleControls();
   171     HbTransparentWindow *mViewfinder; // not own, owned by the graphics scene
   145     virtual void initializeSettingsGrid() = 0;
   172     HbMainWindow *mMainWindow; // not own
   146     void showEvent(QShowEvent *event);
   173     CxuiDocumentLoader *mDocumentLoader; // not own
   147     void hideEvent(QHideEvent *event);
   174     CxuiDisplayPropertyHandler *mDisplayHandler;
   148     bool eventFilter(QObject *object, QEvent *event);
   175     bool   mControlsVisible;
   149     void launchSettingsDialog(QObject *action);
   176     QTimer mHideControlsTimeout;
   150     virtual bool isPostcaptureOn() const = 0;
   177     CxuiZoomSlider *mSlider; // zoom slider, not own, owned by the graphics scene
   151     void addIncreaseDecreaseButtons(CxuiZoomSlider *slider);
   178     HbToolBar *mToolBar; // not own, owned by the graphics scene
   152     QString getSettingItemIcon(const QString &key, QVariant value);
   179     HbToolBarExtension *mSettingsGrid;
   153     virtual void updateQualityIcon() = 0;
   180     bool mZoomVisible;
   154     virtual void updateSceneIcon(const QString& sceneId) = 0;
   181     bool mWidgetsLoaded;
   155     void launchGeoTaggingDisclaimerDialog();
   182     CxuiSettingDialog *mSettingsDialog;
       
   183     CxuiSettingRadioButtonList *mSettingsDialogList;
       
   184     CxuiCaptureKeyHandler *mKeyHandler;
       
   185     HbLabel *mQualityIcon;
       
   186     HbWidget *mIndicators;
       
   187 
   156 
   188 private:
   157 private:
   189     CxuiSettingDialog* createSettingsDialog();
   158     CxuiSettingDialog* createSettingsDialog();
   190     CxuiSettingDialog* createSliderSettingsDialog();
   159     CxuiSettingDialog* createSliderSettingsDialog();
   191     QPointF getDialogPosition();
   160     QPointF getDialogPosition();
       
   161 
       
   162 protected:
       
   163     HbTransparentWindow *mViewfinder; // not own, owned by the graphics scene
       
   164     CxuiDisplayPropertyHandler *mDisplayHandler;
       
   165     HbToolBarExtension *mSettingsGrid;
       
   166     bool mWidgetsLoaded;
       
   167     CxuiSettingDialog *mSettingsDialog;
       
   168     CxuiSettingRadioButtonList *mSettingsDialogList;
       
   169     HbLabel *mQualityIcon;
       
   170     HbLabel *mGeoTaggingIndicatorIcon;
       
   171     HbLabel *mFaceTrackingIcon;
       
   172     CxuiFullScreenPopup *mStandbyPopup;
       
   173 
   192 private:
   174 private:
   193     HbLabel *mSettingsDialogHeading;
   175     HbLabel *mSettingsDialogHeading;
   194 
   176 
   195     CxuiSettingDialog *mSliderSettingsDialog;
   177     CxuiSettingDialog *mSliderSettingsDialog;
   196     HbLabel *mSliderSettingsDialogHeading;
   178     HbLabel *mSliderSettingsDialogHeading;
   197     CxuiSettingSlider *mSettingsSlider;
   179     CxuiSettingSlider *mSettingsSlider;
   198 
   180 
   199     CxuiSettingsInfo *mSettingsInfo;
   181     CxuiSettingsInfo *mSettingsInfo;
   200     
   182 
   201     HbAction *mSettingsDialogOkAction;
   183     HbAction *mSettingsDialogOkAction;
   202     HbAction *mSliderSettingsDialogOkAction;
   184     HbAction *mSliderSettingsDialogOkAction;
   203 };
   185 };
   204 
   186 
   205 #endif // CXUIPRECAPTUREVIEW_H
   187 #endif // CXUIPRECAPTUREVIEW_H