42 lines
880 B
C++
42 lines
880 B
C++
#ifndef WEBIMAGEVIEW_H_
|
|
#define WEBIMAGEVIEW_H_
|
|
|
|
#include <bb/cascades/ImageView>
|
|
#include <QUrl>
|
|
using namespace bb::cascades;
|
|
|
|
class QNetworkAccessManager;
|
|
class WebImageView: public bb::cascades::ImageView {
|
|
Q_OBJECT
|
|
Q_PROPERTY (QUrl url READ url WRITE setUrl NOTIFY urlChanged)
|
|
Q_PROPERTY (float loading READ loading NOTIFY loadingChanged)
|
|
|
|
public:
|
|
WebImageView();
|
|
const QUrl& url() const;
|
|
double loading() const;
|
|
|
|
public Q_SLOTS:
|
|
void setUrl(const QUrl& url);
|
|
|
|
private Q_SLOTS:
|
|
void imageLoaded();
|
|
void dowloadProgressed(qint64,qint64);
|
|
|
|
signals:
|
|
void urlChanged();
|
|
void loadingChanged();
|
|
|
|
|
|
private:
|
|
static QNetworkAccessManager * mNetManager;
|
|
static QNetworkDiskCache * mNetworkDiskCache;
|
|
QUrl mUrl;
|
|
QUrl mRedirectUrl;
|
|
float mLoading;
|
|
|
|
QUrl redirectUrl(const QUrl& possibleRedirectUrl, const QUrl& oldRedirectUrl) const;
|
|
};
|
|
|
|
#endif /* WEBIMAGEVIEW_H_ */
|