refactor: remove GeneralPageView.addIntInput (#6306)
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
- Dev: Refactored `SettingWidget::dropdown` for string enums to the source file. (#6293)
|
||||
- Dev: Don't try to save emote popup bounds if we're quitting. (#6292)
|
||||
- Dev: Remove `ChannelPageView::addCheckbox`. (#6305)
|
||||
- Dev: Remove `ChannelPageView::addIntInput`. (#6306)
|
||||
- Dev: Implemented customizable display names for enums. (#6238)
|
||||
- Dev: Refactored event API initialization away from Application and into TwitchIrcServer. (#6198)
|
||||
- Dev: Updated GoogleTest to v1.17.0. (#6180)
|
||||
|
||||
@@ -1165,31 +1165,53 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
"processing power.")
|
||||
->addTo(layout);
|
||||
|
||||
layout.addIntInput("Shadow opacity (0-255)", s.overlayShadowOpacity, 0, 255,
|
||||
1,
|
||||
"Controls the opacity of the added drop shadow. 255 "
|
||||
"corresponds to a fully opaque shadow.");
|
||||
SettingWidget::intInput("Shadow opacity (0-255)", s.overlayShadowOpacity,
|
||||
{
|
||||
.min = 0,
|
||||
.max = 255,
|
||||
.singleStep = 1,
|
||||
})
|
||||
->setTooltip("Controls the opacity of the added drop shadow. 255 "
|
||||
"corresponds to a fully opaque shadow.")
|
||||
->addTo(layout);
|
||||
|
||||
SettingWidget::colorButton("Shadow color", s.overlayShadowColor)
|
||||
->addTo(layout);
|
||||
|
||||
layout
|
||||
.addIntInput("Shadow radius", s.overlayShadowRadius, 0, 40, 1,
|
||||
"Controls how far the shadow is spread (the blur "
|
||||
SettingWidget::intInput("Shadow radius", s.overlayShadowRadius,
|
||||
{
|
||||
.min = 0,
|
||||
.max = 40,
|
||||
.singleStep = 1,
|
||||
.suffix = "dp",
|
||||
})
|
||||
->setTooltip("Controls how far the shadow is spread (the blur "
|
||||
"radius) in device-independent pixels.")
|
||||
->setSuffix("dp");
|
||||
layout
|
||||
.addIntInput("Shadow offset x", s.overlayShadowOffsetX, -20, 20, 1,
|
||||
"Controls how far the shadow is offset on the x axis in "
|
||||
->addTo(layout);
|
||||
|
||||
SettingWidget::intInput("Shadow offset x", s.overlayShadowOffsetX,
|
||||
{
|
||||
.min = -20,
|
||||
.max = 20,
|
||||
.singleStep = 1,
|
||||
.suffix = "dp",
|
||||
})
|
||||
->setTooltip("Controls how far the shadow is offset on the x axis in "
|
||||
"device-independent pixels. A negative value offsets to "
|
||||
"the left and a positive to the right.")
|
||||
->setSuffix("dp");
|
||||
layout
|
||||
.addIntInput("Shadow offset y", s.overlayShadowOffsetY, -20, 20, 1,
|
||||
"Controls how far the shadow is offset on the y axis in "
|
||||
->addTo(layout);
|
||||
|
||||
SettingWidget::intInput("Shadow offset y", s.overlayShadowOffsetY,
|
||||
{
|
||||
.min = -20,
|
||||
.max = 20,
|
||||
.singleStep = 1,
|
||||
.suffix = "dp",
|
||||
})
|
||||
->setTooltip("Controls how far the shadow is offset on the y axis in "
|
||||
"device-independent pixels. A negative value offsets to "
|
||||
"the top and a positive to the bottom.")
|
||||
->setSuffix("dp");
|
||||
->addTo(layout);
|
||||
|
||||
layout.addSubtitle("Miscellaneous");
|
||||
|
||||
@@ -1393,13 +1415,32 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
->addTo(layout);
|
||||
|
||||
// TODO: Change phrasing to use better english once we can tag settings, right now it's kept as history instead of historical so that the setting shows up when the user searches for history
|
||||
layout.addIntInput("Max number of history messages to load on connect",
|
||||
s.twitchMessageHistoryLimit, 10, 800, 10);
|
||||
SettingWidget::intInput("Max number of history messages to load on connect",
|
||||
s.twitchMessageHistoryLimit,
|
||||
{
|
||||
.min = 10,
|
||||
.max = 800,
|
||||
.singleStep = 10,
|
||||
})
|
||||
->addTo(layout);
|
||||
|
||||
layout.addIntInput("Split message scrollback limit (requires restart)",
|
||||
s.scrollbackSplitLimit, 100, 100000, 100);
|
||||
layout.addIntInput("Usercard scrollback limit (requires restart)",
|
||||
s.scrollbackUsercardLimit, 100, 100000, 100);
|
||||
SettingWidget::intInput("Split message scrollback limit (requires restart)",
|
||||
s.scrollbackSplitLimit,
|
||||
{
|
||||
.min = 100,
|
||||
.max = 100000,
|
||||
.singleStep = 100,
|
||||
})
|
||||
->addTo(layout);
|
||||
|
||||
SettingWidget::intInput("Usercard scrollback limit (requires restart)",
|
||||
s.scrollbackUsercardLimit,
|
||||
{
|
||||
.min = 100,
|
||||
.max = 100000,
|
||||
.singleStep = 100,
|
||||
})
|
||||
->addTo(layout);
|
||||
|
||||
SettingWidget::dropdown("Show blocked term automod messages",
|
||||
s.showBlockedTermAutomodMessages)
|
||||
|
||||
@@ -211,45 +211,6 @@ ComboBox *GeneralPageView::addDropdown(
|
||||
return combo;
|
||||
}
|
||||
|
||||
QSpinBox *GeneralPageView::addIntInput(const QString &text, IntSetting &setting,
|
||||
int min, int max, int step,
|
||||
QString toolTipText)
|
||||
{
|
||||
auto *layout = new QHBoxLayout;
|
||||
|
||||
auto *label = new QLabel(text + ":");
|
||||
this->addToolTip(*label, toolTipText);
|
||||
|
||||
auto *input = new SpinBox;
|
||||
input->setMinimum(min);
|
||||
input->setMaximum(max);
|
||||
|
||||
// update when setting changes
|
||||
setting.connect(
|
||||
[input](const int &value, auto) {
|
||||
input->setValue(value);
|
||||
},
|
||||
this->managedConnections_);
|
||||
|
||||
// update setting on value changed
|
||||
QObject::connect(input, QOverload<int>::of(&QSpinBox::valueChanged), this,
|
||||
[&setting](int newValue) {
|
||||
setting = newValue;
|
||||
});
|
||||
|
||||
layout->addWidget(label);
|
||||
layout->addStretch(1);
|
||||
layout->addWidget(input);
|
||||
|
||||
this->addLayout(layout);
|
||||
|
||||
// groups
|
||||
this->groups_.back().widgets.push_back({input, {text}});
|
||||
this->groups_.back().widgets.push_back({label, {text}});
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
void GeneralPageView::addNavigationSpacing()
|
||||
{
|
||||
assert(this->navigationLayout_ != nullptr &&
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include <boost/variant.hpp>
|
||||
#include <pajlada/signals/signalholder.hpp>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QDebug>
|
||||
#include <QPushButton>
|
||||
@@ -138,8 +137,6 @@ public:
|
||||
ComboBox *addDropdown(const QString &text, const QStringList &items,
|
||||
pajlada::Settings::Setting<QString> &setting,
|
||||
bool editable = false, QString toolTipText = {});
|
||||
QSpinBox *addIntInput(const QString &text, IntSetting &setting, int min,
|
||||
int max, int step, QString toolTipText = {});
|
||||
void addNavigationSpacing();
|
||||
|
||||
template <typename OnClick>
|
||||
|
||||
@@ -136,6 +136,10 @@ SettingWidget *SettingWidget::intInput(const QString &label,
|
||||
{
|
||||
input->setSingleStep(params.singleStep.value());
|
||||
}
|
||||
if (params.suffix.has_value())
|
||||
{
|
||||
input->setSuffix(params.suffix.value());
|
||||
}
|
||||
|
||||
widget->hLayout->addWidget(lbl);
|
||||
widget->hLayout->addStretch(1);
|
||||
|
||||
@@ -31,9 +31,21 @@ class SettingWidget : public QWidget
|
||||
|
||||
public:
|
||||
struct IntInputParams {
|
||||
/// The minimum value of this spin box.
|
||||
/// Leave empty for a minimum value of 0.
|
||||
std::optional<int> min;
|
||||
|
||||
/// The maximum value of this spin box.
|
||||
/// Leave empty for a maximum value of 99.
|
||||
std::optional<int> max;
|
||||
|
||||
/// The value the spinbox is incremented or decremented by when the up or down arrow is clicked.
|
||||
/// Leave empty for a single step of 1.
|
||||
std::optional<int> singleStep;
|
||||
|
||||
/// The suffix appended to the end of the displayed value.
|
||||
/// Leave empty for no suffix.
|
||||
std::optional<QString> suffix;
|
||||
};
|
||||
|
||||
~SettingWidget() override = default;
|
||||
|
||||
Reference in New Issue
Block a user