Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw settings check and radio buttons and workaround background image issues #856

Merged
merged 1 commit into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading