Skip to content

Commit

Permalink
Draw settings check and radio buttons and workaround background image…
Browse files Browse the repository at this point in the history
… issues

IB-6572

Signed-off-by: Raul Metsma <raul@metsma.ee>
  • Loading branch information
metsma committed Dec 2, 2020
1 parent d660d2e commit 9507f26
Show file tree
Hide file tree
Showing 20 changed files with 268 additions and 125 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include( VersionInfo )
find_package( PKCS11 )
find_package( LibDigiDocpp 3.14.4 REQUIRED )
find_package( LDAP REQUIRED )
find_package( Qt5 COMPONENTS Core Widgets Network PrintSupport Svg LinguistTools REQUIRED )
find_package( Qt5 5.9.0 REQUIRED COMPONENTS Core Widgets Network PrintSupport Svg LinguistTools )

set_env( TSL_URL "https://ec.europa.eu/tools/lotl/eu-lotl.xml" CACHE STRING "TSL trust list primary URL" )
set_env( TSL_INCLUDE "EE" CACHE STRING "TSL list include in binary" )
Expand Down
2 changes: 2 additions & 0 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ add_executable( ${PROGNAME} WIN32 MACOSX_BUNDLE
widgets/AddressItem.cpp
widgets/CardWidget.cpp
widgets/CardPopup.cpp
widgets/CheckBox.cpp
widgets/ContainerPage.cpp
widgets/ComboBox.cpp
widgets/DropdownButton.cpp
Expand All @@ -113,6 +114,7 @@ add_executable( ${PROGNAME} WIN32 MACOSX_BUNDLE
widgets/NoCardInfo.cpp
widgets/OtherData.cpp
widgets/PageIcon.cpp
widgets/RadioButton.cpp
widgets/SignatureItem.cpp
widgets/StyledWidget.cpp
widgets/VerifyCert.cpp
Expand Down
2 changes: 1 addition & 1 deletion client/dialogs/FirstRun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ FirstRun::FirstRun(QWidget *parent)
else
ui->lang->setCurrentIndex(0);

connect( ui->lang, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this](int index) {
connect(ui->lang, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this](int index) {
switch(index)
{
case 1: emit langChanged(QStringLiteral("en")); break;
Expand Down
11 changes: 5 additions & 6 deletions client/dialogs/FirstRun.ui
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,15 @@ QComboBox QWidget#content {
/* rows */
QComboBox QPushButton {
margin: 3px;
padding: 0px 4px 0px 8px;
padding: 0px 8px 0px 4px;
border: 0px;
color: #353739;
text-align: left;
qproperty-iconSize: 14px 9px;
qproperty-layoutDirection: RightToLeft;
}
QComboBox QPushButton#selected {
background-image: url(:/images/arrow_up.svg);
background-position: right center;
background-repeat: none;
background-origin: content;
qproperty-icon: url(:/images/arrow_up.svg);
}

/* hover row */
Expand All @@ -117,7 +116,7 @@ QComboBox QPushButton:hover {
color: #FFFFFF;
}
QComboBox QPushButton:hover#selected {
background-image: url(:/images/arrow_up_white.svg);
qproperty-icon: url(:/images/arrow_up_white.svg);
}

/* drop-down button*/
Expand Down
15 changes: 7 additions & 8 deletions client/dialogs/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
#include <QtCore/QIODevice>
#include <QtCore/QJsonObject>
#include <QtCore/QProcess>
#include <QtCore/QSettings>
#include <QtCore/QStandardPaths>
#include <QtCore/QThread>
#include <QtCore/QThreadPool>
#include <QtCore/QUrl>
#include <QtGui/QDesktopServices>
#include <QtCore/QSettings>
#include <QtNetwork/QNetworkProxy>
#include <QtWidgets/QInputDialog>
#include <QtWidgets/QTextBrowser>
Expand Down Expand Up @@ -245,7 +245,7 @@ SettingsDialog::SettingsDialog(QWidget *parent)
ui->pageGroup->setId(ui->btnMenuProxy, NetworkSettings);
ui->pageGroup->setId(ui->btnMenuDiagnostics, DiagnosticsSettings);
ui->pageGroup->setId(ui->btnMenuInfo, LicenseSettings);
connect(ui->pageGroup, static_cast<void (QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked), this, &SettingsDialog::changePage);
connect(ui->pageGroup, QOverload<QAbstractButton*>::of(&QButtonGroup::buttonClicked), this, &SettingsDialog::changePage);

initFunctionality();
updateVersion();
Expand All @@ -258,7 +258,6 @@ SettingsDialog::SettingsDialog(int page, QWidget *parent)
showPage(page);
}


SettingsDialog::~SettingsDialog()
{
QApplication::restoreOverrideCursor();
Expand Down Expand Up @@ -359,7 +358,7 @@ void SettingsDialog::initFunctionality()
if(!dir.isEmpty())
{
ui->rdGeneralSpecifyDirectory->setChecked(true);
setValueEx(QStringLiteral("DefaultDir"), dir, QString());
setValueEx(QStringLiteral("DefaultDir"), dir);
ui->txtGeneralDirectory->setText(dir);
}
});
Expand All @@ -373,7 +372,7 @@ void SettingsDialog::initFunctionality()
if(ui->txtGeneralDirectory->text().isEmpty())
ui->rdGeneralSameDirectory->setChecked(true);
connect(ui->txtGeneralDirectory, &QLineEdit::textChanged, this, [](const QString &text) {
setValueEx(QStringLiteral("DefaultDir"), text, QString());
setValueEx(QStringLiteral("DefaultDir"), text);
});
#endif

Expand Down Expand Up @@ -444,8 +443,8 @@ void SettingsDialog::initFunctionality()
ui->rdMIDUUIDCustom->setChecked(s.value(QStringLiteral("MIDUUID-CUSTOM"), s.contains(QStringLiteral("MIDUUID"))).toBool());
ui->txtMIDUUID->setText(s.value(QStringLiteral("MIDUUID")).toString());
connect(ui->txtMIDUUID, &QLineEdit::textChanged, this, [](const QString &text) {
setValueEx(QStringLiteral("MIDUUID"), text, QString());
setValueEx(QStringLiteral("SIDUUID"), text, QString());
setValueEx(QStringLiteral("MIDUUID"), text);
setValueEx(QStringLiteral("SIDUUID"), text);
});
connect(ui->helpRevocation, &QToolButton::clicked, this, []{
QDesktopServices::openUrl(tr("https://www.id.ee/en/article/access-certificate-what-is-it/"));
Expand Down Expand Up @@ -531,7 +530,7 @@ void SettingsDialog::saveProxy()

void SettingsDialog::setValueEx(const QString &key, const QVariant &value, const QVariant &def)
{
if(value == def)
if(value == def || (def.isNull() && value.isNull()))
QSettings().remove(key);
else
QSettings().setValue(key, value);
Expand Down
6 changes: 4 additions & 2 deletions client/dialogs/SettingsDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#include <QDialog>

#include <QVariant>

namespace digidoc { class Conf; }

namespace Ui {
Expand All @@ -29,7 +31,7 @@ class SettingsDialog;

class QAbstractButton;

class SettingsDialog : public QDialog
class SettingsDialog final: public QDialog
{
Q_OBJECT

Expand All @@ -48,7 +50,7 @@ class SettingsDialog : public QDialog

void showPage(int page);
static void loadProxy( const digidoc::Conf *conf );
static void setValueEx( const QString &key, const QVariant &value, const QVariant &def );
static void setValueEx(const QString &key, const QVariant &value, const QVariant &def = {});

signals:
void langChanged(const QString& lang);
Expand Down
87 changes: 35 additions & 52 deletions client/dialogs/SettingsDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ QLineEdit {
background-color: #FFFFFF;
min-height: 31px;
}
QCheckBox, QRadioButton {
min-height: 31px;
}
QCheckBox:disabled {
color: #75787B;
}
QCheckBox::indicator, QRadioButton::indicator {
width: 14px;
height: 14px;
Expand Down Expand Up @@ -286,7 +292,7 @@ QRadioButton::indicator::checked {
<item>
<layout class="QHBoxLayout" name="languageBoxLayout">
<item>
<widget class="QRadioButton" name="rdGeneralEstonian">
<widget class="RadioButton" name="rdGeneralEstonian">
<property name="text">
<string notr="true">Eesti</string>
</property>
Expand All @@ -299,7 +305,7 @@ QRadioButton::indicator::checked {
</widget>
</item>
<item>
<widget class="QRadioButton" name="rdGeneralRussian">
<widget class="RadioButton" name="rdGeneralRussian">
<property name="text">
<string notr="true">Русский</string>
</property>
Expand All @@ -309,7 +315,7 @@ QRadioButton::indicator::checked {
</widget>
</item>
<item>
<widget class="QRadioButton" name="rdGeneralEnglish">
<widget class="RadioButton" name="rdGeneralEnglish">
<property name="text">
<string notr="true">English</string>
</property>
Expand All @@ -334,7 +340,7 @@ QRadioButton::indicator::checked {
</layout>
</item>
<item>
<widget class="QCheckBox" name="chkGeneralTslRefresh">
<widget class="CheckBox" name="chkGeneralTslRefresh">
<property name="text">
<string>Online TSL digest check</string>
</property>
Expand All @@ -344,14 +350,14 @@ QRadioButton::indicator::checked {
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkShowPrintSummary">
<widget class="CheckBox" name="chkShowPrintSummary">
<property name="text">
<string>Show print summary</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkRoleAddressInfo">
<widget class="CheckBox" name="chkRoleAddressInfo">
<property name="text">
<string>Ask role and address info on signing</string>
</property>
Expand All @@ -376,7 +382,7 @@ QRadioButton::indicator::checked {
<number>20</number>
</property>
<item row="0" column="0">
<widget class="QRadioButton" name="rdGeneralSameDirectory">
<widget class="RadioButton" name="rdGeneralSameDirectory">
<property name="text">
<string>Same folder</string>
</property>
Expand All @@ -386,7 +392,7 @@ QRadioButton::indicator::checked {
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="rdGeneralSpecifyDirectory">
<widget class="RadioButton" name="rdGeneralSpecifyDirectory">
<property name="text">
<string>Select the default directory</string>
</property>
Expand Down Expand Up @@ -426,7 +432,7 @@ QRadioButton::indicator::checked {
</layout>
</item>
<item>
<widget class="QCheckBox" name="tokenBackend">
<widget class="CheckBox" name="tokenBackend">
<property name="text">
<string>I would like to sign with Lithuanian, Latvian ID-card</string>
</property>
Expand Down Expand Up @@ -454,9 +460,6 @@ QPushButton {
padding-bottom:1px;
text-align: middle;
min-height: 30px;
}
QRadioButton, QCheckBox {
min-height: 31px;
}</string>
</property>
<layout class="QVBoxLayout" name="pageServicesLayout">
Expand Down Expand Up @@ -609,7 +612,7 @@ QRadioButton, QCheckBox {
</layout>
</item>
<item>
<widget class="QCheckBox" name="chkIgnoreAccessCert">
<widget class="CheckBox" name="chkIgnoreAccessCert">
<property name="text">
<string>Ignore server access certificate (IP based access)</string>
</property>
Expand Down Expand Up @@ -687,7 +690,7 @@ QRadioButton, QCheckBox {
</layout>
</item>
<item>
<widget class="QRadioButton" name="rdTimeStampDefault">
<widget class="RadioButton" name="rdTimeStampDefault">
<property name="text">
<string>Use default access</string>
</property>
Expand All @@ -700,7 +703,7 @@ QRadioButton, QCheckBox {
</widget>
</item>
<item>
<widget class="QRadioButton" name="rdTimeStampCustom">
<widget class="RadioButton" name="rdTimeStampCustom">
<property name="text">
<string>Use manually configured access</string>
</property>
Expand Down Expand Up @@ -772,7 +775,7 @@ QRadioButton, QCheckBox {
</layout>
</item>
<item>
<widget class="QRadioButton" name="rdMIDUUIDDefault">
<widget class="RadioButton" name="rdMIDUUIDDefault">
<property name="text">
<string>Use default access</string>
</property>
Expand All @@ -785,7 +788,7 @@ QRadioButton, QCheckBox {
</widget>
</item>
<item>
<widget class="QRadioButton" name="rdMIDUUIDCustom">
<widget class="RadioButton" name="rdMIDUUIDCustom">
<property name="text">
<string>Use manually configured access</string>
</property>
Expand Down Expand Up @@ -846,13 +849,7 @@ QRadioButton, QCheckBox {
<number>20</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="rdProxyNone">
<property name="minimumSize">
<size>
<width>0</width>
<height>31</height>
</size>
</property>
<widget class="RadioButton" name="rdProxyNone">
<property name="text">
<string>No proxy</string>
</property>
Expand All @@ -862,26 +859,14 @@ QRadioButton, QCheckBox {
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QRadioButton" name="rdProxySystem">
<property name="minimumSize">
<size>
<width>0</width>
<height>31</height>
</size>
</property>
<widget class="RadioButton" name="rdProxySystem">
<property name="text">
<string>Use system proxy settings</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QRadioButton" name="rdProxyManual">
<property name="minimumSize">
<size>
<width>0</width>
<height>31</height>
</size>
</property>
<widget class="RadioButton" name="rdProxyManual">
<property name="text">
<string>Manual proxy configuration</string>
</property>
Expand Down Expand Up @@ -950,19 +935,7 @@ QRadioButton, QCheckBox {
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="chkProxyEnableForSSL">
<property name="minimumSize">
<size>
<width>0</width>
<height>31</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QCheckBox:disabled {
color: #75787B;
}
</string>
</property>
<widget class="CheckBox" name="chkProxyEnableForSSL">
<property name="text">
<string>Enable proxy for SSL connections</string>
</property>
Expand Down Expand Up @@ -1022,7 +995,7 @@ QScrollBar::sub-line:vertical {
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkLibdigidocppDebug">
<widget class="CheckBox" name="chkLibdigidocppDebug">
<property name="text">
<string>Enable one-time log generation</string>
</property>
Expand Down Expand Up @@ -1386,6 +1359,16 @@ QPushButton:disabled {
<header location="global">QtSvg/QSvgWidget</header>
<container>1</container>
</customwidget>
<customwidget>
<class>CheckBox</class>
<extends>QCheckBox</extends>
<header>widgets/CheckBox.h</header>
</customwidget>
<customwidget>
<class>RadioButton</class>
<extends>QRadioButton</extends>
<header>widgets/RadioButton.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down
Loading

0 comments on commit 9507f26

Please sign in to comment.