Skip to content

Commit c856ba3

Browse files
committedOct 2, 2017
[auth] XYX use the new authentication widget
1 parent 4e4a660 commit c856ba3

File tree

3 files changed

+79
-163
lines changed

3 files changed

+79
-163
lines changed
 

‎src/providers/wms/qgsxyzconnectiondialog.cpp

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* *
1414
***************************************************************************/
1515

16-
#include "qgsauthconfigselect.h"
1716
#include "qgsxyzconnectiondialog.h"
1817
#include "qgsxyzconnection.h"
1918

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

25-
mAuthConfigSelect = new QgsAuthConfigSelect( this );
26-
mTabAuth->insertTab( 1, mAuthConfigSelect, tr( "Configurations" ) );
2724
// Behavior for min and max zoom checkbox
2825
connect( mCheckBoxZMin, &QCheckBox::toggled, mSpinZMin, &QSpinBox::setEnabled );
2926
connect( mCheckBoxZMax, &QCheckBox::toggled, mSpinZMax, &QSpinBox::setEnabled );
@@ -37,18 +34,10 @@ void QgsXyzConnectionDialog::setConnection( const QgsXyzConnection &conn )
3734
mSpinZMin->setValue( conn.zMin != -1 ? conn.zMin : 0 );
3835
mCheckBoxZMax->setChecked( conn.zMax != -1 );
3936
mSpinZMax->setValue( conn.zMax != -1 ? conn.zMax : 18 );
40-
mEditUsername->setText( conn.username );
41-
mEditPassword->setText( conn.password );
37+
mAuthSettings->setUsername( conn.username );
38+
mAuthSettings->setPassword( conn.password );
4239
mEditReferer->setText( conn.referer );
43-
mAuthConfigSelect->setConfigId( conn.authCfg );
44-
if ( ! conn.authCfg.isEmpty( ) )
45-
{
46-
mTabAuth->setCurrentIndex( mTabAuth->indexOf( mAuthConfigSelect ) );
47-
}
48-
else
49-
{
50-
mTabAuth->setCurrentIndex( 0 );
51-
}
40+
mAuthSettings->setConfigId( conn.authCfg );
5241
}
5342

5443
QgsXyzConnection QgsXyzConnectionDialog::connection() const
@@ -60,9 +49,9 @@ QgsXyzConnection QgsXyzConnectionDialog::connection() const
6049
conn.zMin = mSpinZMin->value();
6150
if ( mCheckBoxZMax->isChecked() )
6251
conn.zMax = mSpinZMax->value();
63-
conn.username = mEditUsername->text();
64-
conn.password = mEditPassword->text();
52+
conn.username = mAuthSettings->username();
53+
conn.password = mAuthSettings->password();
6554
conn.referer = mEditReferer->text();
66-
conn.authCfg = mAuthConfigSelect->configId( );
55+
conn.authCfg = mAuthSettings->configId( );
6756
return conn;
6857
}

‎src/providers/wms/qgsxyzconnectiondialog.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
#include "ui_qgsxyzconnectiondialog.h"
2222

23-
class QgsAuthConfigSelect;
2423

2524
struct QgsXyzConnection;
2625

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

4039
QString mBaseKey;
4140
QString mCredentialsBaseKey;
42-
QgsAuthConfigSelect *mAuthConfigSelect = nullptr;
43-
4441
};
4542

4643
#endif // QGSXYZCONNECTIONDIALOG_H

‎src/ui/qgsxyzconnectiondialog.ui

