void NetworkSettings::loadBWLimitSettings() { ConfigFile cfgFile; #if QT_VERSION < QT_VERSION_CHECK(5,3,3) // QNAM bandwidth limiting only works with versions of Qt greater or equal to 5.3.3 // (It needs Qt commits 097b641 and b99fa32) const char *v = qVersion(); // "x.y.z"; if (QLatin1String(v) < QLatin1String("5.3.3")) { QString tooltip = tr("Qt >= 5.4 is required in order to use the bandwidth limit"); _ui->downloadBox->setEnabled(false); _ui->uploadBox->setEnabled(false); _ui->downloadBox->setToolTip(tooltip); _ui->uploadBox->setToolTip(tooltip); _ui->noDownloadLimitRadioButton->setChecked(true); _ui->noUploadLimitRadioButton->setChecked(true); if (cfgFile.useUploadLimit() != 0 || cfgFile.useDownloadLimit() != 0) { // Update from old mirall that was using neon propagator jobs. saveBWLimitSettings(); } return; } #endif int useDownloadLimit = cfgFile.useDownloadLimit(); 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()); int useUploadLimit = cfgFile.useUploadLimit(); 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()); }
void Folder::setDirtyNetworkLimits() { if (_engine) { ConfigFile cfg; int downloadLimit = -75; // 75% int useDownLimit = cfg.useDownloadLimit(); if (useDownLimit >= 1) { downloadLimit = cfg.downloadLimit() * 1000; } else if (useDownLimit == 0) { downloadLimit = 0; } int uploadLimit = -75; // 75% int useUpLimit = cfg.useUploadLimit(); if ( useUpLimit >= 1) { uploadLimit = cfg.uploadLimit() * 1000; } else if (useUpLimit == 0) { uploadLimit = 0; } _engine->setNetworkLimits(uploadLimit, downloadLimit); } }
void NetworkSettings::loadBWLimitSettings() { ConfigFile cfgFile; int useDownloadLimit = cfgFile.useDownloadLimit(); 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()); int useUploadLimit = cfgFile.useUploadLimit(); 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()); }