e8f00844a6feea994534fd288b53742e4ff2c294
[profile/ivi/qtdeclarative.git] / src / quick / items / qquickimagebase_p.h
1 // Commit: af05f64d3edc860c3cf79c7f0bdf2377faae5f40
2 /****************************************************************************
3 **
4 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
5 ** All rights reserved.
6 ** Contact: http://www.qt-project.org/
7 **
8 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 **
10 ** $QT_BEGIN_LICENSE:LGPL$
11 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this
15 ** file. Please review the following information to ensure the GNU Lesser
16 ** General Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** GNU General Public License Usage
24 ** Alternatively, this file may be used under the terms of the GNU General
25 ** Public License version 3.0 as published by the Free Software Foundation
26 ** and appearing in the file LICENSE.GPL included in the packaging of this
27 ** file. Please review the following information to ensure the GNU General
28 ** Public License version 3.0 requirements will be met:
29 ** http://www.gnu.org/copyleft/gpl.html.
30 **
31 ** Other Usage
32 ** Alternatively, this file may be used in accordance with the terms and
33 ** conditions contained in a signed written agreement between you and Nokia.
34 **
35 **
36 **
37 **
38 **
39 ** $QT_END_LICENSE$
40 **
41 ****************************************************************************/
42
43 #ifndef QQUICKIMAGEBASE_P_H
44 #define QQUICKIMAGEBASE_P_H
45
46 #include "qquickimplicitsizeitem_p.h"
47
48 QT_BEGIN_HEADER
49
50 QT_BEGIN_NAMESPACE
51
52 class QQuickImageBasePrivate;
53 class Q_AUTOTEST_EXPORT QQuickImageBase : public QQuickImplicitSizeItem
54 {
55     Q_OBJECT
56     Q_ENUMS(Status)
57
58     Q_PROPERTY(Status status READ status NOTIFY statusChanged)
59     Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
60     Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
61     Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged)
62     Q_PROPERTY(bool cache READ cache WRITE setCache NOTIFY cacheChanged)
63     Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize RESET resetSourceSize NOTIFY sourceSizeChanged)
64     Q_PROPERTY(bool mirror READ mirror WRITE setMirror NOTIFY mirrorChanged)
65
66 public:
67     QQuickImageBase(QQuickItem *parent=0);
68     ~QQuickImageBase();
69     enum Status { Null, Ready, Loading, Error };
70     Status status() const;
71     qreal progress() const;
72
73     QUrl source() const;
74     virtual void setSource(const QUrl &url);
75
76     bool asynchronous() const;
77     void setAsynchronous(bool);
78
79     bool cache() const;
80     void setCache(bool);
81
82     QImage image() const;
83
84     virtual void setSourceSize(const QSize&);
85     QSize sourceSize() const;
86     void resetSourceSize();
87
88     virtual void setMirror(bool mirror);
89     bool mirror() const;
90
91 Q_SIGNALS:
92     void sourceChanged(const QUrl &);
93     void sourceSizeChanged();
94     void statusChanged(QQuickImageBase::Status);
95     void progressChanged(qreal progress);
96     void asynchronousChanged();
97     void cacheChanged();
98     void mirrorChanged();
99
100 protected:
101     virtual void load();
102     virtual void componentComplete();
103     virtual void pixmapChange();
104     QQuickImageBase(QQuickImageBasePrivate &dd, QQuickItem *parent);
105
106 private Q_SLOTS:
107     virtual void requestFinished();
108     void requestProgress(qint64,qint64);
109
110 private:
111     Q_DISABLE_COPY(QQuickImageBase)
112     Q_DECLARE_PRIVATE(QQuickImageBase)
113 };
114
115 QT_END_NAMESPACE
116
117 QT_END_HEADER
118
119 #endif // QQUICKIMAGEBASE_P_H