QGIS API Documentation  2.13.0-Master
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 );
53  void selectSymbols( const QStringList& symbolNames );
58  void deselectSymbols( const QStringList& symbolNames );
59 
60  public slots:
61  void doExportImport();
65  void selectByGroup();
69  void selectAll();
73  void clearSelection();
78  void selectGroup( const QString& groupName );
83  void deselectGroup( const QString& groupName );
88  void selectSmartgroup( const QString& groupName );
93  void deselectSmartgroup( const QString& groupName );
94 
95  void importTypeChanged( int );
96  void browse();
97 
98  private slots:
99  void httpFinished();
100  void fileReadyRead();
101  void updateProgress( qint64, qint64 );
102  void downloadCanceled();
103  void selectionChanged( const QItemSelection & selected, const QItemSelection & deselected );
104 
105  private:
106  void downloadStyleXML( const QUrl& url );
107  bool populateStyles( QgsStyleV2* style );
108  void moveStyles( QModelIndexList* selection, QgsStyleV2* src, QgsStyleV2* dst );
109 
110  QProgressDialog *mProgressDlg;
111  QgsStyleV2GroupSelectionDialog *mGroupSelectionDlg;
112  QTemporaryFile *mTempFile;
113  QNetworkAccessManager *mNetManager;
114  QNetworkReply *mNetReply;
115 
116  QString mFileName;
117  Mode mDialogMode;
118 
119  QgsStyleV2* mQgisStyle;
120  QgsStyleV2* mTempStyle;
121 };
122 
123 #endif // QGSSTYLEV2EXPORTIMPORTDIALOG_H