Skip to content
Permalink
Browse files

[auth] Re-designed authentication configuration selector widget

- single line widget
- takes much less space
- it has the same functionality of the previous version
- use icons and tooltips to convey information
  • Loading branch information
elpaso committed Sep 29, 2017
1 parent db0c223 commit 9ba7a8ca2a654d378530b422a08de03e02fb34ce
Showing with 75 additions and 88 deletions.
  1. +16 −6 src/gui/auth/qgsauthconfigselect.cpp
  2. +1 −0 src/gui/auth/qgsauthconfigselect.h
  3. +58 −82 src/ui/auth/qgsauthconfigselect.ui
@@ -26,6 +26,7 @@
#include "qgsauthmanager.h"
#include "qgsauthconfigedit.h"
#include "qgslogger.h"
#include "qgsapplication.h"


QgsAuthConfigSelect::QgsAuthConfigSelect( QWidget *parent, const QString &dataprovider )
@@ -44,6 +45,17 @@ QgsAuthConfigSelect::QgsAuthConfigSelect( QWidget *parent, const QString &datapr
{
setupUi( this );

// Set icons and remove texts
btnConfigAdd->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionAdd.svg" ) ) );
btnConfigRemove->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDeleteSelected.svg" ) ) );
btnConfigEdit->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionToggleEditing.svg" ) ) );
btnConfigMsgClear->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mIconClose.svg" ) ) );

btnConfigAdd->setText( QStringLiteral( "" ) );
btnConfigRemove->setText( QStringLiteral( "" ) );
btnConfigEdit->setText( QStringLiteral( "" ) );
btnConfigMsgClear->setText( QStringLiteral( "" ) );

leConfigMsg->setStyleSheet( QStringLiteral( "QLineEdit{background-color: %1}" )
.arg( QgsAuthGuiUtils::yellowColor().name() ) );

@@ -94,9 +106,8 @@ void QgsAuthConfigSelect::loadConfig()
{
methoddesc = authmethod->description();
}
leConfigMethodDesc->setText( methoddesc );
leConfigMethodDesc->setCursorPosition( 0 ); // left justify
leConfigId->setText( config.id() );
cmbConfigSelect->setToolTip( tr( "<ul><li><b>Method type:</b> %1</li>"
"<li><b>Configuration ID:</b> %2</li></ul>" ).arg( methoddesc, config.id( ) ) );
btnConfigEdit->setEnabled( true );
btnConfigRemove->setEnabled( true );
}
@@ -105,8 +116,7 @@ void QgsAuthConfigSelect::loadConfig()

void QgsAuthConfigSelect::clearConfig()
{
leConfigMethodDesc->clear();
leConfigId->clear();
cmbConfigSelect->setToolTip( QStringLiteral( "" ) );
btnConfigEdit->setEnabled( false );
btnConfigRemove->setEnabled( false );
}
@@ -134,7 +144,7 @@ void QgsAuthConfigSelect::populateConfigSelector()
for ( cit = mConfigs.constBegin(); cit != mConfigs.constEnd(); ++cit )
{
QgsAuthMethodConfig config = cit.value();
sortmap.insert( config.name(), cit.key() );
sortmap.insert( QStringLiteral( "%1 (%2)" ).arg( config.name(), config.method() ), cit.key() );
}

QgsStringMap::const_iterator sm = sortmap.constBegin();
@@ -18,6 +18,7 @@
#define QGSAUTHCONFIGSELECT_H

#include <QWidget>
#include <QLabel>
#include "qgis.h"

#include "ui_qgsauthconfigselect.h"
@@ -6,29 +6,31 @@
<rect>
<x>0</x>
<y>0</y>
<width>278</width>
<height>176</height>
<width>546</width>
<height>90</height>
</rect>
</property>
<property name="windowTitle">
<string>Authentication Configuration</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<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>
<layout class="QGridLayout" name="gridLayout">
<property name="verticalSpacing">
<number>10</number>
</property>
<item row="1" column="1">
<widget class="QToolButton" name="btnConfigAdd">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QComboBox" name="cmbConfigSelect">
<property name="sizePolicy">
@@ -39,13 +41,13 @@
</property>
<property name="minimumSize">
<size>
<width>200</width>
<width>250</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<item row="0" column="0" colspan="6">
<widget class="QFrame" name="frConfigMsg">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
@@ -57,7 +59,16 @@
<property name="spacing">
<number>0</number>
</property>
<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>
@@ -68,7 +79,7 @@
</widget>
</item>
<item>
<widget class="QToolButton" name="btnConfigMsgClear">
<widget class="QPushButton" name="btnConfigMsgClear">
<property name="minimumSize">
<size>
<width>26</width>
@@ -81,91 +92,61 @@
<height>22</height>
</size>
</property>
<property name="text">
<string/>
<property name="toolTip">
<string>Dismiss</string>
</property>
<property name="icon">
<iconset resource="../../../images/images.qrc">
<normaloff>:/images/themes/default/mIconClose.svg</normaloff>:/images/themes/default/mIconClose.svg</iconset>
<property name="text">
<string>Dismiss</string>
</property>
<property name="iconSize">
<size>
<width>14</width>
<height>14</height>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="styleSheet">
<string notr="true">QLabel{color: rgb(128, 128, 128);}</string>
<item row="1" column="4">
<widget class="QPushButton" name="btnConfigAdd">
<property name="toolTip">
<string>Create a new authentication configuration</string>
</property>
<property name="text">
<string>Method</string>
<string>New</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="styleSheet">
<string notr="true">QLabel{color: rgb(128, 128, 128);}</string>
<item row="1" column="2">
<widget class="QPushButton" name="btnConfigRemove">
<property name="toolTip">
<string>Delete selected configuration</string>
</property>
<property name="text">
<string>Id</string>
<string>Delete</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="leConfigId">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit{color: rgb(128, 128, 128);}</string>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnConfigEdit">
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnConfigRemove">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leConfigMethodDesc">
<property name="styleSheet">
<string notr="true">QLineEdit{color: rgb(128, 128, 128);}</string>
<widget class="QPushButton" name="btnConfigEdit">
<property name="toolTip">
<string>Edit selected configuration</string>
</property>
<property name="text">
<string>Edit</string>
</property>
<property name="readOnly">
<property name="flat">
<bool>true</bool>
</property>
</widget>
@@ -180,7 +161,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
<height>40</height>
</size>
</property>
</spacer>
@@ -191,11 +172,6 @@
<tabstop>leConfigMsg</tabstop>
<tabstop>btnConfigMsgClear</tabstop>
<tabstop>cmbConfigSelect</tabstop>
<tabstop>btnConfigAdd</tabstop>
<tabstop>leConfigMethodDesc</tabstop>
<tabstop>leConfigId</tabstop>
<tabstop>btnConfigEdit</tabstop>
<tabstop>btnConfigRemove</tabstop>
</tabstops>
<resources>
<include location="../../../images/images.qrc"/>

0 comments on commit 9ba7a8c

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