diff --git a/src/options.ui b/src/options.ui index b569c522e..d26400af0 100644 --- a/src/options.ui +++ b/src/options.ui @@ -200,7 +200,7 @@ - 0 + 1 @@ -663,14 +663,14 @@ - + Temp folder: - + false @@ -693,6 +693,12 @@ 22 + + + 25 + 27 + + :/Icons/oxygen/browse.png:/Icons/oxygen/browse.png diff --git a/src/options_imp.cpp b/src/options_imp.cpp index 0cdb26613..d18251859 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -129,9 +129,11 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ // General tab connect(checkNoSystray, SIGNAL(stateChanged(int)), this, SLOT(setSystrayOptionsState(int))); // Downloads tab + connect(checkTempFolder, SIGNAL(stateChanged(int)), this, SLOT(enableTempPathInput(int))); connect(checkScanDir, SIGNAL(stateChanged(int)), this, SLOT(enableDirScan(int))); connect(actionTorrentDlOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); connect(actionTorrentFnOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); + connect(checkTempFolder, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); // Connection tab connect(checkUploadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableUploadLimit(int))); connect(checkDownloadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableDownloadLimit(int))); @@ -305,6 +307,8 @@ void options_imp::saveOptions(){ // Downloads preferences settings.beginGroup("Downloads"); settings.setValue(QString::fromUtf8("SavePath"), getSavePath()); + settings.setValue(QString::fromUtf8("TempPathEnabled"), isTempPathEnabled()); + settings.setValue(QString::fromUtf8("TempPath"), getTempPath()); settings.setValue(QString::fromUtf8("PreAllocation"), preAllocateAllFiles()); settings.setValue(QString::fromUtf8("AdditionDialog"), useAdditionDialog()); settings.setValue(QString::fromUtf8("StartInPause"), addTorrentsInPause()); @@ -509,6 +513,13 @@ void options_imp::loadOptions(){ home += QDir::separator(); } textSavePath->setText(settings.value(QString::fromUtf8("SavePath"), home+"qBT_dir").toString()); + if(settings.value(QString::fromUtf8("TempPathEnabled"), false).toBool()) { + // enable + enableTempPathInput(2); + } else { + enableTempPathInput(0); + } + textTempPath->setText(settings.value(QString::fromUtf8("TempPath"), home+"qBT_dir").toString()); checkPreallocateAll->setChecked(settings.value(QString::fromUtf8("PreAllocation"), false).toBool()); checkAdditionDialog->setChecked(settings.value(QString::fromUtf8("AdditionDialog"), true).toBool()); checkStartPaused->setChecked(settings.value(QString::fromUtf8("StartInPause"), false).toBool()); @@ -856,6 +867,14 @@ QString options_imp::getSavePath() const{ return textSavePath->text(); } +QString options_imp::getTempPath() const { + return textTempPath->text(); +} + +bool options_imp::isTempPathEnabled() const { + return checkTempFolder->isChecked(); +} + // Return max connections number int options_imp::getMaxConnecs() const{ if(!checkMaxConnecs->isChecked()){ @@ -912,7 +931,7 @@ void options_imp::on_buttonBox_rejected(){ } void options_imp::enableDownloadLimit(int checkBoxValue){ - if(checkBoxValue!=2){ + if(checkBoxValue != 2){ //Disable spinDownloadLimit->setEnabled(false); }else{ @@ -921,6 +940,18 @@ void options_imp::enableDownloadLimit(int checkBoxValue){ } } +void options_imp::enableTempPathInput(int checkBoxValue){ + if(checkBoxValue != 2){ + //Disable + textTempPath->setEnabled(false); + browseTempDirButton->setEnabled(false); + }else{ + //enable + textTempPath->setEnabled(true); + browseTempDirButton->setEnabled(true); + } +} + bool options_imp::useAdditionDialog() const{ return checkAdditionDialog->isChecked(); } diff --git a/src/options_imp.h b/src/options_imp.h index 305b1fd6f..cc3515513 100644 --- a/src/options_imp.h +++ b/src/options_imp.h @@ -69,6 +69,8 @@ class options_imp : public QDialog, private Ui::Dialog { bool isToolbarDisplayed() const; // Downloads QString getSavePath() const; + bool isTempPathEnabled() const; + QString getTempPath() const; bool preAllocateAllFiles() const; bool useAdditionDialog() const; bool addTorrentsInPause() const; @@ -128,6 +130,7 @@ class options_imp : public QDialog, private Ui::Dialog { protected slots: void enableUploadLimit(int checkBoxValue); void enableDownloadLimit(int checkBoxValue); + void enableTempPathInput(int checkBoxValue); void enableDirScan(int checkBoxValue); void enableProxy(int comboIndex); void enableProxyAuth(int checkBoxValue);