QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsdatasourcemanagerdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdatasourcemanagerdialog.h - datasource manager dialog
3 
4  ---------------------
5  begin : May 19, 2017
6  copyright : (C) 2017 by Alessandro Pasotti
7  email : apasotti at itopen dot it
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 QGSDATASOURCEMANAGERDIALOG_H
18 #define QGSDATASOURCEMANAGERDIALOG_H
19 
20 #include <QList>
21 #include <QDialog>
22 #include "ui_qgsdatasourcemanagerdialog.h"
23 #include "qgsoptionsdialogbase.h"
24 #include "qgsguiutils.h"
25 #include "qgsmimedatautils.h"
26 #include "qgshelp.h"
27 #include "qgis_gui.h"
28 
29 #define SIP_NO_FILE
30 
32 class QgsRasterLayer;
33 class QgsMapCanvas;
35 class QgsBrowserGuiModel;
36 class QgsMessageBar;
37 
47 class GUI_EXPORT QgsDataSourceManagerDialog : public QgsOptionsDialogBase, private Ui::QgsDataSourceManagerDialog
48 {
49  Q_OBJECT
50 
51  public:
52 
60  explicit QgsDataSourceManagerDialog( QgsBrowserGuiModel *browserModel, QWidget *parent = nullptr, QgsMapCanvas *canvas = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags );
61  ~QgsDataSourceManagerDialog() override;
62 
68  void openPage( const QString &pageName );
69 
71  QgsMessageBar *messageBar() const;
72 
73  public slots:
74 
76  void setCurrentPage( int index );
77 
78  // TODO: use this with an internal source select dialog instead of forwarding the whole raster selection to app
79 
83  void rasterLayerAdded( QString const &uri, QString const &baseName, QString const &providerKey );
85  void vectorLayerAdded( const QString &vectorLayerPath, const QString &baseName, const QString &providerKey );
87  void vectorLayersAdded( const QStringList &layerQStringList, const QString &enc, const QString &dataSourceType );
89  void setPreviousPage();
91  void refresh();
92 
100  void reset();
101 
102  protected:
103  void showEvent( QShowEvent *event ) override;
104 
105  signals:
107  void addRasterLayer( const QString &uri, const QString &baseName, const QString &providerKey );
111  void addVectorLayer( const QString &vectorLayerPath, const QString &baseName, const QString &providerKey );
112 
117  void addMeshLayer( const QString &uri, const QString &baseName, const QString &providerKey );
118 
123  void addVectorTileLayer( const QString &uri, const QString &baseName );
124 
126  void replaceSelectedVectorLayer( const QString &oldId, const QString &uri, const QString &layerName, const QString &provider );
128  void addVectorLayers( const QStringList &layerQStringList, const QString &enc, const QString &dataSourceType );
129 
131  void showStatusMessage( const QString &message );
133  void addDatabaseLayers( const QStringList &layerPathList, const QString &providerKey );
135  void openFile( const QString &fileName, const QString &fileTypeHint = QString() );
140 
147 
153 
154  private:
155  void addProviderDialog( QgsAbstractDataSourceWidget *dlg, const QString &providerKey, const QString &providerName, const QIcon &icon, const QString &toolTip = QString() );
156  void makeConnections( QgsAbstractDataSourceWidget *dlg, const QString &providerKey );
157  Ui::QgsDataSourceManagerDialog *ui = nullptr;
158  QgsBrowserDockWidget *mBrowserWidget = nullptr;
159  int mPreviousRow;
160  QStringList mPageNames;
161  // Map canvas
162  QgsMapCanvas *mMapCanvas = nullptr;
163  QgsMessageBar *mMessageBar = nullptr;
164 
165 };
166 
167 #endif // QGSDATASOURCEMANAGERDIALOG_H
QgsAbstractDataSourceWidget
Abstract base Data Source Widget to create connections and add layers This class provides common func...
Definition: qgsabstractdatasourcewidget.h:43
QgsOptionsDialogBase
A base dialog for options and properties dialogs that offers vertical tabs.
Definition: qgsoptionsdialogbase.h:63
QgsDataSourceManagerDialog::showStatusMessage
void showStatusMessage(const QString &message)
Emitted when a status message needs to be shown: for signal forwarding to QgisApp.
QgsDataSourceManagerDialog::addRasterLayer
void addRasterLayer(const QString &uri, const QString &baseName, const QString &providerKey)
Emitted when a raster layer was selected for addition: for signal forwarding to QgisApp.
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:85
QgsDataSourceManagerDialog::addVectorTileLayer
void addVectorTileLayer(const QString &uri, const QString &baseName)
Emitted when a vector tile layer was selected for addition: for signal forwarding to QgisApp.
qgsmimedatautils.h
QgsMimeDataUtils::UriList
QList< QgsMimeDataUtils::Uri > UriList
Definition: qgsmimedatautils.h:156
QgsOptionsDialogBase::setCurrentPage
void setCurrentPage(const QString &page)
Sets the dialog page (by object name) to show.
Definition: qgsoptionsdialogbase.cpp:251
QgsDataSourceManagerDialog::connectionsChanged
void connectionsChanged()
Emitted when a connection has changed inside the provider dialogs This signal is normally forwarded t...
QgsDataSourceManagerDialog::addDatabaseLayers
void addDatabaseLayers(const QStringList &layerPathList, const QString &providerKey)
Emitted when a DB layer was selected for addition: for signal forwarding to QgisApp.
QgsDataSourceManagerDialog::replaceSelectedVectorLayer
void replaceSelectedVectorLayer(const QString &oldId, const QString &uri, const QString &layerName, const QString &provider)
Replace the selected layer by a vector layer defined by uri, layer name, data source uri.
qgsoptionsdialogbase.h
QgsDataSourceManagerDialog::handleDropUriList
void handleDropUriList(const QgsMimeDataUtils::UriList &)
Emitted when drop uri list needs to be handled from the browser.
QgsDataSourceManagerDialog::addVectorLayer
void addVectorLayer(const QString &vectorLayerPath, const QString &baseName, const QString &providerKey)
Emitted when a vector layer was selected for addition: for signal forwarding to QgisApp.
QgsMessageBar
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:61
QgsDataSourceManagerDialog::addRasterLayer
void addRasterLayer()
Emitted when the user wants to select a raster layer: for signal forwarding to QgisApp.
QgsRasterLayer
Represents a raster layer.
Definition: qgsrasterlayer.h:71
QgsDataSourceManagerDialog::updateProjectHome
void updateProjectHome()
Update project home directory.
QgsDataSourceManagerDialog::providerDialogsRefreshRequested
void providerDialogsRefreshRequested()
One or more provider connections have changed and the dialogs should be refreshed.
QgsDataSourceManagerDialog::addVectorLayers
void addVectorLayers(const QStringList &layerQStringList, const QString &enc, const QString &dataSourceType)
Emitted when a one or more layer were selected for addition: for signal forwarding to QgisApp.
QgsOptionsDialogBase::showEvent
void showEvent(QShowEvent *e) override
Definition: qgsoptionsdialogbase.cpp:388
QgsBrowserDockWidget
The QgsBrowserDockWidget class.
Definition: qgsbrowserdockwidget.h:44
QgsDataSourceManagerDialog
The QgsDataSourceManagerDialog class embeds the browser panel and all the provider dialogs.
Definition: qgsdatasourcemanagerdialog.h:48
qgsguiutils.h
qgshelp.h
QgsBrowserGuiModel
A model for showing available data sources and other items in a structured tree.
Definition: qgsbrowserguimodel.h:38
QgsDataSourceManagerDialog::addMeshLayer
void addMeshLayer(const QString &uri, const QString &baseName, const QString &providerKey)
Emitted when a mesh layer was selected for addition: for signal forwarding to QgisApp.
QgsDataSourceManagerDialog::openFile
void openFile(const QString &fileName, const QString &fileTypeHint=QString())
Emitted when a file needs to be opened.