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
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_OSD_MESSAGES{{System::Main, "Interface", "OnScreenDisplayMessages"}, true};
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
extern const Info<bool> MAIN_USE_HIGH_CONTRAST_TOOLTIPS;
extern const Info<bool> MAIN_USE_PANIC_HANDLERS;
extern const Info<bool> MAIN_OSD_MESSAGES;
extern const Info<bool> MAIN_SKIP_NKIT_WARNING;

View File

@ -29,6 +29,8 @@
#include <QToolTip>
#endif
#include "Core/Config/MainSettings.h"
namespace
{
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 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;")