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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2015 Stanciu Marius-Valeriu <stanciumarius94@gmail.com>
0004 //
0005 
0006 #ifndef MARBLE_OSMRELATIONMANAGERWIDGET_H
0007 #define MARBLE_OSMRELATIONMANAGERWIDGET_H
0008 
0009 #include <QWidget>
0010 
0011 #include "MarbleGlobal.h"
0012 #include "marble_export.h"
0013 
0014 class QTreeWidgetItem;
0015 
0016 namespace Marble
0017 {
0018 
0019 class OsmRelationManagerWidgetPrivate;
0020 class GeoDataPlacemark;
0021 class OsmPlacemarkData;
0022 
0023 enum Column {
0024     Name = 0,
0025     Type = 1,
0026     Role = 2
0027 };
0028 
0029 /**
0030  * @brief The OsmRelationManagerWidget class is used to view and edit relations for any placemark
0031  * within the Annotate Plugin.
0032  * It can add the placemark to any relation the Annotate Plugin has loaded, or to newly created ones
0033  */
0034 class MARBLE_EXPORT OsmRelationManagerWidget : public QWidget
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039     explicit OsmRelationManagerWidget( GeoDataPlacemark *placemark,
0040                                        const QHash<qint64, OsmPlacemarkData> *relations,
0041                                        QWidget *parent = nullptr );
0042     ~OsmRelationManagerWidget() override;
0043 
0044 public Q_SLOTS:
0045     /**
0046      * @brief addRelation adds the placemark to the relation specified in the action->text();
0047      * If the text is "New Relation", a new relation is added
0048      */
0049     void addRelation( QAction* action );
0050     void handleItemChange( QTreeWidgetItem *item, int column );
0051     void handleDoubleClick( QTreeWidgetItem * item, int column );
0052     void handleRelationContextMenuRequest( const QPoint& point );
0053     /**
0054      * @brief update updates the relations list and the suggested relations drop menu
0055      */
0056     void update();
0057 
0058 Q_SIGNALS:
0059     void relationCreated( const OsmPlacemarkData &relationData );
0060 
0061 private:
0062     friend class OsmRelationManagerWidgetPrivate;
0063     OsmRelationManagerWidgetPrivate* const d;
0064 };
0065 
0066 }
0067 
0068 #endif
0069