camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h
changeset 39 c5025ea871a1
parent 38 0f0b4c1d7744
child 40 2922f70fca82
equal deleted inserted replaced
38:0f0b4c1d7744 39:c5025ea871a1
     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".
    25 #include <hbframedrawer.h>
    25 #include <hbframedrawer.h>
    26 
    26 
    27 #include "cxezoomcontrol.h"
    27 #include "cxezoomcontrol.h"
    28 #include "cxeviewfindercontrol.h"
    28 #include "cxeviewfindercontrol.h"
    29 #include "cxuidisplaypropertyhandler.h"
    29 #include "cxuidisplaypropertyhandler.h"
       
    30 #include "cxuiview.h"
    30 
    31 
    31 
    32 
    32 class HbAction;
    33 class HbAction;
    33 class HbLabel;
    34 class HbLabel;
    34 class HbSlider;
    35 class HbSlider;
    48 class CxuiZoomSlider;
    49 class CxuiZoomSlider;
    49 
    50 
    50 /**
    51 /**
    51  * Pre-capture view
    52  * Pre-capture view
    52  */
    53  */
    53 class CxuiPrecaptureView : public HbView
    54 class CxuiPrecaptureView : public CxuiView
    54 {
    55 {
    55     Q_OBJECT
    56     Q_OBJECT
    56 
    57 
    57 public:
    58 public:
    58     CxuiPrecaptureView(QGraphicsItem *parent = 0);
    59     CxuiPrecaptureView(QGraphicsItem *parent = 0);
    59 
    60 
    60     virtual ~CxuiPrecaptureView();
    61     virtual ~CxuiPrecaptureView();
    61 
    62 
    62 public:
    63 public:
    63 
    64 
    64     /**
       
    65      * Construct-method handles initialisation tasks for this class.
       
    66      * @param mainwindow
       
    67      * @param engine
       
    68      * @param documentLoader
       
    69      * @param keyHandler
       
    70      */
       
    71     virtual void construct(HbMainWindow *mainWindow, CxeEngine *engine,
    65     virtual void construct(HbMainWindow *mainWindow, CxeEngine *engine,
    72                            CxuiDocumentLoader *documentLoader,
    66                            CxuiDocumentLoader *documentLoader,
    73                            CxuiCaptureKeyHandler *keyHandler);
    67                            CxuiCaptureKeyHandler *keyHandler);
    74 
    68 
    75     /**
    69     /**
    76      * Loads widgets that are not part of the default section in layouts xml.
    70      * Loads widgets that are not part of the default section in layouts xml.
    77      * Widgets are created at the time they are first loaded.
    71      * Widgets are created at the time they are first loaded.
    78      */
    72      */
    79     virtual void loadWidgets() = 0;
    73     virtual void loadWidgets() = 0;
    80     void prepareWindow();
    74     void prepareWindow();
    81     virtual void updateOrientation(Qt::Orientation orient) = 0;
       
    82 
    75 
    83 public slots:
    76 public slots:
    84 
    77 
    85     void releaseCamera();
       
    86     void initCamera();
    78     void initCamera();
    87     void requestCameraSwitch();
    79     void requestCameraSwitch();
    88 
    80 
    89     // whenever a setting is changed on the engine side, an icon might need updating
    81     // whenever a setting is changed on the engine side, an icon might need updating
    90     // connects to the settingValueChanged signal of CxeSettings
    82     // connects to the settingValueChanged signal of CxeSettings
   102     virtual void handleFocusGained();
    94     virtual void handleFocusGained();
   103     virtual void handleFocusLost() = 0;
    95     virtual void handleFocusLost() = 0;
   104     // UI: Zoom slider change notification
    96     // UI: Zoom slider change notification
   105     void zoomTo(int value);
    97     void zoomTo(int value);
   106 
    98 
   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();
    99     void disableControlsTimeout();
   113 
   100 
   114     void toggleZoom();
   101     void toggleZoom();
   115     void hideToolbar();
       
   116 
       
   117     void launchPhotosApp();
       
   118     void launchVideosApp();
       
   119 
   102 
   120     // Settings related
   103     // Settings related
   121     void launchNotSupportedNotification();
       
   122     void launchDiskFullNotification();
   104     void launchDiskFullNotification();
   123     void showSettingsGrid();
   105     void showSettingsGrid();
   124     void hideSettingsGrid();
   106     void hideSettingsGrid();
   125     void launchSliderSetting();
   107     void launchSliderSetting();
   126     void prepareToShowDialog(HbAction *action);
   108     void prepareToShowDialog(HbAction *action);
   127     void prepareToCloseDialog(HbAction *action);
   109     void prepareToCloseDialog(HbAction *action);
   128 
   110 
   129 protected:
   111 protected:
   130 
   112     void toggleControls();
   131    virtual void initializeSettingsGrid() = 0;
   113     virtual void initializeSettingsGrid() = 0;
   132 
       
   133     void hideZoom();
       
   134     void showZoom();
       
   135     void hideIndicators();
       
   136     void showIndicators();
       
   137     void showEvent(QShowEvent *event);
   114     void showEvent(QShowEvent *event);
   138     void hideEvent(QHideEvent *event);
   115     void hideEvent(QHideEvent *event);
   139     void mousePressEvent(QGraphicsSceneMouseEvent *event);
   116     void mousePressEvent(QGraphicsSceneMouseEvent *event);
   140     virtual void showToolbar();
       
   141     bool eventFilter(QObject *object, QEvent *event);
   117     bool eventFilter(QObject *object, QEvent *event);
   142     void launchSettingsDialog(QObject *action);
   118     void launchSettingsDialog(QObject *action);
   143     bool isPostcaptureOn() const;
   119     bool isPostcaptureOn() const;
   144     void addIncreaseDecreaseButtons(CxuiZoomSlider *slider);
   120     void addIncreaseDecreaseButtons(CxuiZoomSlider *slider);
   145     QString getSettingItemIcon(const QString &key, QVariant value);
   121     QString getSettingItemIcon(const QString &key, QVariant value);
   146     void updateQualityIcon();
   122     void updateQualityIcon();
   147     void updateSceneIcon(const QString& sceneId);
   123     void updateSceneIcon(const QString& sceneId);
   148     void createWidgetBackgroundGraphic(HbWidget *widget,
   124 
   149                                        const QString &graphicName,
       
   150                                        HbFrameDrawer::FrameType frameType =
       
   151                                        HbFrameDrawer::NinePieces);
       
   152 
   125 
   153 signals:
   126 signals:
   154 
   127 
   155     // signals to switch to post/pre-capture view.
   128     // signals to switch to post/pre-capture view.
   156     void changeToPostcaptureView();
   129     void changeToPostcaptureView();
   163     void startStandbyTimer();
   136     void startStandbyTimer();
   164     void stopStandbyTimer();
   137     void stopStandbyTimer();
   165 
   138 
   166     // signal to report error to ErrorManager for further actions.
   139     // signal to report error to ErrorManager for further actions.
   167     void reportError(CxeError::Id errorId);
   140     void reportError(CxeError::Id errorId);
   168     void showScenesView();
       
   169 
   141 
   170 protected:
   142 protected:
   171     CxeEngine *mEngine; // not own
       
   172     HbTransparentWindow *mViewfinder; // not own, owned by the graphics scene
   143     HbTransparentWindow *mViewfinder; // not own, owned by the graphics scene
   173     HbMainWindow *mMainWindow; // not own
       
   174     CxuiDocumentLoader *mDocumentLoader; // not own
       
   175     CxuiDisplayPropertyHandler *mDisplayHandler;
   144     CxuiDisplayPropertyHandler *mDisplayHandler;
   176     bool   mControlsVisible;
       
   177     QTimer mHideControlsTimeout;
       
   178     CxuiZoomSlider *mSlider; // zoom slider, not own, owned by the graphics scene
       
   179     HbToolBar *mToolBar; // not own, owned by the graphics scene
       
   180     HbToolBarExtension *mSettingsGrid;
   145     HbToolBarExtension *mSettingsGrid;
   181     bool mZoomVisible;
       
   182     bool mWidgetsLoaded;
   146     bool mWidgetsLoaded;
   183     CxuiSettingDialog *mSettingsDialog;
   147     CxuiSettingDialog *mSettingsDialog;
   184     CxuiSettingRadioButtonList *mSettingsDialogList;
   148     CxuiSettingRadioButtonList *mSettingsDialogList;
   185     CxuiCaptureKeyHandler *mKeyHandler;
       
   186     HbLabel *mQualityIcon;
   149     HbLabel *mQualityIcon;
   187     HbWidget *mIndicators;
       
   188 
   150 
   189 private:
   151 private:
   190     CxuiSettingDialog* createSettingsDialog();
   152     CxuiSettingDialog* createSettingsDialog();
   191     CxuiSettingDialog* createSliderSettingsDialog();
   153     CxuiSettingDialog* createSliderSettingsDialog();
   192     QPointF getDialogPosition();
   154     QPointF getDialogPosition();