|
|
@ -376,17 +376,9 @@ void options_imp::saveOptions() { |
|
|
|
// End General preferences
|
|
|
|
// End General preferences
|
|
|
|
|
|
|
|
|
|
|
|
// Downloads preferences
|
|
|
|
// Downloads preferences
|
|
|
|
QString save_path = getSavePath(); |
|
|
|
pref.setSavePath(getSavePath()); |
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
|
|
|
|
save_path.replace("\\", "/"); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
pref.setSavePath(save_path); |
|
|
|
|
|
|
|
pref.setTempPathEnabled(isTempPathEnabled()); |
|
|
|
pref.setTempPathEnabled(isTempPathEnabled()); |
|
|
|
QString temp_path = getTempPath(); |
|
|
|
pref.setTempPath(getTempPath()); |
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
|
|
|
|
temp_path.replace("\\", "/"); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
pref.setTempPath(temp_path); |
|
|
|
|
|
|
|
pref.setAppendTorrentLabel(checkAppendLabel->isChecked()); |
|
|
|
pref.setAppendTorrentLabel(checkAppendLabel->isChecked()); |
|
|
|
pref.useIncompleteFilesExtension(checkAppendqB->isChecked()); |
|
|
|
pref.useIncompleteFilesExtension(checkAppendqB->isChecked()); |
|
|
|
pref.preAllocateAllFiles(preAllocateAllFiles()); |
|
|
|
pref.preAllocateAllFiles(preAllocateAllFiles()); |
|
|
@ -395,14 +387,8 @@ void options_imp::saveOptions() { |
|
|
|
pref.addTorrentsInPause(addTorrentsInPause()); |
|
|
|
pref.addTorrentsInPause(addTorrentsInPause()); |
|
|
|
ScanFoldersModel::instance()->makePersistent(); |
|
|
|
ScanFoldersModel::instance()->makePersistent(); |
|
|
|
addedScanDirs.clear(); |
|
|
|
addedScanDirs.clear(); |
|
|
|
QString export_dir = getTorrentExportDir(); |
|
|
|
pref.setTorrentExportDir(getTorrentExportDir()); |
|
|
|
QString export_dir_fin = getFinishedTorrentExportDir(); |
|
|
|
pref.setFinishedTorrentExportDir(getFinishedTorrentExportDir()); |
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
|
|
|
|
export_dir_fin.replace("\\", "/"); |
|
|
|
|
|
|
|
export_dir.replace("\\", "/"); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
pref.setTorrentExportDir(export_dir); |
|
|
|
|
|
|
|
pref.setFinishedTorrentExportDir(export_dir_fin); |
|
|
|
|
|
|
|
pref.setMailNotificationEnabled(groupMailNotification->isChecked()); |
|
|
|
pref.setMailNotificationEnabled(groupMailNotification->isChecked()); |
|
|
|
pref.setMailNotificationEmail(dest_email_txt->text()); |
|
|
|
pref.setMailNotificationEmail(dest_email_txt->text()); |
|
|
|
pref.setMailNotificationSMTP(smtp_server_txt->text()); |
|
|
|
pref.setMailNotificationSMTP(smtp_server_txt->text()); |
|
|
@ -457,13 +443,8 @@ void options_imp::saveOptions() { |
|
|
|
// Misc preferences
|
|
|
|
// Misc preferences
|
|
|
|
// * IPFilter
|
|
|
|
// * IPFilter
|
|
|
|
pref.setFilteringEnabled(isFilteringEnabled()); |
|
|
|
pref.setFilteringEnabled(isFilteringEnabled()); |
|
|
|
if (isFilteringEnabled()) { |
|
|
|
if (isFilteringEnabled()) |
|
|
|
QString filter_path = textFilterPath->text(); |
|
|
|
pref.setFilter(textFilterPath->text()); |
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
|
|
|
|
filter_path.replace("\\", "/"); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
pref.setFilter(filter_path); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// End IPFilter preferences
|
|
|
|
// End IPFilter preferences
|
|
|
|
// Queueing system
|
|
|
|
// Queueing system
|
|
|
|
pref.setQueueingSystemEnabled(isQueueingSystemEnabled()); |
|
|
|
pref.setQueueingSystemEnabled(isQueueingSystemEnabled()); |
|
|
@ -551,22 +532,14 @@ void options_imp::loadOptions() { |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
// End General preferences
|
|
|
|
// End General preferences
|
|
|
|
// Downloads preferences
|
|
|
|
// Downloads preferences
|
|
|
|
QString save_path = pref.getSavePath(); |
|
|
|
textSavePath->setText(fsutils::toNativePath(pref.getSavePath())); |
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
|
|
|
|
save_path.replace("/", "\\"); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
textSavePath->setText(save_path); |
|
|
|
|
|
|
|
if (pref.isTempPathEnabled()) { |
|
|
|
if (pref.isTempPathEnabled()) { |
|
|
|
// enable
|
|
|
|
// enable
|
|
|
|
checkTempFolder->setChecked(true); |
|
|
|
checkTempFolder->setChecked(true); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
checkTempFolder->setChecked(false); |
|
|
|
checkTempFolder->setChecked(false); |
|
|
|
} |
|
|
|
} |
|
|
|
QString temp_path = pref.getTempPath(); |
|
|
|
textTempPath->setText(fsutils::toNativePath(pref.getTempPath())); |
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
|
|
|
|
temp_path.replace("/", "\\"); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
textTempPath->setText(temp_path); |
|
|
|
|
|
|
|
checkAppendLabel->setChecked(pref.appendTorrentLabel()); |
|
|
|
checkAppendLabel->setChecked(pref.appendTorrentLabel()); |
|
|
|
checkAppendqB->setChecked(pref.useIncompleteFilesExtension()); |
|
|
|
checkAppendqB->setChecked(pref.useIncompleteFilesExtension()); |
|
|
|
checkPreallocateAll->setChecked(pref.preAllocateAllFiles()); |
|
|
|
checkPreallocateAll->setChecked(pref.preAllocateAllFiles()); |
|
|
@ -574,29 +547,22 @@ void options_imp::loadOptions() { |
|
|
|
checkAdditionDialogFront->setChecked(pref.AdditionDialogFront()); |
|
|
|
checkAdditionDialogFront->setChecked(pref.AdditionDialogFront()); |
|
|
|
checkStartPaused->setChecked(pref.addTorrentsInPause()); |
|
|
|
checkStartPaused->setChecked(pref.addTorrentsInPause()); |
|
|
|
|
|
|
|
|
|
|
|
strValue = pref.getTorrentExportDir(); |
|
|
|
strValue = fsutils::toNativePath(pref.getTorrentExportDir()); |
|
|
|
if (strValue.isEmpty()) { |
|
|
|
if (strValue.isEmpty()) { |
|
|
|
// Disable
|
|
|
|
// Disable
|
|
|
|
checkExportDir->setChecked(false); |
|
|
|
checkExportDir->setChecked(false); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// enable
|
|
|
|
// enable
|
|
|
|
checkExportDir->setChecked(true); |
|
|
|
|
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
|
|
|
|
strValue.replace("/", "\\"); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
textExportDir->setText(strValue); |
|
|
|
textExportDir->setText(strValue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
strValue = pref.getFinishedTorrentExportDir(); |
|
|
|
strValue = fsutils::toNativePath(pref.getFinishedTorrentExportDir()); |
|
|
|
if (strValue.isEmpty()) { |
|
|
|
if (strValue.isEmpty()) { |
|
|
|
// Disable
|
|
|
|
// Disable
|
|
|
|
checkExportDirFin->setChecked(false); |
|
|
|
checkExportDirFin->setChecked(false); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// enable
|
|
|
|
// enable
|
|
|
|
checkExportDirFin->setChecked(true); |
|
|
|
checkExportDirFin->setChecked(true); |
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
|
|
|
|
strValue.replace("/", "\\"); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
textExportDirFin->setText(strValue); |
|
|
|
textExportDirFin->setText(strValue); |
|
|
|
} |
|
|
|
} |
|
|
|
groupMailNotification->setChecked(pref.isMailNotificationEnabled()); |
|
|
|
groupMailNotification->setChecked(pref.isMailNotificationEnabled()); |
|
|
@ -756,7 +722,7 @@ void options_imp::loadOptions() { |
|
|
|
// Misc preferences
|
|
|
|
// Misc preferences
|
|
|
|
// * IP Filter
|
|
|
|
// * IP Filter
|
|
|
|
checkIPFilter->setChecked(pref.isFilteringEnabled()); |
|
|
|
checkIPFilter->setChecked(pref.isFilteringEnabled()); |
|
|
|
textFilterPath->setText(pref.getFilter()); |
|
|
|
textFilterPath->setText(fsutils::toNativePath(pref.getFilter())); |
|
|
|
// End IP Filter
|
|
|
|
// End IP Filter
|
|
|
|
// Queueing system preferences
|
|
|
|
// Queueing system preferences
|
|
|
|
checkEnableQueueing->setChecked(pref.isQueueingSystemEnabled()); |
|
|
|
checkEnableQueueing->setChecked(pref.isQueueingSystemEnabled()); |
|
|
@ -875,16 +841,13 @@ qreal options_imp::getMaxRatio() const { |
|
|
|
QString options_imp::getSavePath() const { |
|
|
|
QString options_imp::getSavePath() const { |
|
|
|
if (textSavePath->text().trimmed().isEmpty()) { |
|
|
|
if (textSavePath->text().trimmed().isEmpty()) { |
|
|
|
QString save_path = Preferences().getSavePath(); |
|
|
|
QString save_path = Preferences().getSavePath(); |
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
textSavePath->setText(fsutils::toNativePath(save_path)); |
|
|
|
save_path.replace("/", "\\"); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
textSavePath->setText(save_path); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return fsutils::expandPath(textSavePath->text()); |
|
|
|
return fsutils::expandPathAbs(textSavePath->text()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString options_imp::getTempPath() const { |
|
|
|
QString options_imp::getTempPath() const { |
|
|
|
return fsutils::expandPath(textTempPath->text()); |
|
|
|
return fsutils::expandPathAbs(textTempPath->text()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool options_imp::isTempPathEnabled() const { |
|
|
|
bool options_imp::isTempPathEnabled() const { |
|
|
@ -1068,13 +1031,13 @@ void options_imp::setLocale(const QString &localeStr) { |
|
|
|
|
|
|
|
|
|
|
|
QString options_imp::getTorrentExportDir() const { |
|
|
|
QString options_imp::getTorrentExportDir() const { |
|
|
|
if (checkExportDir->isChecked()) |
|
|
|
if (checkExportDir->isChecked()) |
|
|
|
return fsutils::expandPath(textExportDir->text()); |
|
|
|
return fsutils::expandPathAbs(textExportDir->text()); |
|
|
|
return QString(); |
|
|
|
return QString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString options_imp::getFinishedTorrentExportDir() const { |
|
|
|
QString options_imp::getFinishedTorrentExportDir() const { |
|
|
|
if (checkExportDirFin->isChecked()) |
|
|
|
if (checkExportDirFin->isChecked()) |
|
|
|
return fsutils::expandPath(textExportDirFin->text()); |
|
|
|
return fsutils::expandPathAbs(textExportDirFin->text()); |
|
|
|
return QString(); |
|
|
|
return QString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1133,7 +1096,7 @@ void options_imp::handleScanFolderViewSelectionChanged() { |
|
|
|
|
|
|
|
|
|
|
|
QString options_imp::askForExportDir(const QString& currentExportPath) |
|
|
|
QString options_imp::askForExportDir(const QString& currentExportPath) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QDir currentExportDir(fsutils::expandPath(currentExportPath)); |
|
|
|
QDir currentExportDir(fsutils::expandPathAbs(currentExportPath)); |
|
|
|
QString dir; |
|
|
|
QString dir; |
|
|
|
if (!currentExportPath.isEmpty() && currentExportDir.exists()) { |
|
|
|
if (!currentExportPath.isEmpty() && currentExportDir.exists()) { |
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose export directory"), currentExportDir.absolutePath()); |
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose export directory"), currentExportDir.absolutePath()); |
|
|
@ -1156,7 +1119,7 @@ void options_imp::on_browseExportDirFinButton_clicked() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void options_imp::on_browseFilterButton_clicked() { |
|
|
|
void options_imp::on_browseFilterButton_clicked() { |
|
|
|
const QString filter_path = fsutils::expandPath(textFilterPath->text()); |
|
|
|
const QString filter_path = fsutils::expandPathAbs(textFilterPath->text()); |
|
|
|
QDir filterDir(filter_path); |
|
|
|
QDir filterDir(filter_path); |
|
|
|
QString ipfilter; |
|
|
|
QString ipfilter; |
|
|
|
if (!filter_path.isEmpty() && filterDir.exists()) { |
|
|
|
if (!filter_path.isEmpty() && filterDir.exists()) { |
|
|
@ -1164,17 +1127,13 @@ void options_imp::on_browseFilterButton_clicked() { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ipfilter = QFileDialog::getOpenFileName(this, tr("Choose an ip filter file"), QDir::homePath(), tr("Filters")+QString(" (*.dat *.p2p *.p2b)")); |
|
|
|
ipfilter = QFileDialog::getOpenFileName(this, tr("Choose an ip filter file"), QDir::homePath(), tr("Filters")+QString(" (*.dat *.p2p *.p2b)")); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!ipfilter.isNull()) { |
|
|
|
if (!ipfilter.isNull()) |
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
textFilterPath->setText(fsutils::toNativePath(ipfilter)); |
|
|
|
ipfilter.replace("/", "\\"); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
textFilterPath->setText(ipfilter); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Display dialog to choose save dir
|
|
|
|
// Display dialog to choose save dir
|
|
|
|
void options_imp::on_browseSaveDirButton_clicked() { |
|
|
|
void options_imp::on_browseSaveDirButton_clicked() { |
|
|
|
const QString save_path = fsutils::expandPath(textSavePath->text()); |
|
|
|
const QString save_path = fsutils::expandPathAbs(textSavePath->text()); |
|
|
|
QDir saveDir(save_path); |
|
|
|
QDir saveDir(save_path); |
|
|
|
QString dir; |
|
|
|
QString dir; |
|
|
|
if (!save_path.isEmpty() && saveDir.exists()) { |
|
|
|
if (!save_path.isEmpty() && saveDir.exists()) { |
|
|
@ -1182,16 +1141,12 @@ void options_imp::on_browseSaveDirButton_clicked() { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), QDir::homePath()); |
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), QDir::homePath()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!dir.isNull()) { |
|
|
|
if (!dir.isNull()) |
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
textSavePath->setText(fsutils::toNativePath(dir)); |
|
|
|
dir.replace("/", "\\"); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
textSavePath->setText(dir); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void options_imp::on_browseTempDirButton_clicked() { |
|
|
|
void options_imp::on_browseTempDirButton_clicked() { |
|
|
|
const QString temp_path = fsutils::expandPath(textTempPath->text()); |
|
|
|
const QString temp_path = fsutils::expandPathAbs(textTempPath->text()); |
|
|
|
QDir tempDir(temp_path); |
|
|
|
QDir tempDir(temp_path); |
|
|
|
QString dir; |
|
|
|
QString dir; |
|
|
|
if (!temp_path.isEmpty() && tempDir.exists()) { |
|
|
|
if (!temp_path.isEmpty() && tempDir.exists()) { |
|
|
@ -1199,17 +1154,13 @@ void options_imp::on_browseTempDirButton_clicked() { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), QDir::homePath()); |
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), QDir::homePath()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!dir.isNull()) { |
|
|
|
if (!dir.isNull()) |
|
|
|
#if defined(Q_WS_WIN) || defined(Q_OS_OS2) |
|
|
|
textTempPath->setText(fsutils::toNativePath(dir)); |
|
|
|
dir.replace("/", "\\"); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
textTempPath->setText(dir); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Return Filter object to apply to BT session
|
|
|
|
// Return Filter object to apply to BT session
|
|
|
|
QString options_imp::getFilter() const { |
|
|
|
QString options_imp::getFilter() const { |
|
|
|
return textFilterPath->text(); |
|
|
|
return fsutils::fromNativePath(textFilterPath->text()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Web UI
|
|
|
|
// Web UI
|
|
|
|