diff --git a/client/Utils.h b/client/Utils.h index a13ebe7ec..4038e5f53 100644 --- a/client/Utils.h +++ b/client/Utils.h @@ -31,8 +31,7 @@ namespace { std::exception_ptr exception; std::invoke_result_t result{}; QEventLoop l; - // c++20 ... args == std::forward(args) - std::thread([&, function = std::forward(function)]{ + std::thread([&, function = std::forward(function), ...args = std::forward(args)]{ try { result = std::invoke(function, args...); } catch(...) { @@ -51,14 +50,14 @@ namespace { QEventLoop l; using result_t = typename std::invoke_result_t; if constexpr (std::is_void_v) { - QMetaObject::invokeMethod(qApp, [&, function = std::forward(function)] { + QMetaObject::invokeMethod(qApp, [&, function = std::forward(function), ...args = std::forward(args)] { std::invoke(function, args...); l.exit(); }, Qt::QueuedConnection); l.exec(); } else { result_t result{}; - QMetaObject::invokeMethod(qApp, [&, function = std::forward(function)] { + QMetaObject::invokeMethod(qApp, [&, function = std::forward(function), ...args = std::forward(args)] { result = std::invoke(function, args...); l.exit(); }, Qt::QueuedConnection); diff --git a/client/effects/FadeInNotification.cpp b/client/effects/FadeInNotification.cpp index 176671b41..df31e2a7d 100644 --- a/client/effects/FadeInNotification.cpp +++ b/client/effects/FadeInNotification.cpp @@ -36,17 +36,17 @@ constexpr QRect adjustHeight(QRect rect, int height) noexcept FadeInNotification::FadeInNotification(QWidget *parent, QRect rect, Type type, const QString &label) : QLabel(parent) { - auto bgcolor = [type] { + auto bgcolor = [type]() -> QString { switch(type) { - case FadeInNotification::Success: return QStringLiteral("#218123"); - case FadeInNotification::Warning: return QStringLiteral("#FBAE38"); - case FadeInNotification::Error: return QStringLiteral("#AD2A45"); - case FadeInNotification::Default: return QStringLiteral("#2F70B6"); + case Success: return QStringLiteral("#218123"); + case Warning: return QStringLiteral("#FBAE38"); + case Error: return QStringLiteral("#AD2A45"); + case Default: return QStringLiteral("#2F70B6"); default: return QStringLiteral("none"); } }(); - auto fgcolor = [type] { - return type == FadeInNotification::Warning ? QStringLiteral("#07142A") : QStringLiteral("#FFFFFF"); + auto fgcolor = [type]() -> QString { + return type == Warning ? QStringLiteral("#07142A") : QStringLiteral("#FFFFFF"); }(); setStyleSheet(QStringLiteral("color: %1; background-color: %2;").arg(fgcolor, bgcolor)); setFocusPolicy(Qt::TabFocus); diff --git a/client/effects/FadeInNotification.h b/client/effects/FadeInNotification.h index 10a504eee..196f03085 100644 --- a/client/effects/FadeInNotification.h +++ b/client/effects/FadeInNotification.h @@ -28,7 +28,7 @@ class FadeInNotification final: public QLabel public: using ms = std::chrono::milliseconds; - enum Type { + enum Type : quint8 { Success, Warning, Error,