Root/
| 1 | /* |
| 2 | * Copyright 2010-2011 Niels Kummerfeldt <niels.kummerfeldt@tu-harburg.de> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU 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, |
| 17 | * Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #ifndef DOWNLOADWIDGET_H |
| 21 | #define DOWNLOADWIDGET_H |
| 22 | |
| 23 | #include <QtGui/QCheckBox> |
| 24 | #include <QtGui/QLabel> |
| 25 | #include <QtGui/QLineEdit> |
| 26 | #include <QtGui/QListWidget> |
| 27 | #include <QtGui/QProgressBar> |
| 28 | #include <QtGui/QPushButton> |
| 29 | #include <QtGui/QSpinBox> |
| 30 | #include <QtGui/QTabWidget> |
| 31 | #include <QtGui/QWidget> |
| 32 | #include <QtNetwork/QNetworkAccessManager> |
| 33 | #include <QtNetwork/QNetworkReply> |
| 34 | |
| 35 | class DownloadWidget : public QWidget |
| 36 | { |
| 37 | Q_OBJECT |
| 38 | public: |
| 39 | DownloadWidget(QWidget *parent = 0); |
| 40 | ~DownloadWidget(); |
| 41 | |
| 42 | void setStartLevel(int level); |
| 43 | void setDownloadRect(const QRectF &rect); |
| 44 | |
| 45 | signals: |
| 46 | void back(); |
| 47 | void loadFile(const QString &filename, const QString &title); |
| 48 | |
| 49 | private slots: |
| 50 | void startDownload(); |
| 51 | void replyFinished(QNetworkReply *reply); |
| 52 | void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); |
| 53 | void saveDownload(); |
| 54 | void updateSourceList(); |
| 55 | |
| 56 | private: |
| 57 | enum DownloadMode { |
| 58 | Tiles, |
| 59 | POIs, |
| 60 | Packages, |
| 61 | SourceList |
| 62 | }; |
| 63 | |
| 64 | void startDownloadTiles(); |
| 65 | void replyFinishedTiles(QNetworkReply *reply); |
| 66 | void startDownloadPOIs(); |
| 67 | void replyFinishedPOIs(QNetworkReply *reply); |
| 68 | void startDownloadPackages(); |
| 69 | void replyFinishedPackages(QNetworkReply *reply); |
| 70 | QString lon2string(qreal lon); |
| 71 | QString lat2string(qreal lat); |
| 72 | int lon2tilex(qreal lon, int z); |
| 73 | int lat2tiley(qreal lat, int z); |
| 74 | |
| 75 | QNetworkAccessManager *m_manager; |
| 76 | DownloadMode m_downloadMode; |
| 77 | QTabWidget *m_tabWidget; |
| 78 | QProgressBar *m_dlProgress; |
| 79 | QPushButton *m_startButton, *m_backButton; |
| 80 | int m_startLevel; |
| 81 | QRectF m_dlRect; |
| 82 | QStringList m_dlList; |
| 83 | QNetworkReply *m_currentDownload; |
| 84 | QString m_prefix; |
| 85 | QLabel *m_up, *m_left, *m_right, *m_bottom; |
| 86 | QSpinBox *m_levelSpinBox; |
| 87 | QLineEdit *m_prefixInput; |
| 88 | QCheckBox *m_skipExisting; |
| 89 | QListWidget *m_poiTypes; |
| 90 | QCheckBox *m_makePOILayer; |
| 91 | QLineEdit *m_destFilename; |
| 92 | QListWidget *m_packageList; |
| 93 | QLineEdit *m_destDir; |
| 94 | |
| 95 | }; |
| 96 | |
| 97 | #endif // DOWNLOADWIDGET_H |
| 98 |
Branches:
master
