mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
parent
82460557cb
commit
c6cfb548f5
|
@ -56,6 +56,19 @@ void Fonts::initialize(Application &app)
|
|||
}
|
||||
this->fontChanged.invoke();
|
||||
});
|
||||
|
||||
getSettings()->boldScale.connect([this, &app](const int &, auto) {
|
||||
assertInGuiThread();
|
||||
|
||||
if (app.windows) {
|
||||
app.windows->incGeneration();
|
||||
}
|
||||
|
||||
for (auto &map : this->fontsByType_) {
|
||||
map.clear();
|
||||
}
|
||||
this->fontChanged.invoke();
|
||||
});
|
||||
}
|
||||
|
||||
QFont Fonts::getFont(Fonts::Type type, float scale)
|
||||
|
@ -99,12 +112,13 @@ Fonts::FontData Fonts::createFontData(Type type, float scale)
|
|||
{ChatSmall, {0.6f, false, QFont::Normal}},
|
||||
{ChatMediumSmall, {0.8f, false, QFont::Normal}},
|
||||
{ChatMedium, {1, false, QFont::Normal}},
|
||||
{ChatMediumBold, {1, false, QFont::Medium}},
|
||||
{ChatMediumBold, {1, false, QFont::Weight(getApp()->settings->boldScale.getValue())}},
|
||||
{ChatMediumItalic, {1, true, QFont::Normal}},
|
||||
{ChatLarge, {1.2f, false, QFont::Normal}},
|
||||
{ChatVeryLarge, {1.4f, false, QFont::Normal}},
|
||||
};
|
||||
|
||||
sizeScale[ChatMediumBold] = {1, false,
|
||||
QFont::Weight(getApp()->settings->boldScale.getValue())};
|
||||
auto data = sizeScale[type];
|
||||
return FontData(QFont(QString::fromStdString(this->chatFontFamily.getValue()),
|
||||
int(this->chatFontSize.getValue() * data.scale * scale), data.weight,
|
||||
|
|
|
@ -36,6 +36,7 @@ public:
|
|||
BoolSetting alternateMessageBackground = {"/appearance/messages/alternateMessageBackground",
|
||||
false};
|
||||
IntSetting uiScale = {"/appearance/uiScale", 0};
|
||||
IntSetting boldScale = {"/appearance/boldScale", 57};
|
||||
BoolSetting windowTopMost = {"/appearance/windowAlwaysOnTop", false};
|
||||
BoolSetting showTabCloseButton = {"/appearance/showTabCloseButton", true};
|
||||
BoolSetting hidePreferencesButton = {"/appearance/hidePreferencesButton", false};
|
||||
|
|
|
@ -113,6 +113,12 @@ void LookPage::addMessageTab(LayoutCreator<QVBoxLayout> layout)
|
|||
// font
|
||||
layout.append(this->createFontChanger());
|
||||
|
||||
// bold-slider
|
||||
{
|
||||
auto box = layout.emplace<QHBoxLayout>().withoutMargin();
|
||||
box.emplace<QLabel>("Boldness: ");
|
||||
box.append(this->createBoldScaleSlider());
|
||||
}
|
||||
// --
|
||||
layout.emplace<Line>(false);
|
||||
|
||||
|
@ -419,4 +425,40 @@ QLayout *LookPage::createUiScaleSlider()
|
|||
return layout;
|
||||
}
|
||||
|
||||
QLayout *LookPage::createBoldScaleSlider()
|
||||
{
|
||||
auto layout = new QHBoxLayout();
|
||||
auto slider = new QSlider(Qt::Horizontal);
|
||||
auto label = new QLabel();
|
||||
|
||||
layout->addWidget(slider);
|
||||
layout->addWidget(label);
|
||||
|
||||
slider->setMinimum(50);
|
||||
slider->setMaximum(100);
|
||||
slider->setValue(getSettings()->boldScale.getValue());
|
||||
|
||||
label->setMinimumWidth(100);
|
||||
|
||||
QObject::connect(slider, &QSlider::valueChanged,
|
||||
[](auto value) { getSettings()->boldScale.setValue(value); });
|
||||
// show value
|
||||
// getSettings()->boldScale.connect(
|
||||
// [label](auto, auto) {
|
||||
// label->setText(QString::number(getSettings()->boldScale.getValue()));
|
||||
// },
|
||||
// this->connections_);
|
||||
|
||||
QPushButton *button = new QPushButton("Reset");
|
||||
layout->addWidget(button);
|
||||
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Policy::Fixed);
|
||||
|
||||
QObject::connect(button, &QPushButton::clicked, [=]() {
|
||||
getSettings()->boldScale.setValue(57);
|
||||
slider->setValue(57);
|
||||
});
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -28,6 +28,7 @@ private:
|
|||
QLayout *createThemeColorChanger();
|
||||
QLayout *createFontChanger();
|
||||
QLayout *createUiScaleSlider();
|
||||
QLayout *createBoldScaleSlider();
|
||||
|
||||
ChannelPtr createPreviewChannel();
|
||||
|
||||
|
|
Loading…
Reference in a new issue