QGIS API Documentation
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 
34 class GUI_EXPORT QgsStyleV2ExportImportDialog : public QDialog, private Ui::QgsStyleV2ExportImportDialogBase
35 {
36  Q_OBJECT
37 
38  public:
39  enum Mode
40  {
42  Import
43  };
44 
45  // constructor
46  // mode argument must be 0 for saving and 1 for loading
47  QgsStyleV2ExportImportDialog( QgsStyleV2* style, QWidget *parent = nullptr, Mode mode = Export );
49 
54  void selectSymbols( const QStringList& symbolNames );
59  void deselectSymbols( const QStringList& symbolNames );
60 
61  public slots:
62  void doExportImport();
66  void selectByGroup();
70  void selectAll();
74  void clearSelection();
79  void selectGroup( const QString& groupName );
84  void deselectGroup( const QString& groupName );
89  void selectSmartgroup( const QString& groupName );
94  void deselectSmartgroup( const QString& groupName );
95 
96  void importTypeChanged( int );
97  void browse();
98 
99  private slots:
100  void httpFinished();
101  void fileReadyRead();
102  void updateProgress( qint64, qint64 );
103  void downloadCanceled();
104  void selectionChanged( const QItemSelection & selected, const QItemSelection & deselected );
105 
106  private:
107  void downloadStyleXML( const QUrl& url );
108  bool populateStyles( QgsStyleV2* style );
109  void moveStyles( QModelIndexList* selection, QgsStyleV2* src, QgsStyleV2* dst );
110 
111  QProgressDialog *mProgressDlg;
112  QgsStyleV2GroupSelectionDialog *mGroupSelectionDlg;
113  QTemporaryFile *mTempFile;
114  QNetworkAccessManager *mNetManager;
115  QNetworkReply *mNetReply;
116 
117  QString mFileName;
118  Mode mDialogMode;
119 
120  QgsStyleV2* mQgisStyle;
121  QgsStyleV2* mTempStyle;
122 };
123 
124 #endif // QGSSTYLEV2EXPORTIMPORTDIALOG_H