Add setting to limit number of historical messages to load on connect (#2252)

This commit is contained in:
pajlada
2020-12-06 13:04:49 +01:00
committed by GitHub
parent 8b2c3c7386
commit 4436109a2f
7 changed files with 59 additions and 1 deletions
@@ -189,6 +189,43 @@ ColorButton *GeneralPageView::addColorButton(
return colorButton;
}
QSpinBox *GeneralPageView::addIntInput(const QString &text, IntSetting &setting,
int min, int max, int step)
{
auto layout = new QHBoxLayout;
auto label = new QLabel(text + ":");
auto input = new QSpinBox;
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()
{
this->navigationLayout_->addSpacing(24);