Core / DolphinQt: Add ini only option to force low-contrast tooltips

This commit is contained in:
iwubcode 2020-10-24 23:30:14 -05:00
parent 9c204428fe
commit cc837a59d6
3 changed files with 36 additions and 10 deletions

View File

@ -156,6 +156,8 @@ const Info<bool> MAIN_NETWORK_SSL_DUMP_PEER_CERT{{System::Main, "Network", "SSLD
// Main.Interface // Main.Interface
const Info<bool> MAIN_USE_HIGH_CONTRAST_TOOLTIPS{
{System::Main, "Interface", "UseHighContrastTooltips"}, true};
const Info<bool> MAIN_USE_PANIC_HANDLERS{{System::Main, "Interface", "UsePanicHandlers"}, true}; const Info<bool> MAIN_USE_PANIC_HANDLERS{{System::Main, "Interface", "UsePanicHandlers"}, true};
const Info<bool> MAIN_OSD_MESSAGES{{System::Main, "Interface", "OnScreenDisplayMessages"}, true}; const Info<bool> MAIN_OSD_MESSAGES{{System::Main, "Interface", "OnScreenDisplayMessages"}, true};
const Info<bool> MAIN_SKIP_NKIT_WARNING{{System::Main, "Interface", "SkipNKitWarning"}, false}; const Info<bool> MAIN_SKIP_NKIT_WARNING{{System::Main, "Interface", "SkipNKitWarning"}, false};

View File

@ -130,6 +130,7 @@ extern const Info<bool> MAIN_NETWORK_SSL_DUMP_PEER_CERT;
// Main.Interface // Main.Interface
extern const Info<bool> MAIN_USE_HIGH_CONTRAST_TOOLTIPS;
extern const Info<bool> MAIN_USE_PANIC_HANDLERS; extern const Info<bool> MAIN_USE_PANIC_HANDLERS;
extern const Info<bool> MAIN_OSD_MESSAGES; extern const Info<bool> MAIN_OSD_MESSAGES;
extern const Info<bool> MAIN_SKIP_NKIT_WARNING; extern const Info<bool> MAIN_SKIP_NKIT_WARNING;

View File

@ -29,6 +29,8 @@
#include <QToolTip> #include <QToolTip>
#endif #endif
#include "Core/Config/MainSettings.h"
namespace namespace
{ {
std::unique_ptr<BalloonTip> s_the_balloon_tip = nullptr; std::unique_ptr<BalloonTip> s_the_balloon_tip = nullptr;
@ -81,21 +83,42 @@ BalloonTip::BalloonTip(PrivateTag, const QIcon& icon, QString title, QString mes
QColor window_color; QColor window_color;
QColor text_color; QColor text_color;
QColor dolphin_emphasis; QColor dolphin_emphasis;
const bool use_high_contrast = Config::Get(Config::MAIN_USE_HIGH_CONTRAST_TOOLTIPS);
if (brightness > 128) if (brightness > 128)
{ {
// Our theme color is light, so make it darker if (use_high_contrast)
window_color = QColor(72, 72, 72); {
text_color = Qt::white; // Our theme color is light, so make it darker
dolphin_emphasis = Qt::yellow; window_color = QColor(72, 72, 72);
m_border_color = palette().color(QPalette::Window).darker(160); 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 else
{ {
// Our theme color is dark, so make it lighter if (use_high_contrast)
window_color = Qt::white; {
text_color = Qt::black; // Our theme color is dark, so make it lighter
dolphin_emphasis = QColor(QStringLiteral("#0090ff")); window_color = Qt::white;
m_border_color = palette().color(QPalette::Window).darker(160); 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;") const auto style_sheet = QStringLiteral("background-color: #%1; color: #%2;")