From c6c0f7e0b0d566b216c99b29680e981aacb7b3ce Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Mon, 5 Feb 2024 12:43:48 +0200 Subject: [PATCH] Update page button style IB-7961 Signed-off-by: Raul Metsma --- client/CDoc2.cpp | 2 +- client/Colors.h | 4 - client/MainWindow.cpp | 106 ++-- client/MainWindow.h | 4 +- client/MainWindow.ui | 608 +++++++++----------- client/MainWindow_MyEID.cpp | 4 +- client/effects/FadeInNotification.h | 6 +- client/images/icon_Allkiri.svg | 19 +- client/images/icon_Allkiri_hover.svg | 19 +- client/images/icon_Krypto.svg | 22 +- client/images/icon_Krypto_hover.svg | 22 +- client/images/icon_Minu_eID.svg | 114 +--- client/images/icon_Minu_eID_hover.svg | 24 +- client/images/icon_alert_error.svg | 4 + client/images/icon_alert_filled_orange.svg | 16 - client/images/icon_alert_filled_red.svg | 16 - client/images/icon_alert_warning.svg | 4 + client/images/icon_alert_whitebg_orange.svg | 16 - client/images/images.qrc | 5 +- client/translations/en.ts | 31 +- client/translations/et.ts | 31 +- client/translations/ru.ts | 31 +- client/widgets/PageIcon.cpp | 153 +---- client/widgets/PageIcon.h | 49 +- client/widgets/PageIcon.ui | 65 --- 25 files changed, 409 insertions(+), 966 deletions(-) create mode 100644 client/images/icon_alert_error.svg delete mode 100644 client/images/icon_alert_filled_orange.svg delete mode 100644 client/images/icon_alert_filled_red.svg create mode 100644 client/images/icon_alert_warning.svg delete mode 100644 client/images/icon_alert_whitebg_orange.svg delete mode 100644 client/widgets/PageIcon.ui diff --git a/client/CDoc2.cpp b/client/CDoc2.cpp index 02c099891..c662088a4 100644 --- a/client/CDoc2.cpp +++ b/client/CDoc2.cpp @@ -59,7 +59,7 @@ namespace cdoc20 { return true; return dispatchToMain([] { auto *notification = new FadeInNotification(Application::mainWindow(), - ria::qdigidoc4::colors::WHITE, ria::qdigidoc4::colors::MANTIS, 110); + ria::qdigidoc4::colors::WHITE, ria::qdigidoc4::colors::MANTIS); notification->start(QCoreApplication::translate("MainWindow", "Check internet connection"), 750, 3000, 1200); return false; }); diff --git a/client/Colors.h b/client/Colors.h index f0c221e7b..469365833 100644 --- a/client/Colors.h +++ b/client/Colors.h @@ -26,18 +26,14 @@ namespace qdigidoc4 namespace colors { // Blues - static const QString ASTRONAUT_BLUE = QStringLiteral("#023664"); - static const QString BAHAMA_BLUE = QStringLiteral("#035894"); static const QString CURIOUS_BLUE = QStringLiteral("#31A3D9"); static const QString DEEP_CERULEAN = QStringLiteral("#006EB5"); - static const QString LOCHMARA = QStringLiteral("#008DCF"); // Reds static const QString MOJO = QStringLiteral("#981E32"); // Whites static const QString PORCELAIN = QStringLiteral("#f4f5f6"); static const QString WHITE = QStringLiteral("#ffffff"); // Golds-yellows - static const QString CLAY_CREEK = QStringLiteral("#998B66"); static const QString MARZIPAN = QStringLiteral("#F8DDA7"); // Green static const QString MANTIS = QStringLiteral("#498526"); diff --git a/client/MainWindow.cpp b/client/MainWindow.cpp index 2f65bffa1..feaf0bece 100644 --- a/client/MainWindow.cpp +++ b/client/MainWindow.cpp @@ -67,12 +67,9 @@ MainWindow::MainWindow( QWidget *parent ) setAcceptDrops( true ); ui->setupUi(this); - QFont version = Styles::font(Styles::Regular, 12); - version.setUnderline(true); QFont condensed11 = Styles::font( Styles::Condensed, 11 ); QFont condensed14 = Styles::font( Styles::Condensed, 14 ); QFont regular20 = Styles::font( Styles::Regular, 20 ); - ui->version->setFont(version); ui->signIntroLabel->setFont( regular20 ); ui->signIntroButton->setFont( condensed14 ); ui->signIntroButton->setFocus(); @@ -90,17 +87,17 @@ MainWindow::MainWindow( QWidget *parent ) connect(ui->version, &QPushButton::clicked, this, [this] {showSettings(SettingsDialog::DiagnosticsSettings);}); ui->coatOfArms->load(QStringLiteral(":/images/Logo_small.svg")); - ui->signature->init( Pages::SignIntro, ui->signatureShadow, true ); - ui->crypto->init( Pages::CryptoIntro, ui->cryptoShadow, false ); - ui->myEid->init( Pages::MyEid, ui->myEidShadow, false ); - - connect(ui->signature, &PageIcon::activated, this, &MainWindow::clearPopups); - connect(ui->signature, &PageIcon::activated, this, &MainWindow::pageSelected); - connect(ui->crypto, &PageIcon::activated, this, &MainWindow::clearPopups); - connect(ui->crypto, &PageIcon::activated, this, &MainWindow::pageSelected); - connect(ui->myEid, &PageIcon::activated, this, &MainWindow::clearPopups); - connect(ui->myEid, &PageIcon::activated, this, &MainWindow::pageSelected); - + ui->pageButtonGroup->setId(ui->signature, Pages::SignIntro); + ui->pageButtonGroup->setId(ui->crypto, Pages::CryptoIntro); + ui->pageButtonGroup->setId(ui->myEid, Pages::MyEid); + + connect(ui->pageButtonGroup, QOverload::of(&QButtonGroup::buttonToggled), this, &MainWindow::clearPopups); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + connect(ui->pageButtonGroup, &QButtonGroup::idToggled, this, &MainWindow::pageSelected); +#else + connect(ui->pageButtonGroup, QOverload::of(&QButtonGroup::buttonToggled), this, + [=](QAbstractButton *button, bool checked){ pageSelected(ui->pageButtonGroup->id(button), checked); }); +#endif ui->help->installEventFilter(new ButtonHoverFilter(QStringLiteral(":/images/icon_Abi.svg"), QStringLiteral(":/images/icon_Abi_hover.svg"), this)); ui->settings->installEventFilter(new ButtonHoverFilter(QStringLiteral(":/images/icon_Seaded.svg"), QStringLiteral(":/images/icon_Seaded_hover.svg"), this)); connect(ui->help, &QToolButton::clicked, qApp, &Application::openHelp); @@ -176,39 +173,15 @@ MainWindow::~MainWindow() delete ui; } -void MainWindow::pageSelected(PageIcon *page) +void MainWindow::pageSelected(int page, bool checked) { - // Stay in current view if same page icon clicked - auto current = ui->startScreen->currentIndex(); - bool navigate = false; - switch(current) - { - case SignIntro: - case SignDetails: - navigate = (page->getType() != SignIntro); - break; - case CryptoIntro: - case CryptoDetails: - navigate = (page->getType() != CryptoIntro); - break; - default: - navigate = (page->getType() != current); - break; - } - - Pages toPage = page->getType(); - if(toPage == SignIntro && digiDoc) - { - selectPage(SignDetails); - return; - } - if(toPage == CryptoIntro && cryptoDoc) - { - selectPage(CryptoDetails); + if(!checked) return; - } - if(navigate) - navigateToPage(toPage); + if(page == SignIntro && digiDoc) + page = SignDetails; + if(page == CryptoIntro && cryptoDoc) + page = CryptoDetails; + selectPage(Pages(page)); } void MainWindow::adjustDrops() @@ -345,7 +318,7 @@ void MainWindow::mouseReleaseEvent(QMouseEvent *event) { resetCryptoDoc(); resetDigiDoc(); - navigateToPage(Pages::SignIntro); + selectPage(Pages::SignIntro); } else QWidget::mouseReleaseEvent(event); @@ -448,7 +421,7 @@ void MainWindow::onSignAction(int action, const QString &info1, const QString &i break; case ContainerCancel: resetDigiDoc(); - navigateToPage(Pages::SignIntro); + selectPage(Pages::SignIntro); break; case ContainerConvert: if(digiDoc) @@ -487,7 +460,7 @@ void MainWindow::convertToBDoc() if(!wrap(cryptoDoc->fileName(), cryptoDoc->state() == EncryptedContainer)) return; - auto *notification = new FadeInNotification(this, WHITE, MANTIS, 110); + auto *notification = new FadeInNotification(this, WHITE, MANTIS); notification->start( tr("Converted to signed document!"), 750, 3000, 1200 ); } @@ -515,7 +488,7 @@ void MainWindow::convertToCDoc() ui->cryptoContainerPage->transition(cryptoDoc, qApp->signer()->tokenauth().cert()); selectPage(CryptoDetails); - auto *notification = new FadeInNotification(this, WHITE, MANTIS, 110); + auto *notification = new FadeInNotification(this, WHITE, MANTIS); notification->start( tr("Converted to crypto container!"), 750, 3000, 1200 ); } @@ -539,7 +512,7 @@ void MainWindow::onCryptoAction(int action, const QString &/*id*/, const QString { case ContainerCancel: resetCryptoDoc(); - navigateToPage(Pages::CryptoIntro); + selectPage(Pages::CryptoIntro); break; case ContainerConvert: if(cryptoDoc) @@ -550,7 +523,7 @@ void MainWindow::onCryptoAction(int action, const QString &/*id*/, const QString if(decrypt()) { ui->cryptoContainerPage->transition(cryptoDoc, qApp->signer()->tokenauth().cert()); - auto *notification = new FadeInNotification(this, WHITE, MANTIS, 110); + auto *notification = new FadeInNotification(this, WHITE, MANTIS); notification->start( tr("Decryption succeeded!"), 750, 3000, 1200 ); } break; @@ -558,7 +531,7 @@ void MainWindow::onCryptoAction(int action, const QString &/*id*/, const QString if(encrypt()) { ui->cryptoContainerPage->transition(cryptoDoc, qApp->signer()->tokenauth().cert()); - auto *notification = new FadeInNotification(this, WHITE, MANTIS, 110); + auto *notification = new FadeInNotification(this, WHITE, MANTIS); notification->start( tr("Encryption succeeded!"), 750, 3000, 1200 ); } break; @@ -687,9 +660,9 @@ void MainWindow::openFiles(const QStringList &files, bool addFile, bool forceCre void MainWindow::open(const QStringList ¶ms, bool crypto, bool sign) { if (crypto && !sign) - navigateToPage(Pages::CryptoIntro); + selectPage(Pages::CryptoIntro); else - navigateToPage(Pages::SignIntro); + selectPage(Pages::SignIntro); QStringList files; for(const auto ¶m: params) @@ -756,11 +729,6 @@ void MainWindow::resetDigiDoc(DigiDoc *doc, bool warnOnChange) digiDoc = doc; } -void MainWindow::resizeEvent(QResizeEvent * /*event*/) -{ - ui->version->move( ui->version->geometry().x(), ui->leftBar->height() - ui->version->height() - 11 ); -} - bool MainWindow::save(bool saveAs) { if(!digiDoc) @@ -820,22 +788,14 @@ QString MainWindow::selectFile( const QString &title, const QString &filename, b void MainWindow::selectPage(Pages page) { - selectPageIcon( page < CryptoIntro ? ui->signature : (page == MyEid ? ui->myEid : ui->crypto)); + auto *btn = page < CryptoIntro ? ui->signature : (page == MyEid ? ui->myEid : ui->crypto); + btn->setChecked(true); ui->startScreen->setCurrentIndex(page); warnings->updateWarnings(); adjustDrops(); updateSelector(); } -void MainWindow::selectPageIcon( PageIcon* page ) -{ - ui->rightShadow->raise(); - for(auto *pageIcon: { ui->signature, ui->crypto, ui->myEid }) - { - pageIcon->activate( pageIcon == page ); - } -} - void MainWindow::showCardMenu(bool show) { if(show) @@ -893,7 +853,7 @@ void MainWindow::sign(F &&sign) { if(!CheckConnection().check()) { - auto *notification = new FadeInNotification(this, MOJO, MARZIPAN, 110); + auto *notification = new FadeInNotification(this, MOJO, MARZIPAN); notification->start(tr("Check internet connection"), 750, 3000, 1200); return; } @@ -924,7 +884,7 @@ void MainWindow::sign(F &&sign) ui->signContainerPage->transition(digiDoc); - auto *notification = new FadeInNotification(this, WHITE, MANTIS, 110); + auto *notification = new FadeInNotification(this, WHITE, MANTIS); notification->start(tr("The container has been successfully signed!"), 750, 3000, 1200); adjustDrops(); } @@ -948,7 +908,7 @@ void MainWindow::removeCryptoFile(int index) if(QFile::exists(cryptoDoc->fileName())) QFile::remove(cryptoDoc->fileName()); resetCryptoDoc(); - navigateToPage(Pages::CryptoIntro); + selectPage(Pages::CryptoIntro); } } @@ -1005,7 +965,7 @@ void MainWindow::removeSignatureFile(int index) if(QFile::exists(digiDoc->fileName())) QFile::remove(digiDoc->fileName()); resetDigiDoc(nullptr, false); - navigateToPage(Pages::SignIntro); + selectPage(Pages::SignIntro); } } diff --git a/client/MainWindow.h b/client/MainWindow.h index c6df059f5..e5a9f1780 100644 --- a/client/MainWindow.h +++ b/client/MainWindow.h @@ -54,7 +54,7 @@ private Q_SLOTS: void changePin2Clicked( bool isForgotPin, bool isBlockedPin ); void changePukClicked(); void open(const QStringList ¶ms, bool crypto, bool sign); - void pageSelected(PageIcon *page); + void pageSelected(int page, bool checked = true); void warningClicked(const QString &link); protected: @@ -64,7 +64,6 @@ private Q_SLOTS: void dragLeaveEvent( QDragLeaveEvent *event ) final; void dropEvent( QDropEvent *event ) final; void mouseReleaseEvent(QMouseEvent *event) final; - void resizeEvent( QResizeEvent *event ) final; void showEvent(QShowEvent *event) final; private: @@ -94,7 +93,6 @@ private Q_SLOTS: bool save(bool saveAs = false); QString selectFile( const QString &title, const QString &filename, bool fixedExt ); void selectPage(ria::qdigidoc4::Pages page); - void selectPageIcon( PageIcon* page ); void showCardMenu( bool show ); void showNotification( const QString &msg, bool isSuccess = false ); template diff --git a/client/MainWindow.ui b/client/MainWindow.ui index 257863090..f3ee64a64 100644 --- a/client/MainWindow.ui +++ b/client/MainWindow.ui @@ -20,9 +20,15 @@ DigiDoc4 Client - outline: none; - QLabel { - color: #000000 + #logo, #navBar { +background-color: #003168; +border-right: 1px solid #E7EAEF; +} +#topBar, #startScreen { background-color: #FFFFFF; } +#signPage, #cryptoPage, #noReaderInfo { +background-image: url(:/images/bg_lovid.svg); +background-repeat: repeat-x; +background-position: bottom; } @@ -41,202 +47,234 @@ 0 - - + + + + + + 5 + 17 + 80 + 32 + + + + Qt::TabFocus + + + DigiDoc + + + + + + - 110 - 520 + 92 + 0 - 110 + 92 16777215 - border: none; -background-color: #023664; - - - - QFrame::StyledPanel - - - QFrame::Raised + QToolButton { +border: none; +color: #E7EAEF; +padding: 13px 0px 10px 0px; +font-family: Roboto, Helvetica; +font-size: 16px; +} +QToolButton:checked { +background-color: #ffffff; +color: #003168; +} +#version { +color: #BFD3E8; +font-family: Roboto, Helvetica; +font-size: 10px; +text-decoration: underline; +} - - - - 0 - 0 - 110 - 65 - - - - border-bottom: 1px solid rgba(255, 255, 255, 0.1) - - - - - 15 - 17 - 80 - 32 - - - - Qt::TabFocus - - - DigiDoc - - - border: none - - - - - - - 0 - 65 - 110 - 110 - - - - PointingHandCursor - - - Select signature page - - - border: none; - - - - - - 0 - 175 - 110 - 110 - - - - PointingHandCursor - - - Select crypto page - - - border: none; - - - - - - 0 - 285 - 110 - 110 - - - - PointingHandCursor - - - Select my EID page - - - border: none; - - - - - - 105 - 0 - 5 - 4000 - - - - background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 rgba(0,0,0,0.0), stop: 1 rgba(0,0,0,0.65)); - - - - - - - 0 - 395 - 110 - 5 - - - - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(0,0,0,0.65), stop: 1 rgba(0,0,0,0.0)); - - - - - - 0 - 285 - 110 - 5 - - - - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(0,0,0,0.65), stop: 1 rgba(0,0,0,0.0)); - - - - - - 0 - 175 - 110 - 5 - - - - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(0,0,0,0.65), stop: 1 rgba(0,0,0,0.0)); - - - - - - 5 - 571 - 100 - 16 - - - - - Roboto - 12 - true - + + + 0 - - PointingHandCursor + + 0 - - Qt::NoContextMenu + + 0 - - color: #006EB5; + + 0 - - version + + 0 - + + + + + 91 + 93 + + + + PointingHandCursor + + + Select signature page + + + Signature + + + + :/images/icon_Allkiri.svg + :/images/icon_Allkiri_hover.svg:/images/icon_Allkiri.svg + + + + 40 + 40 + + + + true + + + true + + + Qt::ToolButtonTextUnderIcon + + + pageButtonGroup + + + + + + + + 91 + 93 + + + + PointingHandCursor + + + Select crypto page + + + Crypto + + + + :/images/icon_Krypto.svg + :/images/icon_Krypto_hover.svg:/images/icon_Krypto.svg + + + + 40 + 40 + + + + true + + + Qt::ToolButtonTextUnderIcon + + + pageButtonGroup + + + + + + + + 91 + 93 + + + + PointingHandCursor + + + Select my EID page + + + My eID + + + + :/images/icon_Minu_eID.svg + :/images/icon_Minu_eID_hover.svg:/images/icon_Minu_eID.svg + + + + 40 + 40 + + + + true + + + Qt::ToolButtonTextUnderIcon + + + pageButtonGroup + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 32 + + + + + 16777215 + 32 + + + + PointingHandCursor + + + version + + + true + + + + @@ -253,9 +291,6 @@ background-color: #023664; 65 - - background-color: #FFFFFF; - 0 @@ -274,7 +309,7 @@ background-color: #023664; - + 0 @@ -313,14 +348,7 @@ background-color: #023664; - - - - 0 - 0 - - - + @@ -436,18 +464,6 @@ QToolButton:hover { - - - 0 - 65 - - - - #page{ - background-color: #023565; - border: none; -} - 0 @@ -466,12 +482,6 @@ QToolButton:hover { - - - 1 - 0 - - 914 @@ -485,8 +495,7 @@ QToolButton:hover { - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #c8c8c8, stop: 1 #F4F5F6); -border: none; + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #c8c8c8, stop: 1 #F4F5F6); @@ -495,37 +504,17 @@ border: none; 914 - 350 - - - - - 16777215 - 16777215 + 0 - - #startScreen{ - border:none; - background-color: #ffffff; -} - - - QFrame::StyledPanel - - - QFrame::Raised - 0 - - QWidget#signPage { background-image: url(:/images/bg_lovid.svg); -background-repeat: repeat-x; -background-position: bottom; } - + + 14 + @@ -554,11 +543,7 @@ background-position: bottom; } - border: none; -color: #041E42; - - - 0 + color: #041E42; Drag file here for signing ... @@ -636,14 +621,10 @@ QPushButton:disabled { - - QWidget#cryptoPage { -background-image: url(:/images/bg_lovid.svg); -background-repeat: repeat-x; -background-position: bottom; -} - + + 14 + @@ -672,11 +653,7 @@ background-position: bottom; - border: none; -color: #041E42; - - - 0 + color: #041E42; Drag file here for encryption ... @@ -784,9 +761,6 @@ QPushButton:disabled { 186 - - border: none; - @@ -794,14 +768,10 @@ QPushButton:disabled { - - QWidget#noReaderInfo { -background-image: url(:/images/bg_lovid.svg); -background-repeat: repeat-x; -background-position: bottom; -} - + + 14 + @@ -810,69 +780,57 @@ background-position: bottom; 20 - 52 + 60 - + + + + 0 + 45 + + + + + 20 + true + + + + Qt::TabFocus + + + color: #041E42; + + + Connect the card reader to your computer and insert your ID card into the reader + + + Qt::AlignCenter + + + true + + + true + + + + + 0 - 128 + 45 - - - - - - 20 - true - - - - Qt::TabFocus - - - color: #041E42; - - - Connect the card reader to your computer and insert your ID card into the reader - - - Qt::AlignCenter - - - true - - - true - - - - - - - - 0 - 45 - - - - - 16777215 - 45 - - - - - - + Qt::Vertical @@ -909,12 +867,6 @@ background-position: bottom;
widgets/CardWidget.h
1 - - PageIcon - QPushButton -
widgets/PageIcon.h
- 1 -
ContainerPage QWidget @@ -943,7 +895,17 @@ background-position: bottom;
widgets/IDSelector.h
1
+ + PageIcon + QToolButton +
widgets/PageIcon.h
+
- + + + + + + diff --git a/client/MainWindow_MyEID.cpp b/client/MainWindow_MyEID.cpp index db71c21c8..558f8dd80 100644 --- a/client/MainWindow_MyEID.cpp +++ b/client/MainWindow_MyEID.cpp @@ -111,7 +111,7 @@ bool MainWindow::validateCardError(QSmartCardData::PinType type, QSmartCardData: case QSmartCard::BlockedError: showNotification( tr("%1 blocked").arg( QSmartCardData::typeString( t ) ) ); showPinBlockedWarning(data); - pageSelected( ui->myEid ); + selectPage(Pages::MyEid); ui->myEid->warningIcon( data.retryCount(QSmartCardData::Pin1Type) == 0 || data.retryCount(QSmartCardData::Pin2Type) == 0 || @@ -141,7 +141,7 @@ void MainWindow::showNotification( const QString &msg, bool isSuccess ) { auto *notification = new FadeInNotification(this, isSuccess ? QStringLiteral("#ffffff") : QStringLiteral("#353739"), - isSuccess ? QStringLiteral("#498526") : QStringLiteral("#F8DDA7"), 110); + isSuccess ? QStringLiteral("#498526") : QStringLiteral("#F8DDA7")); notification->start(msg, 750, 3000, 1200); } diff --git a/client/effects/FadeInNotification.h b/client/effects/FadeInNotification.h index 803a94d74..dd0ab1a11 100644 --- a/client/effects/FadeInNotification.h +++ b/client/effects/FadeInNotification.h @@ -22,15 +22,15 @@ #include // A label that fades in on the parent, shows a notification and then fades out. -class FadeInNotification : public QLabel +class FadeInNotification final: public QLabel { Q_OBJECT public: - explicit FadeInNotification(QWidget *parent, const QString &fgColor, const QString &bgColor, int leftOffset = 0, int height = 65); + explicit FadeInNotification(QWidget *parent, const QString &fgColor, const QString &bgColor, int leftOffset = 92, int height = 65); explicit FadeInNotification(QWidget *parent, const QString &fgColor, const QString &bgColor, QPoint pos, int width, int height); void start(const QString &label, int fadeInTime, int displayTime, int fadeOutTime); private: - bool eventFilter(QObject *watched, QEvent *event); + bool eventFilter(QObject *watched, QEvent *event) final; }; diff --git a/client/images/icon_Allkiri.svg b/client/images/icon_Allkiri.svg index 2ed15d739..3a5f9a7d1 100644 --- a/client/images/icon_Allkiri.svg +++ b/client/images/icon_Allkiri.svg @@ -1,15 +1,4 @@ - - - - icon_Allkiri - Created with Sketch. - - - - - - - - - - \ No newline at end of file + + + + diff --git a/client/images/icon_Allkiri_hover.svg b/client/images/icon_Allkiri_hover.svg index 4b6f546dc..f6d4a6f8a 100644 --- a/client/images/icon_Allkiri_hover.svg +++ b/client/images/icon_Allkiri_hover.svg @@ -1,15 +1,4 @@ - - - - icon_Allkiri hover - Created with Sketch. - - - - - - - - - - \ No newline at end of file + + + + diff --git a/client/images/icon_Krypto.svg b/client/images/icon_Krypto.svg index 330af94e1..7fa37b31e 100644 --- a/client/images/icon_Krypto.svg +++ b/client/images/icon_Krypto.svg @@ -1,18 +1,4 @@ - - - - icon_Krüpto - Created with Sketch. - - - - - - - - - - - - - \ No newline at end of file + + + + diff --git a/client/images/icon_Krypto_hover.svg b/client/images/icon_Krypto_hover.svg index ee939a771..cfaa56ac9 100644 --- a/client/images/icon_Krypto_hover.svg +++ b/client/images/icon_Krypto_hover.svg @@ -1,18 +1,4 @@ - - - - icon_Krüpto hover - Created with Sketch. - - - - - - - - - - - - - \ No newline at end of file + + + + diff --git a/client/images/icon_Minu_eID.svg b/client/images/icon_Minu_eID.svg index 0b5236136..98c9888d2 100644 --- a/client/images/icon_Minu_eID.svg +++ b/client/images/icon_Minu_eID.svg @@ -1,112 +1,4 @@ - - - - - - image/svg+xml - - icon_Minu eID - - - - - - icon_Minu eID - Created with Sketch. - - - - - - - - - - - - - - + + + diff --git a/client/images/icon_Minu_eID_hover.svg b/client/images/icon_Minu_eID_hover.svg index 965bae18e..bd1472a14 100644 --- a/client/images/icon_Minu_eID_hover.svg +++ b/client/images/icon_Minu_eID_hover.svg @@ -1,20 +1,4 @@ - - - - icon_Minu eID hover - Created with Sketch. - - - - - - - - - - - - - - - \ No newline at end of file + + + + diff --git a/client/images/icon_alert_error.svg b/client/images/icon_alert_error.svg new file mode 100644 index 000000000..6d26ffe0d --- /dev/null +++ b/client/images/icon_alert_error.svg @@ -0,0 +1,4 @@ + + + + diff --git a/client/images/icon_alert_filled_orange.svg b/client/images/icon_alert_filled_orange.svg deleted file mode 100644 index 2de7fb5ef..000000000 --- a/client/images/icon_alert_filled_orange.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - icon_alert orange - Created with Sketch. - - - - - - - - - - - \ No newline at end of file diff --git a/client/images/icon_alert_filled_red.svg b/client/images/icon_alert_filled_red.svg deleted file mode 100644 index f6fe73e1a..000000000 --- a/client/images/icon_alert_filled_red.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - icon_alert orange copy - Created with Sketch. - - - - - - - - - - - \ No newline at end of file diff --git a/client/images/icon_alert_warning.svg b/client/images/icon_alert_warning.svg new file mode 100644 index 000000000..155606317 --- /dev/null +++ b/client/images/icon_alert_warning.svg @@ -0,0 +1,4 @@ + + + + diff --git a/client/images/icon_alert_whitebg_orange.svg b/client/images/icon_alert_whitebg_orange.svg deleted file mode 100644 index 1ac59d709..000000000 --- a/client/images/icon_alert_whitebg_orange.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - icon_alert orange - Created with Sketch. - - - - - - - - - - - diff --git a/client/images/images.qrc b/client/images/images.qrc index 74cb9b6bb..8e674a3ba 100644 --- a/client/images/images.qrc +++ b/client/images/images.qrc @@ -12,11 +12,10 @@ icon_Abi.svg icon_Abi_hover.svg icon_ajatempel.svg - icon_alert_filled_orange.svg - icon_alert_filled_red.svg + icon_alert_error.svg + icon_alert_warning.svg icon_alert_orange.svg icon_alert_red.svg - icon_alert_whitebg_orange.svg icon_Allkiri_hover.svg icon_Allkiri_small.svg icon_Allkiri.svg diff --git a/client/translations/en.ts b/client/translations/en.ts index 7142f15ea..529ea2902 100644 --- a/client/translations/en.ts +++ b/client/translations/en.ts @@ -1647,6 +1647,18 @@ ID-CARD Decrypting Decrypting + + My eID + My eID + + + Signature + Signature + + + Crypto + Crypto + MobileDialog @@ -1900,21 +1912,6 @@ and enter Smart-ID PIN2-code. The PCSC service, required for using the ID-card, is not working. Check your computer settings. - - PageIcon - - SIGNATURE - SIGNATURE - - - CRYPTO - CRYPTO - - - My eID - My eID - - PinPopup @@ -2464,10 +2461,6 @@ and enter Smart-ID PIN2-code. Password Password - - Enable proxy for SSL connections - Enable proxy for SSL connections - The connection to certificate status service is successful! Network settings are correct, certificate status service is accessible! diff --git a/client/translations/et.ts b/client/translations/et.ts index 28a30a7df..542c9dfef 100644 --- a/client/translations/et.ts +++ b/client/translations/et.ts @@ -1647,6 +1647,18 @@ ID-KAARDIGA Decrypting Dekrüpteerin + + My eID + Minu eID + + + Signature + Allkiri + + + Crypto + Krüpto + MobileDialog @@ -1900,21 +1912,6 @@ ja sisesta nutiseadmes Smart-ID PIN2-kood. ID-kaardi kasutamiseks vajalik PCSC teenus ei tööta. Kontrolli arvuti seadeid. - - PageIcon - - SIGNATURE - ALLKIRI - - - CRYPTO - KRÜPTO - - - My eID - Minu eID - - PinPopup @@ -2468,10 +2465,6 @@ ja sisesta nutiseadmes Smart-ID PIN2-kood. Password Parool - - Enable proxy for SSL connections - Luba proksi kasutamine SSL-ühenduste jaoks - The connection to certificate status service is successful! Interneti seaded on korrektsed, kehtivuskinnitusteenus on kättesaadav! diff --git a/client/translations/ru.ts b/client/translations/ru.ts index ca5afbacd..93c9afc45 100644 --- a/client/translations/ru.ts +++ b/client/translations/ru.ts @@ -1648,6 +1648,18 @@ ID-КАРТОЙ Decrypting Расшифровка + + My eID + Мой eID + + + Signature + Подпись + + + Crypto + Крипто + MobileDialog @@ -1901,21 +1913,6 @@ and enter Smart-ID PIN2-code. Необходимая для использования ID-карты услуга PCSC не работает. Проверьте настройки компьютера. - - PageIcon - - SIGNATURE - ПОДПИСЬ - - - CRYPTO - КРИПТО - - - My eID - Мой eID - - PinPopup @@ -2469,10 +2466,6 @@ and enter Smart-ID PIN2-code. Password Пароль - - Enable proxy for SSL connections - Включить прокси-сервер для подключения SSL - The connection to certificate status service is successful! Настройки Интернета верны, услуга подтверждения действительности доступна! diff --git a/client/widgets/PageIcon.cpp b/client/widgets/PageIcon.cpp index aba93b6d9..8bac22441 100644 --- a/client/widgets/PageIcon.cpp +++ b/client/widgets/PageIcon.cpp @@ -18,166 +18,35 @@ */ #include "PageIcon.h" -#include "ui_PageIcon.h" -#include "Colors.h" -#include "Styles.h" -#include #include -using namespace ria::qdigidoc4; - PageIcon::PageIcon(QWidget *parent) - : QPushButton(parent) - , ui(new Ui::PageIcon) + : QToolButton(parent) + , errorIcon(new QSvgWidget(this)) { - ui->setupUi(this); - connect(this, &QPushButton::clicked, this, [this] { emit activated(this); }); - - icon = new QSvgWidget(this); - icon->resize( 48, 38 ); - icon->move( 31, 23 ); - - errorIcon = new QSvgWidget(QStringLiteral(":/images/icon_alert_filled_red.svg"), this); - errorIcon->resize( 13, 12 ); - errorIcon->move( 84, 12 ); + errorIcon->resize(22, 22); + errorIcon->move(64, 6); errorIcon->hide(); - errorIcon->setStyleSheet(QStringLiteral("border: none;")); -} - -PageIcon::~PageIcon() -{ - delete ui; -} - -void PageIcon::init( Pages type, QWidget *shadow, bool selected ) -{ - const QString BOTTOM_BORDER = QStringLiteral("solid rgba(255, 255, 255, 0.1); border-width: 0px 0px 1px 0px"); - const QString RIGHT_BORDER = QStringLiteral("solid #E7E7E7; border-width: 0px 1px 0px 0px"); - const QFont font = Styles::font( Styles::Condensed, 16 ); - switch( type ) - { - case CryptoIntro: - active = PageIcon::Style { font, QStringLiteral("/images/icon_Krypto_hover.svg"), colors::WHITE, colors::CLAY_CREEK, RIGHT_BORDER }; - hover = PageIcon::Style { font, QStringLiteral("/images/icon_Krypto_hover.svg"), colors::BAHAMA_BLUE, colors::WHITE, QStringLiteral("none") }; - inactive = PageIcon::Style { font, QStringLiteral("/images/icon_Krypto.svg"), colors::ASTRONAUT_BLUE, colors::WHITE, BOTTOM_BORDER }; - icon->resize( 34, 38 ); - icon->move( 38, 26 ); - ui->label->setText( tr("CRYPTO") ); - break; - case MyEid: - active = PageIcon::Style { font, QStringLiteral("/images/icon_Minu_eID_hover.svg"), colors::WHITE, colors::CLAY_CREEK, RIGHT_BORDER }; - hover = PageIcon::Style { font, QStringLiteral("/images/icon_Minu_eID_hover.svg"), colors::BAHAMA_BLUE, colors::WHITE, QStringLiteral("none") }; - inactive = PageIcon::Style { font, QStringLiteral("/images/icon_Minu_eID.svg"), colors::ASTRONAUT_BLUE, colors::WHITE, BOTTOM_BORDER }; - icon->resize( 44, 31 ); - icon->move( 33, 28 ); - ui->label->setText( tr("My eID") ); - break; - default: - active = PageIcon::Style { font, QStringLiteral("/images/icon_Allkiri_hover.svg"), colors::WHITE, colors::CLAY_CREEK, RIGHT_BORDER }; - hover = PageIcon::Style { font, QStringLiteral("/images/icon_Allkiri_hover.svg"), colors::BAHAMA_BLUE, colors::WHITE, QStringLiteral("none") }; - inactive = PageIcon::Style { font, QStringLiteral("/images/icon_Allkiri.svg"), colors::ASTRONAUT_BLUE, colors::WHITE, BOTTOM_BORDER }; - ui->label->setText( tr("SIGNATURE") ); - break; - } - - this->selected = selected; - this->shadow = shadow; - this->type = type; - updateSelection(); -} - -void PageIcon::changeEvent(QEvent* event) -{ - if (event->type() == QEvent::LanguageChange) - { - ui->retranslateUi(this); - switch( type ) - { - case CryptoIntro: ui->label->setText(tr("CRYPTO")); break; - case MyEid: ui->label->setText(tr("My eID")); break; - default: ui->label->setText(tr("SIGNATURE")); break; - } - } - - QPushButton::changeEvent(event); -} - -void PageIcon::activate( bool selected ) -{ - this->selected = selected; - updateIcon(); - updateSelection(); -} - -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) -void PageIcon::enterEvent(QEnterEvent * /*ev*/) -#else -void PageIcon::enterEvent(QEvent * /*ev*/) -#endif -{ - if( !selected ) - updateSelection(hover); -} - -Pages PageIcon::getType() -{ - return type; } void PageIcon::invalidIcon(bool show) { - iconType = show ? Error : None; + err = show; updateIcon(); } -void PageIcon::leaveEvent( QEvent * /*ev*/ ) -{ - if( !selected ) - updateSelection(inactive); -} - void PageIcon::updateIcon() { - if(iconType == Error) - errorIcon->load(selected ? - QStringLiteral(":/images/icon_alert_red.svg") : - QStringLiteral(":/images/icon_alert_filled_red.svg")); - if(iconType == Warning) - errorIcon->load(selected ? - QStringLiteral(":/images/icon_alert_whitebg_orange.svg") : - QStringLiteral(":/images/icon_alert_filled_orange.svg")); - errorIcon->setHidden(iconType == None); -} - -void PageIcon::updateSelection() -{ - const Style &style = selected ? active : inactive; - - if (selected) - { - shadow->show(); - shadow->raise(); - raise(); - } - else - shadow->hide(); - - ui->label->setFont(style.font); - icon->load(QStringLiteral(":%1").arg(style.image)); - updateSelection(style); -} - -void PageIcon::updateSelection(const Style &style) -{ - ui->label->setStyleSheet(QStringLiteral("background-color: %1; color: %2; border: none;").arg(style.backColor, style.foreColor)); - icon->setStyleSheet(QStringLiteral("background-color: %1; border: none;").arg(style.backColor)); - setStyleSheet(QStringLiteral("background-repeat: none; background-color: %1; border: %2;").arg(style.backColor, style.border)); + if(err) + errorIcon->load(QStringLiteral(":/images/icon_alert_error.svg")); + else if(warn) + errorIcon->load(QStringLiteral(":/images/icon_alert_warning.svg")); + errorIcon->setVisible(err || warn); } void PageIcon::warningIcon(bool show) { - if(iconType != Error) - iconType = show ? Warning : None; + warn = show; updateIcon(); } diff --git a/client/widgets/PageIcon.h b/client/widgets/PageIcon.h index 7d60be2ce..cb8bc0b93 100644 --- a/client/widgets/PageIcon.h +++ b/client/widgets/PageIcon.h @@ -19,65 +19,24 @@ #pragma once -#include "common_enums.h" - -#include +#include class QSvgWidget; -namespace Ui { -class PageIcon; -} - -class PageIcon final : public QPushButton +class PageIcon final : public QToolButton { Q_OBJECT public: explicit PageIcon( QWidget *parent = nullptr ); - ~PageIcon() final; - void init( ria::qdigidoc4::Pages page, QWidget *shadow, bool selected ); - void activate( bool selected ); - ria::qdigidoc4::Pages getType(); void invalidIcon( bool show ); void warningIcon( bool show ); -signals: - void activated( PageIcon *icon ); - private: - enum IconType { - None, - Warning, - Error - }; - struct Style - { - QFont font; - QString image, backColor, foreColor, border; - }; - - void changeEvent(QEvent *event) final; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - void enterEvent(QEnterEvent *ev) final; -#else - void enterEvent(QEvent *ev) final; -#endif - void leaveEvent(QEvent *event) final; void updateIcon(); - void updateSelection(); - void updateSelection(const Style &style); - Ui::PageIcon *ui; - QWidget *shadow = nullptr; QSvgWidget *errorIcon; - QSvgWidget *icon; - - Style active; - IconType iconType = IconType::None; - Style inactive; - Style hover; - bool selected = false; - ria::qdigidoc4::Pages type = ria::qdigidoc4::Pages::SignIntro; + bool warn = false; + bool err = false; }; diff --git a/client/widgets/PageIcon.ui b/client/widgets/PageIcon.ui deleted file mode 100644 index f8ce788af..000000000 --- a/client/widgets/PageIcon.ui +++ /dev/null @@ -1,65 +0,0 @@ - - - PageIcon - - - - 0 - 0 - 110 - 110 - - - - - 0 - 0 - - - - - 110 - 110 - - - - false - - - - - 5 - 71 - 100 - 19 - - - - - 44 - 19 - - - - - 14 - - - - color: #FFFFFF; -border: none; - - - PAGE - - - Qt::AutoText - - - Qt::AlignCenter - - - - - -