QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsstylev2exportimportdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsstylev2exportimportdialog.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 
29 
30 #include "ui_qgsstylev2exportimportdialogbase.h"
31 
32 class QgsStyleV2;
33 
37 class GUI_EXPORT QgsStyleV2ExportImportDialog : public QDialog, private Ui::QgsStyleV2ExportImportDialogBase
38 {
39  Q_OBJECT
40 
41  public:
42  enum Mode
43  {
45  Import
46  };
47 
48  // constructor
49  // mode argument must be 0 for saving and 1 for loading
50  QgsStyleV2ExportImportDialog( QgsStyleV2* style, QWidget *parent = nullptr, Mode mode = Export );
52 
57  void selectSymbols( const QStringList& symbolNames );
62  void deselectSymbols( const QStringList& symbolNames );
63 
64  public slots:
65  void doExportImport();
69  void selectByGroup();
73  void selectAll();
77  void clearSelection();
82  void selectGroup( const QString& groupName );
87  void deselectGroup( const QString& groupName );
92  void selectSmartgroup( const QString& groupName );
97  void deselectSmartgroup( const QString& groupName );
98 
99  void importTypeChanged( int );
100  void browse();
101 
102  private slots:
103  void httpFinished();
104  void fileReadyRead();
105  void updateProgress( qint64, qint64 );
106  void downloadCanceled();
107  void selectionChanged( const QItemSelection & selected, const QItemSelection & deselected );
108 
109  private:
110  void downloadStyleXML( const QUrl& url );
111  bool populateStyles( QgsStyleV2* style );
112  void moveStyles( QModelIndexList* selection, QgsStyleV2* src, QgsStyleV2* dst );
113 
114  QProgressDialog *mProgressDlg;
115  QgsStyleV2GroupSelectionDialog *mGroupSelectionDlg;
116  QTemporaryFile *mTempFile;
117  QNetworkAccessManager *mNetManager;
118  QNetworkReply *mNetReply;
119 
120  QString mFileName;
121  Mode mDialogMode;
122 
123  QgsStyleV2* mQgisStyle;
124  QgsStyleV2* mTempStyle;
125 };
126 
127 #endif // QGSSTYLEV2EXPORTIMPORTDIALOG_H