|
|
@ -921,11 +921,11 @@ QString options_imp::getSavePath() const{ |
|
|
|
if(textSavePath->text().trimmed().isEmpty()){ |
|
|
|
if(textSavePath->text().trimmed().isEmpty()){ |
|
|
|
textSavePath->setText(home+QString::fromUtf8("qBT_dir")); |
|
|
|
textSavePath->setText(home+QString::fromUtf8("qBT_dir")); |
|
|
|
} |
|
|
|
} |
|
|
|
return textSavePath->text(); |
|
|
|
return misc::expandPath(textSavePath->text()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString options_imp::getTempPath() const { |
|
|
|
QString options_imp::getTempPath() const { |
|
|
|
return textTempPath->text(); |
|
|
|
return misc::expandPath(textTempPath->text()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool options_imp::isTempPathEnabled() const { |
|
|
|
bool options_imp::isTempPathEnabled() const { |
|
|
@ -1310,9 +1310,9 @@ void options_imp::setLocale(QString locale){ |
|
|
|
// Return scan dir set in options
|
|
|
|
// Return scan dir set in options
|
|
|
|
QString options_imp::getScanDir() const { |
|
|
|
QString options_imp::getScanDir() const { |
|
|
|
if(checkScanDir->isChecked()){ |
|
|
|
if(checkScanDir->isChecked()){ |
|
|
|
return textScanDir->text().trimmed(); |
|
|
|
return misc::expandPath(textScanDir->text()); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
return QString(); |
|
|
|
return QString::null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1332,22 +1332,28 @@ int options_imp::getActionOnDblClOnTorrentFn() const { |
|
|
|
|
|
|
|
|
|
|
|
// Display dialog to choose scan dir
|
|
|
|
// Display dialog to choose scan dir
|
|
|
|
void options_imp::on_browseScanDirButton_clicked() { |
|
|
|
void options_imp::on_browseScanDirButton_clicked() { |
|
|
|
#ifdef Q_WS_WIN |
|
|
|
QString scan_path = misc::expandPath(textScanDir->text()); |
|
|
|
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose scan directory"), QDir::rootPath()); |
|
|
|
QDir scanDir(scan_path); |
|
|
|
#else |
|
|
|
QString dir; |
|
|
|
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose scan directory"), QDir::homePath()); |
|
|
|
if(!scan_path.isEmpty() && scanDir.exists()) { |
|
|
|
#endif |
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose scan directory"), scanDir.absolutePath()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose scan directory"), QDir::homePath()); |
|
|
|
|
|
|
|
} |
|
|
|
if(!dir.isNull()){ |
|
|
|
if(!dir.isNull()){ |
|
|
|
textScanDir->setText(dir); |
|
|
|
textScanDir->setText(dir); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void options_imp::on_browseFilterButton_clicked() { |
|
|
|
void options_imp::on_browseFilterButton_clicked() { |
|
|
|
#ifdef Q_WS_WIN |
|
|
|
QString filter_path = misc::expandPath(textFilterPath->text()); |
|
|
|
QString ipfilter = QFileDialog::getOpenFileName(this, tr("Choose an ip filter file"), QDir::rootPath(), tr("Filters")+QString(" (*.dat *.p2p *.p2b)")); |
|
|
|
QDir filterDir(filter_path); |
|
|
|
#else |
|
|
|
QString ipfilter; |
|
|
|
QString ipfilter = QFileDialog::getOpenFileName(this, tr("Choose an ip filter file"), QDir::homePath(), tr("Filters")+QString(" (*.dat *.p2p *.p2b)")); |
|
|
|
if(!filter_path.isEmpty() && filterDir.exists()) { |
|
|
|
#endif |
|
|
|
ipfilter = QFileDialog::getOpenFileName(this, tr("Choose an ip filter file"), filterDir.absolutePath(), tr("Filters")+QString(" (*.dat *.p2p *.p2b)")); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ipfilter = QFileDialog::getOpenFileName(this, tr("Choose an ip filter file"), QDir::homePath(), tr("Filters")+QString(" (*.dat *.p2p *.p2b)")); |
|
|
|
|
|
|
|
} |
|
|
|
if(!ipfilter.isNull()){ |
|
|
|
if(!ipfilter.isNull()){ |
|
|
|
textFilterPath->setText(ipfilter); |
|
|
|
textFilterPath->setText(ipfilter); |
|
|
|
} |
|
|
|
} |
|
|
@ -1355,20 +1361,28 @@ void options_imp::on_browseFilterButton_clicked() { |
|
|
|
|
|
|
|
|
|
|
|
// Display dialog to choose save dir
|
|
|
|
// Display dialog to choose save dir
|
|
|
|
void options_imp::on_browseSaveDirButton_clicked(){ |
|
|
|
void options_imp::on_browseSaveDirButton_clicked(){ |
|
|
|
QString def_path = QDir::homePath(); |
|
|
|
QString save_path = misc::expandPath(textSavePath->text()); |
|
|
|
if(!textSavePath->text().isEmpty()) |
|
|
|
QDir saveDir(save_path); |
|
|
|
def_path = textSavePath->text(); |
|
|
|
QString dir; |
|
|
|
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), def_path); |
|
|
|
if(!save_path.isEmpty() && saveDir.exists()) { |
|
|
|
|
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), saveDir.absolutePath()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), QDir::homePath()); |
|
|
|
|
|
|
|
} |
|
|
|
if(!dir.isNull()){ |
|
|
|
if(!dir.isNull()){ |
|
|
|
textSavePath->setText(dir); |
|
|
|
textSavePath->setText(dir); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void options_imp::on_browseTempDirButton_clicked(){ |
|
|
|
void options_imp::on_browseTempDirButton_clicked(){ |
|
|
|
QString def_path = QDir::homePath(); |
|
|
|
QString temp_path = misc::expandPath(textTempPath->text()); |
|
|
|
if(!textTempPath->text().isEmpty()) |
|
|
|
QDir tempDir(temp_path); |
|
|
|
def_path = textTempPath->text(); |
|
|
|
QString dir; |
|
|
|
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), def_path); |
|
|
|
if(!temp_path.isEmpty() && tempDir.exists()) { |
|
|
|
|
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), tempDir.absolutePath()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), QDir::homePath()); |
|
|
|
|
|
|
|
} |
|
|
|
if(!dir.isNull()){ |
|
|
|
if(!dir.isNull()){ |
|
|
|
textTempPath->setText(dir); |
|
|
|
textTempPath->setText(dir); |
|
|
|
} |
|
|
|
} |
|
|
|