File indexing completed on 2024-05-05 03:50:38

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2017 Sutirtha Ghosh <ghsutirtha@gmail.com>
0004 //
0005 
0006 #ifndef DOWNLOADOSMDIALOG_H
0007 #define DOWNLOADOSMDIALOG_H
0008 
0009 #include <QDialog>
0010 #include <QPushButton>
0011 #include <GeoDataLatLonAltBox.h>
0012 #include <QNetworkAccessManager>
0013 #include <QNetworkReply>
0014 #include <QProgressDialog>
0015 #include <QTemporaryFile>
0016 
0017 
0018 #include "LatLonBoxWidget.h"
0019 #include "ui_DownloadOsmDialog.h"
0020 
0021 namespace Marble
0022 {
0023 class MarbleWidget;
0024 class AnnotatePlugin;
0025 class DownloadOsmDialog : public QDialog,private Ui::DownloadOsmDialog
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     explicit DownloadOsmDialog(MarbleWidget *parent = nullptr,AnnotatePlugin *annotatePlugin = nullptr);
0031     ~DownloadOsmDialog() override;
0032 
0033 Q_SIGNALS:
0034     void openFile(const QString &filename);
0035 
0036 private:
0037     void updateCoordinates();
0038     MarbleWidget *m_marbleWidget;
0039     QPushButton *m_downloadButton;
0040     QNetworkAccessManager m_qnam;
0041     QNetworkReply *m_reply;
0042     QTemporaryFile *m_file;
0043     LatLonBoxWidget *m_latLonBoxWidget;
0044     bool m_isDownloadSuccess;
0045 
0046 private Q_SLOTS:
0047     void downloadFile();
0048     void updateCoordinates(const GeoDataLatLonAltBox&);
0049     void httpReadyRead();
0050     void httpFinished();
0051 };
0052 
0053 }
0054 #endif // DOWNLOADOSMDIALOG_H