QGIS API Documentation 3.29.0-Master (d0a9f12494)
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"
24#include "qgsguiutils.h"
25#include "qgsmimedatautils.h"
26#include "qgshelp.h"
27#include "qgis_gui.h"
28
29#define SIP_NO_FILE
30
32class QgsRasterLayer;
33class QgsMapCanvas;
37class QgsMessageBar;
38
48class GUI_EXPORT QgsDataSourceManagerDialog : public QgsOptionsDialogBase, private Ui::QgsDataSourceManagerDialog
49{
50 Q_OBJECT
51
52 public:
53
61 explicit QgsDataSourceManagerDialog( QgsBrowserGuiModel *browserModel, QWidget *parent = nullptr, QgsMapCanvas *canvas = nullptr, Qt::WindowFlags fl = Qt::Window );
63
69 void openPage( const QString &pageName );
70
72 QgsMessageBar *messageBar() const;
73
74 public slots:
75
81 void activate();
82
84 void setCurrentPage( int index );
85
86 // TODO: use this with an internal source select dialog instead of forwarding the whole raster selection to app
87
89 void rasterLayerAdded( QString const &uri, QString const &baseName, QString const &providerKey );
90
95 void rasterLayersAdded( const QStringList &layersList );
97 void vectorLayerAdded( const QString &vectorLayerPath, const QString &baseName, const QString &providerKey );
99 void vectorLayersAdded( const QStringList &layerQStringList, const QString &enc, const QString &dataSourceType );
101 void setPreviousPage();
103 void refresh();
104
112 void reset();
113
114 protected:
115 void showEvent( QShowEvent *event ) override;
116
117 signals:
118
123 void addRasterLayers( const QStringList &layersList );
125 void addRasterLayer( const QString &uri, const QString &baseName, const QString &providerKey );
126
128 void addVectorLayer( const QString &vectorLayerPath, const QString &baseName, const QString &providerKey );
129
134 void addMeshLayer( const QString &uri, const QString &baseName, const QString &providerKey );
135
140 void addVectorTileLayer( const QString &uri, const QString &baseName );
141
146 void addPointCloudLayer( const QString &pointCloudLayerPath, const QString &baseName, const QString &providerKey );
147
149 void replaceSelectedVectorLayer( const QString &oldId, const QString &uri, const QString &layerName, const QString &provider );
151 void addVectorLayers( const QStringList &layerQStringList, const QString &enc, const QString &dataSourceType );
152
154 void showStatusMessage( const QString &message );
156 void addDatabaseLayers( const QStringList &layerPathList, const QString &providerKey );
158 void openFile( const QString &fileName, const QString &fileTypeHint = QString() );
163
170
176
177 private:
178 void addProviderDialog( QgsAbstractDataSourceWidget *dlg, const QString &providerKey, const QString &providerName, const QString &text, const QIcon &icon, const QString &toolTip = QString() );
179 void removeProviderDialog( const QString &providerName );
180 void makeConnections( QgsAbstractDataSourceWidget *dlg, const QString &providerKey );
181 Ui::QgsDataSourceManagerDialog *ui = nullptr;
182 QgsBrowserDockWidget *mBrowserWidget = nullptr;
183 QgsLayerMetadataSearchWidget *mLayerMetadataSearchWidget = nullptr;
184 int mPreviousRow;
185 QStringList mPageProviderKeys;
186 QStringList mPageProviderNames;
187 // Map canvas
188 QgsMapCanvas *mMapCanvas = nullptr;
189 QgsMessageBar *mMessageBar = nullptr;
190 QgsBrowserGuiModel *mBrowserModel = nullptr;
191
192};
193
194#endif // QGSDATASOURCEMANAGERDIALOG_H
Abstract base Data Source Widget to create connections and add layers This class provides common func...
A dock widget containing a QgsBrowserWidget for navigating and managing data sources.
A model for showing available data sources and other items in a structured tree.
The QgsDataSourceManagerDialog class embeds the browser panel and all the provider dialogs.
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.
void openFile(const QString &fileName, const QString &fileTypeHint=QString())
Emitted when a file needs to be opened.
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.
void addPointCloudLayer(const QString &pointCloudLayerPath, const QString &baseName, const QString &providerKey)
Emitted when a point cloud layer was selected for addition: for signal forwarding to QgisApp.
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.
void showStatusMessage(const QString &message)
Emitted when a status message needs to be shown: for signal forwarding to QgisApp.
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.
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.
void connectionsChanged()
Emitted when a connection has changed inside the provider dialogs This signal is normally forwarded t...
void addDatabaseLayers(const QStringList &layerPathList, const QString &providerKey)
Emitted when a DB layer was selected for addition: for signal forwarding to QgisApp.
void handleDropUriList(const QgsMimeDataUtils::UriList &)
Emitted when drop uri list needs to be handled from the browser.
void addVectorTileLayer(const QString &uri, const QString &baseName)
Emitted when a vector tile layer was selected for addition: for signal forwarding to QgisApp.
void providerDialogsRefreshRequested()
One or more provider connections have changed and the dialogs should be refreshed.
void updateProjectHome()
Update project home directory.
void addRasterLayers(const QStringList &layersList)
Emitted when a one or more layer were selected for addition: for signal forwarding to QgisApp.
The QgsLayerMetadataSearchWidget class offers layer metadata search and filtering.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:90
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:61
QList< QgsMimeDataUtils::Uri > UriList
A base dialog for options and properties dialogs that offers vertical tabs.
void showEvent(QShowEvent *e) override
void setCurrentPage(const QString &page)
Sets the dialog page (by object name) to show.
Represents a raster layer.