fd6d52184f4e952447398dba49c5ac7657723002
[harmattan/cameraplus] / src / quillitem.h
1 // -*- c++ -*-
2
3 #ifndef QUILL_ITEM_H
4 #define QUILL_ITEM_H
5
6 #include <QDeclarativeItem>
7
8 class QuillFile;
9
10 class QuillItem : public QDeclarativeItem {
11   Q_OBJECT
12
13   Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged);
14   Q_PROPERTY(QString mimeType READ mimeType WRITE setMimeType NOTIFY mimeTypeChanged);
15   Q_PROPERTY(bool error READ error NOTIFY errorChanged);
16
17 public:
18   QuillItem(QDeclarativeItem *parent = 0);
19   ~QuillItem();
20
21   QUrl source() const;
22   void setSource(const QUrl& src);
23
24   QString mimeType() const;
25   void setMimeType(const QString& mime);
26
27   void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
28
29   virtual void componentComplete();
30
31   bool error() const;
32
33 signals:
34   void sourceChanged();
35   void error(const QString& err);
36   void mimeTypeChanged();
37   void errorChanged();
38
39 private slots:
40   void fileLoaded();
41   bool fileError();
42
43 private:
44   void recreate();
45
46   QuillFile *m_file;
47   QUrl m_url;
48   QString m_type;
49   bool m_error;
50 };
51
52 #endif /* QUILL_ITEM_H */