From 04e008afa0f895f65359e09e5c40e930492be99e Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 18 Dec 2009 16:32:26 +0000 Subject: [PATCH] - Fix new settings not being saved --- src/bittorrent.cpp | 1 + src/options_imp.cpp | 4 ++-- src/torrentpersistentdata.h | 6 +++--- src/ui/options.ui | 30 +++++++++++++++--------------- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index bd4e11ef8..58f6b1847 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -1794,6 +1794,7 @@ QString Bittorrent::getSavePath(QString hash) { if(savePath.isEmpty()) savePath = defaultSavePath; if(appendLabelToSavePath) { + qDebug("appendLabelToSavePath is true"); QString label = TorrentTempData::getLabel(hash); if(!label.isEmpty()) { QDir save_dir(savePath); diff --git a/src/options_imp.cpp b/src/options_imp.cpp index e0a4aa235..87d06dd95 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -148,8 +148,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ // Downloads tab connect(checkTempFolder, SIGNAL(toggled(bool)), this, SLOT(enableTempPathInput(bool))); connect(checkScanDir, SIGNAL(toggled(bool)), this, SLOT(enableDirScan(bool))); - connect(checkAppendLabel, SIGNAL(toggled(bool)), this, SLOT(enableDirScan(bool))); - connect(checkAppendqB, SIGNAL(toggled(bool)), this, SLOT(enableDirScan(bool))); connect(actionTorrentDlOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); connect(actionTorrentFnOnDblClBox, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); connect(checkTempFolder, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); @@ -192,6 +190,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ connect(checkNoSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); // Downloads tab connect(textSavePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); + connect(checkAppendLabel, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); + connect(checkAppendqB, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkPreallocateAll, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(spinCache, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); connect(checkAdditionDialog, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); diff --git a/src/torrentpersistentdata.h b/src/torrentpersistentdata.h index 48ec93424..45f537dae 100644 --- a/src/torrentpersistentdata.h +++ b/src/torrentpersistentdata.h @@ -91,6 +91,7 @@ public: QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); QHash all_data = settings.value("torrents-tmp", QHash()).toHash(); QHash data = all_data[hash].toHash(); + qDebug("Saving label %s to tmp data", label.toLocal8Bit().data()); data["label"] = label; all_data[hash] = data; settings.setValue("torrents-tmp", all_data); @@ -149,9 +150,8 @@ public: QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); QHash all_data = settings.value("torrents-tmp", QHash()).toHash(); QHash data = all_data[hash].toHash(); - if(data.contains("label")) - return data["label"].toString(); - return ""; + qDebug("Got label %s from tmp data", data.value("label", "").toString().toLocal8Bit().data()); + return data.value("label", "").toString(); } static std::vector getFilesPriority(QString hash) { diff --git a/src/ui/options.ui b/src/ui/options.ui index 885ee7b14..45113be5a 100644 --- a/src/ui/options.ui +++ b/src/ui/options.ui @@ -236,7 +236,7 @@ 0 0 620 - 490 + 495 @@ -638,8 +638,8 @@ 0 0 - 642 - 515 + 644 + 504 @@ -1132,8 +1132,8 @@ QGroupBox { 0 0 - 602 - 513 + 451 + 505 @@ -1553,8 +1553,8 @@ QGroupBox { 0 0 - 468 - 376 + 466 + 368 @@ -1864,8 +1864,8 @@ QGroupBox { 0 0 - 363 - 424 + 370 + 428 @@ -2364,8 +2364,8 @@ QGroupBox { 0 0 - 226 - 123 + 228 + 124 @@ -2461,8 +2461,8 @@ QGroupBox { 0 0 - 620 - 490 + 219 + 221 @@ -2625,8 +2625,8 @@ QGroupBox { 0 0 - 620 - 490 + 452 + 192