1 /*************************************************************************** 2 qgsannotationlayerproperties.h 3 -------------------------------------- 4 Date : September 2021 5 Copyright : (C) 2021 by Nyall Dawson 6 Email : nyall dot dawson 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 QGSANNOTATIONLAYERPROPERTIES_H 17 #define QGSANNOTATIONLAYERPROPERTIES_H 18 19 #include "qgsoptionsdialogbase.h" 20 21 #include "ui_qgsannotationlayerpropertiesbase.h" 22 23 #include "qgsmaplayerstylemanager.h" 24 25 #include "qgsannotationlayer.h" 26 27 class QgsMapLayer; 28 class QgsMapCanvas; 29 class QgsMessageBar; 30 class QgsAnnotationLayer; 31 class QgsMetadataWidget; 32 class QgsMapLayerConfigWidgetFactory; 33 class QgsMapLayerConfigWidget; 34 35 36 class QgsAnnotationLayerProperties : public QgsOptionsDialogBase, private Ui::QgsAnnotationLayerPropertiesBase 37 { 38 Q_OBJECT 39 public: 40 QgsAnnotationLayerProperties( QgsAnnotationLayer *layer, QgsMapCanvas *canvas, QgsMessageBar *messageBar, QWidget *parent = nullptr, Qt::WindowFlags = QgsGuiUtils::ModalDialogFlags ); 41 ~QgsAnnotationLayerProperties() override; 42 43 void addPropertiesPageFactory( const QgsMapLayerConfigWidgetFactory *factory ); 44 45 private slots: 46 void apply(); 47 void onCancel(); 48 49 void loadDefaultStyle(); 50 void saveDefaultStyle(); 51 void loadStyle(); 52 void saveStyleAs(); 53 void aboutToShowStyleMenu(); 54 void showHelp(); 55 void urlClicked( const QUrl &url ); 56 void crsChanged( const QgsCoordinateReferenceSystem &crs ); 57 58 protected slots: 59 void optionsStackedWidget_CurrentChanged( int index ) override SIP_SKIP ; 60 61 private: 62 void syncToLayer(); 63 64 private: 65 QgsAnnotationLayer *mLayer = nullptr; 66 67 QPushButton *mBtnStyle = nullptr; 68 69 QgsMapCanvas *mMapCanvas = nullptr; 70 71 /** 72 * Previous layer style. Used to reset style to previous state if new style 73 * was loaded but dialog is canceled. 74 */ 75 QgsMapLayerStyle mOldStyle; 76 77 std::unique_ptr< QgsPaintEffect > mPaintEffect; 78 79 QList<QgsMapLayerConfigWidget *> mConfigWidgets; 80 81 QgsCoordinateReferenceSystem mBackupCrs; 82 83 }; 84 85 #endif // QGSANNOTATIONLAYERPROPERTIES_H 86