mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 08:43:08 -07:00
parent
d05d5a85a5
commit
dd34663224
59 changed files with 1796 additions and 1280 deletions
|
@ -51,6 +51,7 @@
|
|||
#include "advancedsettings.h"
|
||||
#include "guiiconprovider.h"
|
||||
#include "scanfoldersdelegate.h"
|
||||
#include "addnewtorrentdialog.h"
|
||||
#include "options_imp.h"
|
||||
|
||||
#ifndef QT_NO_OPENSSL
|
||||
|
@ -168,8 +169,12 @@ options_imp::options_imp(QWidget *parent)
|
|||
#endif
|
||||
// Downloads tab
|
||||
connect(textSavePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(radioBtnEnableSubcategories, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(radioBtnAdvancedMode, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(radioBtnRelocateOnCategoryChanged, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(radioBtnRelocateOnCategorySavePathChanged, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(radioBtnRelocateOnDefaultSavePathChanged, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(textTempPath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(checkAppendLabel, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkAppendqB, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkPreallocateAll, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkAdditionDialog, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
|
@ -197,7 +202,7 @@ options_imp::options_imp(QWidget *parent)
|
|||
autoRun_param->setText(QString::fromUtf8("%1\n %2\n %3\n %4\n %5\n %6\n %7\n %8\n %9\n %10")
|
||||
.arg(tr("Supported parameters (case sensitive):"))
|
||||
.arg(tr("%N: Torrent name"))
|
||||
.arg(tr("%L: Label"))
|
||||
.arg(tr("%L: Category"))
|
||||
.arg(tr("%F: Content path (same as root path for multifile torrent)"))
|
||||
.arg(tr("%R: Root path (first torrent subdirectory path)"))
|
||||
.arg(tr("%D: Save path"))
|
||||
|
@ -429,16 +434,22 @@ void options_imp::saveOptions()
|
|||
#endif
|
||||
// End General preferences
|
||||
|
||||
auto session = BitTorrent::Session::instance();
|
||||
|
||||
// Downloads preferences
|
||||
pref->setSavePath(getSavePath());
|
||||
pref->setTempPathEnabled(isTempPathEnabled());
|
||||
pref->setTempPath(getTempPath());
|
||||
pref->setAppendTorrentLabel(checkAppendLabel->isChecked());
|
||||
session->setDefaultSavePath(Utils::Fs::expandPathAbs(textSavePath->text()));
|
||||
session->setSubcategoriesEnabled(radioBtnEnableSubcategories->isChecked());
|
||||
session->setASMDisabledByDefault(radioBtnSimpleMode->isChecked());
|
||||
session->setDisableASMWhenCategoryChanged(radioBtnDisableASMOnCategoryChanged->isChecked());
|
||||
session->setDisableASMWhenCategorySavePathChanged(radioBtnDisableASMOnCategorySavePathChanged->isChecked());
|
||||
session->setDisableASMWhenDefaultSavePathChanged(radioBtnDisableASMOnDefaultSavePathChanged->isChecked());
|
||||
session->setTempPathEnabled(checkTempFolder->isChecked());
|
||||
session->setTempPath(Utils::Fs::expandPathAbs(textTempPath->text()));
|
||||
pref->useIncompleteFilesExtension(checkAppendqB->isChecked());
|
||||
pref->preAllocateAllFiles(preAllocateAllFiles());
|
||||
pref->useAdditionDialog(useAdditionDialog());
|
||||
pref->additionDialogFront(checkAdditionDialogFront->isChecked());
|
||||
pref->addTorrentsInPause(addTorrentsInPause());
|
||||
AddNewTorrentDialog::setEnabled(useAdditionDialog());
|
||||
AddNewTorrentDialog::setTopLevel(checkAdditionDialogFront->isChecked());
|
||||
session->setAddTorrentPaused(addTorrentsInPause());
|
||||
ScanFoldersModel::instance()->removeFromFSWatcher(removedScanDirs);
|
||||
ScanFoldersModel::instance()->addToFSWatcher(addedScanDirs);
|
||||
ScanFoldersModel::instance()->makePersistent();
|
||||
|
@ -500,7 +511,7 @@ void options_imp::saveOptions()
|
|||
pref->setAddTrackersEnabled(checkEnableAddTrackers->isChecked());
|
||||
pref->setTrackersList(textTrackers->toPlainText());
|
||||
pref->setGlobalMaxRatio(getMaxRatio());
|
||||
pref->setMaxRatioAction(static_cast<MaxRatioAction>(comboRatioLimitAct->currentIndex()));
|
||||
session->setMaxRatioAction(static_cast<MaxRatioAction>(comboRatioLimitAct->currentIndex()));
|
||||
// End Bittorrent preferences
|
||||
// Misc preferences
|
||||
// * IPFilter
|
||||
|
@ -610,18 +621,21 @@ void options_imp::loadOptions()
|
|||
#endif
|
||||
// End General preferences
|
||||
|
||||
// Downloads preferences
|
||||
checkAdditionDialog->setChecked(pref->useAdditionDialog());
|
||||
checkAdditionDialogFront->setChecked(pref->additionDialogFront());
|
||||
checkStartPaused->setChecked(pref->addTorrentsInPause());
|
||||
auto session = BitTorrent::Session::instance();
|
||||
|
||||
textSavePath->setText(Utils::Fs::toNativePath(pref->getSavePath()));
|
||||
if (pref->isTempPathEnabled())
|
||||
checkTempFolder->setChecked(true);
|
||||
else
|
||||
checkTempFolder->setChecked(false);
|
||||
textTempPath->setText(Utils::Fs::toNativePath(pref->getTempPath()));
|
||||
checkAppendLabel->setChecked(pref->appendTorrentLabel());
|
||||
// Downloads preferences
|
||||
checkAdditionDialog->setChecked(AddNewTorrentDialog::isEnabled());
|
||||
checkAdditionDialogFront->setChecked(AddNewTorrentDialog::isTopLevel());
|
||||
checkStartPaused->setChecked(session->isAddTorrentPaused());
|
||||
|
||||
textSavePath->setText(Utils::Fs::toNativePath(session->defaultSavePath()));
|
||||
(session->isSubcategoriesEnabled() ? radioBtnEnableSubcategories : radioBtnDisableSubcategories)->setChecked(true);
|
||||
(session->isASMDisabledByDefault() ? radioBtnSimpleMode : radioBtnAdvancedMode)->setChecked(true);
|
||||
(session->isDisableASMWhenCategoryChanged() ? radioBtnDisableASMOnCategoryChanged : radioBtnRelocateOnCategoryChanged)->setChecked(true);
|
||||
(session->isDisableASMWhenCategorySavePathChanged() ? radioBtnDisableASMOnCategorySavePathChanged : radioBtnRelocateOnCategorySavePathChanged)->setChecked(true);
|
||||
(session->isDisableASMWhenDefaultSavePathChanged() ? radioBtnDisableASMOnDefaultSavePathChanged : radioBtnRelocateOnDefaultSavePathChanged)->setChecked(true);
|
||||
checkTempFolder->setChecked(session->isTempPathEnabled());
|
||||
textTempPath->setText(Utils::Fs::toNativePath(session->tempPath()));
|
||||
checkAppendqB->setChecked(pref->useIncompleteFilesExtension());
|
||||
checkPreallocateAll->setChecked(pref->preAllocateAllFiles());
|
||||
|
||||
|
@ -844,7 +858,7 @@ void options_imp::loadOptions()
|
|||
spinMaxRatio->setEnabled(false);
|
||||
comboRatioLimitAct->setEnabled(false);
|
||||
}
|
||||
comboRatioLimitAct->setCurrentIndex(static_cast<int>(pref->getMaxRatioAction()));
|
||||
comboRatioLimitAct->setCurrentIndex(session->maxRatioAction());
|
||||
// End Bittorrent preferences
|
||||
|
||||
// Web UI preferences
|
||||
|
@ -974,26 +988,6 @@ qreal options_imp::getMaxRatio() const
|
|||
return -1;
|
||||
}
|
||||
|
||||
// Return Save Path
|
||||
QString options_imp::getSavePath() const
|
||||
{
|
||||
if (textSavePath->text().trimmed().isEmpty()) {
|
||||
QString save_path = Preferences::instance()->getSavePath();
|
||||
textSavePath->setText(Utils::Fs::toNativePath(save_path));
|
||||
}
|
||||
return Utils::Fs::expandPathAbs(textSavePath->text());
|
||||
}
|
||||
|
||||
QString options_imp::getTempPath() const
|
||||
{
|
||||
return Utils::Fs::expandPathAbs(textTempPath->text());
|
||||
}
|
||||
|
||||
bool options_imp::isTempPathEnabled() const
|
||||
{
|
||||
return checkTempFolder->isChecked();
|
||||
}
|
||||
|
||||
// Return max connections number
|
||||
int options_imp::getMaxConnecs() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue