Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[delimitedtext] Move GUI-related code to a separate file
- Loading branch information
Showing
4 changed files
with
66 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/providers/delimitedtext/qgsdelimitedtextprovidergui.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/*************************************************************************** | ||
qgsdelimitedtextprovidergui.cpp | ||
-------------------------------------- | ||
Date : June 2019 | ||
Copyright : (C) 2019 by Martin Dobias | ||
Email : wonder dot sk at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsapplication.h" | ||
#include "qgsproviderguimetadata.h" | ||
#include "qgssourceselectprovider.h" | ||
|
||
#include "qgsdelimitedtextprovider.h" | ||
#include "qgsdelimitedtextsourceselect.h" | ||
|
||
//! Provider for delimited text source select | ||
class QgsDelimitedTextSourceSelectProvider : public QgsSourceSelectProvider | ||
{ | ||
public: | ||
|
||
QString providerKey() const override { return QStringLiteral( "delimitedtext" ); } | ||
QString text() const override { return QObject::tr( "Delimited Text" ); } | ||
int ordering() const override { return QgsSourceSelectProvider::OrderLocalProvider + 30; } | ||
QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddDelimitedTextLayer.svg" ) ); } | ||
QgsAbstractDataSourceWidget *createDataSourceWidget( QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::Widget, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Embedded ) const override | ||
{ | ||
return new QgsDelimitedTextSourceSelect( parent, fl, widgetMode ); | ||
} | ||
}; | ||
|
||
|
||
class QgsDelimitedTextProviderGuiMetadata: public QgsProviderGuiMetadata | ||
{ | ||
public: | ||
QgsDelimitedTextProviderGuiMetadata() | ||
: QgsProviderGuiMetadata( QgsDelimitedTextProvider::TEXT_PROVIDER_KEY ) | ||
{ | ||
} | ||
|
||
QList<QgsSourceSelectProvider *> sourceSelectProviders() override | ||
{ | ||
QList<QgsSourceSelectProvider *> providers; | ||
providers << new QgsDelimitedTextSourceSelectProvider; | ||
return providers; | ||
} | ||
}; | ||
|
||
|
||
QGISEXTERN QgsProviderGuiMetadata *providerGuiMetadataFactory() | ||
{ | ||
return new QgsDelimitedTextProviderGuiMetadata(); | ||
} |