QGIS API Documentation  3.0.2-Girona (307d082)
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;
35 
40 class GUI_EXPORT QgsStyleExportImportDialog : public QDialog, private Ui::QgsStyleExportImportDialogBase
41 {
42  Q_OBJECT
43 
44  public:
45  enum Mode
46  {
48  Import
49  };
50 
51  // constructor
52  // mode argument must be 0 for saving and 1 for loading
53  QgsStyleExportImportDialog( QgsStyle *style, QWidget *parent SIP_TRANSFERTHIS = nullptr, Mode mode = Export );
54  ~QgsStyleExportImportDialog() override;
55 
60  void selectSymbols( const QStringList &symbolNames );
61 
66  void deselectSymbols( const QStringList &symbolNames );
67 
68  public slots:
69  void doExportImport();
70 
74  void selectByGroup();
75 
79  void selectAll();
80 
84  void clearSelection();
85 
90  void selectTag( const QString &tagName );
91 
96  void deselectTag( const QString &tagName );
97 
102  void selectSmartgroup( const QString &groupName );
103 
108  void deselectSmartgroup( const QString &groupName );
109 
110  void importTypeChanged( int );
111  void browse();
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  private:
122  void downloadStyleXml( const QUrl &url );
123  bool populateStyles( QgsStyle *style );
124  void moveStyles( QModelIndexList *selection, QgsStyle *src, QgsStyle *dst );
125 
126  QProgressDialog *mProgressDlg = nullptr;
127  QgsStyleGroupSelectionDialog *mGroupSelectionDlg = nullptr;
128  QTemporaryFile *mTempFile = nullptr;
129  QNetworkAccessManager *mNetManager = nullptr;
130  QNetworkReply *mNetReply = nullptr;
131 
132  QString mFileName;
133  Mode mDialogMode;
134 
135  QgsStyle *mStyle = nullptr;
136  QgsStyle *mTempStyle = nullptr;
137 };
138 
139 #endif // QGSSTYLEV2EXPORTIMPORTDIALOG_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46