QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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 class QgsStyle;
31 class QgsStyleModel;
32 class QTemporaryFile;
33 class QProgressDialog;
34 class QNetworkAccessManager;
35 class QNetworkReply;
36 
41 class GUI_EXPORT QgsStyleExportImportDialog : public QDialog, private Ui::QgsStyleExportImportDialogBase
42 {
43  Q_OBJECT
44 
45  public:
46  enum Mode
47  {
49  Import
50  };
51 
52  // constructor
53  // mode argument must be 0 for saving and 1 for loading
54  QgsStyleExportImportDialog( QgsStyle *style, QWidget *parent SIP_TRANSFERTHIS = nullptr, Mode mode = Export );
55  ~QgsStyleExportImportDialog() override;
56 
61  void selectSymbols( const QStringList &symbolNames );
62 
67  void deselectSymbols( const QStringList &symbolNames );
68 
69  public slots:
70  void doExportImport();
71 
75  void selectByGroup();
76 
80  void selectAll();
81 
85  void clearSelection();
86 
91  void selectTag( const QString &tagName );
92 
97  void deselectTag( const QString &tagName );
98 
103  void selectSmartgroup( const QString &groupName );
104 
109  void deselectSmartgroup( const QString &groupName );
110 
111  void importTypeChanged( int );
112 
113  private slots:
114  void httpFinished();
115  void fileReadyRead();
116  void updateProgress( qint64, qint64 );
117  void downloadCanceled();
118  void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
119  void showHelp();
120 
121  void fetch();
122  void importFileChanged( const QString &path );
123 
124  private:
125 
126  enum ImportSource
127  {
128  File,
129  //Official,
130  Url,
131  };
132 
133  void downloadStyleXml( const QUrl &url );
134  bool populateStyles();
135  void moveStyles( QModelIndexList *selection, QgsStyle *src, QgsStyle *dst );
136 
137  QProgressDialog *mProgressDlg = nullptr;
138  QgsStyleGroupSelectionDialog *mGroupSelectionDlg = nullptr;
139  QTemporaryFile *mTempFile = nullptr;
140  QNetworkAccessManager *mNetManager = nullptr;
141  QNetworkReply *mNetReply = nullptr;
142 
143  QString mFileName;
144  Mode mDialogMode;
145 
146  QgsStyleModel *mModel = nullptr;
147 
148  QgsStyle *mStyle = nullptr;
149  std::unique_ptr< QgsStyle > mTempStyle;
150  std::unique_ptr< QgsTemporaryCursorOverride > mCursorOverride;
151 };
152 
153 #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