Skip to content
Permalink
Browse files

[addlayerbutton] More embeddable dialogs

  • Loading branch information
elpaso committed Jun 2, 2017
1 parent b31f05c commit 143e0c63c895d39a4118393659ae18926a8efc82
@@ -54,7 +54,7 @@
#include <QNetworkRequest>
#include <QNetworkReply>

QgsOWSSourceSelect::QgsOWSSourceSelect( const QString &service, QWidget *parent, Qt::WindowFlags fl, bool managerMode, bool embeddedMode )
QgsOWSSourceSelect::QgsOWSSourceSelect( const QString &service, QWidget *parent, Qt::WindowFlags fl, bool embeddedMode, bool managerMode )
: QDialog( parent, fl )
, mService( service )
, mManagerMode( managerMode )
@@ -65,12 +65,13 @@ QgsOWSSourceSelect::QgsOWSSourceSelect( const QString &service, QWidget *parent,

if ( mEmbeddedMode )
{
mDialogButtonBox->button( QDialogButtonBox::Close )->hide();
buttonBox->removeButton( buttonBox->button( QDialogButtonBox::Close ) );
}


setWindowTitle( tr( "Add Layer(s) from a %1 Server" ).arg( service ) );

mAddButton = mDialogButtonBox->button( QDialogButtonBox::Apply );
mAddButton = buttonBox->button( QDialogButtonBox::Apply );
mAddButton->setText( tr( "&Add" ) );
mAddButton->setToolTip( tr( "Add selected layers to map" ) );
mAddButton->setEnabled( false );
@@ -60,7 +60,7 @@ class GUI_EXPORT QgsOWSSourceSelect : public QDialog, public Ui::QgsOWSSourceSel
};

//! Constructor
QgsOWSSourceSelect( const QString &service, QWidget *parent = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false );
QgsOWSSourceSelect( const QString &service, QWidget *parent = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, bool embeddedMode = false, bool managerMode = false );

~QgsOWSSourceSelect();

@@ -129,7 +129,8 @@ QgsDb2SourceSelect::QgsDb2SourceSelect( QWidget *parent, Qt::WindowFlags fl, boo

if ( mEmbeddedMode )
{
buttonBox->button( QDialogButtonBox::Close )->hide();
buttonBox->removeButton( buttonBox->button( QDialogButtonBox::Close ) );
mHoldDialogOpen->hide();
}

mAddButton = new QPushButton( tr( "&Add" ) );
@@ -130,7 +130,8 @@ QgsMssqlSourceSelect::QgsMssqlSourceSelect( QWidget *parent, Qt::WindowFlags fl,

if ( mEmbeddedMode )
{
buttonBox->button( QDialogButtonBox::Close )->hide();
buttonBox->removeButton( buttonBox->button( QDialogButtonBox::Close ) );
mHoldDialogOpen->hide();
}

mAddButton = new QPushButton( tr( "&Add" ) );
@@ -351,7 +351,7 @@ void QgsSLRootItem::createDatabase()
QGISEXTERN QgsSpatiaLiteSourceSelect *selectWidget( QWidget *parent, Qt::WindowFlags fl, bool embeddedMode )
{
// TODO: this should be somewhere else
return new QgsSpatiaLiteSourceSelect( parent, fl, false );
return new QgsSpatiaLiteSourceSelect( parent, fl, embeddedMode );
}

QGISEXTERN int dataCapabilities()
@@ -45,11 +45,6 @@ QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QWidget *parent, Qt::Windo
{
setupUi( this );

if ( embeddedMode )
{
buttonBox->removeButton( buttonBox->button( QDialogButtonBox::Close ) );
}

QgsSettings settings;
restoreGeometry( settings.value( QStringLiteral( "Windows/SpatiaLiteSourceSelect/geometry" ) ).toByteArray() );
mHoldDialogOpen->setChecked( settings.value( QStringLiteral( "Windows/SpatiaLiteSourceSelect/HoldDialogOpen" ), false ).toBool() );
@@ -73,7 +68,8 @@ QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QWidget *parent, Qt::Windo

if ( mEmbeddedMode )
{
buttonBox->button( QDialogButtonBox::Close )->hide();
buttonBox->removeButton( buttonBox->button( QDialogButtonBox::Close ) );
mHoldDialogOpen->hide();
}
else
{
@@ -423,7 +419,7 @@ void QgsSpatiaLiteSourceSelect::addTables()
else
{
emit addDatabaseLayers( m_selectedTables, QStringLiteral( "spatialite" ) );
if ( !mHoldDialogOpen->isChecked() )
if ( !( mEmbeddedMode || mHoldDialogOpen->isChecked() ) )
{
accept();
}
@@ -30,6 +30,7 @@
QgsWCSSourceSelect::QgsWCSSourceSelect( QWidget *parent, Qt::WindowFlags fl, bool embeddedMode, bool managerMode )
: QgsOWSSourceSelect( QStringLiteral( "WCS" ), parent, fl, embeddedMode, managerMode )
{

// Hide irrelevant widgets
mWMSGroupBox->hide();
mLayersTab->layout()->removeWidget( mWMSGroupBox );
@@ -151,10 +151,34 @@
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../images/images.qrc"/>
</resources>
<connections/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>QgsDataSourceManagerDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>504</x>
<y>578</y>
</hint>
<hint type="destinationlabel">
<x>504</x>
<y>299</y>
</hint>
</hints>
</connection>
</connections>
</ui>
@@ -3,7 +3,7 @@
<class>QgsOWSSourceSelectBase</class>
<widget class="QDialog" name="QgsOWSSourceSelectBase">
<property name="geometry">
<rect>:
<rect>
<x>0</x>
<y>0</y>
<width>743</width>
@@ -15,8 +15,7 @@
</property>
<property name="windowIcon">
<iconset>
<normaloff/>
</iconset>
<normaloff>.</normaloff>.</iconset>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
@@ -26,7 +25,7 @@
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0">
<widget class="QDialogButtonBox" name="mDialogButtonBox">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Close|QDialogButtonBox::Help</set>
</property>
@@ -68,12 +67,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="mConnectButton">
<property name="toolTip">
<string>Connect to selected service</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Connect to selected service</string>
</property>
<property name="text">
<string>C&amp;onnect</string>
</property>
@@ -91,25 +90,25 @@
</item>
<item>
<widget class="QPushButton" name="mEditButton">
<property name="toolTip">
<string>Edit selected service connection</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Edit selected service connection</string>
</property>
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mDeleteButton">
<property name="toolTip">
<string>Remove connection to selected service</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Remove connection to selected service</string>
</property>
<property name="text">
<string>Remove</string>
</property>
@@ -202,7 +201,16 @@
<item>
<widget class="QWidget" name="mTimeWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -231,7 +239,16 @@
<item>
<widget class="QWidget" name="mCRSWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -273,7 +290,16 @@
<item>
<widget class="QWidget" name="mFormatWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -350,7 +376,16 @@
<item>
<widget class="QWidget" name="mCacheWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -585,12 +620,12 @@ Always network: always load from network and do not check if the cache has a val
<tabstop>mSearchButton</tabstop>
<tabstop>mSearchTableWidget</tabstop>
<tabstop>mSearchAddButton</tabstop>
<tabstop>mDialogButtonBox</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>mDialogButtonBox</sender>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>QgsOWSSourceSelectBase</receiver>
<slot>reject()</slot>

0 comments on commit 143e0c6

Please sign in to comment.
You can’t perform that action at this time.