mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
fixed some light mode issues
This commit is contained in:
parent
3446a623f5
commit
653e4c6adf
9 changed files with 31 additions and 19 deletions
|
@ -112,6 +112,12 @@ void BaseWidget::childEvent(QChildEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseWidget::showEvent(QShowEvent *)
|
||||||
|
{
|
||||||
|
this->scaleChangedEvent(this->getScale());
|
||||||
|
this->themeRefreshEvent();
|
||||||
|
}
|
||||||
|
|
||||||
void BaseWidget::setScale(float value)
|
void BaseWidget::setScale(float value)
|
||||||
{
|
{
|
||||||
// update scale value
|
// update scale value
|
||||||
|
|
|
@ -41,6 +41,8 @@ protected:
|
||||||
virtual void scaleChangedEvent(float newScale);
|
virtual void scaleChangedEvent(float newScale);
|
||||||
virtual void themeRefreshEvent();
|
virtual void themeRefreshEvent();
|
||||||
|
|
||||||
|
virtual void showEvent(QShowEvent *) override;
|
||||||
|
|
||||||
void setScale(float value);
|
void setScale(float value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -74,7 +74,6 @@ SplitHeader::SplitHeader(Split *_split)
|
||||||
|
|
||||||
// ---- misc
|
// ---- misc
|
||||||
this->layout()->setMargin(0);
|
this->layout()->setMargin(0);
|
||||||
this->themeRefreshEvent();
|
|
||||||
this->scaleChangedEvent(this->getScale());
|
this->scaleChangedEvent(this->getScale());
|
||||||
|
|
||||||
this->updateChannelText();
|
this->updateChannelText();
|
||||||
|
|
|
@ -31,7 +31,6 @@ SplitInput::SplitInput(Split *_chatWidget)
|
||||||
|
|
||||||
// misc
|
// misc
|
||||||
this->installKeyPressedEvent();
|
this->installKeyPressedEvent();
|
||||||
this->themeRefreshEvent();
|
|
||||||
this->scaleChangedEvent(this->getScale());
|
this->scaleChangedEvent(this->getScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,8 +111,6 @@ void SplitInput::scaleChangedEvent(float scale)
|
||||||
|
|
||||||
// set maximum height
|
// set maximum height
|
||||||
this->setMaximumHeight((int)(150 * this->getScale()));
|
this->setMaximumHeight((int)(150 * this->getScale()));
|
||||||
|
|
||||||
this->themeRefreshEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplitInput::themeRefreshEvent()
|
void SplitInput::themeRefreshEvent()
|
||||||
|
|
|
@ -123,8 +123,6 @@ SelectChannelDialog::SelectChannelDialog()
|
||||||
|
|
||||||
this->setScaleIndependantSize(300, 210);
|
this->setScaleIndependantSize(300, 210);
|
||||||
|
|
||||||
this->setStyleSheet("QRadioButton { color: #fff } QLabel { color: #fff }");
|
|
||||||
|
|
||||||
// Shortcuts
|
// Shortcuts
|
||||||
auto *shortcut_ok = new QShortcut(QKeySequence("Return"), this);
|
auto *shortcut_ok = new QShortcut(QKeySequence("Return"), this);
|
||||||
QObject::connect(shortcut_ok, &QShortcut::activated, [=] { this->ok(); });
|
QObject::connect(shortcut_ok, &QShortcut::activated, [=] { this->ok(); });
|
||||||
|
@ -255,15 +253,21 @@ bool SelectChannelDialog::EventFilter::eventFilter(QObject *watched, QEvent *eve
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectChannelDialog::SelectChannelDialog::showEvent(QShowEvent *)
|
|
||||||
{
|
|
||||||
// QTimer::singleShot(100, [=] { this->setSelectedChannel(this->selectedChannel); });
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectChannelDialog::closeEvent(QCloseEvent *)
|
void SelectChannelDialog::closeEvent(QCloseEvent *)
|
||||||
{
|
{
|
||||||
this->closed.invoke();
|
this->closed.invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SelectChannelDialog::themeRefreshEvent()
|
||||||
|
{
|
||||||
|
BaseWindow::themeRefreshEvent();
|
||||||
|
|
||||||
|
if (this->themeManager.isLightTheme()) {
|
||||||
|
this->setStyleSheet("QRadioButton { color: #000 } QLabel { color: #000 }");
|
||||||
|
} else {
|
||||||
|
this->setStyleSheet("QRadioButton { color: #fff } QLabel { color: #fff }");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace widgets
|
} // namespace widgets
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent *) override;
|
virtual void closeEvent(QCloseEvent *) override;
|
||||||
virtual void showEvent(QShowEvent *) override;
|
virtual void themeRefreshEvent() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class EventFilter : public QObject
|
class EventFilter : public QObject
|
||||||
|
|
|
@ -56,10 +56,6 @@ void SettingsDialog::initUi()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- misc
|
// ---- misc
|
||||||
QPalette palette;
|
|
||||||
palette.setColor(QPalette::Background, QColor("#444"));
|
|
||||||
this->setPalette(palette);
|
|
||||||
|
|
||||||
this->ui.tabContainerContainer->setObjectName("tabWidget");
|
this->ui.tabContainerContainer->setObjectName("tabWidget");
|
||||||
this->ui.pageStack->setObjectName("pages");
|
this->ui.pageStack->setObjectName("pages");
|
||||||
|
|
||||||
|
@ -166,6 +162,15 @@ void SettingsDialog::scaleChangedEvent(float newDpi)
|
||||||
this->ui.tabContainerContainer->setFixedWidth((int)(200 * newDpi));
|
this->ui.tabContainerContainer->setFixedWidth((int)(200 * newDpi));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::themeRefreshEvent()
|
||||||
|
{
|
||||||
|
BaseWindow::themeRefreshEvent();
|
||||||
|
|
||||||
|
QPalette palette;
|
||||||
|
palette.setColor(QPalette::Background, QColor("#444"));
|
||||||
|
this->setPalette(palette);
|
||||||
|
}
|
||||||
|
|
||||||
// void SettingsDialog::setChildrensFont(QLayout *object, QFont &font, int indent)
|
// void SettingsDialog::setChildrensFont(QLayout *object, QFont &font, int indent)
|
||||||
//{
|
//{
|
||||||
// // for (QWidget *widget : this->widgets) {
|
// // for (QWidget *widget : this->widgets) {
|
||||||
|
|
|
@ -32,7 +32,8 @@ public:
|
||||||
static void showDialog(PreferredTab preferredTab = PreferredTab::NoPreference);
|
static void showDialog(PreferredTab preferredTab = PreferredTab::NoPreference);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void scaleChangedEvent(float newDpi) override;
|
virtual void scaleChangedEvent(float newDpi) override;
|
||||||
|
virtual void themeRefreshEvent() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
|
@ -61,8 +61,6 @@ Window::Window(singletons::ThemeManager &_themeManager, WindowType _type)
|
||||||
// set margin
|
// set margin
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
|
|
||||||
this->themeRefreshEvent();
|
|
||||||
|
|
||||||
/// Initialize program-wide hotkeys
|
/// Initialize program-wide hotkeys
|
||||||
// CTRL+P: Open Settings Dialog
|
// CTRL+P: Open Settings Dialog
|
||||||
CreateWindowShortcut(this, "CTRL+P", [] { SettingsDialog::showDialog(); });
|
CreateWindowShortcut(this, "CTRL+P", [] { SettingsDialog::showDialog(); });
|
||||||
|
|
Loading…
Reference in a new issue