Browse Source

- Fix new settings not being saved

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
04e008afa0
  1. 1
      src/bittorrent.cpp
  2. 4
      src/options_imp.cpp
  3. 6
      src/torrentpersistentdata.h
  4. 30
      src/ui/options.ui

1
src/bittorrent.cpp

@ -1794,6 +1794,7 @@ QString Bittorrent::getSavePath(QString hash) {
if(savePath.isEmpty()) if(savePath.isEmpty())
savePath = defaultSavePath; savePath = defaultSavePath;
if(appendLabelToSavePath) { if(appendLabelToSavePath) {
qDebug("appendLabelToSavePath is true");
QString label = TorrentTempData::getLabel(hash); QString label = TorrentTempData::getLabel(hash);
if(!label.isEmpty()) { if(!label.isEmpty()) {
QDir save_dir(savePath); QDir save_dir(savePath);

4
src/options_imp.cpp

@ -148,8 +148,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
// Downloads tab // Downloads tab
connect(checkTempFolder, SIGNAL(toggled(bool)), this, SLOT(enableTempPathInput(bool))); connect(checkTempFolder, SIGNAL(toggled(bool)), this, SLOT(enableTempPathInput(bool)));
connect(checkScanDir, SIGNAL(toggled(bool)), this, SLOT(enableDirScan(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(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(toggled(bool)), 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())); connect(checkNoSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
// Downloads tab // Downloads tab
connect(textSavePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); 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(checkPreallocateAll, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(spinCache, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); connect(spinCache, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkAdditionDialog, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkAdditionDialog, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));

6
src/torrentpersistentdata.h

@ -91,6 +91,7 @@ public:
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
QHash<QString, QVariant> all_data = settings.value("torrents-tmp", QHash<QString, QVariant>()).toHash(); QHash<QString, QVariant> all_data = settings.value("torrents-tmp", QHash<QString, QVariant>()).toHash();
QHash<QString, QVariant> data = all_data[hash].toHash(); QHash<QString, QVariant> data = all_data[hash].toHash();
qDebug("Saving label %s to tmp data", label.toLocal8Bit().data());
data["label"] = label; data["label"] = label;
all_data[hash] = data; all_data[hash] = data;
settings.setValue("torrents-tmp", all_data); settings.setValue("torrents-tmp", all_data);
@ -149,9 +150,8 @@ public:
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
QHash<QString, QVariant> all_data = settings.value("torrents-tmp", QHash<QString, QVariant>()).toHash(); QHash<QString, QVariant> all_data = settings.value("torrents-tmp", QHash<QString, QVariant>()).toHash();
QHash<QString, QVariant> data = all_data[hash].toHash(); QHash<QString, QVariant> data = all_data[hash].toHash();
if(data.contains("label")) qDebug("Got label %s from tmp data", data.value("label", "").toString().toLocal8Bit().data());
return data["label"].toString(); return data.value("label", "").toString();
return "";
} }
static std::vector<int> getFilesPriority(QString hash) { static std::vector<int> getFilesPriority(QString hash) {

30
src/ui/options.ui

@ -236,7 +236,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>620</width> <width>620</width>
<height>490</height> <height>495</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_16"> <layout class="QVBoxLayout" name="verticalLayout_16">
@ -638,8 +638,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>642</width> <width>644</width>
<height>515</height> <height>504</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_17"> <layout class="QVBoxLayout" name="verticalLayout_17">
@ -1132,8 +1132,8 @@ QGroupBox {
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>602</width> <width>451</width>
<height>513</height> <height>505</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_18"> <layout class="QVBoxLayout" name="verticalLayout_18">
@ -1553,8 +1553,8 @@ QGroupBox {
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>468</width> <width>466</width>
<height>376</height> <height>368</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_19"> <layout class="QVBoxLayout" name="verticalLayout_19">
@ -1864,8 +1864,8 @@ QGroupBox {
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>363</width> <width>370</width>
<height>424</height> <height>428</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_20"> <layout class="QVBoxLayout" name="verticalLayout_20">
@ -2364,8 +2364,8 @@ QGroupBox {
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>226</width> <width>228</width>
<height>123</height> <height>124</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_21"> <layout class="QVBoxLayout" name="verticalLayout_21">
@ -2461,8 +2461,8 @@ QGroupBox {
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>620</width> <width>219</width>
<height>490</height> <height>221</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_23"> <layout class="QVBoxLayout" name="verticalLayout_23">
@ -2625,8 +2625,8 @@ QGroupBox {
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>620</width> <width>452</width>
<height>490</height> <height>192</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_24"> <layout class="QVBoxLayout" name="verticalLayout_24">

Loading…
Cancel
Save