Allow save resume interval to be disabled

Also raise the allowable upper limit
This commit is contained in:
Chocobo1 2018-07-04 14:02:05 +08:00
parent 6a16fc1ca2
commit d61435e4bf
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
3 changed files with 36 additions and 12 deletions

View file

@ -28,6 +28,8 @@
#include "advancedsettings.h"
#include <limits>
#include <QFont>
#include <QHeaderView>
#include <QHostAddress>
@ -129,6 +131,8 @@ AdvancedSettings::AdvancedSettings(QWidget *parent)
, this, &AdvancedSettings::updateCacheSpinSuffix);
connect(&comboBoxInterface, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
, this, &AdvancedSettings::updateInterfaceAddressCombo);
connect(&spinBoxSaveResumeDataInterval, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
, this, &AdvancedSettings::updateSaveResumeDataIntervalSuffix);
// Load settings
loadAdvancedSettings();
resizeColumnToContents(0);
@ -241,6 +245,14 @@ void AdvancedSettings::updateCacheSpinSuffix(int value)
spinBoxCache.setSuffix(tr(" MiB"));
}
void AdvancedSettings::updateSaveResumeDataIntervalSuffix(const int value)
{
if (value > 0)
spinBoxSaveResumeDataInterval.setSuffix(tr(" min", " minutes"));
else
spinBoxSaveResumeDataInterval.setSuffix(tr(" (disabled)"));
}
void AdvancedSettings::updateInterfaceAddressCombo()
{
// Try to get the currently selected interface name
@ -346,10 +358,10 @@ void AdvancedSettings::loadAdvancedSettings()
spinBoxSendBufferWatermarkFactor.setValue(session->sendBufferWatermarkFactor());
addRow(SEND_BUF_WATERMARK_FACTOR, tr("Send buffer watermark factor"), &spinBoxSendBufferWatermarkFactor);
// Save resume data interval
spinBoxSaveResumeDataInterval.setMinimum(1);
spinBoxSaveResumeDataInterval.setMaximum(1440);
spinBoxSaveResumeDataInterval.setMinimum(0);
spinBoxSaveResumeDataInterval.setMaximum(std::numeric_limits<int>::max());
spinBoxSaveResumeDataInterval.setValue(session->saveResumeDataInterval());
spinBoxSaveResumeDataInterval.setSuffix(tr(" m", " minutes"));
updateSaveResumeDataIntervalSuffix(spinBoxSaveResumeDataInterval.value());
addRow(SAVE_RESUME_DATA_INTERVAL, tr("Save resume data interval", "How often the fastresume file is saved."), &spinBoxSaveResumeDataInterval);
// Outgoing port Min
spinBoxOutgoingPortsMin.setMinimum(0);