From cc837a59d64298d8a777ddec90b8ac26432886bd Mon Sep 17 00:00:00 2001 From: iwubcode Date: Sat, 24 Oct 2020 23:30:14 -0500 Subject: [PATCH] Core / DolphinQt: Add ini only option to force low-contrast tooltips --- Source/Core/Core/Config/MainSettings.cpp | 2 + Source/Core/Core/Config/MainSettings.h | 1 + .../DolphinQt/Config/Graphics/BalloonTip.cpp | 43 ++++++++++++++----- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/Config/MainSettings.cpp b/Source/Core/Core/Config/MainSettings.cpp index 6715a2a877..0c2b331cc9 100644 --- a/Source/Core/Core/Config/MainSettings.cpp +++ b/Source/Core/Core/Config/MainSettings.cpp @@ -156,6 +156,8 @@ const Info MAIN_NETWORK_SSL_DUMP_PEER_CERT{{System::Main, "Network", "SSLD // Main.Interface +const Info MAIN_USE_HIGH_CONTRAST_TOOLTIPS{ + {System::Main, "Interface", "UseHighContrastTooltips"}, true}; const Info MAIN_USE_PANIC_HANDLERS{{System::Main, "Interface", "UsePanicHandlers"}, true}; const Info MAIN_OSD_MESSAGES{{System::Main, "Interface", "OnScreenDisplayMessages"}, true}; const Info MAIN_SKIP_NKIT_WARNING{{System::Main, "Interface", "SkipNKitWarning"}, false}; diff --git a/Source/Core/Core/Config/MainSettings.h b/Source/Core/Core/Config/MainSettings.h index ddd6cac340..d842fc3f49 100644 --- a/Source/Core/Core/Config/MainSettings.h +++ b/Source/Core/Core/Config/MainSettings.h @@ -130,6 +130,7 @@ extern const Info MAIN_NETWORK_SSL_DUMP_PEER_CERT; // Main.Interface +extern const Info MAIN_USE_HIGH_CONTRAST_TOOLTIPS; extern const Info MAIN_USE_PANIC_HANDLERS; extern const Info MAIN_OSD_MESSAGES; extern const Info MAIN_SKIP_NKIT_WARNING; diff --git a/Source/Core/DolphinQt/Config/Graphics/BalloonTip.cpp b/Source/Core/DolphinQt/Config/Graphics/BalloonTip.cpp index 6be2c637f0..98b5062934 100644 --- a/Source/Core/DolphinQt/Config/Graphics/BalloonTip.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/BalloonTip.cpp @@ -29,6 +29,8 @@ #include #endif +#include "Core/Config/MainSettings.h" + namespace { std::unique_ptr s_the_balloon_tip = nullptr; @@ -81,21 +83,42 @@ BalloonTip::BalloonTip(PrivateTag, const QIcon& icon, QString title, QString mes QColor window_color; QColor text_color; QColor dolphin_emphasis; + const bool use_high_contrast = Config::Get(Config::MAIN_USE_HIGH_CONTRAST_TOOLTIPS); if (brightness > 128) { - // Our theme color is light, so make it darker - window_color = QColor(72, 72, 72); - text_color = Qt::white; - dolphin_emphasis = Qt::yellow; - m_border_color = palette().color(QPalette::Window).darker(160); + if (use_high_contrast) + { + // Our theme color is light, so make it darker + window_color = QColor(72, 72, 72); + text_color = Qt::white; + dolphin_emphasis = Qt::yellow; + m_border_color = palette().color(QPalette::Window).darker(160); + } + else + { + window_color = pal.color(QPalette::Window); + text_color = pal.color(QPalette::Text); + dolphin_emphasis = QColor(QStringLiteral("#0090ff")); + m_border_color = pal.color(QPalette::Text); + } } else { - // Our theme color is dark, so make it lighter - window_color = Qt::white; - text_color = Qt::black; - dolphin_emphasis = QColor(QStringLiteral("#0090ff")); - m_border_color = palette().color(QPalette::Window).darker(160); + if (use_high_contrast) + { + // Our theme color is dark, so make it lighter + window_color = Qt::white; + text_color = Qt::black; + dolphin_emphasis = QColor(QStringLiteral("#0090ff")); + m_border_color = palette().color(QPalette::Window).darker(160); + } + else + { + window_color = pal.color(QPalette::Window); + text_color = pal.color(QPalette::Text); + dolphin_emphasis = Qt::yellow; + m_border_color = pal.color(QPalette::Text); + } } const auto style_sheet = QStringLiteral("background-color: #%1; color: #%2;")