camerauis/cameraxui/cxengine/inc/cxefilesavethreaddesktop.h
branchRCL_3
changeset 24 bac7acad7cb3
parent 23 61bc0f252b2b
child 25 2c87b2808fd7
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
     1 /*
       
     2 * Copyright (c) 2010 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:  Still image saving thread
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CXEFILESAVETHREADDESKTOP_H
       
    19 #define CXEFILESAVETHREADDESKTOP_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <QThread>
       
    23 #include <QMutex>
       
    24 #include <QWaitCondition>
       
    25 #include "cxefilesavethread.h"
       
    26 
       
    27 class CxeImageDataItem;
       
    28 
       
    29 
       
    30 class CxeFileSaveThreadDesktop : public CxeFileSaveThread
       
    31 {
       
    32     Q_OBJECT
       
    33 public:
       
    34 
       
    35     CxeFileSaveThreadDesktop(QObject *parent = 0);
       
    36     ~CxeFileSaveThreadDesktop();
       
    37 
       
    38     void save(CxeImageDataItem *data);
       
    39 
       
    40 public slots:
       
    41     void handleVideoSaved(CxeError::Id status, const QString &filename);
       
    42     void handleSnapshotReady(CxeError::Id status, const QImage &snapshot, const QString &filename);
       
    43     void handleSnapshotReady(CxeError::Id status, const QImage &snapshot, int id);
       
    44 
       
    45 private:
       
    46     /**
       
    47      * This method includes saving in own thread.
       
    48      * Functions called from this method are running in "saving thread"
       
    49      */
       
    50     void run();
       
    51     void read();
       
    52 
       
    53 private: // data shared between the threads
       
    54     
       
    55     bool mExitThread;
       
    56     QList<CxeImageDataItem*> mDataList; //! @todo Consider QQueue 
       
    57 
       
    58     QMutex mMutex;
       
    59     QWaitCondition mDataToSave;
       
    60 
       
    61 private: // thread private data    
       
    62     int mCount;
       
    63     bool mExit;
       
    64 };
       
    65 
       
    66 #endif // CXEFILESAVETHREADDESKTOP_H