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 @@
<item> <item>
<widget class="QStackedWidget" name="tabOption"> <widget class="QStackedWidget" name="tabOption">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tabOptionPage1"> <widget class="QWidget" name="tabOptionPage1">
<layout class="QVBoxLayout" name="verticalLayout_10"> <layout class="QVBoxLayout" name="verticalLayout_10">
@ -663,14 +663,14 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_7"> <layout class="QHBoxLayout" name="horizontalLayout_7">
<item> <item>
<widget class="QCheckBox" name="checkBox"> <widget class="QCheckBox" name="checkTempFolder">
<property name="text"> <property name="text">
<string>Temp folder:</string> <string>Temp folder:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="tempSavePath"> <widget class="QLineEdit" name="textTempPath">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
@ -693,6 +693,12 @@
<height>22</height> <height>22</height>
</size> </size>
</property> </property>
<property name="maximumSize">
<size>
<width>25</width>
<height>27</height>
</size>
</property>
<property name="icon"> <property name="icon">
<iconset resource="icons.qrc"> <iconset resource="icons.qrc">
<normaloff>:/Icons/oxygen/browse.png</normaloff>:/Icons/oxygen/browse.png</iconset> <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){
// General tab // General tab
connect(checkNoSystray, SIGNAL(stateChanged(int)), this, SLOT(setSystrayOptionsState(int))); connect(checkNoSystray, SIGNAL(stateChanged(int)), this, SLOT(setSystrayOptionsState(int)));
// Downloads tab // Downloads tab
connect(checkTempFolder, SIGNAL(stateChanged(int)), this, SLOT(enableTempPathInput(int)));
connect(checkScanDir, SIGNAL(stateChanged(int)), this, SLOT(enableDirScan(int))); connect(checkScanDir, SIGNAL(stateChanged(int)), this, SLOT(enableDirScan(int)));
connect(actionTorrentDlOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); connect(actionTorrentDlOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(actionTorrentFnOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); connect(actionTorrentFnOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(checkTempFolder, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
// Connection tab // Connection tab
connect(checkUploadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableUploadLimit(int))); connect(checkUploadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableUploadLimit(int)));
connect(checkDownloadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableDownloadLimit(int))); connect(checkDownloadLimit, SIGNAL(stateChanged(int)), this, SLOT(enableDownloadLimit(int)));
@ -305,6 +307,8 @@ void options_imp::saveOptions(){
// Downloads preferences // Downloads preferences
settings.beginGroup("Downloads"); settings.beginGroup("Downloads");
settings.setValue(QString::fromUtf8("SavePath"), getSavePath()); 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("PreAllocation"), preAllocateAllFiles());
settings.setValue(QString::fromUtf8("AdditionDialog"), useAdditionDialog()); settings.setValue(QString::fromUtf8("AdditionDialog"), useAdditionDialog());
settings.setValue(QString::fromUtf8("StartInPause"), addTorrentsInPause()); settings.setValue(QString::fromUtf8("StartInPause"), addTorrentsInPause());
@ -509,6 +513,13 @@ void options_imp::loadOptions(){
home += QDir::separator(); home += QDir::separator();
} }
textSavePath->setText(settings.value(QString::fromUtf8("SavePath"), home+"qBT_dir").toString()); 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()); checkPreallocateAll->setChecked(settings.value(QString::fromUtf8("PreAllocation"), false).toBool());
checkAdditionDialog->setChecked(settings.value(QString::fromUtf8("AdditionDialog"), true).toBool()); checkAdditionDialog->setChecked(settings.value(QString::fromUtf8("AdditionDialog"), true).toBool());
checkStartPaused->setChecked(settings.value(QString::fromUtf8("StartInPause"), false).toBool()); checkStartPaused->setChecked(settings.value(QString::fromUtf8("StartInPause"), false).toBool());
@ -856,6 +867,14 @@ QString options_imp::getSavePath() const{
return textSavePath->text(); return textSavePath->text();
} }
QString options_imp::getTempPath() const {
return textTempPath->text();
}
bool options_imp::isTempPathEnabled() const {
return checkTempFolder->isChecked();
}
// Return max connections number // Return max connections number
int options_imp::getMaxConnecs() const{ int options_imp::getMaxConnecs() const{
if(!checkMaxConnecs->isChecked()){ if(!checkMaxConnecs->isChecked()){
@ -912,7 +931,7 @@ void options_imp::on_buttonBox_rejected(){
} }
void options_imp::enableDownloadLimit(int checkBoxValue){ void options_imp::enableDownloadLimit(int checkBoxValue){
if(checkBoxValue!=2){ if(checkBoxValue != 2){
//Disable //Disable
spinDownloadLimit->setEnabled(false); spinDownloadLimit->setEnabled(false);
}else{ }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{ bool options_imp::useAdditionDialog() const{
return checkAdditionDialog->isChecked(); return checkAdditionDialog->isChecked();
} }

3
src/options_imp.h

@ -69,6 +69,8 @@ class options_imp : public QDialog, private Ui::Dialog {
bool isToolbarDisplayed() const; bool isToolbarDisplayed() const;
// Downloads // Downloads
QString getSavePath() const; QString getSavePath() const;
bool isTempPathEnabled() const;
QString getTempPath() const;
bool preAllocateAllFiles() const; bool preAllocateAllFiles() const;
bool useAdditionDialog() const; bool useAdditionDialog() const;
bool addTorrentsInPause() const; bool addTorrentsInPause() const;
@ -128,6 +130,7 @@ class options_imp : public QDialog, private Ui::Dialog {
protected slots: protected slots:
void enableUploadLimit(int checkBoxValue); void enableUploadLimit(int checkBoxValue);
void enableDownloadLimit(int checkBoxValue); void enableDownloadLimit(int checkBoxValue);
void enableTempPathInput(int checkBoxValue);
void enableDirScan(int checkBoxValue); void enableDirScan(int checkBoxValue);
void enableProxy(int comboIndex); void enableProxy(int comboIndex);
void enableProxyAuth(int checkBoxValue); void enableProxyAuth(int checkBoxValue);

Loading…
Cancel
Save