camerauis/cameraxui/cxengine/inc/cxefilesavethreaddesktop.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 18 Aug 2010 09:37:18 +0300
changeset 48 42ba2d16bf40
permissions -rw-r--r--
Revision: 201031 Kit: 201033

/*
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Still image saving thread
*
*/

#ifndef CXEFILESAVETHREADDESKTOP_H
#define CXEFILESAVETHREADDESKTOP_H

#include <QObject>
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include "cxefilesavethread.h"

class CxeImageDataItem;


class CxeFileSaveThreadDesktop : public CxeFileSaveThread
{
    Q_OBJECT
public:

    CxeFileSaveThreadDesktop(QObject *parent = 0);
    ~CxeFileSaveThreadDesktop();

    void save(CxeImageDataItem *data);

public slots:
    void handleVideoSaved(CxeError::Id status, const QString &filename);
    void handleSnapshotReady(CxeError::Id status, const QImage &snapshot, const QString &filename);
    void handleSnapshotReady(CxeError::Id status, const QImage &snapshot, int id);

private:
    /**
     * This method includes saving in own thread.
     * Functions called from this method are running in "saving thread"
     */
    void run();
    void read();

private: // data shared between the threads
    
    bool mExitThread;
    QList<CxeImageDataItem*> mDataList; //! @todo Consider QQueue 

    QMutex mMutex;
    QWaitCondition mDataToSave;

private: // thread private data    
    int mCount;
    bool mExit;
};

#endif // CXEFILESAVETHREADDESKTOP_H