diff --git a/src/base/preferences.cpp b/src/base/preferences.cpp index 4e2856330..fa35f8f47 100644 --- a/src/base/preferences.cpp +++ b/src/base/preferences.cpp @@ -1241,26 +1241,6 @@ void Preferences::setMainLastDir(const QString &path) setValue("MainWindowLastDir", path); } -QSize Preferences::getPrefSize() const -{ - return value("Preferences/State/size").toSize(); -} - -void Preferences::setPrefSize(const QSize &size) -{ - setValue("Preferences/State/size", size); -} - -QStringList Preferences::getPrefHSplitterSizes() const -{ - return value("Preferences/State/hSplitterSizes").toStringList(); -} - -void Preferences::setPrefHSplitterSizes(const QStringList &sizes) -{ - setValue("Preferences/State/hSplitterSizes", sizes); -} - QByteArray Preferences::getPeerListState() const { return value("TorrentProperties/Peers/qt5/PeerListState").toByteArray(); diff --git a/src/base/preferences.h b/src/base/preferences.h index cab46c6a1..903d0008e 100644 --- a/src/base/preferences.h +++ b/src/base/preferences.h @@ -329,10 +329,6 @@ public: void setMainVSplitterState(const QByteArray &state); QString getMainLastDir() const; void setMainLastDir(const QString &path); - QSize getPrefSize() const; - void setPrefSize(const QSize &size); - QStringList getPrefHSplitterSizes() const; - void setPrefHSplitterSizes(const QStringList &sizes); QByteArray getPeerListState() const; void setPeerListState(const QByteArray &state); QString getPropSplitterSizes() const; diff --git a/src/gui/aboutdialog.cpp b/src/gui/aboutdialog.cpp index bbe1433d5..eefac2e36 100644 --- a/src/gui/aboutdialog.cpp +++ b/src/gui/aboutdialog.cpp @@ -36,9 +36,12 @@ #include "uithememanager.h" #include "utils.h" +#define SETTINGS_KEY(name) "AboutDialog/" name + AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent) , m_ui(new Ui::AboutDialog) + , m_storeDialogSize(SETTINGS_KEY("Size")) { m_ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); @@ -107,11 +110,12 @@ AboutDialog::AboutDialog(QWidget *parent) "The database is licensed under the Creative Commons Attribution 4.0 International License")); m_ui->labelDBIP->setText(DBIPText); - Utils::Gui::resize(this); + Utils::Gui::resize(this, m_storeDialogSize); show(); } AboutDialog::~AboutDialog() { + m_storeDialogSize = size(); delete m_ui; } diff --git a/src/gui/aboutdialog.h b/src/gui/aboutdialog.h index ca5115e34..a8f0065d2 100644 --- a/src/gui/aboutdialog.h +++ b/src/gui/aboutdialog.h @@ -30,12 +30,14 @@ #include +#include "base/settingvalue.h" + namespace Ui { class AboutDialog; } -class AboutDialog : public QDialog +class AboutDialog final : public QDialog { Q_OBJECT Q_DISABLE_COPY(AboutDialog) @@ -46,4 +48,5 @@ public: private: Ui::AboutDialog *m_ui; + SettingValue m_storeDialogSize; }; diff --git a/src/gui/banlistoptionsdialog.cpp b/src/gui/banlistoptionsdialog.cpp index 9d047ffaf..095a69b03 100644 --- a/src/gui/banlistoptionsdialog.cpp +++ b/src/gui/banlistoptionsdialog.cpp @@ -38,11 +38,13 @@ #include "ui_banlistoptionsdialog.h" #include "utils.h" +#define SETTINGS_KEY(name) "BanListOptionsDialog/" name + BanListOptionsDialog::BanListOptionsDialog(QWidget *parent) : QDialog(parent) , m_ui(new Ui::BanListOptionsDialog) + , m_storeDialogSize(SETTINGS_KEY("Size")) , m_model(new QStringListModel(BitTorrent::Session::instance()->bannedIPs(), this)) - , m_modified(false) { m_ui->setupUi(this); @@ -54,11 +56,12 @@ BanListOptionsDialog::BanListOptionsDialog(QWidget *parent) m_ui->bannedIPList->sortByColumn(0, Qt::AscendingOrder); m_ui->buttonBanIP->setEnabled(false); - Utils::Gui::resize(this); + Utils::Gui::resize(this, m_storeDialogSize); } BanListOptionsDialog::~BanListOptionsDialog() { + m_storeDialogSize = size(); delete m_ui; } diff --git a/src/gui/banlistoptionsdialog.h b/src/gui/banlistoptionsdialog.h index 131b274a9..a5b1c86aa 100644 --- a/src/gui/banlistoptionsdialog.h +++ b/src/gui/banlistoptionsdialog.h @@ -30,6 +30,8 @@ #include +#include "base/settingvalue.h" + class QSortFilterProxyModel; class QStringListModel; @@ -38,13 +40,14 @@ namespace Ui class BanListOptionsDialog; } -class BanListOptionsDialog : public QDialog +class BanListOptionsDialog final : public QDialog { Q_OBJECT + Q_DISABLE_COPY(BanListOptionsDialog) public: explicit BanListOptionsDialog(QWidget *parent = nullptr); - ~BanListOptionsDialog(); + ~BanListOptionsDialog() override; private slots: void on_buttonBox_accepted(); @@ -54,7 +57,8 @@ private slots: private: Ui::BanListOptionsDialog *m_ui; + SettingValue m_storeDialogSize; QStringListModel *m_model; QSortFilterProxyModel *m_sortFilter; - bool m_modified; + bool m_modified = false; }; diff --git a/src/gui/downloadfromurldialog.cpp b/src/gui/downloadfromurldialog.cpp index 8b35ec141..fdfad868c 100644 --- a/src/gui/downloadfromurldialog.cpp +++ b/src/gui/downloadfromurldialog.cpp @@ -39,6 +39,8 @@ #include "ui_downloadfromurldialog.h" #include "utils.h" +#define SETTINGS_KEY(name) "DownloadFromURLDialog/" name + namespace { bool isDownloadable(const QString &str) @@ -55,6 +57,7 @@ namespace DownloadFromURLDialog::DownloadFromURLDialog(QWidget *parent) : QDialog(parent) , m_ui(new Ui::DownloadFromURLDialog) + , m_storeDialogSize(SETTINGS_KEY("Size")) { m_ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); @@ -82,12 +85,13 @@ DownloadFromURLDialog::DownloadFromURLDialog(QWidget *parent) } m_ui->textUrls->setText(uniqueURLs.values().join('\n')); - Utils::Gui::resize(this); + Utils::Gui::resize(this, m_storeDialogSize); show(); } DownloadFromURLDialog::~DownloadFromURLDialog() { + m_storeDialogSize = size(); delete m_ui; } diff --git a/src/gui/downloadfromurldialog.h b/src/gui/downloadfromurldialog.h index f3058f309..7782e3a2a 100644 --- a/src/gui/downloadfromurldialog.h +++ b/src/gui/downloadfromurldialog.h @@ -30,19 +30,21 @@ #include +#include "base/settingvalue.h" + namespace Ui { class DownloadFromURLDialog; } -class DownloadFromURLDialog : public QDialog +class DownloadFromURLDialog final : public QDialog { Q_OBJECT Q_DISABLE_COPY(DownloadFromURLDialog) public: explicit DownloadFromURLDialog(QWidget *parent); - ~DownloadFromURLDialog(); + ~DownloadFromURLDialog() override; signals: void urlsReadyToBeDownloaded(const QStringList &torrentURLs); @@ -52,4 +54,5 @@ private slots: private: Ui::DownloadFromURLDialog *m_ui; + SettingValue m_storeDialogSize; }; diff --git a/src/gui/ipsubnetwhitelistoptionsdialog.cpp b/src/gui/ipsubnetwhitelistoptionsdialog.cpp index 3474290a1..1e74317e0 100644 --- a/src/gui/ipsubnetwhitelistoptionsdialog.cpp +++ b/src/gui/ipsubnetwhitelistoptionsdialog.cpp @@ -38,10 +38,12 @@ #include "ui_ipsubnetwhitelistoptionsdialog.h" #include "utils.h" +#define SETTINGS_KEY(name) "IPSubnetWhitelistOptionsDialog/" name + IPSubnetWhitelistOptionsDialog::IPSubnetWhitelistOptionsDialog(QWidget *parent) : QDialog(parent) , m_ui(new Ui::IPSubnetWhitelistOptionsDialog) - , m_modified(false) + , m_storeDialogSize(SETTINGS_KEY("Size")) { m_ui->setupUi(this); @@ -58,11 +60,12 @@ IPSubnetWhitelistOptionsDialog::IPSubnetWhitelistOptionsDialog(QWidget *parent) m_ui->whitelistedIPSubnetList->sortByColumn(0, Qt::AscendingOrder); m_ui->buttonWhitelistIPSubnet->setEnabled(false); - Utils::Gui::resize(this); + Utils::Gui::resize(this, m_storeDialogSize); } IPSubnetWhitelistOptionsDialog::~IPSubnetWhitelistOptionsDialog() { + m_storeDialogSize = size(); delete m_ui; } diff --git a/src/gui/ipsubnetwhitelistoptionsdialog.h b/src/gui/ipsubnetwhitelistoptionsdialog.h index ac231f070..d7e116632 100644 --- a/src/gui/ipsubnetwhitelistoptionsdialog.h +++ b/src/gui/ipsubnetwhitelistoptionsdialog.h @@ -30,6 +30,8 @@ #include +#include "base/settingvalue.h" + class QSortFilterProxyModel; class QStringListModel; @@ -38,14 +40,14 @@ namespace Ui class IPSubnetWhitelistOptionsDialog; } -class IPSubnetWhitelistOptionsDialog : public QDialog +class IPSubnetWhitelistOptionsDialog final : public QDialog { Q_OBJECT Q_DISABLE_COPY(IPSubnetWhitelistOptionsDialog) public: explicit IPSubnetWhitelistOptionsDialog(QWidget *parent = nullptr); - ~IPSubnetWhitelistOptionsDialog(); + ~IPSubnetWhitelistOptionsDialog() override; private slots: void on_buttonBox_accepted(); @@ -55,7 +57,9 @@ private slots: private: Ui::IPSubnetWhitelistOptionsDialog *m_ui; + SettingValue m_storeDialogSize; + QStringListModel *m_model; QSortFilterProxyModel *m_sortFilter; - bool m_modified; + bool m_modified = false; }; diff --git a/src/gui/optionsdialog.cpp b/src/gui/optionsdialog.cpp index 8c0a90976..e867b614f 100644 --- a/src/gui/optionsdialog.cpp +++ b/src/gui/optionsdialog.cpp @@ -68,6 +68,8 @@ #include "uithememanager.h" #include "utils.h" +#define SETTINGS_KEY(name) "OptionsDialog/" name + namespace { QStringList translatedWeekdayNames() @@ -129,7 +131,7 @@ namespace case QLocale::Latvian: return QString::fromUtf8(C_LOCALE_LATVIAN); case QLocale::Lithuanian: return QString::fromUtf8(C_LOCALE_LITHUANIAN); case QLocale::Malay: return QString::fromUtf8(C_LOCALE_MALAY); - case QLocale::Norwegian: return QString::fromUtf8(C_LOCALE_NORWEGIAN); + case QLocale::NorwegianBokmal: return QString::fromUtf8(C_LOCALE_NORWEGIAN); case QLocale::Occitan: return QString::fromUtf8(C_LOCALE_OCCITAN); case QLocale::Polish: return QString::fromUtf8(C_LOCALE_POLISH); case QLocale::Portuguese: @@ -169,9 +171,10 @@ private: // Constructor OptionsDialog::OptionsDialog(QWidget *parent) - : QDialog(parent) - , m_refreshingIpFilter(false) - , m_ui(new Ui::OptionsDialog) + : QDialog {parent} + , m_ui {new Ui::OptionsDialog} + , m_storeDialogSize {SETTINGS_KEY("Size")} + , m_storeHSplitterSize {SETTINGS_KEY("HorizontalSplitterSizes")} { qDebug("-> Constructing Options"); m_ui->setupUi(this); @@ -565,7 +568,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) for (QSpinBox *widget : asConst(findChildren())) widget->installEventFilter(wheelEventEater); - loadWindowState(); + Utils::Gui::resize(this, m_storeDialogSize); show(); // Have to be called after show(), because splitter width needed loadSplitterState(); @@ -606,7 +609,13 @@ OptionsDialog::~OptionsDialog() { qDebug("-> destructing Options"); - saveWindowState(); + // save dialog states + m_storeDialogSize = size(); + + QStringList hSplitterSizes; + for (const int size : asConst(m_ui->hsplitter->sizes())) + hSplitterSizes.append(QString::number(size)); + m_storeHSplitterSize = hSplitterSizes; for (const QString &path : asConst(m_addedScanDirs)) ScanFoldersModel::instance()->removePath(path); @@ -621,38 +630,18 @@ void OptionsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previo m_ui->tabOption->setCurrentIndex(m_ui->tabSelection->row(current)); } -void OptionsDialog::loadWindowState() -{ - Utils::Gui::resize(this, Preferences::instance()->getPrefSize()); -} - void OptionsDialog::loadSplitterState() { - const QStringList sizesStr = Preferences::instance()->getPrefHSplitterSizes(); - // width has been modified, use height as width reference instead const int width = Utils::Gui::scaledSize(this , (m_ui->tabSelection->item(TAB_UI)->sizeHint().height() * 2)); - QList sizes {width, (m_ui->hsplitter->width() - width)}; - if (sizesStr.size() == 2) - sizes = {sizesStr.first().toInt(), sizesStr.last().toInt()}; - m_ui->hsplitter->setSizes(sizes); -} - -void OptionsDialog::saveWindowState() const -{ - Preferences *const pref = Preferences::instance(); + const QStringList defaultSizes = {QString::number(width), QString::number(m_ui->hsplitter->width() - width)}; - // window size - pref->setPrefSize(size()); + QList splitterSizes; + for (const QString &string : asConst(m_storeHSplitterSize.get(defaultSizes))) + splitterSizes.append(string.toInt()); - // Splitter size - const QStringList sizesStr = - { - QString::number(m_ui->hsplitter->sizes().first()), - QString::number(m_ui->hsplitter->sizes().last()) - }; - pref->setPrefHSplitterSizes(sizesStr); + m_ui->hsplitter->setSizes(splitterSizes); } void OptionsDialog::saveOptions() diff --git a/src/gui/optionsdialog.h b/src/gui/optionsdialog.h index 056dc8e17..8479c450a 100644 --- a/src/gui/optionsdialog.h +++ b/src/gui/optionsdialog.h @@ -30,6 +30,8 @@ #include +#include "base/settingvalue.h" + class QAbstractButton; class QCloseEvent; class QListWidgetItem; @@ -58,6 +60,8 @@ namespace Ui class OptionsDialog final : public QDialog { Q_OBJECT + Q_DISABLE_COPY(OptionsDialog) + using ThisType = OptionsDialog; enum Tabs @@ -95,9 +99,7 @@ private slots: void enableApplyButton(); void toggleComboRatioLimitAct(); void changePage(QListWidgetItem *, QListWidgetItem *); - void loadWindowState(); void loadSplitterState(); - void saveWindowState() const; void handleScanFolderViewSelectionChanged(); void on_IpFilterRefreshBtn_clicked(); void handleIPFilterParsed(bool error, int ruleCount); @@ -161,7 +163,6 @@ private: // IP Filter bool isIPFilteringEnabled() const; QString getFilter() const; - bool m_refreshingIpFilter; // Queueing system bool isQueueingSystemEnabled() const; int getMaxActiveDownloads() const; @@ -177,8 +178,15 @@ private: bool schedTimesOk(); Ui::OptionsDialog *m_ui; + SettingValue m_storeDialogSize; + SettingValue m_storeHSplitterSize; + QAbstractButton *m_applyButton; + AdvancedSettings *m_advancedSettings; + QList m_addedScanDirs; QList m_removedScanDirs; + + bool m_refreshingIpFilter = false; }; diff --git a/src/gui/previewselectdialog.cpp b/src/gui/previewselectdialog.cpp index 7768c6500..cdbb72d86 100644 --- a/src/gui/previewselectdialog.cpp +++ b/src/gui/previewselectdialog.cpp @@ -51,7 +51,7 @@ PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, const BitTorrent::Torr : QDialog(parent) , m_ui(new Ui::PreviewSelectDialog) , m_torrent(torrent) - , m_storeDialogSize(SETTINGS_KEY("Dimension")) + , m_storeDialogSize(SETTINGS_KEY("Size")) , m_storeTreeHeaderState(SETTINGS_KEY("HeaderState")) { m_ui->setupUi(this); diff --git a/src/gui/search/pluginselectdialog.cpp b/src/gui/search/pluginselectdialog.cpp index 966300e6c..9ab36b187 100644 --- a/src/gui/search/pluginselectdialog.cpp +++ b/src/gui/search/pluginselectdialog.cpp @@ -49,6 +49,8 @@ #include "searchwidget.h" #include "ui_pluginselectdialog.h" +#define SETTINGS_KEY(name) "SearchPluginSelectDialog/" name + enum PluginColumns { PLUGIN_NAME, @@ -60,10 +62,9 @@ enum PluginColumns PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent) : QDialog(parent) - , m_ui(new Ui::PluginSelectDialog()) + , m_ui(new Ui::PluginSelectDialog) + , m_storeDialogSize(SETTINGS_KEY("Size")) , m_pluginManager(pluginManager) - , m_asyncOps(0) - , m_pendingUpdates(0) { m_ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); @@ -94,12 +95,13 @@ PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidg connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFinished, this, &PluginSelectDialog::checkForUpdatesFinished); connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFailed, this, &PluginSelectDialog::checkForUpdatesFailed); - Utils::Gui::resize(this); + Utils::Gui::resize(this, m_storeDialogSize); show(); } PluginSelectDialog::~PluginSelectDialog() { + m_storeDialogSize = size(); delete m_ui; } diff --git a/src/gui/search/pluginselectdialog.h b/src/gui/search/pluginselectdialog.h index d47767786..23e94b963 100644 --- a/src/gui/search/pluginselectdialog.h +++ b/src/gui/search/pluginselectdialog.h @@ -33,6 +33,7 @@ #include #include "base/search/searchpluginmanager.h" +#include "base/settingvalue.h" class QDropEvent; class QTreeWidgetItem; @@ -91,8 +92,9 @@ private: void finishPluginUpdate(); Ui::PluginSelectDialog *m_ui; + SettingValue m_storeDialogSize; SearchPluginManager *m_pluginManager; QStringList m_updatedPlugins; - int m_asyncOps; - int m_pendingUpdates; + int m_asyncOps = 0; + int m_pendingUpdates = 0; }; diff --git a/src/gui/search/pluginsourcedialog.cpp b/src/gui/search/pluginsourcedialog.cpp index 89148ddb8..35eef656e 100644 --- a/src/gui/search/pluginsourcedialog.cpp +++ b/src/gui/search/pluginsourcedialog.cpp @@ -31,19 +31,23 @@ #include "gui/utils.h" #include "ui_pluginsourcedialog.h" +#define SETTINGS_KEY(name) "SearchPluginSourceDialog/" name + PluginSourceDialog::PluginSourceDialog(QWidget *parent) : QDialog(parent) - , m_ui(new Ui::PluginSourceDialog()) + , m_ui(new Ui::PluginSourceDialog) + , m_storeDialogSize(SETTINGS_KEY("Size")) { m_ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); - Utils::Gui::resize(this); + Utils::Gui::resize(this, m_storeDialogSize); show(); } PluginSourceDialog::~PluginSourceDialog() { + m_storeDialogSize = size(); delete m_ui; } diff --git a/src/gui/search/pluginsourcedialog.h b/src/gui/search/pluginsourcedialog.h index 8a8948a5b..5b62c2f9a 100644 --- a/src/gui/search/pluginsourcedialog.h +++ b/src/gui/search/pluginsourcedialog.h @@ -30,18 +30,21 @@ #include +#include "base/settingvalue.h" + namespace Ui { class PluginSourceDialog; } -class PluginSourceDialog : public QDialog +class PluginSourceDialog final : public QDialog { Q_OBJECT + Q_DISABLE_COPY(PluginSourceDialog) public: explicit PluginSourceDialog(QWidget *parent = nullptr); - ~PluginSourceDialog(); + ~PluginSourceDialog() override; signals: void askForUrl(); @@ -53,4 +56,5 @@ private slots: private: Ui::PluginSourceDialog *m_ui; + SettingValue m_storeDialogSize; }; diff --git a/src/gui/speedlimitdialog.cpp b/src/gui/speedlimitdialog.cpp index 334dd75ac..adae8f56c 100644 --- a/src/gui/speedlimitdialog.cpp +++ b/src/gui/speedlimitdialog.cpp @@ -35,6 +35,8 @@ #include "uithememanager.h" #include "utils.h" +#define SETTINGS_KEY(name) "SpeedLimitDialog/" name + namespace { void updateSliderValue(QSlider *slider, const int value) @@ -48,6 +50,7 @@ namespace SpeedLimitDialog::SpeedLimitDialog(QWidget *parent) : QDialog {parent} , m_ui {new Ui::SpeedLimitDialog} + , m_storeDialogSize {SETTINGS_KEY("Size")} { m_ui->setupUi(this); @@ -103,11 +106,12 @@ SpeedLimitDialog::SpeedLimitDialog(QWidget *parent) connect(m_ui->spinAltDownloadLimit, qOverload(&QSpinBox::valueChanged) , this, [this](const int value) { updateSliderValue(m_ui->sliderAltDownloadLimit, value); }); - Utils::Gui::resize(this); + Utils::Gui::resize(this, m_storeDialogSize); } SpeedLimitDialog::~SpeedLimitDialog() { + m_storeDialogSize = size(); delete m_ui; } diff --git a/src/gui/speedlimitdialog.h b/src/gui/speedlimitdialog.h index 1c3d77676..25a277cbd 100644 --- a/src/gui/speedlimitdialog.h +++ b/src/gui/speedlimitdialog.h @@ -30,6 +30,8 @@ #include +#include "base/settingvalue.h" + namespace Ui { class SpeedLimitDialog; @@ -38,6 +40,7 @@ namespace Ui class SpeedLimitDialog final : public QDialog { Q_OBJECT + Q_DISABLE_COPY(SpeedLimitDialog) public: explicit SpeedLimitDialog(QWidget *parent); @@ -48,6 +51,7 @@ public slots: private: Ui::SpeedLimitDialog *m_ui; + SettingValue m_storeDialogSize; struct { int uploadSpeedLimit; diff --git a/src/gui/statsdialog.cpp b/src/gui/statsdialog.cpp index 1cb43f5f3..c618cfa3c 100644 --- a/src/gui/statsdialog.cpp +++ b/src/gui/statsdialog.cpp @@ -40,9 +40,12 @@ #include "ui_statsdialog.h" #include "utils.h" +#define SETTINGS_KEY(name) "StatisticsDialog/" name + StatsDialog::StatsDialog(QWidget *parent) : QDialog(parent) , m_ui(new Ui::StatsDialog) + , m_storeDialogSize(SETTINGS_KEY("Size")) { m_ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); @@ -57,12 +60,13 @@ StatsDialog::StatsDialog(QWidget *parent) m_ui->labelCacheHits->hide(); #endif - Utils::Gui::resize(this); + Utils::Gui::resize(this, m_storeDialogSize); show(); } StatsDialog::~StatsDialog() { + m_storeDialogSize = size(); delete m_ui; } diff --git a/src/gui/statsdialog.h b/src/gui/statsdialog.h index d2add7915..8b3509841 100644 --- a/src/gui/statsdialog.h +++ b/src/gui/statsdialog.h @@ -30,6 +30,8 @@ #include +#include "base/settingvalue.h" + namespace Ui { class StatsDialog; @@ -38,6 +40,7 @@ namespace Ui class StatsDialog final : public QDialog { Q_OBJECT + Q_DISABLE_COPY(StatsDialog) public: explicit StatsDialog(QWidget *parent); @@ -48,4 +51,5 @@ private slots: private: Ui::StatsDialog *m_ui; + SettingValue m_storeDialogSize; }; diff --git a/src/gui/torrentcreatordialog.cpp b/src/gui/torrentcreatordialog.cpp index 120c67dc1..1dc2a9fda 100644 --- a/src/gui/torrentcreatordialog.cpp +++ b/src/gui/torrentcreatordialog.cpp @@ -48,7 +48,7 @@ TorrentCreatorDialog::TorrentCreatorDialog(QWidget *parent, const QString &defau : QDialog(parent) , m_ui(new Ui::TorrentCreatorDialog) , m_creatorThread(new BitTorrent::TorrentCreatorThread(this)) - , m_storeDialogSize(SETTINGS_KEY("Dimension")) + , m_storeDialogSize(SETTINGS_KEY("Size")) , m_storePieceSize(SETTINGS_KEY("PieceSize")) , m_storePrivateTorrent(SETTINGS_KEY("PrivateTorrent")) , m_storeStartSeeding(SETTINGS_KEY("StartSeeding")) diff --git a/src/gui/torrentoptionsdialog.cpp b/src/gui/torrentoptionsdialog.cpp index b80122573..335cf3987 100644 --- a/src/gui/torrentoptionsdialog.cpp +++ b/src/gui/torrentoptionsdialog.cpp @@ -39,6 +39,8 @@ #include "ui_torrentoptionsdialog.h" #include "utils.h" +#define SETTINGS_KEY(name) "TorrentOptionsDialog/" name + namespace { const int MIXED_SHARE_LIMITS = -9; @@ -54,6 +56,7 @@ namespace TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector &torrents) : QDialog {parent} , m_ui {new Ui::TorrentOptionsDialog} + , m_storeDialogSize {SETTINGS_KEY("Size")} { m_ui->setupUi(this); @@ -265,11 +268,12 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector +#include "base/settingvalue.h" + namespace BitTorrent { class InfoHash; @@ -44,6 +46,7 @@ namespace Ui class TorrentOptionsDialog final : public QDialog { Q_OBJECT + Q_DISABLE_COPY(TorrentOptionsDialog) public: explicit TorrentOptionsDialog(QWidget *parent, const QVector &torrents); @@ -64,6 +67,7 @@ private: QVector m_torrentHashes; Ui::TorrentOptionsDialog *m_ui; + SettingValue m_storeDialogSize; struct { qreal ratio; diff --git a/src/gui/trackerentriesdialog.cpp b/src/gui/trackerentriesdialog.cpp index 62d2db1e0..e02f688db 100644 --- a/src/gui/trackerentriesdialog.cpp +++ b/src/gui/trackerentriesdialog.cpp @@ -42,7 +42,7 @@ TrackerEntriesDialog::TrackerEntriesDialog(QWidget *parent) : QDialog(parent) , m_ui(new Ui::TrackerEntriesDialog) - , m_storeDialogSize(SETTINGS_KEY("Dimension")) + , m_storeDialogSize(SETTINGS_KEY("Size")) { m_ui->setupUi(this);