Browse Source

- Still working on temp folder

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
5b7b4b2cf3
  1. 12
      src/options.ui
  2. 33
      src/options_imp.cpp
  3. 3
      src/options_imp.h

12
src/options.ui

@ -200,7 +200,7 @@ @@ -200,7 +200,7 @@
<item>
<widget class="QStackedWidget" name="tabOption">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tabOptionPage1">
<layout class="QVBoxLayout" name="verticalLayout_10">
@ -663,14 +663,14 @@ @@ -663,14 +663,14 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QCheckBox" name="checkBox">
<widget class="QCheckBox" name="checkTempFolder">
<property name="text">
<string>Temp folder:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="tempSavePath">
<widget class="QLineEdit" name="textTempPath">
<property name="enabled">
<bool>false</bool>
</property>
@ -693,6 +693,12 @@ @@ -693,6 +693,12 @@
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>25</width>
<height>27</height>
</size>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/Icons/oxygen/browse.png</normaloff>:/Icons/oxygen/browse.png</iconset>

33
src/options_imp.cpp

@ -129,9 +129,11 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -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(){ @@ -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(){ @@ -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{ @@ -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(){ @@ -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){ @@ -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();
}

3
src/options_imp.h

@ -69,6 +69,8 @@ class options_imp : public QDialog, private Ui::Dialog { @@ -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 { @@ -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);

Loading…
Cancel
Save