camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.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 CXUIVIDEOPRECAPTUREVIEW_H
       
    18 #define CXUIVIDEOPRECAPTUREVIEW_H
       
    19 
       
    20 #include <QTimer>
       
    21 #include <QPropertyAnimation>
       
    22 
       
    23 #include "cxuiprecaptureview.h"
       
    24 #include "cxevideocapturecontrol.h"
       
    25 
       
    26 class HbLabel;
       
    27 class HbAction;
       
    28 class CxeVideoCaptureControl;
       
    29 class CxuiDocumentLoader;
       
    30 class CxuiCaptureKeyHandler;
       
    31 class HbDialog;
       
    32 
       
    33 
       
    34 /**
       
    35  * Pre-capture view for video recording mode
       
    36  */
       
    37 class CxuiVideoPrecaptureView : public CxuiPrecaptureView
       
    38     {
       
    39     Q_OBJECT
       
    40 
       
    41 public:
       
    42     CxuiVideoPrecaptureView(QGraphicsItem *parent = 0);
       
    43 
       
    44     virtual ~CxuiVideoPrecaptureView();
       
    45 
       
    46 public:
       
    47 
       
    48     /**
       
    49      * Construct-method handles initialisation tasks for this class.
       
    50      * @param mainwindow
       
    51      * @param engine
       
    52      * @param documentLoader
       
    53      * @param keyHandler
       
    54      */
       
    55     void construct(HbMainWindow *mainwindow, CxeEngine *engine,
       
    56                    CxuiDocumentLoader *documentLoader,
       
    57                    CxuiCaptureKeyHandler *keyHandler = NULL);
       
    58 
       
    59     /**
       
    60      * Loads widgets that are needed right from the start.
       
    61      */
       
    62     virtual void loadDefaultWidgets();
       
    63 
       
    64     /**
       
    65      * Loads widgets that are not part of the default section in layouts xml.
       
    66      * Widgets are created at the time they are first loaded.
       
    67      */
       
    68     virtual void loadWidgets();
       
    69 
       
    70     void updateOrientation(Qt::Orientation orientation);
       
    71 
       
    72 public slots:
       
    73 
       
    74     // from CxuiPrecaptureView
       
    75     virtual void handleSettingValueChanged(const QString& key, QVariant newValue);
       
    76 
       
    77     void handleQuitClicked();
       
    78 
       
    79 protected slots:
       
    80 
       
    81     void handleSnapshot(CxeError::Id error);
       
    82     void record();
       
    83     void pause();
       
    84     void stop();
       
    85     void stopAndPrepareNewVideo();
       
    86     void goToStill();
       
    87     void showEvent(QShowEvent *event);
       
    88     void handleVideoStateChanged(CxeVideoCaptureControl::State newState, CxeError::Id error);
       
    89     void handleCaptureKeyPressed();
       
    90     void prepareNewVideo(CxeError::Id error = CxeError::None);
       
    91     void toggleLight();
       
    92     void launchVideoScenePopup();
       
    93     void launchSetting();
       
    94 
       
    95     /**
       
    96      * Application focus slots are called if focus state is changed.
       
    97      * Recording is stopped and camera released or reserved according to new state.
       
    98      */
       
    99     void handleFocusLost();
       
   100 
       
   101     /**
       
   102      * Battery almost empty warning signal.
       
   103      * Need to stop ongoing recording.
       
   104      */
       
   105     void handleBatteryEmpty();
       
   106 
       
   107     void updateTimeLabels();
       
   108 
       
   109 protected:
       
   110 
       
   111     void setVideoTime(HbLabel* label, int time);
       
   112     bool getElapsedTime();
       
   113     void getRemainingTime();
       
   114     virtual void showToolbar();
       
   115     void disableFeedback();
       
   116     void enableFeedback();
       
   117 
       
   118     void initializeSettingsGrid();
       
   119     void setRecordingItemsVisibility(bool visible);
       
   120 
       
   121 protected:
       
   122     QTimer mElapsedTimer;
       
   123     int mTimeElapsed;
       
   124     int mTimeRemaining;
       
   125 
       
   126     HbLabel *mElapsedTimeText; // not own
       
   127     HbLabel *mRemainingTimeText; // not own
       
   128     HbLabel *mRecordingIcon; // not own
       
   129     HbAction *mGoToStillAction; // not own
       
   130     HbToolBar *mToolBarIdle; // not own
       
   131     HbToolBar *mToolBarRec; // not own
       
   132     HbToolBar *mToolBarPaused; // not own
       
   133     HbAction *mToggleLightAction; // not own
       
   134     HbDialog *mVideoScenePopup;
       
   135     CxeVideoCaptureControl *mVideoCaptureControl;
       
   136     HbMenu *mMenu;    // own
       
   137     QPropertyAnimation* mRecordingAnimation; //For recording indicator
       
   138 
       
   139     bool mCapturePending;
       
   140     };
       
   141 
       
   142 #endif // CXUIVIDEOPRECAPTUREVIEW_H