Skip to content

Commit

Permalink
Core / DolphinQt: Add ini only option to force low-contrast tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
iwubcode committed Nov 28, 2020
1 parent 9c20442 commit cc837a5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Source/Core/Core/Config/MainSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/Config/MainSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
43 changes: 33 additions & 10 deletions Source/Core/DolphinQt/Config/Graphics/BalloonTip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <QToolTip>
#endif

#include "Core/Config/MainSettings.h"

namespace
{
std::unique_ptr<BalloonTip> s_the_balloon_tip = nullptr;
Expand Down Expand Up @@ -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;")
Expand Down

0 comments on commit cc837a5

Please sign in to comment.