|
1 /* |
|
2 * Copyright (c) 2009-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: Still image saving thread |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CXEFILESAVETHREADSYMBIAN_H |
|
21 #define CXEFILESAVETHREADSYMBIAN_H |
|
22 |
|
23 #include <QMutex> |
|
24 #include <QWaitCondition> |
|
25 #include <QHash> |
|
26 #include <QQueue> |
|
27 #include "cxeerror.h" |
|
28 #include "cxefilesavethread.h" |
|
29 |
|
30 class CxeImageDataItem; |
|
31 class CxeThumbnailManagerSymbian; |
|
32 class CxeHarvesterControlSymbian; |
|
33 |
|
34 |
|
35 class CxeFileSaveThreadSymbian : public CxeFileSaveThread |
|
36 { |
|
37 Q_OBJECT |
|
38 public: |
|
39 |
|
40 CxeFileSaveThreadSymbian(QObject *parent = 0); |
|
41 ~CxeFileSaveThreadSymbian(); |
|
42 |
|
43 /** |
|
44 * Save is called by Camera UI thread. |
|
45 * Method takes ownership of data. |
|
46 */ |
|
47 void save(CxeImageDataItem* data); |
|
48 |
|
49 public slots: |
|
50 void handleVideoSaved(CxeError::Id status, const QString& filename); |
|
51 void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, const QString& filename); |
|
52 void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, int id); |
|
53 |
|
54 |
|
55 protected slots: |
|
56 void handleFileHarvested(CxeError::Id status, const QString& filename); |
|
57 |
|
58 protected: |
|
59 virtual void init(); |
|
60 virtual void deinit(); |
|
61 |
|
62 private: |
|
63 /** |
|
64 * This method includes saving in own thread. |
|
65 * Functions called from this method are running in "saving thread" |
|
66 */ |
|
67 void run(); |
|
68 void read(); |
|
69 void saveNow(); |
|
70 void harvestFile(const QString& filename); |
|
71 |
|
72 private: // data shared between the threads |
|
73 |
|
74 bool mExitThread; |
|
75 QQueue<CxeImageDataItem*> mQueue; |
|
76 |
|
77 mutable QMutex mMutex; |
|
78 QWaitCondition mDataToSave; |
|
79 |
|
80 mutable QMutex mSnapshotsMutex; |
|
81 QHash<QString, QPixmap> mSnapshots; |
|
82 |
|
83 protected: // thread only used data |
|
84 int mCount; |
|
85 int mActiveHarvests; |
|
86 bool mExit; |
|
87 CxeThumbnailManagerSymbian *mThumbnailManager; // own |
|
88 CxeHarvesterControlSymbian *mHarvesterControl; // own |
|
89 }; |
|
90 |
|
91 #endif // CXEFILESAVETHREADSYMBIAN_H |