diff --git a/src/app/main.cpp b/src/app/main.cpp
index f7a8f31c..197fed52 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -30,8 +30,6 @@
int main(int argc, char* argv[])
{
- Q_INIT_RESOURCE(web_eid_resources);
-
Application app(argc, argv, QStringLiteral("web-eid"));
try {
diff --git a/src/mac/main.mm b/src/mac/main.mm
index 6f3bec48..f2b5b1ed 100644
--- a/src/mac/main.mm
+++ b/src/mac/main.mm
@@ -171,8 +171,6 @@ void showSafariSettings() final
int main(int argc, char* argv[])
{
- Q_INIT_RESOURCE(web_eid_resources);
-
SafariApplication app(argc, argv, QStringLiteral("web-eid-safari"));
auto appPtr = &app;
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index cfd822f9..52a0d6cb 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -1,26 +1,26 @@
add_library(ui STATIC
certificatewidget.cpp
certificatewidget.hpp
+ languageselect.cpp
+ languageselect.hpp
+ languageselect.ui
punycode.hpp
ui.cpp
webeiddialog.cpp
webeiddialog.hpp
- web-eid-resources.qrc
dialog.ui
)
-qt_add_translations(ui TS_FILES
- translations/en.ts
- translations/et.ts
- translations/fi.ts
- translations/hr.ts
- translations/ru.ts
- translations/de.ts
- translations/fr.ts
- translations/nl.ts
- translations/cs.ts
- translations/sk.ts
- RESOURCE_PREFIX /translations
+file(GLOB IMAGES images/*.svg)
+file(GLOB FONTS fonts/*.ttf)
+qt_add_resources(ui resources BASE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX / FILES
+ ../../install/appicon_128.png
+ dark.qss
+ languageselect.qss
+ ${IMAGES}
+ ${FONTS}
)
+file(GLOB TRANSLATIONS translations/*.ts)
+qt_add_translations(ui TS_FILES ${TRANSLATIONS} RESOURCE_PREFIX /translations)
set_target_properties(ui PROPERTIES
AUTORCC ON
AUTOUIC ON
diff --git a/src/ui/dark.qss b/src/ui/dark.qss
index eb12ec47..fda55a34 100644
--- a/src/ui/dark.qss
+++ b/src/ui/dark.qss
@@ -3,36 +3,11 @@ background-color: #232325;
color: white;
}
QPushButton {
-border-color: #4E4E53;
-background-color: #4E4E53;
-}
-QPushButton::disabled {
-border-color: #27272A;
-background-color: #27272A;
-}
-QPushButton::hover {
-background-color: #76767B;
-border-color: #76767B;
-}
-QPushButton::focus {
-background-color: #76767B;
-border-color: #DEDEDE;
+color: #FF5C79;
+border-color: #FF5C79;
}
-QPushButton:default {
-background-color: #113F8E;
-border-color: #113F8E;
-}
-QPushButton:default::disabled {
-background-color: #15213E;
-border-color: #15213E;
-}
-QPushButton:default::hover {
-background-color: #008EEA;
-border-color: #008EEA;
-}
-QPushButton:default::focus {
-background-color: #008EEA;
-border-color: #DEDEDE;
+QPushButton:hover, QPushButton:pressed {
+background-color: #232325;
}
#langButton {
color: #FFFFFF;
@@ -41,13 +16,6 @@ background-image: url(:images/down_dark.svg);
#langButton::hover {
background-color: #4E4E53;
}
-#langMenu {
-border-color: #4E4E53;
-background-color: #4E4E53;
-}
-#langMenu > QPushButton {
-color: #FFFFFF;
-}
CertificateButton, CertificateWidget {
border-color: #4E4E53;
}
diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui
index 19bfd744..042fde43 100644
--- a/src/ui/dialog.ui
+++ b/src/ui/dialog.ui
@@ -27,43 +27,32 @@ font-family: "Roboto";
color: black;
}
QPushButton {
-font-size: 17px;
-border: 3px solid #EFEFEF;
-border-radius: 3px;
-height: 39px;
-padding-left: 17px;
-padding-right: 17px;
-min-width: 30px;
-background-color: #EFEFEF;
-}
-QPushButton::disabled {
-background-color: #FAFAFA;
-border-color: #FAFAFA;
+color: #AD2A45;
+border: 1px solid #AD2A45;
+border-radius: 4px;
+padding: 11px 12px;
+font-family: Roboto, Helvetica;
+font-size: 14px;
+font-weight: 700;
}
-QPushButton::hover {
-background-color: #DEDEDE;
-border-color: #DEDEDE;
+QPushButton:hover {
+background-color: #F5EBED;
}
-QPushButton::focus {
-background-color: #DEDEDE;
-border-color: #76767B;
+QPushButton:pressed {
+background-color: #E1C1C6;
}
-QPushButton:default {
+QPushButton::default, #helpButton {
color: white;
-background-color: #113F8E;
-border-color: #113F8E;
-}
-QPushButton:default::disabled {
-background-color: #B7C5DD;
-border-color: #B7C5DD;
+border-color: #2F70B6;
+background-color: #2F70B6;
}
-QPushButton:default::hover {
-background-color: #003168;
-border-color: #003168
+QPushButton::default:hover, #helpButton:hover {
+border-color: #2B66A6;
+background-color: #2B66A6;
}
-QPushButton:default::focus {
-background-color: #003168;
-border-color: #008EEA;
+QPushButton::default:pressed, #helpButton:pressed {
+border-color: #215081;
+background-color: #215081;
}
#langButton {
color: #003168;
@@ -83,23 +72,6 @@ background-image: url(:images/down.svg);
#langButton::hover {
background-color: #EFEFEF;
}
-#langMenu {
-border: 3px solid #EFEFEF;
-border-radius: 3px;
-background-color: #EFEFEF;
-}
-#langMenu > QPushButton {
-color: #003168;
-border: 0px;
-max-height: 22px;
-padding-left: 7px;
-padding-right: 6px;
-font-size: 14px;
-text-align: left;
-}
-#langMenu > QPushButton:checked {
-font-weight: bold;
-}
CertificateButton, CertificateWidget {
border: 1px solid rgba(0,49,104,0.1);
border-radius: 4px;
@@ -183,9 +155,6 @@ border-radius: 3px;
#fatalErrorLabel, #aboutAlert {
color: #CD2541;
}
-#helpButton {
-color: #003168;
-}
#aboutVersion {
color: #76767B;
}
@@ -891,21 +860,24 @@ height: 24px;
PointingHandCursor
+
+ Qt::RightToLeft
+
Help
- :/images/help.svg:/images/help.svg
+ :/images/link.svg:/images/link.svg
- 30
- 26
+ 16
+ 16
-
- false
+
+ true
@@ -917,16 +889,6 @@ height: 24px;
Confirm
-
-
- :/images/arrow.svg:/images/arrow.svg
-
-
-
- 20
- 16
-
-
true
diff --git a/src/ui/images/arrow.svg b/src/ui/images/arrow.svg
deleted file mode 100644
index 1a6a0997..00000000
--- a/src/ui/images/arrow.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/ui/images/help.svg b/src/ui/images/help.svg
deleted file mode 100644
index c9fe386e..00000000
--- a/src/ui/images/help.svg
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/ui/images/help_dark.svg b/src/ui/images/help_dark.svg
deleted file mode 100644
index 0388ea38..00000000
--- a/src/ui/images/help_dark.svg
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/ui/images/link.svg b/src/ui/images/link.svg
new file mode 100644
index 00000000..b576d24b
--- /dev/null
+++ b/src/ui/images/link.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/src/ui/languageselect.cpp b/src/ui/languageselect.cpp
new file mode 100644
index 00000000..5e541489
--- /dev/null
+++ b/src/ui/languageselect.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2020-2024 Estonian Information System Authority
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "languageselect.hpp"
+#include "ui_languageselect.h"
+
+#include "application.hpp"
+
+#include
+#include
+#include
+
+LanguageSelect::LanguageSelect(QWidget* parent) : QDialog(parent)
+{
+ Ui::LanguageSelect ui;
+ ui.setupUi(this);
+ if (Application::isDarkTheme()) {
+ if (QFile f(QStringLiteral(":languageselect.qss")); f.open(QFile::ReadOnly | QFile::Text)) {
+ style()->unpolish(this);
+ setStyleSheet(styleSheet() + QTextStream(&f).readAll());
+ style()->polish(this);
+ }
+ }
+ if(auto *btn = findChild(QSettings().value(QStringLiteral("lang")).toString()))
+ btn->setChecked(true);
+ connect(ui.select, &QPushButton::clicked, this, &LanguageSelect::accept);
+ connect(ui.cancel, &QPushButton::clicked, this, &LanguageSelect::reject);
+ connect(ui.langGroup, qOverload(&QButtonGroup::buttonClicked), this,
+ [](QAbstractButton* action) {
+ QSettings().setValue(QStringLiteral("lang"), action->objectName());
+ qApp->loadTranslations();
+ });
+}
diff --git a/src/ui/languageselect.hpp b/src/ui/languageselect.hpp
new file mode 100644
index 00000000..b5a4db4d
--- /dev/null
+++ b/src/ui/languageselect.hpp
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2020-2024 Estonian Information System Authority
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#pragma once
+
+#include
+
+class LanguageSelect : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit LanguageSelect(QWidget* parent = nullptr);
+};
diff --git a/src/ui/languageselect.qss b/src/ui/languageselect.qss
new file mode 100644
index 00000000..844970bf
--- /dev/null
+++ b/src/ui/languageselect.qss
@@ -0,0 +1,21 @@
+
+#LanguageSelect {
+background-color: #232325;
+}
+#label {
+color: white;
+}
+QPushButton {
+color: #FF5C79;
+border-color: #FF5C79;
+}
+QPushButton:hover, QPushButton:pressed {
+background-color: #232325;
+}
+QToolButton {
+color: white;
+border-color: #92A0B7;
+}
+QToolButton:checked {
+background-color: #415982;
+}
diff --git a/src/ui/languageselect.ui b/src/ui/languageselect.ui
new file mode 100644
index 00000000..0bdebb9d
--- /dev/null
+++ b/src/ui/languageselect.ui
@@ -0,0 +1,372 @@
+
+
+ LanguageSelect
+
+
+
+ 0
+ 0
+ 540
+ 438
+
+
+
+ Web-eID
+
+
+ #LanguageSelect {
+background-color: white;
+}
+#label {
+font-family: Roboto, Helvetica;
+font-size: 20px;
+font-weight: 700;
+color: #003168;
+}
+QAbstractButton {
+font-family: Roboto, Helvetica;
+font-size: 14px;
+font-weight: 700;
+}
+QToolButton {
+color: #07142A;
+border: 1px solid #AEB9CA;
+border-radius: 5px;
+padding: 16px;
+}
+QToolButton:checked {
+border-color: #003168;
+background-color: #EAF1F8
+}
+QPushButton {
+color: #AD2A45;
+border: 1px solid #AD2A45;
+border-radius: 4px;
+padding: 11px 12px;
+}
+QPushButton:hover {
+background-color: #F5EBED;
+}
+QPushButton:pressed {
+background-color: #E1C1C6;
+}
+QPushButton::default {
+color: white;
+border-color: #2F70B6;
+background-color: #2F70B6;
+}
+QPushButton::default:hover {
+border-color: #2B66A6;
+background-color: #2B66A6;
+}
+QPushButton::default:pressed {
+border-color: #215081;
+background-color: #215081;
+}
+
+
+
+ QLayout::SetFixedSize
+
+
+ 40
+
+
+ 32
+
+
+ 40
+
+
+ 32
+
+
+ 0
+
+
+ 40
+
+ -
+
+
+ Select language
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Eesti keel
+
+
+ true
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ English
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Русский
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Suomi
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Hrvatska
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Deutsch
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Française
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Nederlands
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Čeština
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Slovenština
+
+
+ true
+
+
+ langGroup
+
+
+
+
+
+ -
+
+
+ PointingHandCursor
+
+
+ Cancel
+
+
+ false
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 317
+ 20
+
+
+
+
+ -
+
+
+ PointingHandCursor
+
+
+ Select
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/ui/translations/cs.ts b/src/ui/translations/cs.ts
index 1039c78f..9ce4edf8 100644
--- a/src/ui/translations/cs.ts
+++ b/src/ui/translations/cs.ts
@@ -27,6 +27,21 @@
PIN zablokován
+
+ LanguageSelect
+
+ Cancel
+ Zrušit
+
+
+ Select language
+
+
+
+ Select
+
+
+
WebEidDialog
@@ -274,5 +289,14 @@
Active language
CS
+
+ PIN entry disabled
+
+
+
+ English
+ Active language accessible
+ Čeština
+
diff --git a/src/ui/translations/de.ts b/src/ui/translations/de.ts
index 1475cb5b..d6fe4307 100644
--- a/src/ui/translations/de.ts
+++ b/src/ui/translations/de.ts
@@ -27,6 +27,21 @@
PIN gesperrt
+
+ LanguageSelect
+
+ Cancel
+ Abbrechen
+
+
+ Select language
+
+
+
+ Select
+
+
+
WebEidDialog
@@ -272,5 +287,14 @@
Active language
DE
+
+ PIN entry disabled
+
+
+
+ English
+ Active language accessible
+ Deutsch
+
diff --git a/src/ui/translations/en.ts b/src/ui/translations/en.ts
index 38ec43ac..7454be95 100644
--- a/src/ui/translations/en.ts
+++ b/src/ui/translations/en.ts
@@ -27,6 +27,21 @@
Pin locked
+
+ LanguageSelect
+
+ Cancel
+ Cancel
+
+
+ Select language
+ Select language
+
+
+ Select
+ Select
+
+
WebEidDialog
@@ -272,5 +287,14 @@
Active language
EN
+
+ PIN entry disabled
+
+
+
+ English
+ Active language accessible
+ English
+
diff --git a/src/ui/translations/et.ts b/src/ui/translations/et.ts
index 97d7d4df..f45eb050 100644
--- a/src/ui/translations/et.ts
+++ b/src/ui/translations/et.ts
@@ -27,6 +27,21 @@
PIN-kood on lukus
+
+ LanguageSelect
+
+ Cancel
+ Katkesta
+
+
+ Select language
+ Vali keel
+
+
+ Select
+ Vali
+
+
WebEidDialog
@@ -272,5 +287,14 @@
Active language
ET
+
+ PIN entry disabled
+
+
+
+ English
+ Active language accessible
+ Eesti
+
diff --git a/src/ui/translations/fi.ts b/src/ui/translations/fi.ts
index 120ca47e..cc581136 100644
--- a/src/ui/translations/fi.ts
+++ b/src/ui/translations/fi.ts
@@ -27,6 +27,21 @@
Pin lukittu
+
+ LanguageSelect
+
+ Cancel
+ Peruuta
+
+
+ Select language
+
+
+
+ Select
+
+
+
WebEidDialog
@@ -272,5 +287,14 @@
Active language
FI
+
+ PIN entry disabled
+
+
+
+ English
+ Active language accessible
+ Suomi
+
diff --git a/src/ui/translations/fr.ts b/src/ui/translations/fr.ts
index 72220236..52f41fda 100644
--- a/src/ui/translations/fr.ts
+++ b/src/ui/translations/fr.ts
@@ -27,6 +27,21 @@
Pin bloquée
+
+ LanguageSelect
+
+ Cancel
+ Annuler
+
+
+ Select language
+
+
+
+ Select
+
+
+
WebEidDialog
@@ -272,5 +287,14 @@
Active language
FR
+
+ PIN entry disabled
+
+
+
+ English
+ Active language accessible
+ Française
+
diff --git a/src/ui/translations/hr.ts b/src/ui/translations/hr.ts
index 8bf5c112..ca94d71e 100644
--- a/src/ui/translations/hr.ts
+++ b/src/ui/translations/hr.ts
@@ -27,6 +27,21 @@
<b>%1</b><br />Izdavatelj: %2<br />Vrijedi: %3 do %4%5
+
+ LanguageSelect
+
+ Cancel
+ Prekid
+
+
+ Select language
+
+
+
+ Select
+
+
+
WebEidDialog
@@ -274,5 +289,14 @@
Active language
HR
+
+ PIN entry disabled
+
+
+
+ English
+ Active language accessible
+ Hrvatska
+
diff --git a/src/ui/translations/nl.ts b/src/ui/translations/nl.ts
index 643a5cf4..65d03b97 100644
--- a/src/ui/translations/nl.ts
+++ b/src/ui/translations/nl.ts
@@ -27,6 +27,21 @@
PIN geblokkeerd
+
+ LanguageSelect
+
+ Cancel
+ Annuleer
+
+
+ Select language
+
+
+
+ Select
+
+
+
WebEidDialog
@@ -272,5 +287,14 @@
Active language
NL
+
+ PIN entry disabled
+
+
+
+ English
+ Active language accessible
+ Nederlands
+
diff --git a/src/ui/translations/ru.ts b/src/ui/translations/ru.ts
index d0041855..825cc25d 100644
--- a/src/ui/translations/ru.ts
+++ b/src/ui/translations/ru.ts
@@ -27,6 +27,21 @@
PIN-код заблокирован
+
+ LanguageSelect
+
+ Cancel
+ Прервать
+
+
+ Select language
+
+
+
+ Select
+
+
+
WebEidDialog
@@ -274,5 +289,14 @@
Active language
RU
+
+ PIN entry disabled
+
+
+
+ English
+ Active language accessible
+ Русский
+
diff --git a/src/ui/translations/sk.ts b/src/ui/translations/sk.ts
index 5fa57401..1f14a924 100644
--- a/src/ui/translations/sk.ts
+++ b/src/ui/translations/sk.ts
@@ -27,6 +27,21 @@
PIN zablokovaný
+
+ LanguageSelect
+
+ Cancel
+ Zrušiť
+
+
+ Select language
+
+
+
+ Select
+
+
+
WebEidDialog
@@ -274,5 +289,14 @@
Active language
SK
+
+ PIN entry disabled
+
+
+
+ English
+ Active language accessible
+ Slovenština
+
diff --git a/src/ui/web-eid-resources.qrc b/src/ui/web-eid-resources.qrc
deleted file mode 100644
index f3e72615..00000000
--- a/src/ui/web-eid-resources.qrc
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
- dark.qss
- images/arrow.svg
- images/cardreader.svg
- images/cardreader_dark.svg
- images/down.svg
- images/down_dark.svg
- images/fatal.svg
- images/fatal_dark.svg
- images/help.svg
- images/help_dark.svg
- images/id-card.svg
- images/id-card_dark.svg
- images/left.svg
- images/no-id-card.svg
- images/no-id-card_dark.svg
- images/origin.svg
- images/origin_dark.svg
- images/wait.svg
- fonts/Roboto-Black.ttf
- fonts/Roboto-BlackItalic.ttf
- fonts/Roboto-Bold.ttf
- fonts/Roboto-BoldItalic.ttf
- fonts/Roboto-Italic.ttf
- fonts/Roboto-Light.ttf
- fonts/Roboto-LightItalic.ttf
- fonts/Roboto-Medium.ttf
- fonts/Roboto-MediumItalic.ttf
- fonts/Roboto-Regular.ttf
- fonts/Roboto-Thin.ttf
- fonts/Roboto-ThinItalic.ttf
- ../../install/appicon_128.png
-
-
diff --git a/src/ui/webeiddialog.cpp b/src/ui/webeiddialog.cpp
index dd30e2d0..6e104c97 100644
--- a/src/ui/webeiddialog.cpp
+++ b/src/ui/webeiddialog.cpp
@@ -22,6 +22,7 @@
#include "webeiddialog.hpp"
#include "application.hpp"
+#include "languageselect.hpp"
#include "punycode.hpp"
#include "ui_dialog.h"
@@ -43,8 +44,6 @@
#include
#endif
-#include
-
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
constexpr inline QLatin1String operator"" _L1(const char* str, size_t size) noexcept
{
@@ -79,7 +78,6 @@ WebEidDialog::WebEidDialog(QWidget* parent) : WebEidUI(parent), ui(new Private)
ui->cardChipIcon->setPixmap(pixmap("no-id-card"_L1));
ui->fatalErrorIcon->setPixmap(pixmap("fatal"_L1));
ui->aboutIcon->setPixmap(pixmap("fatal"_L1));
- ui->helpButton->setIcon(QIcon(QStringLiteral(":/images/help_dark.svg")));
}
}
setWindowFlag(Qt::CustomizeWindowHint);
@@ -91,62 +89,9 @@ WebEidDialog::WebEidDialog(QWidget* parent) : WebEidUI(parent), ui(new Private)
ui->langButton = new QToolButton(this);
ui->langButton->setObjectName("langButton");
- static const std::vector> LANG_LIST {
- {QStringLiteral("et"), QStringLiteral("Eesti")},
- {QStringLiteral("en"), QStringLiteral("English")},
- {QStringLiteral("ru"), QStringLiteral("Русский")},
- {QStringLiteral("fi"), QStringLiteral("Suomi")},
- {QStringLiteral("hr"), QStringLiteral("Hrvatska")},
- {QStringLiteral("de"), QStringLiteral("Deutsch")},
- {QStringLiteral("fr"), QStringLiteral("Française")},
- {QStringLiteral("nl"), QStringLiteral("Nederlands")},
- {QStringLiteral("cs"), QStringLiteral("Čeština")},
- {QStringLiteral("sk"), QStringLiteral("Slovenština")}};
ui->langButton->setText(tr("EN", "Active language"));
- if (auto i = std::find_if(LANG_LIST.cbegin(), LANG_LIST.cend(),
- [lang = ui->langButton->text().toLower()](const auto& elem) {
- return elem.first == lang;
- });
- i != LANG_LIST.cend()) {
- ui->langButton->setAccessibleName(i->second);
- }
- connect(ui->langButton, &QToolButton::clicked, this, [this] {
- if (auto* menu = findChild(QStringLiteral("langMenu"))) {
- menu->deleteLater();
- return;
- }
- auto* menu = new QWidget(this);
- menu->setObjectName("langMenu");
- auto* layout = new QGridLayout(menu);
- layout->setContentsMargins(1, 1, 1, 1);
- layout->setSpacing(1);
- layout->setSizeConstraint(QLayout::SetFixedSize);
- auto* langGroup = new QButtonGroup(menu);
- langGroup->setExclusive(true);
- int i {};
- for (const auto& [lang, title] : LANG_LIST) {
- auto* action = new QPushButton(menu);
- action->setText(title);
- action->setProperty("lang", lang);
- action->setAutoDefault(false);
- layout->addWidget(action, i / 2, i % 2);
- langGroup->addButton(action);
- action->setCheckable(true);
- action->setChecked(lang == ui->langButton->text().toLower());
- action->setMinimumSize(action->sizeHint() + QSize(1, 0));
- ++i;
- }
- menu->show();
- menu->move(ui->langButton->geometry().bottomRight() - menu->geometry().topRight()
- + QPoint(0, 2));
- connect(langGroup, qOverload(&QButtonGroup::buttonClicked), menu,
- [this, menu](QAbstractButton* action) {
- QSettings().setValue(QStringLiteral("lang"), action->property("lang"));
- ui->langButton->setText(action->property("lang").toString().toUpper());
- qApp->loadTranslations();
- menu->deleteLater();
- });
- });
+ ui->langButton->setAccessibleName(tr("English", "Active language accessible"));
+ connect(ui->langButton, &QToolButton::clicked, this, [] { LanguageSelect().exec(); });
ui->pinInput->setAttribute(Qt::WA_MacShowFocusRect, false);
auto pinInputFont = ui->pinInput->font();
@@ -509,14 +454,11 @@ bool WebEidDialog::event(QEvent* event)
switch (event->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
+ ui->langButton->setText(tr("EN", "Active language"));
+ ui->langButton->setAccessibleName(tr("English", "Active language accessible"));
emit languageChange();
resizeHeight();
break;
- case QEvent::MouseButtonRelease:
- if (auto* w = findChild(QStringLiteral("langMenu"))) {
- w->deleteLater();
- }
- break;
case QEvent::Resize:
ui->langButton->move(width() - ui->langButton->width() - 20, 5);
break;