qtmobility/examples/flickrdemo/flickrdemo.h
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 5 453da2cfceef
--- a/qtmobility/examples/flickrdemo/flickrdemo.h	Fri Apr 16 15:51:22 2010 +0300
+++ b/qtmobility/examples/flickrdemo/flickrdemo.h	Mon May 03 13:18:40 2010 +0300
@@ -42,8 +42,21 @@
 #ifndef FLICKRDEMO_H
 #define FLICKRDEMO_H
 
-#include <QtGui>
-#include <QtNetwork>
+#include <QDialog>
+#include <QMainWindow>
+#include <QNetworkReply>
+#include <QSize>
+
+QT_BEGIN_NAMESPACE
+class QAction;
+class QDialogButtonBox;
+class QLabel;
+class QNetworkAccessManager;
+class QNetworkRequest;
+class QProgressDialog;
+class QPushButton;
+class QWidget;
+QT_END_NAMESPACE
 
 //// QtMobility API headers
 #include <qmobilityglobal.h>
@@ -86,9 +99,25 @@
     void downloadButtonClicked();
     void cancelDownload();
 
-    void httpRequestFinished(int requestId, bool error);
-    void readResponseHeader(const QHttpResponseHeader& responseHeader);
-    void updateDataReadProgress(int bytesRead, int totalBytes);
+    /*
+        void httpRequestFinished(int requestId, bool error);
+        void readResponseHeader(const QHttpResponseHeader& responseHeader);
+        void updateDataReadProgress(int bytesRead, int totalBytes);
+    */
+
+    void pictureListDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
+    void pictureListFinished();
+    void pictureListError(QNetworkReply::NetworkError code);
+    void clearPictureListRequest();
+
+    void thumbnailFinished();
+    void thumbnailError(QNetworkReply::NetworkError code);
+    void clearThumbnailRequest();
+
+    void pictureDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
+    void pictureFinished();
+    void pictureError(QNetworkReply::NetworkError code);
+    void clearPictureRequest();
 
     // QGeoPositionInfoSource
     void positionUpdated(const QGeoPositionInfo &gpsPos);
@@ -104,7 +133,7 @@
     static const QString apikey;
     static const QString savePath;
 
-    void displayImage();
+    void displayImage(const QPixmap &pixmap);
 
     QLabel *locationLabel;
     QLabel *satellitesLabel;
@@ -121,12 +150,11 @@
     ConnectivityHelper *m_connectivityHelper;
 
     QProgressDialog *m_progressDialog;
-    QHttp *m_http;
-    QString m_filePath;
-    QFile* m_file;
-    int m_httpGetId;
-    int m_httpThumbnailGetId;
-    bool m_httpRequestAborted;
+
+    QNetworkAccessManager *m_nam;
+    QNetworkReply *m_pictureListReply;
+    QNetworkReply *m_thumbnailReply;
+    QNetworkReply *m_pictureReply;
 
     int m_pages;
     int m_page;
@@ -137,10 +165,9 @@
     double m_longitude;
 
     bool m_downloadPictureList;
-
-    bool m_downloadingThumbnails;
     int m_nameCounter;
     QStringList m_names;
+    bool m_shuttingDown;
 };
 
 class PictureDialog: public QDialog
@@ -148,19 +175,12 @@
     Q_OBJECT
 
 public:
-    PictureDialog(const QString& filePath, const QString& pictureName, QWidget* parent = 0);
-
-private slots:
-    void clicked(QAbstractButton *button);
+    PictureDialog(const QPixmap& pixmapd, const QString& pictureName, QWidget* parent = 0);
 
 private:
-    static const QSize imageSize;
-
     QLabel *label;
     QLabel *imageLabel;
     QDialogButtonBox *buttonBox;
-    QPushButton *keepButton;
-    QPushButton *discardButton;
 };
 
 #endif // FLICKRDEMO_H