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

3
src/torrentadditiondlg.h

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

22
src/torrentcreator/torrentcreatordlg.cpp

@ -51,6 +51,7 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent): QDialog(parent), creatorT @@ -51,6 +51,7 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent): QDialog(parent), creatorT
loadTrackerList();
// Piece sizes
m_piece_sizes << 32 << 64 << 128 << 256 << 512 << 1024 << 2048 << 4096;
loadSettings();
show();
}
@ -182,7 +183,7 @@ void TorrentCreatorDlg::on_cancelButton_clicked() { @@ -182,7 +183,7 @@ void TorrentCreatorDlg::on_cancelButton_clicked() {
creatorThread->wait();
}
// Close the dialog
reject();
close();
}
void TorrentCreatorDlg::updateProgressBar(int progress) {
@ -255,3 +256,22 @@ void TorrentCreatorDlg::loadTrackerList() @@ -255,3 +256,22 @@ void TorrentCreatorDlg::loadTrackerList()
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
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{ @@ -63,6 +63,13 @@ class TorrentCreatorDlg : public QDialog, private Ui::createTorrentDialog{
void saveTrackerList();
void loadTrackerList();
protected:
void closeEvent(QCloseEvent *event);
private:
void saveSettings();
void loadSettings();
private:
TorrentCreatorThread *creatorThread;
QList<int> m_piece_sizes;

15
src/torrentimportdlg.cpp

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

Loading…
Cancel
Save