QGIS API Documentation  master-6164ace
src/gui/symbology-ng/qgsstylev2exportimportdialog.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     qgsstylev2exportimportdialog.h
00003     ---------------------
00004     begin                : Jan 2011
00005     copyright            : (C) 2011 by Alexander Bruy
00006     email                : alexander dot bruy at gmail dot com
00007 
00008  ***************************************************************************
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  ***************************************************************************/
00016 
00017 
00018 #ifndef QGSSTYLEV2EXPORTIMPORTDIALOG_H
00019 #define QGSSTYLEV2EXPORTIMPORTDIALOG_H
00020 
00021 #include <QDialog>
00022 #include <QUrl>
00023 #include <QProgressDialog>
00024 #include <QTemporaryFile>
00025 #include <QNetworkAccessManager>
00026 #include <QNetworkReply>
00027 
00028 #include "ui_qgsstylev2exportimportdialogbase.h"
00029 
00030 class QgsStyleV2;
00031 
00032 class QgsStyleV2ExportImportDialog : public QDialog, private Ui::QgsStyleV2ExportImportDialogBase
00033 {
00034     Q_OBJECT
00035 
00036   public:
00037     enum Mode
00038     {
00039       Export,
00040       Import
00041     };
00042 
00043     // constructor
00044     // mode argument must be 0 for saving and 1 for loading
00045     QgsStyleV2ExportImportDialog( QgsStyleV2* style, QWidget *parent = NULL, Mode mode = Export );
00046     ~QgsStyleV2ExportImportDialog();
00047 
00048   public slots:
00049     void doExportImport();
00050     void selectAll();
00051     void clearSelection();
00052 
00053     void importTypeChanged( int );
00054     void browse();
00055 
00056   private slots:
00057     void httpFinished();
00058     void fileReadyRead();
00059     void updateProgress( qint64, qint64 );
00060     void downloadCanceled();
00061 
00062   private:
00063     void downloadStyleXML( QUrl url );
00064     bool populateStyles( QgsStyleV2* style );
00065     void moveStyles( QModelIndexList* selection, QgsStyleV2* src, QgsStyleV2* dst );
00066 
00067     QProgressDialog *mProgressDlg;
00068     QTemporaryFile *mTempFile;
00069     QNetworkAccessManager *mNetManager;
00070     QNetworkReply *mNetReply;
00071 
00072     QString mFileName;
00073     Mode mDialogMode;
00074 
00075     QgsStyleV2* mQgisStyle;
00076     QgsStyleV2* mTempStyle;
00077 };
00078 
00079 #endif // QGSSTYLEV2EXPORTIMPORTDIALOG_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines