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) { @@ -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);

4
src/options_imp.cpp

@ -148,8 +148,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -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){ @@ -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()));

6
src/torrentpersistentdata.h

@ -91,6 +91,7 @@ public: @@ -91,6 +91,7 @@ public:
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> 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: @@ -149,9 +150,8 @@ public:
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> 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<int> getFilesPriority(QString hash) {

30
src/ui/options.ui

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

Loading…
Cancel
Save