QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
27 #include "ui_qgsstylev2exportimportdialogbase.h"
28 
29 class QgsStyleV2;
30 
31 class GUI_EXPORT QgsStyleV2ExportImportDialog : public QDialog, private Ui::QgsStyleV2ExportImportDialogBase
32 {
33  Q_OBJECT
34 
35  public:
36  enum Mode
37  {
39  Import
40  };
41 
42  // constructor
43  // mode argument must be 0 for saving and 1 for loading
44  QgsStyleV2ExportImportDialog( QgsStyleV2* style, QWidget *parent = NULL, Mode mode = Export );
46 
47  public slots:
48  void doExportImport();
49  void selectAll();
50  void clearSelection();
51 
52  void importTypeChanged( int );
53  void browse();
54 
55  private slots:
56  void httpFinished();
57  void fileReadyRead();
58  void updateProgress( qint64, qint64 );
59  void downloadCanceled();
60 
61  private:
62  void downloadStyleXML( QUrl url );
63  bool populateStyles( QgsStyleV2* style );
64  void moveStyles( QModelIndexList* selection, QgsStyleV2* src, QgsStyleV2* dst );
65 
66  QProgressDialog *mProgressDlg;
67  QTemporaryFile *mTempFile;
68  QNetworkAccessManager *mNetManager;
69  QNetworkReply *mNetReply;
70 
71  QString mFileName;
72  Mode mDialogMode;
73 
74  QgsStyleV2* mQgisStyle;
75  QgsStyleV2* mTempStyle;
76 };
77 
78 #endif // QGSSTYLEV2EXPORTIMPORTDIALOG_H