Subversion Repositories svn1-original

Rev

Rev 381 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*============================================================================ 
*           Copyright (C) 2013 Embedded Solutions
**============================================================================
**
**  Project/Product : 
**  Filename        : qmhttppath.h
**  Author(s)       : DDP
**
**  Description     : Class to load an HTML file from a URL
**                    This version will save it as a data blob internally
**                    Commented out code will write it to a file
**
**  Information     :
**   Compiler       : ANSI C++
**   Target         : 
**
***==========================================================================*/

#ifndef HTTPWINDOW_H
#define HTTPWINDOW_H

#include <QDialog>
#include <QNetworkAccessManager>
#include <QUrl>

QT_BEGIN_NAMESPACE
class QDialogButtonBox;
class QFile;
class QLabel;
class QLineEdit;
class QProgressDialog;
class QPushButton;
class QSslError;
class QAuthenticator;
class QNetworkReply;


QT_END_NAMESPACE

class Qmhttppath : public QDialog
{
    Q_OBJECT

public:
    Qmhttppath(QWidget *parent = 0);

    void startRequest(QUrl url);

    QByteArray allData;
    QLineEdit *urlLineEdit;

private slots:
    void downloadFile();
    void cancelDownload();
    void httpFinished();
    void httpReadyRead();
    void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
    void enableDownloadButton();
    void slotAuthenticationRequired(QNetworkReply*,QAuthenticator *);
#ifndef QT_NO_OPENSSL
    void sslErrors(QNetworkReply*,const QList<QSslError> &errors);
#endif

private:
    QLabel *statusLabel;
    QLabel *urlLabel;

    QProgressDialog *progressDialog;
    QPushButton *downloadButton;
    QPushButton *quitButton;
    QDialogButtonBox *buttonBox;

    QUrl url;
    QNetworkAccessManager qnam;
    QNetworkReply *reply;
    //QFile *file;
    int httpGetId;
    bool httpRequestAborted;
};

#endif