|
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 CXEIMAGEDATAITEM_H |
|
18 #define CXEIMAGEDATAITEM_H |
|
19 |
|
20 #include <QObject> |
|
21 #include <QString> |
|
22 #include <QMetaType> |
|
23 |
|
24 #include "cxeerror.h" |
|
25 |
|
26 class CxeImageDataItem; |
|
27 class QImage; |
|
28 |
|
29 /** |
|
30 * CxeImageDataItem represents a single object that is in a queue to be saved to |
|
31 * the file system. |
|
32 */ |
|
33 class CxeImageDataItem : public QObject |
|
34 { |
|
35 Q_OBJECT |
|
36 |
|
37 public: |
|
38 // State Machine |
|
39 enum State { |
|
40 SavePending = 0x01, |
|
41 Saving = 0x02, |
|
42 Saved = 0x04, |
|
43 SaveFailed = 0x08 |
|
44 }; |
|
45 |
|
46 /** |
|
47 * Helper method to save file to Fs |
|
48 * @return symbian error code |
|
49 */ |
|
50 virtual CxeError::Id save() = 0; |
|
51 |
|
52 /** |
|
53 * Get the current state for this item. |
|
54 * |
|
55 * @return State |
|
56 */ |
|
57 virtual State state() const = 0; |
|
58 |
|
59 /** |
|
60 * Get the id of this item. |
|
61 */ |
|
62 virtual int id() const = 0; |
|
63 |
|
64 /** |
|
65 * Get the id of this item. |
|
66 */ |
|
67 virtual QString path() const = 0; |
|
68 |
|
69 signals: |
|
70 void imageSaved(CxeError::Id error, const QString& filename, int id); |
|
71 void stateChanged( State newState, CxeError::Id error ); |
|
72 |
|
73 protected: |
|
74 CxeImageDataItem() {} |
|
75 |
|
76 private: |
|
77 Q_DISABLE_COPY(CxeImageDataItem) |
|
78 }; |
|
79 |
|
80 Q_DECLARE_METATYPE(CxeImageDataItem::State) |
|
81 |
|
82 #endif // CXEIMAGEDATAITEM_H |