File indexing completed on 2025-01-05 03:59:35

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