Songbook-Client  0.7
This application is a manager of customguitar songbooks
 All Classes Files Functions Variables Enumerations Enumerator Pages
library-download.hh
Go to the documentation of this file.
1 // Copyright (C) 2009-2011, Romain Goffe <romain.goffe@gmail.com>
2 // Copyright (C) 2009-2011, Alexandre Dupas <alexandre.dupas@gmail.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License as
6 // published by the Free Software Foundation; either version 2 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 // 02110-1301, USA.
18 //******************************************************************************
19 
20 #ifndef __LIBRARY_DOWNLOAD_HH__
21 #define __LIBRARY_DOWNLOAD_HH__
22 
23 #include <QDialog>
24 #include <QDir>
25 #include <QTime>
26 #include <QList>
27 #include <QSslError>
28 
29 class QNetworkAccessManager;
30 class QNetworkReply;
31 class QComboBox;
32 
33 class CFileChooser;
34 class CMainWindow;
35 
46 class CLibraryDownload : public QDialog
47 {
48  Q_OBJECT
49 
50 public:
53 
56 
61  bool saveToDisk(const QString &filename, QIODevice *data);
62 
68  bool decompress(const QString &filename, QDir &directory);
69 
70 public slots:
73  void downloadFinished();
74 
75  void sslErrors(const QList<QSslError> &errors);
76 
78  void downloadStart();
79 
80  void downloadProgress(qint64 bytesRead, qint64 totalBytes);
81 
82  void cancelDownload();
83 
84 private:
85  CMainWindow * parent();
86  QString bytesToString(double bytes);
87  QString findFileName();
88 
89  QNetworkAccessManager *m_manager;
90  QNetworkReply *m_reply;
91  QComboBox *m_url;
92  CFileChooser *m_path;
93  QTime m_downloadTime;
94 };
95 
96 #endif // __LIBRARY_DOWNLOAD_HH_