File indexing completed on 2024-04-14 03:47:43

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 
0003 #ifndef MARBLE_DOWNLOADREGIONDIALOG_H
0004 #define MARBLE_DOWNLOADREGIONDIALOG_H
0005 
0006 #include <QDialog>
0007 #include <QVector>
0008 
0009 #include <MarbleGlobal.h>
0010 
0011 #include "marble_export.h"
0012 
0013 namespace Marble
0014 {
0015 class GeoDataLatLonAltBox;
0016 class TileCoordsPyramid;
0017 class MarbleWidget;
0018 
0019 class MARBLE_EXPORT DownloadRegionDialog: public QDialog
0020 {
0021     Q_OBJECT
0022 
0023  public:
0024     enum SelectionMethod { VisibleRegionMethod, SpecifiedRegionMethod, RouteDownloadMethod };
0025 
0026     explicit DownloadRegionDialog( MarbleWidget *const widget, QWidget * const parent = nullptr,
0027                                    Qt::WindowFlags const f = Qt::WindowFlags() );
0028     ~DownloadRegionDialog() override;
0029     void setAllowedTileLevelRange( int const minimumTileLevel,
0030                                    int const maximumTileLevel );
0031     void setVisibleTileLevel( int const tileLevel );
0032     void setSelectionMethod( SelectionMethod const );
0033 
0034     QVector<TileCoordsPyramid> region() const;
0035 
0036     TileType tileType() const;
0037 
0038  public Q_SLOTS:
0039     void setSpecifiedLatLonAltBox( GeoDataLatLonAltBox const & );
0040     void setVisibleLatLonAltBox( GeoDataLatLonAltBox const & );
0041     void updateTileLayer();
0042     void delayUpdateTileLayer();
0043 
0044  Q_SIGNALS:
0045     /// This signal is emitted when the "Apply" button is pressed.
0046     void applied();
0047     /// This signal is emitted when the dialog receives a QHideEvent.
0048     void hidden();
0049     /// This signal is emitted when the dialog receives a QShowEvent
0050     void shown();
0051 
0052  protected:
0053     void hideEvent( QHideEvent * event ) override;
0054     void showEvent( QShowEvent * event ) override;
0055 
0056  private Q_SLOTS:
0057     void toggleSelectionMethod();
0058     void updateTileCount();
0059     void updateTileType();
0060 
0061     /// This slot is called upon to update the route download UI when a route exists
0062     void updateRouteDialog();
0063     /// This slot sets the unit of the offset(m or km) in the spinbox
0064     void setOffsetUnit();
0065 
0066  private:
0067     Q_DISABLE_COPY( DownloadRegionDialog )
0068     class Private;
0069     Private * const d;
0070 
0071 };
0072 
0073 }
0074 
0075 #endif