1. In option window add column 'download path' for watched folders and enlarge heigth.

2. Change logic checkbox in column 'download here': if it checked,
   then torrent file will download to watchdir, if state is unchecked,
   will be use download path from next column.
This commit is contained in:
dsimakov 2015-03-18 17:25:25 +04:00 committed by sledgehammer999
parent 84f6a82d98
commit 1f17a7836d
8 changed files with 3519 additions and 11 deletions

View file

@ -63,6 +63,11 @@ QByteArray prefjson::getPreferences()
l << Utils::Fs::toNativePath(s);
}
data["scan_dirs"] = l;
QVariantList l2;
foreach (const QString& s, pref->getDownloadPathsInScanDir()) {
l2 << fsutils::toNativePath(s);
}
data["download_paths"] = l2;
QVariantList var_list;
foreach (bool b, pref->getDownloadInScanDirs()) {
var_list << b;
@ -183,7 +188,7 @@ void prefjson::setPreferences(const QString& json)
pref->preAllocateAllFiles(m["preallocate_all"].toBool());
if (m.contains("incomplete_files_ext"))
pref->useIncompleteFilesExtension(m["incomplete_files_ext"].toBool());
if (m.contains("scan_dirs") && m.contains("download_in_scan_dirs")) {
if (m.contains("scan_dirs") && m.contains("download_in_scan_dirs") && m.contains("download_paths")) {
QVariantList download_at_path_tmp = m["download_in_scan_dirs"].toList();
QList<bool> download_at_path;
foreach (QVariant var, download_at_path_tmp) {
@ -191,9 +196,11 @@ void prefjson::setPreferences(const QString& json)
}
QStringList old_folders = pref->getScanDirs();
QStringList new_folders = m["scan_dirs"].toStringList();
QStringList download_paths = m["download_paths"].toStringList();
if (download_at_path.size() == new_folders.size()) {
pref->setScanDirs(new_folders);
pref->setDownloadInScanDirs(download_at_path);
pref->setDownloadPathsInScanDir(download_paths);
foreach (const QString &old_folder, old_folders) {
// Update deleted folders
if (!new_folders.contains(old_folder)) {
@ -205,7 +212,7 @@ void prefjson::setPreferences(const QString& json)
qDebug("New watched folder: %s", qPrintable(new_folder));
// Update new folders
if (!old_folders.contains(Utils::Fs::fromNativePath(new_folder))) {
ScanFoldersModel::instance()->addPath(new_folder, download_at_path.at(i));
ScanFoldersModel::instance()->addPath(new_folder, download_at_path.at(i), download_paths.at(i));
}
++i;
}