Browse Source

Several dimension saving fixes

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
45f0383ee2
  1. 9
      src/torrentadditiondlg.cpp
  2. 3
      src/torrentadditiondlg.h
  3. 22
      src/torrentcreator/torrentcreatordlg.cpp
  4. 7
      src/torrentcreator/torrentcreatordlg.h
  5. 15
      src/torrentimportdlg.cpp
  6. 3
      src/torrentimportdlg.h

9
src/torrentadditiondlg.cpp

@ -38,6 +38,7 @@
#include <QApplication> #include <QApplication>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QInputDialog> #include <QInputDialog>
#include <QDebug>
#include <libtorrent/version.hpp> #include <libtorrent/version.hpp>
#include <libtorrent/session.hpp> #include <libtorrent/session.hpp>
@ -112,11 +113,17 @@ torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) :
} }
torrentAdditionDialog::~torrentAdditionDialog() { torrentAdditionDialog::~torrentAdditionDialog() {
saveSettings();
delete PropDelegate; delete PropDelegate;
delete PropListModel; delete PropListModel;
} }
void torrentAdditionDialog::closeEvent(QCloseEvent *event)
{
qDebug() << Q_FUNC_INFO;
saveSettings();
QDialog::closeEvent(event);
}
void torrentAdditionDialog::readSettings() { void torrentAdditionDialog::readSettings() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
restoreGeometry(settings.value("TorrentAdditionDlg/dimensions").toByteArray()); restoreGeometry(settings.value("TorrentAdditionDlg/dimensions").toByteArray());

3
src/torrentadditiondlg.h

@ -71,6 +71,9 @@ public slots:
void updateSavePathCurrentText(); void updateSavePathCurrentText();
void resetComboLabelIndex(QString text); void resetComboLabelIndex(QString text);
protected:
void closeEvent(QCloseEvent *event);
private: private:
QString fileName; QString fileName;
QString hash; QString hash;

22
src/torrentcreator/torrentcreatordlg.cpp

@ -51,6 +51,7 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent): QDialog(parent), creatorT
loadTrackerList(); loadTrackerList();
// Piece sizes // Piece sizes
m_piece_sizes << 32 << 64 << 128 << 256 << 512 << 1024 << 2048 << 4096; m_piece_sizes << 32 << 64 << 128 << 256 << 512 << 1024 << 2048 << 4096;
loadSettings();
show(); show();
} }
@ -182,7 +183,7 @@ void TorrentCreatorDlg::on_cancelButton_clicked() {
creatorThread->wait(); creatorThread->wait();
} }
// Close the dialog // Close the dialog
reject(); close();
} }
void TorrentCreatorDlg::updateProgressBar(int progress) { void TorrentCreatorDlg::updateProgressBar(int progress) {
@ -255,3 +256,22 @@ void TorrentCreatorDlg::loadTrackerList()
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
trackers_list->setPlainText(settings.value("CreateTorrent/TrackerList", "").toString()); trackers_list->setPlainText(settings.value("CreateTorrent/TrackerList", "").toString());
} }
void TorrentCreatorDlg::saveSettings()
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
settings.setValue("CreateTorrent/dimensions", saveGeometry());
}
void TorrentCreatorDlg::loadSettings()
{
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
restoreGeometry(settings.value("CreateTorrent/dimensions").toByteArray());
}
void TorrentCreatorDlg::closeEvent(QCloseEvent *event)
{
qDebug() << Q_FUNC_INFO;
saveSettings();
QDialog::closeEvent(event);
}

7
src/torrentcreator/torrentcreatordlg.h

@ -63,6 +63,13 @@ class TorrentCreatorDlg : public QDialog, private Ui::createTorrentDialog{
void saveTrackerList(); void saveTrackerList();
void loadTrackerList(); void loadTrackerList();
protected:
void closeEvent(QCloseEvent *event);
private:
void saveSettings();
void loadSettings();
private: private:
TorrentCreatorThread *creatorThread; TorrentCreatorThread *creatorThread;
QList<int> m_piece_sizes; QList<int> m_piece_sizes;

15
src/torrentimportdlg.cpp

@ -30,6 +30,7 @@
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include <QDebug>
#include "torrentimportdlg.h" #include "torrentimportdlg.h"
#include "ui_torrentimportdlg.h" #include "ui_torrentimportdlg.h"
@ -54,7 +55,6 @@ TorrentImportDlg::TorrentImportDlg(QWidget *parent) :
TorrentImportDlg::~TorrentImportDlg() TorrentImportDlg::~TorrentImportDlg()
{ {
saveSettings();
delete ui; delete ui;
} }
@ -180,7 +180,7 @@ void TorrentImportDlg::on_browseContentBtn_clicked()
void TorrentImportDlg::on_importBtn_clicked() void TorrentImportDlg::on_importBtn_clicked()
{ {
accept(); close();
} }
QString TorrentImportDlg::getTorrentPath() const QString TorrentImportDlg::getTorrentPath() const
@ -283,11 +283,18 @@ bool TorrentImportDlg::skipFileChecking() const
void TorrentImportDlg::loadSettings() void TorrentImportDlg::loadSettings()
{ {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
settings.setValue("TorrentImportDlg/dimensions", saveGeometry()); restoreGeometry(settings.value("TorrentImportDlg/dimensions").toByteArray());
} }
void TorrentImportDlg::saveSettings() void TorrentImportDlg::saveSettings()
{ {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
restoreGeometry(settings.value("TorrentImportDlg/dimensions").toByteArray()); settings.setValue("TorrentImportDlg/dimensions", saveGeometry());
}
void TorrentImportDlg::closeEvent(QCloseEvent *event)
{
qDebug() << Q_FUNC_INFO;
saveSettings();
QDialog::closeEvent(event);
} }

3
src/torrentimportdlg.h

@ -69,6 +69,9 @@ private slots:
void on_importBtn_clicked(); void on_importBtn_clicked();
protected:
void closeEvent(QCloseEvent *event);
private: private:
void loadSettings(); void loadSettings();
void saveSettings(); void saveSettings();

Loading…
Cancel
Save