QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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 QgsStyleModel;
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 selectTag( const QString &tagName );
104 
109  void deselectTag( const QString &tagName );
110 
115  void selectSmartgroup( const QString &groupName );
116 
121  void deselectSmartgroup( const QString &groupName );
122 
123  void importTypeChanged( int );
124 
125  private slots:
126  void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
127  void showHelp();
128 
129  void fetch();
130  void importFileChanged( const QString &path );
131 
132  private:
133 
134  enum ImportSource
135  {
136  File,
137  //Official,
138  Url,
139  };
140 
141  void downloadStyleXml( const QUrl &url );
142  bool populateStyles();
143  void moveStyles( QModelIndexList *selection, QgsStyle *src, QgsStyle *dst );
144 
145  QgsStyleGroupSelectionDialog *mGroupSelectionDlg = nullptr;
146  QTemporaryFile *mTempFile = nullptr;
147 
148  QString mFileName;
149  Mode mDialogMode;
150 
151  QgsStyleModel *mModel = nullptr;
152 
153  QgsStyle *mStyle = nullptr;
154  std::unique_ptr< QgsStyle > mTempStyle;
155  std::unique_ptr< QgsTemporaryCursorOverride > mCursorOverride;
156 };
157 
158 #endif // QGSSTYLEV2EXPORTIMPORTDIALOG_H
A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle ...
Definition: qgsstylemodel.h:45
Temporarily sets a cursor override for the QApplication for the lifetime of the object.
Definition: qgsguiutils.h:203
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53