QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsstyleexportimportdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsstyleexportimportdialog.h
3  ---------------------
4  begin : Jan 2011
5  copyright : (C) 2011 by Alexander Bruy
6  email : alexander dot bruy at gmail dot com
7 
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef QGSSTYLEV2EXPORTIMPORTDIALOG_H
18 #define QGSSTYLEV2EXPORTIMPORTDIALOG_H
19 
20 #include <QDialog>
21 #include <QUrl>
22 
23 #include "ui_qgsstyleexportimportdialogbase.h"
24 #include "qgis_gui.h"
25 #include "qgis_sip.h"
26 #include "qgshelp.h"
27 
28 #include <memory>
29 
30 class QgsStyle;
33 class QgsStyleProxyModel;
34 class QTemporaryFile;
35 
40 class GUI_EXPORT QgsStyleExportImportDialog : public QDialog, private Ui::QgsStyleExportImportDialogBase
41 {
42  Q_OBJECT
43 
44  public:
45 
47  enum Mode
48  {
51  };
52 
59  QgsStyleExportImportDialog( QgsStyle *style, QWidget *parent SIP_TRANSFERTHIS = nullptr, Mode mode = Export );
60  ~QgsStyleExportImportDialog() override;
61 
67  void setImportFilePath( const QString &path );
68 
73  void selectSymbols( const QStringList &symbolNames );
74 
79  void deselectSymbols( const QStringList &symbolNames );
80 
81  public slots:
82  void doExportImport();
83 
87  void selectByGroup();
88 
92  void selectAll();
93 
97  void clearSelection();
98 
103  void selectFavorites();
104 
109  void deselectFavorites();
110 
115  void selectTag( const QString &tagName );
116 
121  void deselectTag( const QString &tagName );
122 
127  void selectSmartgroup( const QString &groupName );
128 
133  void deselectSmartgroup( const QString &groupName );
134 
135  void importTypeChanged( int );
136 
137  private slots:
138  void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
139  void showHelp();
140 
141  void fetch();
142  void importFileChanged( const QString &path );
143 
144  private:
145 
146  enum ImportSource
147  {
148  File,
149  //Official,
150  Url,
151  };
152 
153  void downloadStyleXml( const QUrl &url );
154  bool populateStyles();
155  void moveStyles( QModelIndexList *selection, QgsStyle *src, QgsStyle *dst );
156 
157  QgsStyleGroupSelectionDialog *mGroupSelectionDlg = nullptr;
158  QTemporaryFile *mTempFile = nullptr;
159 
160  QString mFileName;
161  Mode mDialogMode;
162 
163  QgsStyleProxyModel *mModel = nullptr;
164 
165  QgsStyle *mStyle = nullptr;
166  std::unique_ptr< QgsStyle > mTempStyle;
167  std::unique_ptr< QgsTemporaryCursorOverride > mCursorOverride;
168 };
169 
170 #endif // QGSSTYLEV2EXPORTIMPORTDIALOG_H
@ Export
Export existing symbols mode.
A QSortFilterProxyModel subclass for showing filtered symbol and color ramps entries from a QgsStyle ...
Temporarily sets a cursor override for the QApplication for the lifetime of the object.
Definition: qgsguiutils.h:221
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53