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: 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: Don't try to save emote popup bounds if we're quitting. (#6292)
|
||||||
- Dev: Remove `ChannelPageView::addCheckbox`. (#6305)
|
- Dev: Remove `ChannelPageView::addCheckbox`. (#6305)
|
||||||
|
- Dev: Remove `ChannelPageView::addIntInput`. (#6306)
|
||||||
- Dev: Implemented customizable display names for enums. (#6238)
|
- Dev: Implemented customizable display names for enums. (#6238)
|
||||||
- Dev: Refactored event API initialization away from Application and into TwitchIrcServer. (#6198)
|
- Dev: Refactored event API initialization away from Application and into TwitchIrcServer. (#6198)
|
||||||
- Dev: Updated GoogleTest to v1.17.0. (#6180)
|
- Dev: Updated GoogleTest to v1.17.0. (#6180)
|
||||||
|
|||||||
@@ -1165,31 +1165,53 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
|||||||
"processing power.")
|
"processing power.")
|
||||||
->addTo(layout);
|
->addTo(layout);
|
||||||
|
|
||||||
layout.addIntInput("Shadow opacity (0-255)", s.overlayShadowOpacity, 0, 255,
|
SettingWidget::intInput("Shadow opacity (0-255)", s.overlayShadowOpacity,
|
||||||
1,
|
{
|
||||||
"Controls the opacity of the added drop shadow. 255 "
|
.min = 0,
|
||||||
"corresponds to a fully opaque shadow.");
|
.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)
|
SettingWidget::colorButton("Shadow color", s.overlayShadowColor)
|
||||||
->addTo(layout);
|
->addTo(layout);
|
||||||
|
|
||||||
layout
|
SettingWidget::intInput("Shadow radius", s.overlayShadowRadius,
|
||||||
.addIntInput("Shadow radius", s.overlayShadowRadius, 0, 40, 1,
|
{
|
||||||
"Controls how far the shadow is spread (the blur "
|
.min = 0,
|
||||||
|
.max = 40,
|
||||||
|
.singleStep = 1,
|
||||||
|
.suffix = "dp",
|
||||||
|
})
|
||||||
|
->setTooltip("Controls how far the shadow is spread (the blur "
|
||||||
"radius) in device-independent pixels.")
|
"radius) in device-independent pixels.")
|
||||||
->setSuffix("dp");
|
->addTo(layout);
|
||||||
layout
|
|
||||||
.addIntInput("Shadow offset x", s.overlayShadowOffsetX, -20, 20, 1,
|
SettingWidget::intInput("Shadow offset x", s.overlayShadowOffsetX,
|
||||||
"Controls how far the shadow is offset on the x axis in "
|
{
|
||||||
|
.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 "
|
"device-independent pixels. A negative value offsets to "
|
||||||
"the left and a positive to the right.")
|
"the left and a positive to the right.")
|
||||||
->setSuffix("dp");
|
->addTo(layout);
|
||||||
layout
|
|
||||||
.addIntInput("Shadow offset y", s.overlayShadowOffsetY, -20, 20, 1,
|
SettingWidget::intInput("Shadow offset y", s.overlayShadowOffsetY,
|
||||||
"Controls how far the shadow is offset on the y axis in "
|
{
|
||||||
|
.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 "
|
"device-independent pixels. A negative value offsets to "
|
||||||
"the top and a positive to the bottom.")
|
"the top and a positive to the bottom.")
|
||||||
->setSuffix("dp");
|
->addTo(layout);
|
||||||
|
|
||||||
layout.addSubtitle("Miscellaneous");
|
layout.addSubtitle("Miscellaneous");
|
||||||
|
|
||||||
@@ -1393,13 +1415,32 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
|||||||
->addTo(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
|
// 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",
|
SettingWidget::intInput("Max number of history messages to load on connect",
|
||||||
s.twitchMessageHistoryLimit, 10, 800, 10);
|
s.twitchMessageHistoryLimit,
|
||||||
|
{
|
||||||
|
.min = 10,
|
||||||
|
.max = 800,
|
||||||
|
.singleStep = 10,
|
||||||
|
})
|
||||||
|
->addTo(layout);
|
||||||
|
|
||||||
layout.addIntInput("Split message scrollback limit (requires restart)",
|
SettingWidget::intInput("Split message scrollback limit (requires restart)",
|
||||||
s.scrollbackSplitLimit, 100, 100000, 100);
|
s.scrollbackSplitLimit,
|
||||||
layout.addIntInput("Usercard scrollback limit (requires restart)",
|
{
|
||||||
s.scrollbackUsercardLimit, 100, 100000, 100);
|
.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",
|
SettingWidget::dropdown("Show blocked term automod messages",
|
||||||
s.showBlockedTermAutomodMessages)
|
s.showBlockedTermAutomodMessages)
|
||||||
|
|||||||
@@ -211,45 +211,6 @@ ComboBox *GeneralPageView::addDropdown(
|
|||||||
return combo;
|
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()
|
void GeneralPageView::addNavigationSpacing()
|
||||||
{
|
{
|
||||||
assert(this->navigationLayout_ != nullptr &&
|
assert(this->navigationLayout_ != nullptr &&
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include <boost/variant.hpp>
|
#include <boost/variant.hpp>
|
||||||
#include <pajlada/signals/signalholder.hpp>
|
#include <pajlada/signals/signalholder.hpp>
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
@@ -138,8 +137,6 @@ public:
|
|||||||
ComboBox *addDropdown(const QString &text, const QStringList &items,
|
ComboBox *addDropdown(const QString &text, const QStringList &items,
|
||||||
pajlada::Settings::Setting<QString> &setting,
|
pajlada::Settings::Setting<QString> &setting,
|
||||||
bool editable = false, QString toolTipText = {});
|
bool editable = false, QString toolTipText = {});
|
||||||
QSpinBox *addIntInput(const QString &text, IntSetting &setting, int min,
|
|
||||||
int max, int step, QString toolTipText = {});
|
|
||||||
void addNavigationSpacing();
|
void addNavigationSpacing();
|
||||||
|
|
||||||
template <typename OnClick>
|
template <typename OnClick>
|
||||||
|
|||||||
@@ -136,6 +136,10 @@ SettingWidget *SettingWidget::intInput(const QString &label,
|
|||||||
{
|
{
|
||||||
input->setSingleStep(params.singleStep.value());
|
input->setSingleStep(params.singleStep.value());
|
||||||
}
|
}
|
||||||
|
if (params.suffix.has_value())
|
||||||
|
{
|
||||||
|
input->setSuffix(params.suffix.value());
|
||||||
|
}
|
||||||
|
|
||||||
widget->hLayout->addWidget(lbl);
|
widget->hLayout->addWidget(lbl);
|
||||||
widget->hLayout->addStretch(1);
|
widget->hLayout->addStretch(1);
|
||||||
|
|||||||
@@ -31,9 +31,21 @@ class SettingWidget : public QWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
struct IntInputParams {
|
struct IntInputParams {
|
||||||
|
/// The minimum value of this spin box.
|
||||||
|
/// Leave empty for a minimum value of 0.
|
||||||
std::optional<int> min;
|
std::optional<int> min;
|
||||||
|
|
||||||
|
/// The maximum value of this spin box.
|
||||||
|
/// Leave empty for a maximum value of 99.
|
||||||
std::optional<int> max;
|
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;
|
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;
|
~SettingWidget() override = default;
|
||||||
|
|||||||
Reference in New Issue
Block a user