1 /***************************************************************************
2   qgsvectortilelayerproperties.h
3   --------------------------------------
4   Date                 : May 2020
5   Copyright            : (C) 2020 by Martin Dobias
6   Email                : wonder dot sk at gmail dot com
7  ***************************************************************************
8  *                                                                         *
9  *   This program is free software; you can redistribute it and/or modify  *
10  *   it under the terms of the GNU General Public License as published by  *
11  *   the Free Software Foundation; either version 2 of the License, or     *
12  *   (at your option) any later version.                                   *
13  *                                                                         *
14  ***************************************************************************/
15 
16 #ifndef QGSVECTORTILELAYERPROPERTIES_H
17 #define QGSVECTORTILELAYERPROPERTIES_H
18 
19 #include "qgsoptionsdialogbase.h"
20 
21 #include "ui_qgsvectortilelayerpropertiesbase.h"
22 
23 #include "qgsmaplayerstylemanager.h"
24 
25 class QgsMapLayer;
26 class QgsMapCanvas;
27 class QgsMessageBar;
28 class QgsVectorTileBasicLabelingWidget;
29 class QgsVectorTileBasicRendererWidget;
30 class QgsVectorTileLayer;
31 class QgsMetadataWidget;
32 
33 
34 class QgsVectorTileLayerProperties : public QgsOptionsDialogBase, private Ui::QgsVectorTileLayerPropertiesBase
35 {
36     Q_OBJECT
37   public:
38     QgsVectorTileLayerProperties( QgsVectorTileLayer *lyr, QgsMapCanvas *canvas, QgsMessageBar *messageBar, QWidget *parent = nullptr, Qt::WindowFlags = QgsGuiUtils::ModalDialogFlags );
39 
40   private slots:
41     void apply();
42     void onCancel();
43 
44     void loadDefaultStyle();
45     void saveDefaultStyle();
46     void loadStyle();
47     void saveStyleAs();
48     void aboutToShowStyleMenu();
49     void loadMetadata();
50     void saveMetadataAs();
51     void showHelp();
52     void urlClicked( const QUrl &url );
53 
54   protected slots:
55     void optionsStackedWidget_CurrentChanged( int index ) override SIP_SKIP ;
56 
57   private:
58     void syncToLayer();
59 
60   private:
61     QgsVectorTileLayer *mLayer = nullptr;
62 
63     QgsVectorTileBasicRendererWidget *mRendererWidget = nullptr;
64     QgsVectorTileBasicLabelingWidget *mLabelingWidget = nullptr;
65 
66     QPushButton *mBtnStyle = nullptr;
67     QPushButton *mBtnMetadata = nullptr;
68     QAction *mActionLoadMetadata = nullptr;
69     QAction *mActionSaveMetadataAs = nullptr;
70 
71     QgsMapCanvas *mMapCanvas = nullptr;
72     QgsMetadataWidget *mMetadataWidget = nullptr;
73 
74     /**
75      * Previous layer style. Used to reset style to previous state if new style
76      * was loaded but dialog is canceled.
77     */
78     QgsMapLayerStyle mOldStyle;
79 };
80 
81 #endif // QGSVECTORTILELAYERPROPERTIES_H
82