qtmobility/examples/flickrdemo/flickrdemo.h
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 5 453da2cfceef
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    40 ****************************************************************************/
    40 ****************************************************************************/
    41 
    41 
    42 #ifndef FLICKRDEMO_H
    42 #ifndef FLICKRDEMO_H
    43 #define FLICKRDEMO_H
    43 #define FLICKRDEMO_H
    44 
    44 
    45 #include <QtGui>
    45 #include <QDialog>
    46 #include <QtNetwork>
    46 #include <QMainWindow>
       
    47 #include <QNetworkReply>
       
    48 #include <QSize>
       
    49 
       
    50 QT_BEGIN_NAMESPACE
       
    51 class QAction;
       
    52 class QDialogButtonBox;
       
    53 class QLabel;
       
    54 class QNetworkAccessManager;
       
    55 class QNetworkRequest;
       
    56 class QProgressDialog;
       
    57 class QPushButton;
       
    58 class QWidget;
       
    59 QT_END_NAMESPACE
    47 
    60 
    48 //// QtMobility API headers
    61 //// QtMobility API headers
    49 #include <qmobilityglobal.h>
    62 #include <qmobilityglobal.h>
    50 
    63 
    51 #include "xqlistwidget.h"
    64 #include "xqlistwidget.h"
    84     void networkSessionOpened();
    97     void networkSessionOpened();
    85 
    98 
    86     void downloadButtonClicked();
    99     void downloadButtonClicked();
    87     void cancelDownload();
   100     void cancelDownload();
    88 
   101 
    89     void httpRequestFinished(int requestId, bool error);
   102     /*
    90     void readResponseHeader(const QHttpResponseHeader& responseHeader);
   103         void httpRequestFinished(int requestId, bool error);
    91     void updateDataReadProgress(int bytesRead, int totalBytes);
   104         void readResponseHeader(const QHttpResponseHeader& responseHeader);
       
   105         void updateDataReadProgress(int bytesRead, int totalBytes);
       
   106     */
       
   107 
       
   108     void pictureListDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
       
   109     void pictureListFinished();
       
   110     void pictureListError(QNetworkReply::NetworkError code);
       
   111     void clearPictureListRequest();
       
   112 
       
   113     void thumbnailFinished();
       
   114     void thumbnailError(QNetworkReply::NetworkError code);
       
   115     void clearThumbnailRequest();
       
   116 
       
   117     void pictureDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
       
   118     void pictureFinished();
       
   119     void pictureError(QNetworkReply::NetworkError code);
       
   120     void clearPictureRequest();
    92 
   121 
    93     // QGeoPositionInfoSource
   122     // QGeoPositionInfoSource
    94     void positionUpdated(const QGeoPositionInfo &gpsPos);
   123     void positionUpdated(const QGeoPositionInfo &gpsPos);
    95 
   124 
    96     // QGeoSatelliteInfoSource
   125     // QGeoSatelliteInfoSource
   102     static const QSize thumbnailSize;
   131     static const QSize thumbnailSize;
   103     static const QSize imageSize;
   132     static const QSize imageSize;
   104     static const QString apikey;
   133     static const QString apikey;
   105     static const QString savePath;
   134     static const QString savePath;
   106 
   135 
   107     void displayImage();
   136     void displayImage(const QPixmap &pixmap);
   108 
   137 
   109     QLabel *locationLabel;
   138     QLabel *locationLabel;
   110     QLabel *satellitesLabel;
   139     QLabel *satellitesLabel;
   111     XQListWidget *listWidget;
   140     XQListWidget *listWidget;
   112     QPushButton *downloadButton;
   141     QPushButton *downloadButton;
   119 
   148 
   120     QNetworkSession* m_session;
   149     QNetworkSession* m_session;
   121     ConnectivityHelper *m_connectivityHelper;
   150     ConnectivityHelper *m_connectivityHelper;
   122 
   151 
   123     QProgressDialog *m_progressDialog;
   152     QProgressDialog *m_progressDialog;
   124     QHttp *m_http;
   153 
   125     QString m_filePath;
   154     QNetworkAccessManager *m_nam;
   126     QFile* m_file;
   155     QNetworkReply *m_pictureListReply;
   127     int m_httpGetId;
   156     QNetworkReply *m_thumbnailReply;
   128     int m_httpThumbnailGetId;
   157     QNetworkReply *m_pictureReply;
   129     bool m_httpRequestAborted;
       
   130 
   158 
   131     int m_pages;
   159     int m_pages;
   132     int m_page;
   160     int m_page;
   133 
   161 
   134     int m_satellitesInView;
   162     int m_satellitesInView;
   135     int m_satellitesUsed;
   163     int m_satellitesUsed;
   136     double m_latitude;
   164     double m_latitude;
   137     double m_longitude;
   165     double m_longitude;
   138 
   166 
   139     bool m_downloadPictureList;
   167     bool m_downloadPictureList;
   140 
       
   141     bool m_downloadingThumbnails;
       
   142     int m_nameCounter;
   168     int m_nameCounter;
   143     QStringList m_names;
   169     QStringList m_names;
       
   170     bool m_shuttingDown;
   144 };
   171 };
   145 
   172 
   146 class PictureDialog: public QDialog
   173 class PictureDialog: public QDialog
   147 {
   174 {
   148     Q_OBJECT
   175     Q_OBJECT
   149 
   176 
   150 public:
   177 public:
   151     PictureDialog(const QString& filePath, const QString& pictureName, QWidget* parent = 0);
   178     PictureDialog(const QPixmap& pixmapd, const QString& pictureName, QWidget* parent = 0);
   152 
       
   153 private slots:
       
   154     void clicked(QAbstractButton *button);
       
   155 
   179 
   156 private:
   180 private:
   157     static const QSize imageSize;
       
   158 
       
   159     QLabel *label;
   181     QLabel *label;
   160     QLabel *imageLabel;
   182     QLabel *imageLabel;
   161     QDialogButtonBox *buttonBox;
   183     QDialogButtonBox *buttonBox;
   162     QPushButton *keepButton;
       
   163     QPushButton *discardButton;
       
   164 };
   184 };
   165 
   185 
   166 #endif // FLICKRDEMO_H
   186 #endif // FLICKRDEMO_H
   167 
   187