DownloadDialog.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2011 Jürgen Riegel <juergen.riegel@web.de>              *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 #ifndef GUI_DOWNLOADDIALOG_H
00024 #define GUI_DOWNLOADDIALOG_H
00025 
00026 #include <QtCore>
00027 #include <QDialog>
00028 #include <QUrl>
00029 #include <QMessageBox>
00030 #include <QBuffer>
00031 #include <QLabel>
00032 #include <QProgressDialog>
00033 #include <QHttp>
00034 #include <QFileInfo>
00035 #include <QCloseEvent>
00036 
00037 namespace Gui {
00038 namespace Dialog {
00039 
00044 class GuiExport DownloadDialog : public QDialog
00045 {
00046     Q_OBJECT
00047 
00048 public:
00049 
00050     DownloadDialog( QUrl url, QString s, QString p = QString() );
00051     ~DownloadDialog();
00052     QUrl url;
00053     QString purpose;
00054     QString path;
00055     QByteArray ba;
00056     bool stopped;
00057     QByteArray return_data();
00058 
00059 public Q_SLOTS:
00060 
00061     void request_finished( int, bool );
00062     void cancel_download();
00063     void update_progress( int read_bytes, int total_bytes );
00064     void read_response_header(const QHttpResponseHeader & response_header);
00065 
00066 Q_SIGNALS:
00067 
00068     void download_finished( DownloadDialog * d,
00069                             bool ok,
00070                             QString s,
00071                             QString p,
00072                             QString e );
00073 
00074 
00075 protected:
00076 
00077     QHttp * http;
00078     int http_request_id;
00079     QBuffer * buffer;
00080     void closeEvent( QCloseEvent * e );
00081 
00082 private:
00083 
00084     bool url_is_valid;
00085     QProgressDialog * progressDialog;
00086     QLabel * statusLabel;
00087 
00088 };
00089 
00090 } // namespace Dialog
00091 } // namespace Gui
00092 
00093 
00094 #endif // GUI_DOWNLOADDIALOG_H

Generated on Wed Nov 23 19:00:08 2011 for FreeCAD by  doxygen 1.6.1