Reorder code in options_imp::loadOptions() according to GUI layout

This commit is contained in:
Chocobo1 2015-09-03 14:36:37 +08:00
parent 9d051ea523
commit 7028c2712a

View File

@ -423,6 +423,7 @@ void options_imp::saveOptions() {
pref->setActionOnDblClOnTorrentDl(getActionOnDblClOnTorrentDl()); pref->setActionOnDblClOnTorrentDl(getActionOnDblClOnTorrentDl());
pref->setActionOnDblClOnTorrentFn(getActionOnDblClOnTorrentFn()); pref->setActionOnDblClOnTorrentFn(getActionOnDblClOnTorrentFn());
// End Downloads preferences // End Downloads preferences
// Connection preferences // Connection preferences
pref->setSessionPort(getPort()); pref->setSessionPort(getPort());
pref->setRandomPort(checkRandomPort->isChecked()); pref->setRandomPort(checkRandomPort->isChecked());
@ -539,8 +540,9 @@ void options_imp::loadOptions() {
int intValue; int intValue;
qreal floatValue; qreal floatValue;
QString strValue; QString strValue;
// General preferences
const Preferences* const pref = Preferences::instance(); const Preferences* const pref = Preferences::instance();
// General preferences
setLocale(pref->getLocale()); setLocale(pref->getLocale());
confirmDeletion->setChecked(pref->confirmTorrentDeletion()); confirmDeletion->setChecked(pref->confirmTorrentDeletion());
checkAltRowColors->setChecked(pref->useAlternatingRowColors()); checkAltRowColors->setChecked(pref->useAlternatingRowColors());
@ -560,15 +562,18 @@ void options_imp::loadOptions() {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
checkStartup->setChecked(pref->WinStartup()); checkStartup->setChecked(pref->WinStartup());
// Windows: file association settings
checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet()); checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet());
checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet()); checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet());
#endif #endif
// End General preferences // End General preferences
// Downloads preferences // Downloads preferences
checkAdditionDialog->setChecked(pref->useAdditionDialog());
checkAdditionDialogFront->setChecked(pref->additionDialogFront());
checkStartPaused->setChecked(pref->addTorrentsInPause());
textSavePath->setText(Utils::Fs::toNativePath(pref->getSavePath())); textSavePath->setText(Utils::Fs::toNativePath(pref->getSavePath()));
if (pref->isTempPathEnabled()) { if (pref->isTempPathEnabled()) {
// enable
checkTempFolder->setChecked(true); checkTempFolder->setChecked(true);
} else { } else {
checkTempFolder->setChecked(false); checkTempFolder->setChecked(false);
@ -577,16 +582,13 @@ void options_imp::loadOptions() {
checkAppendLabel->setChecked(pref->appendTorrentLabel()); checkAppendLabel->setChecked(pref->appendTorrentLabel());
checkAppendqB->setChecked(pref->useIncompleteFilesExtension()); checkAppendqB->setChecked(pref->useIncompleteFilesExtension());
checkPreallocateAll->setChecked(pref->preAllocateAllFiles()); checkPreallocateAll->setChecked(pref->preAllocateAllFiles());
checkAdditionDialog->setChecked(pref->useAdditionDialog());
checkAdditionDialogFront->setChecked(pref->additionDialogFront());
checkStartPaused->setChecked(pref->addTorrentsInPause());
strValue = Utils::Fs::toNativePath(pref->getTorrentExportDir()); strValue = Utils::Fs::toNativePath(pref->getTorrentExportDir());
if (strValue.isEmpty()) { if (strValue.isEmpty()) {
// Disable // Disable
checkExportDir->setChecked(false); checkExportDir->setChecked(false);
} else { } else {
// enable // Enable
checkExportDir->setChecked(true); checkExportDir->setChecked(true);
textExportDir->setText(strValue); textExportDir->setText(strValue);
} }
@ -596,10 +598,11 @@ void options_imp::loadOptions() {
// Disable // Disable
checkExportDirFin->setChecked(false); checkExportDirFin->setChecked(false);
} else { } else {
// enable // Enable
checkExportDirFin->setChecked(true); checkExportDirFin->setChecked(true);
textExportDirFin->setText(strValue); textExportDirFin->setText(strValue);
} }
groupMailNotification->setChecked(pref->isMailNotificationEnabled()); groupMailNotification->setChecked(pref->isMailNotificationEnabled());
dest_email_txt->setText(pref->getMailNotificationEmail()); dest_email_txt->setText(pref->getMailNotificationEmail());
smtp_server_txt->setText(pref->getMailNotificationSMTP()); smtp_server_txt->setText(pref->getMailNotificationSMTP());
@ -607,6 +610,7 @@ void options_imp::loadOptions() {
groupMailNotifAuth->setChecked(pref->getMailNotificationSMTPAuth()); groupMailNotifAuth->setChecked(pref->getMailNotificationSMTPAuth());
mailNotifUsername->setText(pref->getMailNotificationSMTPUsername()); mailNotifUsername->setText(pref->getMailNotificationSMTPUsername());
mailNotifPassword->setText(pref->getMailNotificationSMTPPassword()); mailNotifPassword->setText(pref->getMailNotificationSMTPPassword());
autoRunBox->setChecked(pref->isAutoRunEnabled()); autoRunBox->setChecked(pref->isAutoRunEnabled());
autoRun_txt->setText(pref->getAutoRunProgram()); autoRun_txt->setText(pref->getAutoRunProgram());
intValue = pref->getActionOnDblClOnTorrentDl(); intValue = pref->getActionOnDblClOnTorrentDl();
@ -618,11 +622,90 @@ void options_imp::loadOptions() {
intValue = 1; intValue = 1;
actionTorrentFnOnDblClBox->setCurrentIndex(intValue); actionTorrentFnOnDblClBox->setCurrentIndex(intValue);
// End Downloads preferences // End Downloads preferences
// Connection preferences // Connection preferences
spinPort->setValue(pref->getSessionPort());
checkUPnP->setChecked(pref->isUPnPEnabled()); checkUPnP->setChecked(pref->isUPnPEnabled());
checkRandomPort->setChecked(pref->useRandomPort()); checkRandomPort->setChecked(pref->useRandomPort());
spinPort->setValue(pref->getSessionPort());
spinPort->setDisabled(checkRandomPort->isChecked()); spinPort->setDisabled(checkRandomPort->isChecked());
intValue = pref->getMaxConnecs();
if (intValue > 0) {
// enable
checkMaxConnecs->setChecked(true);
spinMaxConnec->setEnabled(true);
spinMaxConnec->setValue(intValue);
} else {
// disable
checkMaxConnecs->setChecked(false);
spinMaxConnec->setEnabled(false);
}
intValue = pref->getMaxConnecsPerTorrent();
if (intValue > 0) {
// enable
checkMaxConnecsPerTorrent->setChecked(true);
spinMaxConnecPerTorrent->setEnabled(true);
spinMaxConnecPerTorrent->setValue(intValue);
} else {
// disable
checkMaxConnecsPerTorrent->setChecked(false);
spinMaxConnecPerTorrent->setEnabled(false);
}
intValue = pref->getMaxUploads();
if (intValue > 0) {
// enable
checkMaxUploads->setChecked(true);
spinMaxUploads->setEnabled(true);
spinMaxUploads->setValue(intValue);
} else {
// disable
checkMaxUploads->setChecked(false);
spinMaxUploads->setEnabled(false);
}
intValue = pref->getMaxUploadsPerTorrent();
if (intValue > 0) {
// enable
checkMaxUploadsPerTorrent->setChecked(true);
spinMaxUploadsPerTorrent->setEnabled(true);
spinMaxUploadsPerTorrent->setValue(intValue);
} else {
// disable
checkMaxUploadsPerTorrent->setChecked(false);
spinMaxUploadsPerTorrent->setEnabled(false);
}
intValue = pref->getProxyType();
switch(intValue) {
case Proxy::SOCKS4:
comboProxyType->setCurrentIndex(1);
break;
case Proxy::SOCKS5:
case Proxy::SOCKS5_PW:
comboProxyType->setCurrentIndex(2);
break;
case Proxy::HTTP:
case Proxy::HTTP_PW:
comboProxyType->setCurrentIndex(3);
break;
default:
comboProxyType->setCurrentIndex(0);
}
enableProxy(comboProxyType->currentIndex());
textProxyIP->setText(pref->getProxyIp());
spinProxyPort->setValue(pref->getProxyPort());
checkProxyPeerConnecs->setChecked(pref->proxyPeerConnections());
checkForceProxy->setChecked(pref->getForceProxy());
isProxyOnlyForTorrents->setChecked(pref->isProxyOnlyForTorrents());
checkProxyAuth->setChecked(pref->isProxyAuthEnabled());
textProxyUsername->setText(pref->getProxyUsername());
textProxyPassword->setText(pref->getProxyPassword());
checkIPFilter->setChecked(pref->isFilteringEnabled());
checkIpFilterTrackers->setChecked(pref->isFilteringTrackerEnabled());
textFilterPath->setText(Utils::Fs::toNativePath(pref->getFilter()));
// End Connection preferences
// Speed preferences
intValue = pref->getGlobalDownloadLimit(); intValue = pref->getGlobalDownloadLimit();
if (intValue > 0) { if (intValue > 0) {
// Enabled // Enabled
@ -668,97 +751,31 @@ void options_imp::loadOptions() {
checkUploadLimitAlt->setChecked(false); checkUploadLimitAlt->setChecked(false);
spinUploadLimitAlt->setEnabled(false); spinUploadLimitAlt->setEnabled(false);
} }
// Options
checkuTP->setChecked(pref->isuTPEnabled()); checkuTP->setChecked(pref->isuTPEnabled());
checkLimituTPConnections->setChecked(pref->isuTPRateLimited()); checkLimituTPConnections->setChecked(pref->isuTPRateLimited());
checkLimitTransportOverhead->setChecked(pref->includeOverheadInLimits()); checkLimitTransportOverhead->setChecked(pref->includeOverheadInLimits());
checkLimitLocalPeerRate->setChecked(!pref->getIgnoreLimitsOnLAN()); checkLimitLocalPeerRate->setChecked(!pref->getIgnoreLimitsOnLAN());
// Scheduler
check_schedule->setChecked(pref->isSchedulerEnabled()); check_schedule->setChecked(pref->isSchedulerEnabled());
schedule_from->setTime(pref->getSchedulerStartTime()); schedule_from->setTime(pref->getSchedulerStartTime());
schedule_to->setTime(pref->getSchedulerEndTime()); schedule_to->setTime(pref->getSchedulerEndTime());
schedule_days->setCurrentIndex((int)pref->getSchedulerDays()); schedule_days->setCurrentIndex((int)pref->getSchedulerDays());
// End Speed preferences
intValue = pref->getProxyType();
switch(intValue) {
case Proxy::SOCKS4:
comboProxyType->setCurrentIndex(1);
break;
case Proxy::SOCKS5:
case Proxy::SOCKS5_PW:
comboProxyType->setCurrentIndex(2);
break;
case Proxy::HTTP:
case Proxy::HTTP_PW:
comboProxyType->setCurrentIndex(3);
break;
default:
comboProxyType->setCurrentIndex(0);
}
enableProxy(comboProxyType->currentIndex());
//if (isProxyEnabled()) {
// Proxy is enabled, save settings
textProxyIP->setText(pref->getProxyIp());
spinProxyPort->setValue(pref->getProxyPort());
checkProxyPeerConnecs->setChecked(pref->proxyPeerConnections());
checkForceProxy->setChecked(pref->getForceProxy());
isProxyOnlyForTorrents->setChecked(pref->isProxyOnlyForTorrents());
checkProxyAuth->setChecked(pref->isProxyAuthEnabled());
textProxyUsername->setText(pref->getProxyUsername());
textProxyPassword->setText(pref->getProxyPassword());
//}
// End Connection preferences
// Bittorrent preferences // Bittorrent preferences
intValue = pref->getMaxConnecs();
if (intValue > 0) {
// enable
checkMaxConnecs->setChecked(true);
spinMaxConnec->setEnabled(true);
spinMaxConnec->setValue(intValue);
} else {
// disable
checkMaxConnecs->setChecked(false);
spinMaxConnec->setEnabled(false);
}
intValue = pref->getMaxConnecsPerTorrent();
if (intValue > 0) {
// enable
checkMaxConnecsPerTorrent->setChecked(true);
spinMaxConnecPerTorrent->setEnabled(true);
spinMaxConnecPerTorrent->setValue(intValue);
} else {
// disable
checkMaxConnecsPerTorrent->setChecked(false);
spinMaxConnecPerTorrent->setEnabled(false);
}
intValue = pref->getMaxUploads();
if (intValue > 0) {
// enable
checkMaxUploads->setChecked(true);
spinMaxUploads->setEnabled(true);
spinMaxUploads->setValue(intValue);
} else {
// disable
checkMaxUploads->setChecked(false);
spinMaxUploads->setEnabled(false);
}
intValue = pref->getMaxUploadsPerTorrent();
if (intValue > 0) {
// enable
checkMaxUploadsPerTorrent->setChecked(true);
spinMaxUploadsPerTorrent->setEnabled(true);
spinMaxUploadsPerTorrent->setValue(intValue);
} else {
// disable
checkMaxUploadsPerTorrent->setChecked(false);
spinMaxUploadsPerTorrent->setEnabled(false);
}
checkDHT->setChecked(pref->isDHTEnabled()); checkDHT->setChecked(pref->isDHTEnabled());
checkPeX->setChecked(pref->isPeXEnabled()); checkPeX->setChecked(pref->isPeXEnabled());
checkLSD->setChecked(pref->isLSDEnabled()); checkLSD->setChecked(pref->isLSDEnabled());
comboEncryption->setCurrentIndex(pref->getEncryptionSetting()); comboEncryption->setCurrentIndex(pref->getEncryptionSetting());
checkAnonymousMode->setChecked(pref->isAnonymousModeEnabled()); checkAnonymousMode->setChecked(pref->isAnonymousModeEnabled());
// Ratio limit
checkEnableQueueing->setChecked(pref->isQueueingSystemEnabled());
spinMaxActiveDownloads->setValue(pref->getMaxActiveDownloads());
spinMaxActiveUploads->setValue(pref->getMaxActiveUploads());
spinMaxActiveTorrents->setValue(pref->getMaxActiveTorrents());
checkIgnoreSlowTorrentsForQueueing->setChecked(pref->ignoreSlowTorrentsForQueueing());
floatValue = pref->getGlobalMaxRatio(); floatValue = pref->getGlobalMaxRatio();
if (floatValue >= 0.) { if (floatValue >= 0.) {
// Enable // Enable
@ -774,20 +791,8 @@ void options_imp::loadOptions() {
} }
comboRatioLimitAct->setCurrentIndex(pref->getMaxRatioAction()); comboRatioLimitAct->setCurrentIndex(pref->getMaxRatioAction());
// End Bittorrent preferences // End Bittorrent preferences
// Misc preferences
// * IP Filter // Web UI preferences
checkIPFilter->setChecked(pref->isFilteringEnabled());
checkIpFilterTrackers->setChecked(pref->isFilteringTrackerEnabled());
textFilterPath->setText(Utils::Fs::toNativePath(pref->getFilter()));
// End IP Filter
// Queueing system preferences
checkEnableQueueing->setChecked(pref->isQueueingSystemEnabled());
spinMaxActiveDownloads->setValue(pref->getMaxActiveDownloads());
spinMaxActiveUploads->setValue(pref->getMaxActiveUploads());
spinMaxActiveTorrents->setValue(pref->getMaxActiveTorrents());
checkIgnoreSlowTorrentsForQueueing->setChecked(pref->ignoreSlowTorrentsForQueueing());
// End Queueing system preferences
// Web UI
checkWebUi->setChecked(pref->isWebUiEnabled()); checkWebUi->setChecked(pref->isWebUiEnabled());
spinWebUiPort->setValue(pref->getWebUiPort()); spinWebUiPort->setValue(pref->getWebUiPort());
checkWebUIUPnP->setChecked(pref->useUPnPForWebUIPort()); checkWebUIUPnP->setChecked(pref->useUPnPForWebUIPort());
@ -797,13 +802,13 @@ void options_imp::loadOptions() {
textWebUiUsername->setText(pref->getWebUiUsername()); textWebUiUsername->setText(pref->getWebUiUsername());
textWebUiPassword->setText(pref->getWebUiPassword()); textWebUiPassword->setText(pref->getWebUiPassword());
checkBypassLocalAuth->setChecked(!pref->isWebUiLocalAuthEnabled()); checkBypassLocalAuth->setChecked(!pref->isWebUiLocalAuthEnabled());
// Dynamic DNS
checkDynDNS->setChecked(pref->isDynDNSEnabled()); checkDynDNS->setChecked(pref->isDynDNSEnabled());
comboDNSService->setCurrentIndex((int)pref->getDynDNSService()); comboDNSService->setCurrentIndex((int)pref->getDynDNSService());
domainNameTxt->setText(pref->getDynDomainName()); domainNameTxt->setText(pref->getDynDomainName());
DNSUsernameTxt->setText(pref->getDynDNSUsername()); DNSUsernameTxt->setText(pref->getDynDNSUsername());
DNSPasswordTxt->setText(pref->getDynDNSPassword()); DNSPasswordTxt->setText(pref->getDynDNSPassword());
// End Web UI // End Web UI preferences
} }
// return min & max ports // return min & max ports