1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
4 //
5 
6 #ifndef MARBLE_GOTODIALOG_H
7 #define MARBLE_GOTODIALOG_H
8 
9 #include "marble_export.h"
10 
11 #include <QDialog>
12 
13 class QModelIndex;
14 
15 namespace Marble
16 {
17 
18 class GeoDataPlacemark;
19 class GeoDataCoordinates;
20 class GoToDialogPrivate;
21 class MarbleModel;
22 
23 /**
24   * A dialog that provides a list of targets to go to: The current location,
25   * route start, destination and via points and bookmarks. Clicking on a target
26   * centers the map on the selected position
27   */
28 class MARBLE_EXPORT GoToDialog: public QDialog
29 {
30     Q_OBJECT
31 
32 public:
33     explicit GoToDialog( MarbleModel* marbleModel, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr );
34 
35     ~GoToDialog() override;
36 
37     /** Toggle whether routing items (source, destination and via points) are visible */
38     void setShowRoutingItems( bool show );
39 
40     /** Toggle whether the dialog can be used to search for placemarks */
41     void setSearchEnabled( bool enabled );
42 
43     /**
44       * Returns the position of the item selected by the user, or a default
45       * constructed GeoDataLookAt if the dialog was cancelled by the user
46       */
47     GeoDataCoordinates coordinates() const;
48 
49     Q_PRIVATE_SLOT( d, void saveSelection( const QModelIndex &index ) )
50 
51     Q_PRIVATE_SLOT( d, void startSearch() )
52 
53     Q_PRIVATE_SLOT( d, void updateSearchResult( const QVector<GeoDataPlacemark*>& placemarks ) )
54 
55     Q_PRIVATE_SLOT( d, void updateSearchMode() )
56 
57     Q_PRIVATE_SLOT( d, void updateProgress() )
58 
59     Q_PRIVATE_SLOT( d, void stopProgressAnimation() )
60 
61 private:
62     GoToDialogPrivate * const d;
63     friend class GoToDialogPrivate;
64 };
65 
66 } // namespace Marble
67 
68 #endif // MARBLE_GOTODIALOG_H
69