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