mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Style account switcher to match the current theme (#4817)
This commit is contained in:
parent
337b043bc3
commit
2d5f078306
|
@ -3,6 +3,7 @@
|
|||
## Unversioned
|
||||
|
||||
- Minor: Migrate to the new Get Channel Followers Helix endpoint, fixing follower count not showing up in usercards. (#4809)
|
||||
- Minor: The account switcher is now styled to match your theme. (#4817)
|
||||
- Bugfix: Fixed a performance issue when displaying replies to certain messages. (#4807)
|
||||
- Bugfix: Fixed a data race when disconnecting from Twitch PubSub. (#4771)
|
||||
- Bugfix: Fixed `/shoutout` command not working with usernames starting with @'s (e.g. `/shoutout @forsen`). (#4800)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "widgets/AccountSwitchPopup.hpp"
|
||||
|
||||
#include "common/Literals.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "widgets/AccountSwitchWidget.hpp"
|
||||
#include "widgets/dialogs/SettingsDialog.hpp"
|
||||
|
||||
|
@ -9,6 +11,8 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
using namespace literals;
|
||||
|
||||
AccountSwitchPopup::AccountSwitchPopup(QWidget *parent)
|
||||
: BaseWindow({BaseWindow::TopMost, BaseWindow::Frameless,
|
||||
BaseWindow::DisableLayoutSave},
|
||||
|
@ -39,6 +43,48 @@ AccountSwitchPopup::AccountSwitchPopup(QWidget *parent)
|
|||
this->getLayoutContainer()->setLayout(vbox);
|
||||
|
||||
this->setScaleIndependantSize(200, 200);
|
||||
this->themeChangedEvent();
|
||||
}
|
||||
|
||||
void AccountSwitchPopup::themeChangedEvent()
|
||||
{
|
||||
BaseWindow::themeChangedEvent();
|
||||
|
||||
auto *t = getTheme();
|
||||
auto color = [](const QColor &c) {
|
||||
return c.name(QColor::HexArgb);
|
||||
};
|
||||
this->setStyleSheet(uR"(
|
||||
QListView {
|
||||
color: %1;
|
||||
background: %2;
|
||||
}
|
||||
QListView::item:hover {
|
||||
background: %3;
|
||||
}
|
||||
QListView::item:selected {
|
||||
background: %4;
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background: %5;
|
||||
color: %1;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background: %3;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background: %6;
|
||||
}
|
||||
|
||||
chatterino--AccountSwitchPopup {
|
||||
background: %7;
|
||||
}
|
||||
)"_s.arg(color(t->window.text), color(t->splits.header.background),
|
||||
color(t->splits.header.focusedBackground), color(t->accent),
|
||||
color(t->tabs.regular.backgrounds.regular),
|
||||
color(t->tabs.selected.backgrounds.regular),
|
||||
color(t->window.background)));
|
||||
}
|
||||
|
||||
void AccountSwitchPopup::refresh()
|
||||
|
|
|
@ -21,6 +21,8 @@ protected:
|
|||
void focusOutEvent(QFocusEvent *event) final;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
void themeChangedEvent() override;
|
||||
|
||||
private:
|
||||
struct {
|
||||
AccountSwitchWidget *accountSwitchWidget = nullptr;
|
||||
|
|
Loading…
Reference in a new issue