Lines changed: 73 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>869</width>
10-
<height>787</height>
9+
<width>525</width>
10+
<height>332</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -20,106 +20,34 @@
2020
<string>Connection details</string>
2121
</property>
2222
<layout class="QGridLayout" name="gridLayout">
23-
<item row="3" column="0">
24-
<widget class="QCheckBox" name="mCheckBoxZMin">
23+
<item row="9" column="0" colspan="2">
24+
<widget class="QLabel" name="lblReferer">
2525
<property name="text">
26-
<string>Min. Zoom Level</string>
26+
<string>Referer</string>
2727
</property>
28-
<property name="checked">
29-
<bool>true</bool>
28+
<property name="buddy">
29+
<cstring>mEditReferer</cstring>
3030
</property>
3131
</widget>
3232
</item>
33-
<item row="2" column="0" colspan="2">
34-
<widget class="QTabWidget" name="mTabAuth">
35-
<property name="sizePolicy">
36-
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
37-
<horstretch>0</horstretch>
38-
<verstretch>0</verstretch>
39-
</sizepolicy>
40-
</property>
41-
<property name="currentIndex">
42-
<number>0</number>
33+
<item row="9" column="2">
34+
<widget class="QLineEdit" name="mEditReferer">
35+
<property name="toolTip">
36+
<string>Optional custom referer</string>
4337
</property>
44-
<widget class="QWidget" name="tab">
45-
<attribute name="title">
46-
<string>Authentication</string>
47-
</attribute>
48-
<layout class="QGridLayout" name="gridLayout_3">
49-
<item row="1" column="0">
50-
<widget class="QLabel" name="label_3">
51-
<property name="text">
52-
<string>&amp;User name</string>
53-
</property>
54-
<property name="buddy">
55-
<cstring>mEditUsername</cstring>
56-
</property>
57-
</widget>
58-
</item>
59-
<item row="1" column="1">
60-
<widget class="QLineEdit" name="mEditUsername"/>
61-
</item>
62-
<item row="0" column="0" colspan="2">
63-
<widget class="QLabel" name="label_4">
64-
<property name="sizePolicy">
65-
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
66-
<horstretch>0</horstretch>
67-
<verstretch>0</verstretch>
68-
</sizepolicy>
69-
</property>
70-
<property name="text">
71-
<string>If the service requires basic authentication, enter a user name and optional password</string>
72-
</property>
73-
<property name="textFormat">
74-
<enum>Qt::PlainText</enum>
75-
</property>
76-
<property name="wordWrap">
77-
<bool>true</bool>
78-
</property>
79-
</widget>
80-
</item>
81-
<item row="2" column="0">
82-
<widget class="QLabel" name="label_5">
83-
<property name="text">
84-
<string>Password</string>
85-
</property>
86-
<property name="buddy">
87-
<cstring>mEditPassword</cstring>
88-
</property>
89-
</widget>
90-
</item>
91-
<item row="2" column="1">
92-
<widget class="QgsPasswordLineEdit" name="mEditPassword">
93-
<property name="echoMode">
94-
<enum>QLineEdit::Password</enum>
95-
</property>
96-
</widget>
97-
</item>
98-
<item row="3" column="1">
99-
<spacer name="verticalSpacer_2">
100-
<property name="orientation">
101-
<enum>Qt::Vertical</enum>
102-
</property>
103-
<property name="sizeHint" stdset="0">
104-
<size>
105-
<width>0</width>
106-
<height>0</height>
107-
</size>
108-
</property>
109-
</spacer>
110-
</item>
111-
</layout>
112-
</widget>
11338
</widget>
11439
</item>
115-
<item row="0" column="1">
116-
<widget class="QLineEdit" name="mEditName">
117-
<property name="toolTip">
118-
<string>Name of the new connection</string>
40+
<item row="8" column="0" colspan="2">
41+
<widget class="QCheckBox" name="mCheckBoxZMax">
42+
<property name="text">
43+
<string>Max. Zoom Level</string>
44+
</property>
45+
<property name="checked">
46+
<bool>true</bool>
11947
</property>
12048
</widget>
12149
</item>
122-
<item row="6" column="1">
50+
<item row="8" column="2">
12351
<widget class="QSpinBox" name="mSpinZMax">
12452
<property name="sizePolicy">
12553
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@@ -132,83 +60,85 @@
13260
</property>
13361
</widget>
13462
</item>
135-
<item row="3" column="1">
136-
<widget class="QSpinBox" name="mSpinZMin">
137-
<property name="sizePolicy">
138-
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
139-
<horstretch>0</horstretch>
140-
<verstretch>0</verstretch>
141-
</sizepolicy>
63+
<item row="1" column="2">
64+
<widget class="QLineEdit" name="mEditUrl">
65+
<property name="toolTip">
66+
<string>URL of the connection, {z}, {y}, and {z} will be replaced with actual values. Use {-y} for inverted y axis.</string>
14267
</property>
143-
</widget>
144-
</item>
145-
<item row="1" column="0">
146-
<widget class="QLabel" name="label_2">
147-
<property name="text">
148-
<string>URL</string>
68+
<property name="placeholderText">
69+
<string>http://example.com/{z}/{x}/{y}.png</string>
14970
</property>
15071
</widget>
15172
</item>
152-
<item row="0" column="0">
73+
<item row="0" column="0" colspan="2">
15374
<widget class="QLabel" name="label">
15475
<property name="text">
15576
<string>Name</string>
15677
</property>
15778
</widget>
15879
</item>
159-
<item row="1" column="1">
160-
<widget class="QLineEdit" name="mEditUrl">
80+
<item row="0" column="2">
81+
<widget class="QLineEdit" name="mEditName">
16182
<property name="toolTip">
162-
<string>URL of the connection, {z}, {y}, and {z} will be replaced with actual values. Use {-y} for inverted y axis.</string>
163-
</property>
164-
<property name="placeholderText">
165-
<string>http://example.com/{z}/{x}/{y}.png</string>
83+
<string>Name of the new connection</string>
16684
</property>
16785
</widget>
16886
</item>
169-
<item row="6" column="0">
170-
<widget class="QCheckBox" name="mCheckBoxZMax">
87+
<item row="10" column="2">
88+
<spacer name="verticalSpacer">
89+
<property name="orientation">
90+
<enum>Qt::Vertical</enum>
91+
</property>
92+
<property name="sizeHint" stdset="0">
93+
<size>
94+
<width>20</width>
95+
<height>40</height>
96+
</size>
97+
</property>
98+
</spacer>
99+
</item>
100+
<item row="2" column="0" rowspan="2" colspan="3">
101+
<widget class="QGroupBox" name="mAuthGroupBox">
102+
<property name="title">
103+
<string>Authentication</string>
104+
</property>
105+
<layout class="QVBoxLayout" name="verticalLayout_3">
106+
<item>
107+
<widget class="QgsAuthSettingsWidget" name="mAuthSettings" native="true"/>
108+
</item>
109+
</layout>
110+
</widget>
111+
</item>
112+
<item row="1" column="0">
113+
<widget class="QLabel" name="label_2">
171114
<property name="text">
172-
<string>Max. Zoom Level</string>
173-
</property>
174-
<property name="checked">
175-
<bool>true</bool>
115+
<string>URL</string>
176116
</property>
177117
</widget>
178118
</item>
179-
<item row="7" column="0">
180-
<widget class="QLabel" name="lblReferer">
119+
<item row="4" column="0" colspan="2">
120+
<widget class="QCheckBox" name="mCheckBoxZMin">
181121
<property name="text">
182-
<string>Referer</string>
122+
<string>Min. Zoom Level</string>
183123
</property>
184-
<property name="buddy">
185-
<cstring>mEditReferer</cstring>
124+
<property name="checked">
125+
<bool>true</bool>
186126
</property>
187127
</widget>
188128
</item>
189-
<item row="7" column="1">
190-
<widget class="QLineEdit" name="mEditReferer">
191-
<property name="toolTip">
192-
<string>Optional custom referer</string>
129+
<item row="4" column="2">
130+
<widget class="QSpinBox" name="mSpinZMin">
131+
<property name="sizePolicy">
132+
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
133+
<horstretch>0</horstretch>
134+
<verstretch>0</verstretch>
135+
</sizepolicy>
193136
</property>
194137
</widget>
195138
</item>
196139
</layout>
197140
</widget>
198141
</item>
199-
<item>
200-
<spacer name="verticalSpacer">
201-
<property name="orientation">
202-
<enum>Qt::Vertical</enum>
203-
</property>
204-
<property name="sizeHint" stdset="0">
205-
<size>
206-
<width>20</width>
207-
<height>40</height>
208-
</size>
209-
</property>
210-
</spacer>
211-
</item>
212142
<item>
213143
<widget class="QDialogButtonBox" name="buttonBox">
214144
<property name="orientation">
@@ -223,15 +153,15 @@
223153
</widget>
224154
<customwidgets>
225155
<customwidget>
226-
<class>QgsPasswordLineEdit</class>
227-
<extends>QLineEdit</extends>
228-
<header>qgspasswordlineedit.h</header>
156+
<class>QgsAuthSettingsWidget</class>
157+
<extends>QWidget</extends>
158+
<header>auth/qgsauthsettingswidget.h</header>
159+
<container>1</container>
229160
</customwidget>
230161
</customwidgets>
231162
<tabstops>
232163
<tabstop>mEditUrl</tabstop>
233164
<tabstop>mCheckBoxZMin</tabstop>
234-
<tabstop>mSpinZMin</tabstop>
235165
<tabstop>mCheckBoxZMax</tabstop>
236166
<tabstop>buttonBox</tabstop>
237167
</tabstops>

0 commit comments

Comments
 (0)