UI: Minor fix.

This commit is contained in:
Nodir Temirkhodjaev 2019-12-23 14:09:20 +05:00
parent a06c8e9410
commit cb51a7c94c
2 changed files with 12 additions and 8 deletions

View File

@ -258,10 +258,7 @@ void ApplicationsPage::setupGroupOptions()
void ApplicationsPage::setupGroupLimitIn()
{
m_cscLimitIn = new CheckSpinCombo();
m_cscLimitIn->spinBox()->setRange(0, 99999);
m_cscLimitIn->spinBox()->setSuffix(" KiB/s");
m_cscLimitIn->setValues(speedLimitValues);
m_cscLimitIn = createGroupLimit();
connect(m_cscLimitIn->checkBox(), &QCheckBox::toggled, [&](bool checked) {
if (appGroup()->limitInEnabled() == checked)
@ -285,10 +282,7 @@ void ApplicationsPage::setupGroupLimitIn()
void ApplicationsPage::setupGroupLimitOut()
{
m_cscLimitOut = new CheckSpinCombo();
m_cscLimitOut->spinBox()->setRange(0, 99999);
m_cscLimitOut->spinBox()->setSuffix(" KiB/s");
m_cscLimitOut->setValues(speedLimitValues);
m_cscLimitOut = createGroupLimit();
connect(m_cscLimitOut->checkBox(), &QCheckBox::toggled, [&](bool checked) {
if (appGroup()->limitOutEnabled() == checked)
@ -310,6 +304,15 @@ void ApplicationsPage::setupGroupLimitOut()
});
}
CheckSpinCombo *ApplicationsPage::createGroupLimit()
{
auto c = new CheckSpinCombo();
c->spinBox()->setRange(0, 99999);
c->spinBox()->setSuffix(" KiB/s");
c->setValues(speedLimitValues);
return c;
}
void ApplicationsPage::setupGroupFragmentPacket()
{
m_cbFragmentPacket = ControlUtil::createCheckBox(false, [&](bool checked) {

View File

@ -34,6 +34,7 @@ private:
void setupGroupOptions();
void setupGroupLimitIn();
void setupGroupLimitOut();
static CheckSpinCombo *createGroupLimit();
void setupGroupFragmentPacket();
void setupGroupOptionsEnabled();
void retranslateGroupLimits();