Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dim disabled items in context menus #4423

Merged
merged 7 commits into from
Apr 29, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- Bugfix: Fixed Twitch channel-specific filters not being applied correctly. (#4529)
- Bugfix: Fixed emote & badge tooltips not showing up when thumbnails were hidden. (#4509)
- Bugfix: Fixed links with invalid IPv4 addresses being parsed. (#4576)
- Bugfix: Fixed disabled items in context-menus having a weird or the default text color. (#4423)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Bugfix: Fixed disabled items in context-menus having a weird or the default text color. (#4423)
- Bugfix: Fixed disabled items in context-menus having a weird text-effect or the default text color. (#4423)

Not sure if that suggestion would be correct, but I wanted to point out that it seems to me that there is a word missing

Copy link
Contributor

@Wissididom Wissididom Apr 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I think about it, it might even have been correct, if so, I'm sorry

- Dev: Disabling precompiled headers on Windows is now tested in CI. (#4472)
- Dev: Themes are now stored as JSON files in `resources/themes`. (#4471, #4533)
- Dev: Ignore unhandled BTTV user-events. (#4438)
Expand Down
11 changes: 11 additions & 0 deletions resources/qss/settings.qss
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,14 @@ chatterino--NavigationLabel {
font-size: 15px;
color: #A6DDF4;
}

QMenu {
background: #242424;
border: #555555;
color: #ffffff;
selection-background-color: #555555;
}

QMenu::item:disabled {
color: #8c7f7f;
}
8 changes: 8 additions & 0 deletions src/singletons/Theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@ void Theme::parseFrom(const QJsonObject &root)
(this->isLightTheme() ? "#68B1FF"
: this->tabs.selected.backgrounds.regular.name());

this->window.contextMenuStyleSheet =
QStringLiteral("QMenu { background: %1; border: %2; color: %3; "
"selection-background-color: %2; } "
"QMenu::item:disabled { color: #8c7f7f; }")
.arg(splits.input.background.name(QColor::HexArgb),
tabs.selected.backgrounds.regular.name(QColor::HexArgb),
tabs.selected.text.name(QColor::HexArgb));

// Usercard buttons
if (this->isLightTheme())
{
Expand Down
2 changes: 2 additions & 0 deletions src/singletons/Theme.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class Theme final : public Singleton
struct {
QColor background;
QColor text;

QString contextMenuStyleSheet;
} window;

/// TABS
Expand Down
5 changes: 5 additions & 0 deletions src/widgets/BaseWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ void BaseWindow::themeChangedEvent()
palette.setColor(QPalette::WindowText, this->theme->window.text);
this->setPalette(palette);
}

if (!this->flags_.has(BaseWindow::DisableStyleSheet))
{
this->setStyleSheet(this->theme->window.contextMenuStyleSheet);
}
}

bool BaseWindow::event(QEvent *event)
Expand Down
17 changes: 9 additions & 8 deletions src/widgets/BaseWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ class BaseWindow : public BaseWidget
Q_OBJECT

public:
enum Flags {
enum Flags : uint32_t {
None = 0,
EnableCustomFrame = 1,
Frameless = 2,
TopMost = 4,
DisableCustomScaling = 8,
FramelessDraggable = 16,
DontFocus = 32,
Dialog = 64,
DisableLayoutSave = 128,
Frameless = (1 << 1),
TopMost = (1 << 2),
DisableCustomScaling = (1 << 3),
FramelessDraggable = (1 << 4),
DontFocus = (1 << 5),
Dialog = (1 << 6),
DisableLayoutSave = (1 << 7),
DisableStyleSheet = (1 << 8),
};

enum ActionOnFocusLoss { Nothing, Delete, Close, Hide };
Expand Down
7 changes: 4 additions & 3 deletions src/widgets/dialogs/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
namespace chatterino {

SettingsDialog::SettingsDialog(QWidget *parent)
: BaseWindow({BaseWindow::Flags::DisableCustomScaling,
BaseWindow::Flags::Dialog, BaseWindow::DisableLayoutSave},
parent)
: BaseWindow(
{BaseWindow::Flags::DisableCustomScaling, BaseWindow::Flags::Dialog,
BaseWindow::DisableLayoutSave, BaseWindow::DisableStyleSheet},
parent)
{
this->setObjectName("SettingsDialog");
this->setWindowTitle("Chatterino Settings");
Expand Down