QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 class QProgressDialog;
36 class QNetworkAccessManager;
37 class QNetworkReply;
38 
43 class GUI_EXPORT QgsStyleExportImportDialog : public QDialog, private Ui::QgsStyleExportImportDialogBase
44 {
45  Q_OBJECT
46 
47  public:
48 
50  enum Mode
51  {
54  };
55 
62  QgsStyleExportImportDialog( QgsStyle *style, QWidget *parent SIP_TRANSFERTHIS = nullptr, Mode mode = Export );
63  ~QgsStyleExportImportDialog() override;
64 
70  void setImportFilePath( const QString &path );
71 
76  void selectSymbols( const QStringList &symbolNames );
77 
82  void deselectSymbols( const QStringList &symbolNames );
83 
84  public slots:
85  void doExportImport();
86 
90  void selectByGroup();
91 
95  void selectAll();
96 
100  void clearSelection();
101 
106  void selectTag( const QString &tagName );
107 
112  void deselectTag( const QString &tagName );
113 
118  void selectSmartgroup( const QString &groupName );
119 
124  void deselectSmartgroup( const QString &groupName );
125 
126  void importTypeChanged( int );
127 
128  private slots:
129  void httpFinished();
130  void fileReadyRead();
131  void updateProgress( qint64, qint64 );
132  void downloadCanceled();
133  void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
134  void showHelp();
135 
136  void fetch();
137  void importFileChanged( const QString &path );
138 
139  private:
140 
141  enum ImportSource
142  {
143  File,
144  //Official,
145  Url,
146  };
147 
148  void downloadStyleXml( const QUrl &url );
149  bool populateStyles();
150  void moveStyles( QModelIndexList *selection, QgsStyle *src, QgsStyle *dst );
151 
152  QProgressDialog *mProgressDlg = nullptr;
153  QgsStyleGroupSelectionDialog *mGroupSelectionDlg = nullptr;
154  QTemporaryFile *mTempFile = nullptr;
155  QNetworkAccessManager *mNetManager = nullptr;
156  QNetworkReply *mNetReply = nullptr;
157 
158  QString mFileName;
159  Mode mDialogMode;
160 
161  QgsStyleModel *mModel = nullptr;
162 
163  QgsStyle *mStyle = nullptr;
164  std::unique_ptr< QgsStyle > mTempStyle;
165  std::unique_ptr< QgsTemporaryCursorOverride > mCursorOverride;
166 };
167 
168 #endif // QGSSTYLEV2EXPORTIMPORTDIALOG_H
A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle ...
Definition: qgsstylemodel.h:41
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:46