mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 13:05:51 +03:00
Adapt network settings loadBwLimitSettings for account-specific settings
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
fe031a131c
commit
f9d0f435d1
1 changed files with 15 additions and 7 deletions
|
@ -25,6 +25,7 @@
|
|||
#include <QNetworkProxy>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <type_traits>
|
||||
|
||||
namespace OCC {
|
||||
|
||||
|
@ -158,27 +159,34 @@ void NetworkSettings::loadProxySettings()
|
|||
|
||||
void NetworkSettings::loadBWLimitSettings()
|
||||
{
|
||||
ConfigFile cfgFile;
|
||||
const auto useGlobalLimit = _account == nullptr || _account->downloadLimitSetting() == Account::AccountNetworkTransferLimitSetting::GlobalLimit;
|
||||
const auto cfgFile = ConfigFile();
|
||||
const auto useDownloadLimit = useGlobalLimit ? cfgFile.useDownloadLimit() : static_cast<std::underlying_type_t<Account::AccountNetworkTransferLimitSetting>>(_account->downloadLimitSetting());
|
||||
const auto downloadLimit = useGlobalLimit ? cfgFile.downloadLimit() : _account->downloadLimit();
|
||||
const auto useUploadLimit = useGlobalLimit ? cfgFile.useUploadLimit() : static_cast<std::underlying_type_t<Account::AccountNetworkTransferLimitSetting>>(_account->uploadLimitSetting());
|
||||
const auto uploadLimit = useGlobalLimit ? cfgFile.uploadLimit() : _account->uploadLimit();
|
||||
|
||||
int useDownloadLimit = cfgFile.useDownloadLimit();
|
||||
if (useDownloadLimit >= 1) {
|
||||
if (_account != nullptr && _account->downloadLimitSetting() == Account::AccountNetworkTransferLimitSetting::GlobalLimit) {
|
||||
_ui->globalDownloadSettingsRadioButton->setChecked(true);
|
||||
} else if (useDownloadLimit >= 1) {
|
||||
_ui->downloadLimitRadioButton->setChecked(true);
|
||||
} else if (useDownloadLimit == 0) {
|
||||
_ui->noDownloadLimitRadioButton->setChecked(true);
|
||||
} else {
|
||||
_ui->autoDownloadLimitRadioButton->setChecked(true);
|
||||
}
|
||||
_ui->downloadSpinBox->setValue(cfgFile.downloadLimit());
|
||||
_ui->downloadSpinBox->setValue(downloadLimit);
|
||||
|
||||
int useUploadLimit = cfgFile.useUploadLimit();
|
||||
if (useUploadLimit >= 1) {
|
||||
if (_account != nullptr && _account->uploadLimitSetting() == Account::AccountNetworkTransferLimitSetting::GlobalLimit) {
|
||||
_ui->globalUploadSettingsRadioButton->setChecked(true);
|
||||
} else if (useUploadLimit >= 1) {
|
||||
_ui->uploadLimitRadioButton->setChecked(true);
|
||||
} else if (useUploadLimit == 0) {
|
||||
_ui->noUploadLimitRadioButton->setChecked(true);
|
||||
} else {
|
||||
_ui->autoUploadLimitRadioButton->setChecked(true);
|
||||
}
|
||||
_ui->uploadSpinBox->setValue(cfgFile.uploadLimit());
|
||||
_ui->uploadSpinBox->setValue(uploadLimit);
|
||||
}
|
||||
|
||||
void NetworkSettings::saveProxySettings()
|
||||
|
|
Loading…
Reference in a new issue