QGIS API Documentation  3.6.0-Noosa (5873452)
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 #include <QProgressDialog>
23 #include <QTemporaryFile>
24 #include <QNetworkAccessManager>
25 #include <QNetworkReply>
26 #include <QStandardItem>
27 
28 #include "ui_qgsstyleexportimportdialogbase.h"
29 #include "qgis_gui.h"
30 #include "qgis_sip.h"
31 #include "qgshelp.h"
32 
33 #include <memory>
34 
35 class QgsStyle;
38 class QgsStyleModel;
39 
44 class GUI_EXPORT QgsStyleExportImportDialog : public QDialog, private Ui::QgsStyleExportImportDialogBase
45 {
46  Q_OBJECT
47 
48  public:
49 
51  enum Mode
52  {
55  };
56 
63  QgsStyleExportImportDialog( QgsStyle *style, QWidget *parent SIP_TRANSFERTHIS = nullptr, Mode mode = Export );
64  ~QgsStyleExportImportDialog() override;
65 
71  void setImportFilePath( const QString &path );
72 
77  void selectSymbols( const QStringList &symbolNames );
78 
83  void deselectSymbols( const QStringList &symbolNames );
84 
85  public slots:
86  void doExportImport();
87 
91  void selectByGroup();
92 
96  void selectAll();
97 
101  void clearSelection();
102 
107  void selectTag( const QString &tagName );
108 
113  void deselectTag( const QString &tagName );
114 
119  void selectSmartgroup( const QString &groupName );
120 
125  void deselectSmartgroup( const QString &groupName );
126 
127  void importTypeChanged( int );
128 
129  private slots:
130  void httpFinished();
131  void fileReadyRead();
132  void updateProgress( qint64, qint64 );
133  void downloadCanceled();
134  void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
135  void showHelp();
136 
137  void fetch();
138  void importFileChanged( const QString &path );
139 
140  private:
141 
142  enum ImportSource
143  {
144  File,
145  //Official,
146  Url,
147  };
148 
149  void downloadStyleXml( const QUrl &url );
150  bool populateStyles();
151  void moveStyles( QModelIndexList *selection, QgsStyle *src, QgsStyle *dst );
152 
153  QProgressDialog *mProgressDlg = nullptr;
154  QgsStyleGroupSelectionDialog *mGroupSelectionDlg = nullptr;
155  QTemporaryFile *mTempFile = nullptr;
156  QNetworkAccessManager *mNetManager = nullptr;
157  QNetworkReply *mNetReply = nullptr;
158 
159  QString mFileName;
160  Mode mDialogMode;
161 
162  QgsStyleModel *mModel = nullptr;
163 
164  QgsStyle *mStyle = nullptr;
165  std::unique_ptr< QgsStyle > mTempStyle;
166  std::unique_ptr< QgsTemporaryCursorOverride > mCursorOverride;
167 };
168 
169 #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:186
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46