mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-05 03:14:44 +00:00
Merge pull request #17148 from Chocobo1/gui
Fix wrong dialog sizes on first start up
This commit is contained in:
commit
fb5f563537
@ -45,7 +45,6 @@
|
|||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QNetworkCookie>
|
#include <QNetworkCookie>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QSize>
|
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@ -1371,34 +1370,6 @@ void Preferences::setPropTrackerListState(const QByteArray &state)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize Preferences::getRssGeometrySize() const
|
|
||||||
{
|
|
||||||
return value<QSize>(u"RssFeedDownloader/geometrySize"_qs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Preferences::setRssGeometrySize(const QSize &geometry)
|
|
||||||
{
|
|
||||||
setValue(u"RssFeedDownloader/geometrySize"_qs, geometry);
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray Preferences::getRssHSplitterSizes() const
|
|
||||||
{
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
return value<QByteArray>(u"GUI/Qt6/RSSFeedDownloader/HSplitterSizes"_qs);
|
|
||||||
#else
|
|
||||||
return value<QByteArray>(u"RssFeedDownloader/qt5/hsplitterSizes"_qs);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Preferences::setRssHSplitterSizes(const QByteArray &sizes)
|
|
||||||
{
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
setValue(u"GUI/Qt6/RSSFeedDownloader/HSplitterSizes"_qs, sizes);
|
|
||||||
#else
|
|
||||||
setValue(u"RssFeedDownloader/qt5/hsplitterSizes"_qs, sizes);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList Preferences::getRssOpenFolders() const
|
QStringList Preferences::getRssOpenFolders() const
|
||||||
{
|
{
|
||||||
return value<QStringList>(u"GUI/RSSWidget/OpenedFolders"_qs);
|
return value<QStringList>(u"GUI/RSSWidget/OpenedFolders"_qs);
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
|
|
||||||
class QDateTime;
|
class QDateTime;
|
||||||
class QNetworkCookie;
|
class QNetworkCookie;
|
||||||
class QSize;
|
|
||||||
class QTime;
|
class QTime;
|
||||||
|
|
||||||
namespace Scheduler
|
namespace Scheduler
|
||||||
@ -353,10 +352,6 @@ public:
|
|||||||
void setPropVisible(bool visible);
|
void setPropVisible(bool visible);
|
||||||
QByteArray getPropTrackerListState() const;
|
QByteArray getPropTrackerListState() const;
|
||||||
void setPropTrackerListState(const QByteArray &state);
|
void setPropTrackerListState(const QByteArray &state);
|
||||||
QSize getRssGeometrySize() const;
|
|
||||||
void setRssGeometrySize(const QSize &geometry);
|
|
||||||
QByteArray getRssHSplitterSizes() const;
|
|
||||||
void setRssHSplitterSizes(const QByteArray &sizes);
|
|
||||||
QStringList getRssOpenFolders() const;
|
QStringList getRssOpenFolders() const;
|
||||||
void setRssOpenFolders(const QStringList &folders);
|
void setRssOpenFolders(const QStringList &folders);
|
||||||
QByteArray getRssSideSplitterState() const;
|
QByteArray getRssSideSplitterState() const;
|
||||||
|
@ -47,7 +47,6 @@ AboutDialog::AboutDialog(QWidget *parent)
|
|||||||
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
|
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
m_ui->labelName->setText(QStringLiteral("<b><h2>qBittorrent " QBT_VERSION " (%1-bit)</h2></b>").arg(QT_POINTER_SIZE * 8));
|
m_ui->labelName->setText(QStringLiteral("<b><h2>qBittorrent " QBT_VERSION " (%1-bit)</h2></b>").arg(QT_POINTER_SIZE * 8));
|
||||||
@ -113,8 +112,8 @@ AboutDialog::AboutDialog(QWidget *parent)
|
|||||||
"The database is licensed under the Creative Commons Attribution 4.0 International License"));
|
"The database is licensed under the Creative Commons Attribution 4.0 International License"));
|
||||||
m_ui->labelDBIP->setText(DBIPText);
|
m_ui->labelDBIP->setText(DBIPText);
|
||||||
|
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
show();
|
resize(dialogSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
AboutDialog::~AboutDialog()
|
AboutDialog::~AboutDialog()
|
||||||
|
@ -185,7 +185,6 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
|
|||||||
{
|
{
|
||||||
// TODO: set dialog file properties using m_torrentParams.filePriorities
|
// TODO: set dialog file properties using m_torrentParams.filePriorities
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
|
|
||||||
m_ui->lblMetaLoading->setVisible(false);
|
m_ui->lblMetaLoading->setVisible(false);
|
||||||
m_ui->progMetaLoading->setVisible(false);
|
m_ui->progMetaLoading->setVisible(false);
|
||||||
@ -345,7 +344,9 @@ void AddNewTorrentDialog::setSavePathHistoryLength(const int value)
|
|||||||
|
|
||||||
void AddNewTorrentDialog::loadState()
|
void AddNewTorrentDialog::loadState()
|
||||||
{
|
{
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
|
resize(dialogSize);
|
||||||
|
|
||||||
m_ui->splitter->restoreState(m_storeSplitterState);;
|
m_ui->splitter->restoreState(m_storeSplitterState);;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,6 +361,7 @@ void AddNewTorrentDialog::saveState()
|
|||||||
void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorrentParams &inParams, QWidget *parent)
|
void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorrentParams &inParams, QWidget *parent)
|
||||||
{
|
{
|
||||||
auto *dlg = new AddNewTorrentDialog(inParams, parent);
|
auto *dlg = new AddNewTorrentDialog(inParams, parent);
|
||||||
|
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
if (Net::DownloadManager::hasSupportedScheme(source))
|
if (Net::DownloadManager::hasSupportedScheme(source))
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,8 @@ BanListOptionsDialog::BanListOptionsDialog(QWidget *parent)
|
|||||||
m_ui->bannedIPList->sortByColumn(0, Qt::AscendingOrder);
|
m_ui->bannedIPList->sortByColumn(0, Qt::AscendingOrder);
|
||||||
m_ui->buttonBanIP->setEnabled(false);
|
m_ui->buttonBanIP->setEnabled(false);
|
||||||
|
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
|
resize(dialogSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
BanListOptionsDialog::~BanListOptionsDialog()
|
BanListOptionsDialog::~BanListOptionsDialog()
|
||||||
|
@ -64,7 +64,9 @@ CookiesDialog::CookiesDialog(QWidget *parent)
|
|||||||
m_cookiesModel->index(0, 0),
|
m_cookiesModel->index(0, 0),
|
||||||
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||||
|
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
|
resize(dialogSize);
|
||||||
|
|
||||||
m_ui->treeView->header()->restoreState(m_storeViewState);
|
m_ui->treeView->header()->restoreState(m_storeViewState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,8 +64,6 @@ DownloadFromURLDialog::DownloadFromURLDialog(QWidget *parent)
|
|||||||
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
|
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
setModal(true);
|
|
||||||
|
|
||||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Download"));
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Download"));
|
||||||
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &DownloadFromURLDialog::downloadButtonClicked);
|
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &DownloadFromURLDialog::downloadButtonClicked);
|
||||||
@ -94,8 +92,8 @@ DownloadFromURLDialog::DownloadFromURLDialog(QWidget *parent)
|
|||||||
m_ui->textUrls->setText(text);
|
m_ui->textUrls->setText(text);
|
||||||
m_ui->textUrls->moveCursor(QTextCursor::End);
|
m_ui->textUrls->moveCursor(QTextCursor::End);
|
||||||
|
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
show();
|
resize(dialogSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
DownloadFromURLDialog::~DownloadFromURLDialog()
|
DownloadFromURLDialog::~DownloadFromURLDialog()
|
||||||
|
@ -60,7 +60,8 @@ IPSubnetWhitelistOptionsDialog::IPSubnetWhitelistOptionsDialog(QWidget *parent)
|
|||||||
m_ui->whitelistedIPSubnetList->sortByColumn(0, Qt::AscendingOrder);
|
m_ui->whitelistedIPSubnetList->sortByColumn(0, Qt::AscendingOrder);
|
||||||
m_ui->buttonWhitelistIPSubnet->setEnabled(false);
|
m_ui->buttonWhitelistIPSubnet->setEnabled(false);
|
||||||
|
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
|
resize(dialogSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPSubnetWhitelistOptionsDialog::~IPSubnetWhitelistOptionsDialog()
|
IPSubnetWhitelistOptionsDialog::~IPSubnetWhitelistOptionsDialog()
|
||||||
|
@ -1124,17 +1124,29 @@ void MainWindow::on_actionAbout_triggered()
|
|||||||
{
|
{
|
||||||
// About dialog
|
// About dialog
|
||||||
if (m_aboutDlg)
|
if (m_aboutDlg)
|
||||||
|
{
|
||||||
m_aboutDlg->activateWindow();
|
m_aboutDlg->activateWindow();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_aboutDlg = new AboutDialog(this);
|
m_aboutDlg = new AboutDialog(this);
|
||||||
|
m_aboutDlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
m_aboutDlg->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionStatistics_triggered()
|
void MainWindow::on_actionStatistics_triggered()
|
||||||
{
|
{
|
||||||
if (m_statsDlg)
|
if (m_statsDlg)
|
||||||
|
{
|
||||||
m_statsDlg->activateWindow();
|
m_statsDlg->activateWindow();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_statsDlg = new StatsDialog(this);
|
m_statsDlg = new StatsDialog(this);
|
||||||
|
m_statsDlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
m_statsDlg->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::showEvent(QShowEvent *e)
|
void MainWindow::showEvent(QShowEvent *e)
|
||||||
@ -1279,6 +1291,8 @@ void MainWindow::createTorrentTriggered(const Path &path)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_createTorrentDlg = new TorrentCreatorDialog(this, path);
|
m_createTorrentDlg = new TorrentCreatorDialog(this, path);
|
||||||
|
m_createTorrentDlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
m_createTorrentDlg->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1814,9 +1828,15 @@ PropertiesWidget *MainWindow::propertiesWidget() const
|
|||||||
void MainWindow::on_actionOptions_triggered()
|
void MainWindow::on_actionOptions_triggered()
|
||||||
{
|
{
|
||||||
if (m_options)
|
if (m_options)
|
||||||
|
{
|
||||||
m_options->activateWindow();
|
m_options->activateWindow();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_options = new OptionsDialog(this);
|
m_options = new OptionsDialog(this);
|
||||||
|
m_options->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
m_options->open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionTopToolBar_triggered()
|
void MainWindow::on_actionTopToolBar_triggered()
|
||||||
@ -1923,7 +1943,9 @@ void MainWindow::on_actionDownloadFromURL_triggered()
|
|||||||
if (!m_downloadFromURLDialog)
|
if (!m_downloadFromURLDialog)
|
||||||
{
|
{
|
||||||
m_downloadFromURLDialog = new DownloadFromURLDialog(this);
|
m_downloadFromURLDialog = new DownloadFromURLDialog(this);
|
||||||
|
m_downloadFromURLDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(m_downloadFromURLDialog.data(), &DownloadFromURLDialog::urlsReadyToBeDownloaded, this, &MainWindow::downloadFromURLList);
|
connect(m_downloadFromURLDialog.data(), &DownloadFromURLDialog::urlsReadyToBeDownloaded, this, &MainWindow::downloadFromURLList);
|
||||||
|
m_downloadFromURLDialog->open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCloseEvent>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
@ -185,8 +184,6 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
{
|
{
|
||||||
qDebug("-> Constructing Options");
|
qDebug("-> Constructing Options");
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
setModal(true);
|
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX))
|
#if (defined(Q_OS_UNIX))
|
||||||
setWindowTitle(tr("Preferences"));
|
setWindowTitle(tr("Preferences"));
|
||||||
@ -575,10 +572,8 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
|
|
||||||
m_ui->tabSelection->setCurrentRow(m_storeLastViewedPage);
|
m_ui->tabSelection->setCurrentRow(m_storeLastViewedPage);
|
||||||
|
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
show();
|
resize(dialogSize);
|
||||||
// Have to be called after show(), because splitter width needed
|
|
||||||
loadSplitterState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::initializeLanguageCombo()
|
void OptionsDialog::initializeLanguageCombo()
|
||||||
@ -649,6 +644,13 @@ void OptionsDialog::loadSplitterState()
|
|||||||
m_ui->hsplitter->setSizes(splitterSizes);
|
m_ui->hsplitter->setSizes(splitterSizes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OptionsDialog::showEvent(QShowEvent *e)
|
||||||
|
{
|
||||||
|
QDialog::showEvent(e);
|
||||||
|
|
||||||
|
loadSplitterState();
|
||||||
|
}
|
||||||
|
|
||||||
void OptionsDialog::saveOptions()
|
void OptionsDialog::saveOptions()
|
||||||
{
|
{
|
||||||
auto *pref = Preferences::instance();
|
auto *pref = Preferences::instance();
|
||||||
@ -1477,15 +1479,8 @@ void OptionsDialog::applySettings()
|
|||||||
saveOptions();
|
saveOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::closeEvent(QCloseEvent *e)
|
|
||||||
{
|
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
e->accept();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDialog::on_buttonBox_rejected()
|
void OptionsDialog::on_buttonBox_rejected()
|
||||||
{
|
{
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1667,7 +1662,6 @@ void OptionsDialog::on_addWatchedFolderButton_clicked()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto dialog = new WatchedFolderOptionsDialog({}, this);
|
auto dialog = new WatchedFolderOptionsDialog({}, this);
|
||||||
dialog->setModal(true);
|
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(dialog, &QDialog::accepted, this, [this, dialog, dir, pref]()
|
connect(dialog, &QDialog::accepted, this, [this, dialog, dir, pref]()
|
||||||
{
|
{
|
||||||
@ -1723,7 +1717,6 @@ void OptionsDialog::editWatchedFolderOptions(const QModelIndex &index)
|
|||||||
|
|
||||||
auto watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
auto watchedFoldersModel = static_cast<WatchedFoldersModel *>(m_ui->scanFoldersView->model());
|
||||||
auto dialog = new WatchedFolderOptionsDialog(watchedFoldersModel->folderOptions(index.row()), this);
|
auto dialog = new WatchedFolderOptionsDialog(watchedFoldersModel->folderOptions(index.row()), this);
|
||||||
dialog->setModal(true);
|
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(dialog, &QDialog::accepted, this, [this, dialog, index, watchedFoldersModel]()
|
connect(dialog, &QDialog::accepted, this, [this, dialog, index, watchedFoldersModel]()
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include "base/pathfwd.h"
|
#include "base/pathfwd.h"
|
||||||
#include "base/settingvalue.h"
|
#include "base/settingvalue.h"
|
||||||
|
|
||||||
class QCloseEvent;
|
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
|
|
||||||
class AdvancedSettings;
|
class AdvancedSettings;
|
||||||
@ -94,7 +93,6 @@ public slots:
|
|||||||
private slots:
|
private slots:
|
||||||
void enableProxy(int index);
|
void enableProxy(int index);
|
||||||
void on_buttonBox_accepted();
|
void on_buttonBox_accepted();
|
||||||
void closeEvent(QCloseEvent *e) override;
|
|
||||||
void on_buttonBox_rejected();
|
void on_buttonBox_rejected();
|
||||||
void applySettings();
|
void applySettings();
|
||||||
void enableApplyButton();
|
void enableApplyButton();
|
||||||
@ -117,6 +115,8 @@ private slots:
|
|||||||
void webUIHttpsKeyChanged(const Path &path, ShowError showError);
|
void webUIHttpsKeyChanged(const Path &path, ShowError showError);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void showEvent(QShowEvent *e) override;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void saveOptions();
|
void saveOptions();
|
||||||
void loadOptions();
|
void loadOptions();
|
||||||
|
@ -173,13 +173,12 @@ void PreviewSelectDialog::saveWindowState()
|
|||||||
void PreviewSelectDialog::loadWindowState()
|
void PreviewSelectDialog::loadWindowState()
|
||||||
{
|
{
|
||||||
// Restore dialog size
|
// Restore dialog size
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
|
resize(dialogSize);
|
||||||
|
|
||||||
// Restore TreeView Header state
|
// Restore TreeView Header state
|
||||||
if (!m_storeTreeHeaderState.get().isEmpty())
|
if (const QByteArray treeHeaderState = m_storeTreeHeaderState; !treeHeaderState.isEmpty())
|
||||||
{
|
m_headerStateInitialized = m_ui->previewList->header()->restoreState(treeHeaderState);
|
||||||
m_headerStateInitialized = m_ui->previewList->header()->restoreState(m_storeTreeHeaderState);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewSelectDialog::showEvent(QShowEvent *event)
|
void PreviewSelectDialog::showEvent(QShowEvent *event)
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "automatedrssdownloader.h"
|
#include "automatedrssdownloader.h"
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
@ -41,7 +42,6 @@
|
|||||||
#include "base/bittorrent/session.h"
|
#include "base/bittorrent/session.h"
|
||||||
#include "base/global.h"
|
#include "base/global.h"
|
||||||
#include "base/path.h"
|
#include "base/path.h"
|
||||||
#include "base/preferences.h"
|
|
||||||
#include "base/rss/rss_article.h"
|
#include "base/rss/rss_article.h"
|
||||||
#include "base/rss/rss_autodownloader.h"
|
#include "base/rss/rss_autodownloader.h"
|
||||||
#include "base/rss/rss_feed.h"
|
#include "base/rss/rss_feed.h"
|
||||||
@ -65,6 +65,13 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
|
|||||||
, m_formatFilterLegacy(u"%1 (*%2)"_qs.arg(tr("Rules (legacy)"), EXT_LEGACY))
|
, m_formatFilterLegacy(u"%1 (*%2)"_qs.arg(tr("Rules (legacy)"), EXT_LEGACY))
|
||||||
, m_ui(new Ui::AutomatedRssDownloader)
|
, m_ui(new Ui::AutomatedRssDownloader)
|
||||||
, m_currentRuleItem(nullptr)
|
, m_currentRuleItem(nullptr)
|
||||||
|
, m_storeDialogSize {u"RssFeedDownloader/geometrySize"_qs}
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
, m_storeHSplitterSize {u"GUI/Qt6/RSSFeedDownloader/HSplitterSizes"_qs}
|
||||||
|
#else
|
||||||
|
, m_storeHSplitterSize {u"RssFeedDownloader/qt5/hsplitterSizes"_qs}
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
// Icons
|
// Icons
|
||||||
@ -160,16 +167,17 @@ AutomatedRssDownloader::~AutomatedRssDownloader()
|
|||||||
|
|
||||||
void AutomatedRssDownloader::loadSettings()
|
void AutomatedRssDownloader::loadSettings()
|
||||||
{
|
{
|
||||||
const auto *pref = Preferences::instance();
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
resize(pref->getRssGeometrySize());
|
resize(dialogSize);
|
||||||
m_ui->hsplitter->restoreState(pref->getRssHSplitterSizes());
|
|
||||||
|
if (const QByteArray hSplitterSize = m_storeHSplitterSize; !hSplitterSize.isEmpty())
|
||||||
|
m_ui->hsplitter->restoreState(hSplitterSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutomatedRssDownloader::saveSettings()
|
void AutomatedRssDownloader::saveSettings()
|
||||||
{
|
{
|
||||||
Preferences *const pref = Preferences::instance();
|
m_storeDialogSize = size();
|
||||||
pref->setRssGeometrySize(size());
|
m_storeHSplitterSize = m_ui->hsplitter->saveState();
|
||||||
pref->setRssHSplitterSizes(m_ui->hsplitter->saveState());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutomatedRssDownloader::createRuleItem(const RSS::AutoDownloadRule &rule)
|
void AutomatedRssDownloader::createRuleItem(const RSS::AutoDownloadRule &rule)
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
|
||||||
#include "base/rss/rss_autodownloadrule.h"
|
#include "base/rss/rss_autodownloadrule.h"
|
||||||
|
#include "base/settingvalue.h"
|
||||||
|
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
class QRegularExpression;
|
class QRegularExpression;
|
||||||
@ -106,4 +107,7 @@ private:
|
|||||||
RSS::AutoDownloadRule m_currentRule;
|
RSS::AutoDownloadRule m_currentRule;
|
||||||
QHash<QString, QListWidgetItem *> m_itemsByRuleName;
|
QHash<QString, QListWidgetItem *> m_itemsByRuleName;
|
||||||
QRegularExpression *m_episodeRegex;
|
QRegularExpression *m_episodeRegex;
|
||||||
|
|
||||||
|
SettingValue<QSize> m_storeDialogSize;
|
||||||
|
SettingValue<QByteArray> m_storeHSplitterSize;
|
||||||
};
|
};
|
||||||
|
@ -66,7 +66,6 @@ PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidg
|
|||||||
, m_pluginManager(pluginManager)
|
, m_pluginManager(pluginManager)
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
|
|
||||||
m_ui->pluginsTree->setRootIsDecorated(false);
|
m_ui->pluginsTree->setRootIsDecorated(false);
|
||||||
m_ui->pluginsTree->hideColumn(PLUGIN_ID);
|
m_ui->pluginsTree->hideColumn(PLUGIN_ID);
|
||||||
@ -88,8 +87,8 @@ PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidg
|
|||||||
connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFinished, this, &PluginSelectDialog::checkForUpdatesFinished);
|
connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFinished, this, &PluginSelectDialog::checkForUpdatesFinished);
|
||||||
connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFailed, this, &PluginSelectDialog::checkForUpdatesFailed);
|
connect(m_pluginManager, &SearchPluginManager::checkForUpdatesFailed, this, &PluginSelectDialog::checkForUpdatesFailed);
|
||||||
|
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
show();
|
resize(dialogSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginSelectDialog::~PluginSelectDialog()
|
PluginSelectDialog::~PluginSelectDialog()
|
||||||
@ -346,8 +345,10 @@ void PluginSelectDialog::finishPluginUpdate()
|
|||||||
void PluginSelectDialog::on_installButton_clicked()
|
void PluginSelectDialog::on_installButton_clicked()
|
||||||
{
|
{
|
||||||
auto *dlg = new PluginSourceDialog(this);
|
auto *dlg = new PluginSourceDialog(this);
|
||||||
|
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(dlg, &PluginSourceDialog::askForLocalFile, this, &PluginSelectDialog::askForLocalPlugin);
|
connect(dlg, &PluginSourceDialog::askForLocalFile, this, &PluginSelectDialog::askForLocalPlugin);
|
||||||
connect(dlg, &PluginSourceDialog::askForUrl, this, &PluginSelectDialog::askForPluginUrl);
|
connect(dlg, &PluginSourceDialog::askForUrl, this, &PluginSelectDialog::askForPluginUrl);
|
||||||
|
dlg->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginSelectDialog::askForPluginUrl()
|
void PluginSelectDialog::askForPluginUrl()
|
||||||
|
@ -39,10 +39,9 @@ PluginSourceDialog::PluginSourceDialog(QWidget *parent)
|
|||||||
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
|
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
|
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
show();
|
resize(dialogSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginSourceDialog::~PluginSourceDialog()
|
PluginSourceDialog::~PluginSourceDialog()
|
||||||
|
@ -286,7 +286,9 @@ void SearchWidget::toggleFocusBetweenLineEdits()
|
|||||||
|
|
||||||
void SearchWidget::on_pluginsButton_clicked()
|
void SearchWidget::on_pluginsButton_clicked()
|
||||||
{
|
{
|
||||||
new PluginSelectDialog(SearchPluginManager::instance(), this);
|
auto *dlg = new PluginSelectDialog(SearchPluginManager::instance(), this);
|
||||||
|
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
dlg->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchWidget::searchTextEdited(const QString &)
|
void SearchWidget::searchTextEdited(const QString &)
|
||||||
|
@ -108,7 +108,8 @@ SpeedLimitDialog::SpeedLimitDialog(QWidget *parent)
|
|||||||
connect(m_ui->spinAltDownloadLimit, qOverload<int>(&QSpinBox::valueChanged)
|
connect(m_ui->spinAltDownloadLimit, qOverload<int>(&QSpinBox::valueChanged)
|
||||||
, this, [this](const int value) { updateSliderValue(m_ui->sliderAltDownloadLimit, value); });
|
, this, [this](const int value) { updateSliderValue(m_ui->sliderAltDownloadLimit, value); });
|
||||||
|
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
|
resize(dialogSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpeedLimitDialog::~SpeedLimitDialog()
|
SpeedLimitDialog::~SpeedLimitDialog()
|
||||||
|
@ -48,7 +48,7 @@ StatsDialog::StatsDialog(QWidget *parent)
|
|||||||
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
|
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &StatsDialog::close);
|
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &StatsDialog::close);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
@ -60,8 +60,8 @@ StatsDialog::StatsDialog(QWidget *parent)
|
|||||||
m_ui->labelCacheHits->hide();
|
m_ui->labelCacheHits->hide();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
show();
|
resize(dialogSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
StatsDialog::~StatsDialog()
|
StatsDialog::~StatsDialog()
|
||||||
|
@ -67,8 +67,6 @@ TorrentCreatorDialog::TorrentCreatorDialog(QWidget *parent, const Path &defaultP
|
|||||||
, m_storeSource(SETTINGS_KEY(u"Source"_qs))
|
, m_storeSource(SETTINGS_KEY(u"Source"_qs))
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
setModal(false);
|
|
||||||
|
|
||||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create Torrent"));
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create Torrent"));
|
||||||
|
|
||||||
@ -89,8 +87,6 @@ TorrentCreatorDialog::TorrentCreatorDialog(QWidget *parent, const Path &defaultP
|
|||||||
#else
|
#else
|
||||||
m_ui->widgetTorrentFormat->hide();
|
m_ui->widgetTorrentFormat->hide();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TorrentCreatorDialog::~TorrentCreatorDialog()
|
TorrentCreatorDialog::~TorrentCreatorDialog()
|
||||||
@ -344,5 +340,6 @@ void TorrentCreatorDialog::loadSettings()
|
|||||||
m_ui->txtComment->setPlainText(m_storeComments);
|
m_ui->txtComment->setPlainText(m_storeComments);
|
||||||
m_ui->lineEditSource->setText(m_storeSource);
|
m_ui->lineEditSource->setText(m_storeSource);
|
||||||
|
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
|
resize(dialogSize);
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,8 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTor
|
|||||||
|
|
||||||
connect(m_ui->buttonGroup, &QButtonGroup::idClicked, this, &TorrentOptionsDialog::handleRatioTypeChanged);
|
connect(m_ui->buttonGroup, &QButtonGroup::idClicked, this, &TorrentOptionsDialog::handleRatioTypeChanged);
|
||||||
|
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
|
resize(dialogSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
TorrentOptionsDialog::~TorrentOptionsDialog()
|
TorrentOptionsDialog::~TorrentOptionsDialog()
|
||||||
|
@ -110,5 +110,6 @@ void TrackerEntriesDialog::saveSettings()
|
|||||||
|
|
||||||
void TrackerEntriesDialog::loadSettings()
|
void TrackerEntriesDialog::loadSettings()
|
||||||
{
|
{
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
|
resize(dialogSize);
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,8 @@ TorrentFilesWatcher::WatchedFolderOptions WatchedFolderOptionsDialog::watchedFol
|
|||||||
|
|
||||||
void WatchedFolderOptionsDialog::loadState()
|
void WatchedFolderOptionsDialog::loadState()
|
||||||
{
|
{
|
||||||
resize(m_storeDialogSize);
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
|
resize(dialogSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchedFolderOptionsDialog::saveState()
|
void WatchedFolderOptionsDialog::saveState()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user