Skip to content

Commit

Permalink
[auth] Update embedded QgsAuthSettingsWidget spacing
Browse files Browse the repository at this point in the history
- Minimize all text-wrapped QLabel text in QgsAuthSettingsWidget
  (wrapped text defaulted to 3 lines of spacing, even if not used)
- Remove default 'Basic' text
- Hide Basic QLabel if there is no text
- Add 'Optional' placholder text for Password of Basic
- Fix non-expanded Name and URL fields for newhttpconnectionbase.ui
- Smaller minimum size for QgsAuthConfigSelect
- Minimize 'Convert to configuration' button width
  • Loading branch information
dakcarto committed Oct 4, 2017
1 parent 191942a commit 74e9242
Show file tree
Hide file tree
Showing 8 changed files with 285 additions and 107 deletions.
3 changes: 3 additions & 0 deletions src/gui/auth/qgsauthsettingswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ QgsAuthSettingsWidget::QgsAuthSettingsWidget( QWidget *parent,
{
mAuthConfigSelect->setConfigId( configId );
}
setBasicText( "" );
connect( btnConvertToEncrypted, &QPushButton::clicked, this, &QgsAuthSettingsWidget::convertToEncrypted );
connect( txtUserName, &QLineEdit::textChanged, this, &QgsAuthSettingsWidget::userNameTextChanged );
connect( txtPassword, &QLineEdit::textChanged, this, &QgsAuthSettingsWidget::passwordTextChanged );
Expand All @@ -55,6 +56,8 @@ void QgsAuthSettingsWidget::setWarningText( const QString &warningText )
void QgsAuthSettingsWidget::setBasicText( const QString &basicText )
{
lblBasic->setText( basicText );
// hide unused widget so its word wrapping does not add to parent widget's height
lblBasic->setVisible( ! basicText.isEmpty() );
}

const QString QgsAuthSettingsWidget::username() const
Expand Down
10 changes: 2 additions & 8 deletions src/ui/auth/qgsauthconfigselect.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="verticalSpacing">
<number>10</number>
<number>6</number>
</property>
<item row="1" column="0">
<widget class="QComboBox" name="cmbConfigSelect">
Expand All @@ -41,7 +41,7 @@
</property>
<property name="minimumSize">
<size>
<width>250</width>
<width>125</width>
<height>0</height>
</size>
</property>
Expand Down Expand Up @@ -146,12 +146,6 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
Expand Down
151 changes: 119 additions & 32 deletions src/ui/auth/qgsauthsettingswidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,29 @@
<rect>
<x>0</x>
<y>0</y>
<width>405</width>
<height>264</height>
<width>315</width>
<height>243</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="QTabWidget" name="tabAuth">
<property name="sizePolicy">
Expand All @@ -30,39 +45,66 @@
<string>Configurations</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Choose an authentication configuration or create a new one.</string>
<string>Choose or create a configuration.</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QgsAuthConfigSelect" name="mAuthConfigSelect">
<widget class="QgsAuthConfigSelect" name="mAuthConfigSelect" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Credentials are safely stored in the encrypted QGIS authentication database, protected by your master password. </string>
<string>Credentials are encrypted and stored in the QGIS authentication database. </string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
Expand All @@ -76,8 +118,8 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>80</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
Expand All @@ -89,7 +131,22 @@
<string>Basic</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="5" column="1">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="6" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand All @@ -114,9 +171,18 @@
</item>
<item row="2" column="1">
<widget class="QgsPasswordLineEdit" name="txtPassword">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="placeholderText">
<string>Optional</string>
</property>
</widget>
</item>
<item row="2" column="0">
Expand All @@ -130,7 +196,14 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="txtUserName"/>
<widget class="QLineEdit" name="txtUserName">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="cbStoreUsername">
Expand All @@ -152,17 +225,16 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QPushButton" name="btnConvertToEncrypted">
<property name="text">
<string>Convert to configuration</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QLabel" name="lblWarning">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#ff0000;&quot;&gt;Warning: credentials are stored unencrypted (in clear text) in the project file!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#ff0000;&quot;&gt;Warning: credentials stored unencrypted!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
Expand All @@ -171,23 +243,37 @@
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="lblBasic">
<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>
<string/>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="btnConvertToEncrypted">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Convert to configuration</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
Expand All @@ -202,8 +288,9 @@
</customwidget>
<customwidget>
<class>QgsAuthConfigSelect</class>
<extends>QLineEdit</extends>
<extends>QWidget</extends>
<header>qgsauthconfigselect.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
Expand Down
12 changes: 12 additions & 0 deletions src/ui/qgsdb2newconnectionbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@
<string>Authentication</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QgsAuthSettingsWidget" name="mAuthSettings" native="true"/>
</item>
Expand Down
Loading

0 comments on commit 74e9242

Please sign in to comment.