Skip to content
Open
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
4 changes: 4 additions & 0 deletions src/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
add_library(ui STATIC
certificatewidget.cpp
certificatewidget.hpp
languageselect.cpp
languageselect.hpp
languageselect.ui
punycode.hpp
ui.cpp
webeiddialog.cpp
Expand All @@ -12,6 +15,7 @@ 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}
)
Expand Down
7 changes: 0 additions & 7 deletions src/ui/dark.qss
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,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;
}
Expand Down
17 changes: 0 additions & 17 deletions src/ui/dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,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;
Expand Down
53 changes: 53 additions & 0 deletions src/ui/languageselect.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* 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 <QFile>
#include <QSettings>
#include <QStyle>

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<QToolButton*>(QSettings().value(QStringLiteral("lang")).toString()))
btn->setChecked(true);
connect(ui.select, &QPushButton::clicked, this, [this, langGroup = ui.langGroup] {
if (auto* btn = langGroup->checkedButton()) {
QSettings().setValue(QStringLiteral("lang"), btn->objectName());
qApp->loadTranslations();
}
accept();
});
connect(ui.cancel, &QPushButton::clicked, this, &LanguageSelect::reject);
}
32 changes: 32 additions & 0 deletions src/ui/languageselect.hpp
Original file line number Diff line number Diff line change
@@ -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 <QDialog>

class LanguageSelect : public QDialog
{
Q_OBJECT
public:
explicit LanguageSelect(QWidget* parent = nullptr);
};
21 changes: 21 additions & 0 deletions src/ui/languageselect.qss
Original file line number Diff line number Diff line change
@@ -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;
}
Loading
Loading