2010-06-11 00:52:34 +03:00
|
|
|
/*
|
2011-02-18 10:53:32 +02:00
|
|
|
* Copyright 2010-2011 Niels Kummerfeldt <niels.kummerfeldt@tu-harburg.de>
|
2010-06-11 00:52:34 +03:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DOWNLOADWIDGET_H
|
|
|
|
#define DOWNLOADWIDGET_H
|
|
|
|
|
2010-09-11 10:36:56 +03:00
|
|
|
#include <QtGui/QCheckBox>
|
2011-02-18 10:53:32 +02:00
|
|
|
#include <QtGui/QComboBox>
|
2010-06-11 00:52:34 +03:00
|
|
|
#include <QtGui/QLabel>
|
2010-10-11 15:24:36 +03:00
|
|
|
#include <QtGui/QLineEdit>
|
2011-03-22 16:26:48 +02:00
|
|
|
#include <QtGui/QListWidget>
|
2010-06-11 00:52:34 +03:00
|
|
|
#include <QtGui/QProgressBar>
|
2011-02-18 10:53:32 +02:00
|
|
|
#include <QtGui/QPushButton>
|
2010-06-11 00:52:34 +03:00
|
|
|
#include <QtGui/QSpinBox>
|
2011-02-18 10:53:32 +02:00
|
|
|
#include <QtGui/QTabWidget>
|
2010-06-11 00:52:34 +03:00
|
|
|
#include <QtGui/QWidget>
|
|
|
|
#include <QtNetwork/QNetworkAccessManager>
|
2011-03-22 16:26:48 +02:00
|
|
|
#include <QtNetwork/QNetworkReply>
|
2010-06-11 00:52:34 +03:00
|
|
|
|
|
|
|
class DownloadWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
DownloadWidget(QWidget *parent = 0);
|
|
|
|
~DownloadWidget();
|
|
|
|
|
|
|
|
void setStartLevel(int level);
|
|
|
|
void setDownloadRect(const QRectF &rect);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void back();
|
2011-02-18 10:53:32 +02:00
|
|
|
void loadFile(const QString &filename, const QString &title);
|
2010-06-11 00:52:34 +03:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void startDownload();
|
|
|
|
void replyFinished(QNetworkReply *reply);
|
2011-02-18 10:53:32 +02:00
|
|
|
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
2011-03-22 16:26:48 +02:00
|
|
|
void saveDownload();
|
|
|
|
void updateSourceList();
|
2010-06-11 00:52:34 +03:00
|
|
|
|
|
|
|
private:
|
2011-02-18 10:53:32 +02:00
|
|
|
enum DownloadMode {
|
|
|
|
Tiles,
|
|
|
|
POIs,
|
2011-03-22 16:26:48 +02:00
|
|
|
Packages,
|
|
|
|
SourceList
|
2011-02-18 10:53:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
void startDownloadTiles();
|
|
|
|
void replyFinishedTiles(QNetworkReply *reply);
|
|
|
|
void startDownloadPOIs();
|
|
|
|
void replyFinishedPOIs(QNetworkReply *reply);
|
|
|
|
void startDownloadPackages();
|
|
|
|
void replyFinishedPackages(QNetworkReply *reply);
|
2010-06-11 00:52:34 +03:00
|
|
|
QString lon2string(qreal lon);
|
|
|
|
QString lat2string(qreal lat);
|
|
|
|
int lon2tilex(qreal lon, int z);
|
|
|
|
int lat2tiley(qreal lat, int z);
|
|
|
|
|
|
|
|
QNetworkAccessManager *m_manager;
|
2011-02-18 10:53:32 +02:00
|
|
|
DownloadMode m_downloadMode;
|
|
|
|
QTabWidget *m_tabWidget;
|
|
|
|
QProgressBar *m_dlProgress;
|
|
|
|
QPushButton *m_startButton, *m_backButton;
|
2010-06-11 00:52:34 +03:00
|
|
|
int m_startLevel;
|
|
|
|
QRectF m_dlRect;
|
|
|
|
QStringList m_dlList;
|
2011-03-22 16:26:48 +02:00
|
|
|
QNetworkReply *m_currentDownload;
|
2010-10-11 15:24:36 +03:00
|
|
|
QString m_prefix;
|
2010-06-11 00:52:34 +03:00
|
|
|
QLabel *m_up, *m_left, *m_right, *m_bottom;
|
|
|
|
QSpinBox *m_levelSpinBox;
|
2010-10-11 15:24:36 +03:00
|
|
|
QLineEdit *m_prefixInput;
|
2010-09-11 10:36:56 +03:00
|
|
|
QCheckBox *m_skipExisting;
|
2011-02-18 10:53:32 +02:00
|
|
|
QComboBox *m_poiType;
|
|
|
|
QCheckBox *m_makePOILayer;
|
|
|
|
QLineEdit *m_destFilename;
|
2011-03-22 16:26:48 +02:00
|
|
|
QListWidget *m_packageList;
|
|
|
|
QLineEdit *m_destDir;
|
2010-06-11 00:52:34 +03:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DOWNLOADWIDGET_H
|