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