diff -r 8b2d6d0384b0 -r d9aefe59d544 camerauis/cameraxui/cxengine/inc/cxefilesavethreadsymbian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/inc/cxefilesavethreadsymbian.h Fri Apr 16 14:51:30 2010 +0300 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2009-2009 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 CXEFILESAVETHREADSYMBIAN_H +#define CXEFILESAVETHREADSYMBIAN_H + +#include +#include +#include +#include +#include "cxeerror.h" +#include "cxefilesavethread.h" + +class CxeImageDataItem; +class CxeThumbnailManagerSymbian; +class CxeHarvesterControlSymbian; + + +class CxeFileSaveThreadSymbian : public CxeFileSaveThread + { + Q_OBJECT +public: + + CxeFileSaveThreadSymbian(QObject *parent = 0); + ~CxeFileSaveThreadSymbian(); + + /** + * Save is called by Camera UI thread. + * Method takes ownership of data. + */ + void save(CxeImageDataItem* data); + +public slots: + void handleVideoSaved(CxeError::Id status, const QString& filename); + void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, const QString& filename); + void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, int id); + + +protected slots: + void handleFileHarvested(CxeError::Id status, const QString& filename); + +protected: + virtual void init(); + virtual void deinit(); + +private: + /** + * This method includes saving in own thread. + * Functions called from this method are running in "saving thread" + */ + void run(); + void read(); + void saveNow(); + void harvestFile(const QString& filename); + +private: // data shared between the threads + + bool mExitThread; + QQueue mQueue; + + mutable QMutex mMutex; + QWaitCondition mDataToSave; + + mutable QMutex mSnapshotsMutex; + QHash mSnapshots; + +protected: // thread only used data + int mCount; + int mActiveHarvests; + bool mExit; + CxeThumbnailManagerSymbian *mThumbnailManager; // own + CxeHarvesterControlSymbian *mHarvesterControl; // own + }; + +#endif // CXEFILESAVETHREADSYMBIAN_H