diff --git a/client/Application.cpp b/client/Application.cpp index a8b3329e6..982aced94 100644 --- a/client/Application.cpp +++ b/client/Application.cpp @@ -203,9 +203,13 @@ class DigidocConf final: public digidoc::XmlConfCurrent static bool isAllowed = false; if(!isAllowed) { - QEventLoop e; - QMetaObject::invokeMethod( qApp, "showTSLWarning", Q_ARG(QEventLoop*,&e) ); - e.exec(); + dispatchToMain([] { + WarningDialog::show(Application::tr( + "The renewal of Trust Service status List, used for digital signature validation, has failed. " + "Please check your internet connection and make sure you have the latest ID-software version " + "installed. An expired Trust Service List (TSL) will be used for signature validation. " + "Additional information"), QString()); + }); isAllowed = true; } return isAllowed; @@ -435,9 +439,8 @@ Application::Application( int &argc, char **argv ) qDebug() << "TSL loading finished"; Q_EMIT qApp->TSLLoadingFinished(); qApp->d->ready = true; - if(ex) { + if(ex) dispatchToMain(showWarning, tr("Failed to initalize."), *ex); - } } ); } @@ -472,10 +475,10 @@ Application::Application( int &argc, char **argv ) { Settings::SHOW_INTRO = false; auto *dlg = new FirstRun(mainWindow()); - connect(dlg, &FirstRun::langChanged, this, [this](const QString& lang) { loadTranslation( lang ); }); + connect(dlg, &FirstRun::langChanged, this, &Application::loadTranslation); dlg->open(); } - }); + }, Qt::QueuedConnection); if( !args.isEmpty() || topLevelWindows().isEmpty() ) parseArgs(std::move(args)); @@ -548,7 +551,7 @@ void Application::browse( const QUrl &url ) void Application::closeWindow() { #ifndef Q_OS_MAC - if( MainWindow *w = qobject_cast(activeWindow()) ) + if(auto *w = qobject_cast(activeWindow())) w->close(); else #endif @@ -740,7 +743,9 @@ void Application::mailTo( const QUrl &url ) QWidget* Application::mainWindow() { - if(QWidget *win = qobject_cast(activeWindow())) + if(auto *win = qobject_cast(activeWindow())) + return win; + if(auto *win = qobject_cast(activeWindow())) return win; auto list = topLevelWidgets(); // Prefer main window; on Mac also the menu is top level window @@ -748,7 +753,11 @@ QWidget* Application::mainWindow() [](QWidget *widget) { return qobject_cast(widget); }); i != list.cend()) return *i; - return list.value(0); + if(auto i = std::find_if(list.cbegin(), list.cend(), + [](QWidget *widget) { return qobject_cast(widget); }); + i != list.cend()) + return *i; + return nullptr; } bool Application::notify(QObject *object, QEvent *event) @@ -915,16 +924,6 @@ void Application::showClient(const QStringList ¶ms, bool crypto, bool sign, QMetaObject::invokeMethod(w, "open", Q_ARG(QStringList,params), Q_ARG(bool,crypto), Q_ARG(bool,sign)); } -void Application::showTSLWarning(QEventLoop *e) -{ - auto *dlg = WarningDialog::show(tr( - "The renewal of Trust Service status List, used for digital signature validation, has failed. " - "Please check your internet connection and make sure you have the latest ID-software version " - "installed. An expired Trust Service List (TSL) will be used for signature validation. " - "Additional information")); - connect(dlg, &WarningDialog::finished, e, &QEventLoop::quit); -} - void Application::showWarning( const QString &msg, const digidoc::Exception &e ) { digidoc::Exception::ExceptionCode code = digidoc::Exception::General; diff --git a/client/Application.h b/client/Application.h index f59ffda90..e24cbe5a9 100644 --- a/client/Application.h +++ b/client/Application.h @@ -79,7 +79,6 @@ class Application final: public Common private Q_SLOTS: static void browse(const QUrl &url); static void mailTo(const QUrl &url); - static void showTSLWarning( QEventLoop *e ); Q_SIGNALS: void TSLLoadingFinished(); diff --git a/client/dialogs/FirstRun.ui b/client/dialogs/FirstRun.ui index f9aafa2d8..a40af4c16 100644 --- a/client/dialogs/FirstRun.ui +++ b/client/dialogs/FirstRun.ui @@ -10,24 +10,6 @@ 600 - - #signGotoSigning, #cryptoGotoEncryption, #eidGotoEid { -border: none; -border-radius: 5px; -background-color: #B9D9EB; -width: 10px; -height: 10px; -} -#signGotoEncryption, #signGotoEid, -#cryptoGotoSigning, #cryptoGotoEid, -#eidGotoSigning, #eidGotoEncryption { -border: none; -border-radius: 5px; -background-color: #F4F5F6; -width: 10px; -height: 10px; -} - 0 @@ -43,6 +25,51 @@ height: 10px; + + QToolButton { +border: none; +border-radius: 5px; +background-color: #F4F5F6; +width: 10px; +height: 10px; +} +#signGotoSigning, #cryptoGotoEncryption, #eidGotoEid { +background-color: #B9D9EB; +} +QPushButton { +border-radius: 2px; +border: none; +color: #ffffff; +background-color: #006EB5; +} +QPushButton:pressed { +background-color: #41B6E6; +} +QPushButton:hover:!pressed { +background-color: #008DCF; +} +QPushButton:disabled { +background-color: #BEDBED; +} +#introSkip, #signSkip, #cryptoSkip { +border-radius: 2px; +border: none; +color: #006EB5; +background-color: none; +} +#introSkip:pressed, #signSkip:pressed, #cryptoSkip:pressed { +color: #FFFFFF; +background-color: #006EB5; +} +#introSkip:hover:!pressed, #signSkip:hover:!pressed, #cryptoSkip:hover:!pressed { +border: 1px solid #006EB5; +color: #006EB5; +} +#introSkip:disabled, #signSkip:disabled, #cryptoSkip:disabled { +color: #727679; +background-color: #BEDBED; +} + 0 @@ -102,6 +129,7 @@ QComboBox QPushButton { padding: 0px 8px 0px 4px; border: 0px; color: #353739; + background-color: #FFFFFF; text-align: left; qproperty-iconSize: 14px 9px; qproperty-layoutDirection: RightToLeft; @@ -170,24 +198,6 @@ QComboBox::down-arrow:on { Continue - - QPushButton { - image: none; - border-radius: 2px; - border: none; - color: #ffffff; - background-color: #006EB5; -} -QPushButton:pressed { - background-color: #41B6E6; -} -QPushButton:hover:!pressed { - background-color: #008DCF; -} -QPushButton:disabled { - background-color: #BEDBED; -} - CONTINUE @@ -603,24 +613,6 @@ QWidget { border: none; } View introduction - - QPushButton { - image: none; - border-radius: 2px; - border: none; - color: #ffffff; - background-color: #006EB5; -} -QPushButton:pressed { - background-color: #41B6E6; -} -QPushButton:hover:!pressed { - background-color: #008DCF; -} -QPushButton:disabled { - background-color: #BEDBED; -} - VIEW INTRODUCTION @@ -649,24 +641,6 @@ QPushButton:disabled { View introduction - - QPushButton { - image: none; - border-radius: 2px; - border: none; - color: #ffffff; - background-color: #006EB5; -} -QPushButton:pressed { - background-color: #41B6E6; -} -QPushButton:hover:!pressed { - background-color: #008DCF; -} -QPushButton:disabled { - background-color: #BEDBED; -} - VIEW INTRODUCTION @@ -695,24 +669,6 @@ QPushButton:disabled { View introduction - - QPushButton { - image: none; - border-radius: 2px; - border: none; - color: #ffffff; - background-color: #006EB5; -} -QPushButton:pressed { - background-color: #41B6E6; -} -QPushButton:hover:!pressed { - background-color: #008DCF; -} -QPushButton:disabled { - background-color: #BEDBED; -} - VIEW INTRODUCTION @@ -738,26 +694,6 @@ QPushButton:disabled { PointingHandCursor - - QPushButton { - image: none; - border-radius: 2px; - border: none; - color: #006EB5; -} -QPushButton:pressed { - color: #FFFFFF; - background-color: #006EB5; -} -QPushButton:hover:!pressed { - border: 1px solid #006EB5; - color: #006EB5; -} -QPushButton:disabled { - color: #727679; - background-color: #BEDBED; -} - Skip introductions @@ -903,24 +839,6 @@ border-radius: 3px; View next intro - - QPushButton { - image: none; - border-radius: 2px; - border: none; - color: #ffffff; - background-color: #006EB5; -} -QPushButton:pressed { - background-color: #41B6E6; -} -QPushButton:hover:!pressed { - background-color: #008DCF; -} -QPushButton:disabled { - background-color: #BEDBED; -} - VIEW NEXT INTRO @@ -952,26 +870,6 @@ QPushButton:disabled { PointingHandCursor - - QPushButton { - image: none; - border-radius: 2px; - border: none; - color: #006EB5; -} -QPushButton:pressed { - color: #FFFFFF; - background-color: #006EB5; -} -QPushButton:hover:!pressed { - border: 1px solid #006EB5; - color: #006EB5; -} -QPushButton:disabled { - color: #727679; - background-color: #BEDBED; -} - Skip introductions @@ -1518,26 +1416,6 @@ QPushButton:disabled { PointingHandCursor - - QPushButton { - image: none; - border-radius: 2px; - border: none; - color: #006EB5; -} -QPushButton:pressed { - color: #FFFFFF; - background-color: #006EB5; -} -QPushButton:hover:!pressed { - border: 1px solid #006EB5; - color: #006EB5; -} -QPushButton:disabled { - color: #727679; - background-color: #BEDBED; -} - Skip introductions @@ -1572,24 +1450,6 @@ QPushButton:disabled { View next intro - - QPushButton { - image: none; - border-radius: 2px; - border: none; - color: #ffffff; - background-color: #006EB5; -} -QPushButton:pressed { - background-color: #41B6E6; -} -QPushButton:hover:!pressed { - background-color: #008DCF; -} -QPushButton:disabled { - background-color: #BEDBED; -} - VIEW NEXT INTRO @@ -1886,24 +1746,6 @@ border-radius: 3px; Enter the application - - QPushButton { - image: none; - border-radius: 2px; - border: none; - color: #ffffff; - background-color: #006EB5; -} -QPushButton:pressed { - background-color: #41B6E6; -} -QPushButton:hover:!pressed { - background-color: #008DCF; -} -QPushButton:disabled { - background-color: #BEDBED; -} - ENTER THE APPLICATION diff --git a/client/dialogs/WarningDialog.ui b/client/dialogs/WarningDialog.ui index b1f7ddf3a..3e4d16bd7 100644 --- a/client/dialogs/WarningDialog.ui +++ b/client/dialogs/WarningDialog.ui @@ -11,12 +11,12 @@ - QWidget { + #WarningDialog > QLabel { color: #000000; -background-color: #FFFFFF; } -QDialog { +#WarningDialog { border-radius: 2px; +background-color: #FFFFFF; } QPushButton { border-radius: 2px;