mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
custom theme multiplier support (#825)
This commit is contained in:
parent
c176d836af
commit
c13a88e3b6
3 changed files with 36 additions and 3 deletions
|
@ -66,7 +66,8 @@ public:
|
||||||
BoolSetting showTitle = {"/appearance/splitheader/showTitle", false};
|
BoolSetting showTitle = {"/appearance/splitheader/showTitle", false};
|
||||||
BoolSetting showGame = {"/appearance/splitheader/showGame", false};
|
BoolSetting showGame = {"/appearance/splitheader/showGame", false};
|
||||||
BoolSetting showUptime = {"/appearance/splitheader/showUptime", false};
|
BoolSetting showUptime = {"/appearance/splitheader/showUptime", false};
|
||||||
|
FloatSetting customThemeMultiplier = {"/appearance/customThemeMultiplier",
|
||||||
|
-0.5f};
|
||||||
// BoolSetting useCustomWindowFrame = {"/appearance/useCustomWindowFrame",
|
// BoolSetting useCustomWindowFrame = {"/appearance/useCustomWindowFrame",
|
||||||
// false};
|
// false};
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,9 @@ namespace detail {
|
||||||
{
|
{
|
||||||
return -0.8;
|
return -0.8;
|
||||||
}
|
}
|
||||||
|
else if (themeName == "Custom") {
|
||||||
|
return getSettings()->customThemeMultiplier.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
return -0.8;
|
return -0.8;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#define THEME_ITEMS "White", "Light", "Dark", "Black"
|
#define THEME_ITEMS "White", "Light", "Dark", "Black", "Custom"
|
||||||
|
|
||||||
#define TAB_X "Show tab close button"
|
#define TAB_X "Show tab close button"
|
||||||
#define TAB_PREF "Hide preferences button (ctrl+p to show)"
|
#define TAB_PREF "Hide preferences button (ctrl+p to show)"
|
||||||
|
@ -79,14 +79,43 @@ void LookPage::addInterfaceTab(LayoutCreator<QVBoxLayout> layout)
|
||||||
{
|
{
|
||||||
auto *theme =
|
auto *theme =
|
||||||
this->createComboBox({THEME_ITEMS}, getApp()->themes->themeName);
|
this->createComboBox({THEME_ITEMS}, getApp()->themes->themeName);
|
||||||
|
QDoubleSpinBox *w = new QDoubleSpinBox;
|
||||||
|
|
||||||
QObject::connect(theme, &QComboBox::currentTextChanged,
|
QObject::connect(theme, &QComboBox::currentTextChanged,
|
||||||
[](const QString &) {
|
[w](const QString &themeName) {
|
||||||
|
if (themeName == "Custom") {
|
||||||
|
w->show();
|
||||||
|
} else {
|
||||||
|
w->hide();
|
||||||
|
}
|
||||||
getApp()->windows->forceLayoutChannelViews();
|
getApp()->windows->forceLayoutChannelViews();
|
||||||
});
|
});
|
||||||
|
|
||||||
auto box = layout.emplace<QHBoxLayout>().withoutMargin();
|
auto box = layout.emplace<QHBoxLayout>().withoutMargin();
|
||||||
box.emplace<QLabel>("Theme: ");
|
box.emplace<QLabel>("Theme: ");
|
||||||
box.append(theme);
|
box.append(theme);
|
||||||
|
|
||||||
|
{
|
||||||
|
w->setButtonSymbols(QDoubleSpinBox::NoButtons);
|
||||||
|
if (getApp()->themes->themeName.getValue() != "Custom") {
|
||||||
|
w->hide();
|
||||||
|
} else {
|
||||||
|
w->show();
|
||||||
|
}
|
||||||
|
w->setRange(-1.0, 1.0);
|
||||||
|
w->setSingleStep(0.05);
|
||||||
|
w->setValue(getSettings()->customThemeMultiplier.getValue());
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
w, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
|
[](double value) {
|
||||||
|
getSettings()->customThemeMultiplier.setValue(float(value));
|
||||||
|
getApp()->themes->update();
|
||||||
|
getApp()->windows->forceLayoutChannelViews();
|
||||||
|
});
|
||||||
|
box.append(w);
|
||||||
|
}
|
||||||
|
|
||||||
box->addStretch(1);
|
box->addStretch(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue