Skip to content
Permalink
Browse files

[auth] XYX use the new authentication widget

  • Loading branch information
elpaso committed Oct 2, 2017
1 parent 4e4a660 commit c856ba3ec2bb15d354a573b95f0988b42f11a005
@@ -13,7 +13,6 @@
* *
***************************************************************************/

#include "qgsauthconfigselect.h"
#include "qgsxyzconnectiondialog.h"
#include "qgsxyzconnection.h"

@@ -22,8 +21,6 @@ QgsXyzConnectionDialog::QgsXyzConnectionDialog( QWidget *parent )
{
setupUi( this );

mAuthConfigSelect = new QgsAuthConfigSelect( this );
mTabAuth->insertTab( 1, mAuthConfigSelect, tr( "Configurations" ) );
// Behavior for min and max zoom checkbox
connect( mCheckBoxZMin, &QCheckBox::toggled, mSpinZMin, &QSpinBox::setEnabled );
connect( mCheckBoxZMax, &QCheckBox::toggled, mSpinZMax, &QSpinBox::setEnabled );
@@ -37,18 +34,10 @@ void QgsXyzConnectionDialog::setConnection( const QgsXyzConnection &conn )
mSpinZMin->setValue( conn.zMin != -1 ? conn.zMin : 0 );
mCheckBoxZMax->setChecked( conn.zMax != -1 );
mSpinZMax->setValue( conn.zMax != -1 ? conn.zMax : 18 );
mEditUsername->setText( conn.username );
mEditPassword->setText( conn.password );
mAuthSettings->setUsername( conn.username );
mAuthSettings->setPassword( conn.password );
mEditReferer->setText( conn.referer );
mAuthConfigSelect->setConfigId( conn.authCfg );
if ( ! conn.authCfg.isEmpty( ) )
{
mTabAuth->setCurrentIndex( mTabAuth->indexOf( mAuthConfigSelect ) );
}
else
{
mTabAuth->setCurrentIndex( 0 );
}
mAuthSettings->setConfigId( conn.authCfg );
}

QgsXyzConnection QgsXyzConnectionDialog::connection() const
@@ -60,9 +49,9 @@ QgsXyzConnection QgsXyzConnectionDialog::connection() const
conn.zMin = mSpinZMin->value();
if ( mCheckBoxZMax->isChecked() )
conn.zMax = mSpinZMax->value();
conn.username = mEditUsername->text();
conn.password = mEditPassword->text();
conn.username = mAuthSettings->username();
conn.password = mAuthSettings->password();
conn.referer = mEditReferer->text();
conn.authCfg = mAuthConfigSelect->configId( );
conn.authCfg = mAuthSettings->configId( );
return conn;
}
@@ -20,7 +20,6 @@

#include "ui_qgsxyzconnectiondialog.h"

class QgsAuthConfigSelect;

struct QgsXyzConnection;

@@ -39,8 +38,6 @@ class QgsXyzConnectionDialog : public QDialog, public Ui::QgsXyzConnectionDialog

QString mBaseKey;
QString mCredentialsBaseKey;
QgsAuthConfigSelect *mAuthConfigSelect = nullptr;

};

#endif // QGSXYZCONNECTIONDIALOG_H
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>869</width>
<height>787</height>
<width>525</width>
<height>332</height>
</rect>
</property>
<property name="windowTitle">
@@ -20,106 +20,34 @@
<string>Connection details</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="0">
<widget class="QCheckBox" name="mCheckBoxZMin">
<item row="9" column="0" colspan="2">
<widget class="QLabel" name="lblReferer">
<property name="text">
<string>Min. Zoom Level</string>
<string>Referer</string>
</property>
<property name="checked">
<bool>true</bool>
<property name="buddy">
<cstring>mEditReferer</cstring>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QTabWidget" name="mTabAuth">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
<item row="9" column="2">
<widget class="QLineEdit" name="mEditReferer">
<property name="toolTip">
<string>Optional custom referer</string>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Authentication</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&amp;User name</string>
</property>
<property name="buddy">
<cstring>mEditUsername</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mEditUsername"/>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>If the service requires basic authentication, enter a user name and optional password</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Password</string>
</property>
<property name="buddy">
<cstring>mEditPassword</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QgsPasswordLineEdit" name="mEditPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="mEditName">
<property name="toolTip">
<string>Name of the new connection</string>
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="mCheckBoxZMax">
<property name="text">
<string>Max. Zoom Level</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="8" column="2">
<widget class="QSpinBox" name="mSpinZMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@@ -132,83 +60,85 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="mSpinZMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="1" column="2">
<widget class="QLineEdit" name="mEditUrl">
<property name="toolTip">
<string>URL of the connection, {z}, {y}, and {z} will be replaced with actual values. Use {-y} for inverted y axis.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>URL</string>
<property name="placeholderText">
<string>http://example.com/{z}/{x}/{y}.png</string>
</property>
</widget>
</item>
<item row="0" column="0">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mEditUrl">
<item row="0" column="2">
<widget class="QLineEdit" name="mEditName">
<property name="toolTip">
<string>URL of the connection, {z}, {y}, and {z} will be replaced with actual values. Use {-y} for inverted y axis.</string>
</property>
<property name="placeholderText">
<string>http://example.com/{z}/{x}/{y}.png</string>
<string>Name of the new connection</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="mCheckBoxZMax">
<item row="10" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" rowspan="2" colspan="3">
<widget class="QGroupBox" name="mAuthGroupBox">
<property name="title">
<string>Authentication</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QgsAuthSettingsWidget" name="mAuthSettings" native="true"/>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Max. Zoom Level</string>
</property>
<property name="checked">
<bool>true</bool>
<string>URL</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="lblReferer">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="mCheckBoxZMin">
<property name="text">
<string>Referer</string>
<string>Min. Zoom Level</string>
</property>
<property name="buddy">
<cstring>mEditReferer</cstring>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="mEditReferer">
<property name="toolTip">
<string>Optional custom referer</string>
<item row="4" column="2">
<widget class="QSpinBox" name="mSpinZMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
@@ -223,15 +153,15 @@
</widget>
<customwidgets>
<customwidget>
<class>QgsPasswordLineEdit</class>
<extends>QLineEdit</extends>
<header>qgspasswordlineedit.h</header>
<class>QgsAuthSettingsWidget</class>
<extends>QWidget</extends>
<header>auth/qgsauthsettingswidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>mEditUrl</tabstop>
<tabstop>mCheckBoxZMin</tabstop>
<tabstop>mSpinZMin</tabstop>
<tabstop>mCheckBoxZMax</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>

0 comments on commit c856ba3

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