mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Store Qt6 table header states under a different key
This commit is contained in:
parent
32698fe0be
commit
22abbc1d41
@ -1265,12 +1265,20 @@ void Preferences::setMainGeometry(const QByteArray &geometry)
|
|||||||
|
|
||||||
QByteArray Preferences::getMainVSplitterState() const
|
QByteArray Preferences::getMainVSplitterState() const
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
return value("GUI/Qt6/MainWindow/VSplitterState").toByteArray();
|
||||||
|
#else
|
||||||
return value("MainWindow/qt5/vsplitterState").toByteArray();
|
return value("MainWindow/qt5/vsplitterState").toByteArray();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setMainVSplitterState(const QByteArray &state)
|
void Preferences::setMainVSplitterState(const QByteArray &state)
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
setValue("GUI/Qt6/MainWindow/VSplitterState", state);
|
||||||
|
#else
|
||||||
setValue("MainWindow/qt5/vsplitterState", state);
|
setValue("MainWindow/qt5/vsplitterState", state);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Preferences::getMainLastDir() const
|
QString Preferences::getMainLastDir() const
|
||||||
@ -1285,12 +1293,20 @@ void Preferences::setMainLastDir(const QString &path)
|
|||||||
|
|
||||||
QByteArray Preferences::getPeerListState() const
|
QByteArray Preferences::getPeerListState() const
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
return value("GUI/Qt6/TorrentProperties/PeerListState").toByteArray();
|
||||||
|
#else
|
||||||
return value("TorrentProperties/Peers/qt5/PeerListState").toByteArray();
|
return value("TorrentProperties/Peers/qt5/PeerListState").toByteArray();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setPeerListState(const QByteArray &state)
|
void Preferences::setPeerListState(const QByteArray &state)
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
setValue("GUI/Qt6/TorrentProperties/PeerListState", state);
|
||||||
|
#else
|
||||||
setValue("TorrentProperties/Peers/qt5/PeerListState", state);
|
setValue("TorrentProperties/Peers/qt5/PeerListState", state);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Preferences::getPropSplitterSizes() const
|
QString Preferences::getPropSplitterSizes() const
|
||||||
@ -1305,12 +1321,20 @@ void Preferences::setPropSplitterSizes(const QString &sizes)
|
|||||||
|
|
||||||
QByteArray Preferences::getPropFileListState() const
|
QByteArray Preferences::getPropFileListState() const
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
return value("GUI/Qt6/TorrentProperties/FilesListState").toByteArray();
|
||||||
|
#else
|
||||||
return value("TorrentProperties/qt5/FilesListState").toByteArray();
|
return value("TorrentProperties/qt5/FilesListState").toByteArray();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setPropFileListState(const QByteArray &state)
|
void Preferences::setPropFileListState(const QByteArray &state)
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
setValue("GUI/Qt6/TorrentProperties/FilesListState", state);
|
||||||
|
#else
|
||||||
setValue("TorrentProperties/qt5/FilesListState", state);
|
setValue("TorrentProperties/qt5/FilesListState", state);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int Preferences::getPropCurTab() const
|
int Preferences::getPropCurTab() const
|
||||||
@ -1335,12 +1359,20 @@ void Preferences::setPropVisible(const bool visible)
|
|||||||
|
|
||||||
QByteArray Preferences::getPropTrackerListState() const
|
QByteArray Preferences::getPropTrackerListState() const
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
return value("GUI/Qt6/TorrentProperties/TrackerListState").toByteArray();
|
||||||
|
#else
|
||||||
return value("TorrentProperties/Trackers/qt5/TrackerListState").toByteArray();
|
return value("TorrentProperties/Trackers/qt5/TrackerListState").toByteArray();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setPropTrackerListState(const QByteArray &state)
|
void Preferences::setPropTrackerListState(const QByteArray &state)
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
setValue("GUI/Qt6/TorrentProperties/TrackerListState", state);
|
||||||
|
#else
|
||||||
setValue("TorrentProperties/Trackers/qt5/TrackerListState", state);
|
setValue("TorrentProperties/Trackers/qt5/TrackerListState", state);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize Preferences::getRssGeometrySize() const
|
QSize Preferences::getRssGeometrySize() const
|
||||||
@ -1355,12 +1387,20 @@ void Preferences::setRssGeometrySize(const QSize &geometry)
|
|||||||
|
|
||||||
QByteArray Preferences::getRssHSplitterSizes() const
|
QByteArray Preferences::getRssHSplitterSizes() const
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
return value("GUI/Qt6/RSSFeedDownloader/HSplitterSizes").toByteArray();
|
||||||
|
#else
|
||||||
return value("RssFeedDownloader/qt5/hsplitterSizes").toByteArray();
|
return value("RssFeedDownloader/qt5/hsplitterSizes").toByteArray();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setRssHSplitterSizes(const QByteArray &sizes)
|
void Preferences::setRssHSplitterSizes(const QByteArray &sizes)
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
setValue("GUI/Qt6/RSSFeedDownloader/HSplitterSizes", sizes);
|
||||||
|
#else
|
||||||
setValue("RssFeedDownloader/qt5/hsplitterSizes", sizes);
|
setValue("RssFeedDownloader/qt5/hsplitterSizes", sizes);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Preferences::getRssOpenFolders() const
|
QStringList Preferences::getRssOpenFolders() const
|
||||||
@ -1375,32 +1415,56 @@ void Preferences::setRssOpenFolders(const QStringList &folders)
|
|||||||
|
|
||||||
QByteArray Preferences::getRssSideSplitterState() const
|
QByteArray Preferences::getRssSideSplitterState() const
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
return value("GUI/Qt6/RSSWidget/SideSplitterState").toByteArray();
|
||||||
|
#else
|
||||||
return value("GUI/RSSWidget/qt5/splitter_h").toByteArray();
|
return value("GUI/RSSWidget/qt5/splitter_h").toByteArray();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setRssSideSplitterState(const QByteArray &state)
|
void Preferences::setRssSideSplitterState(const QByteArray &state)
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
setValue("GUI/Qt6/RSSWidget/SideSplitterState", state);
|
||||||
|
#else
|
||||||
setValue("GUI/RSSWidget/qt5/splitter_h", state);
|
setValue("GUI/RSSWidget/qt5/splitter_h", state);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Preferences::getRssMainSplitterState() const
|
QByteArray Preferences::getRssMainSplitterState() const
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
return value("GUI/Qt6/RSSWidget/MainSplitterState").toByteArray();
|
||||||
|
#else
|
||||||
return value("GUI/RSSWidget/qt5/splitterMain").toByteArray();
|
return value("GUI/RSSWidget/qt5/splitterMain").toByteArray();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setRssMainSplitterState(const QByteArray &state)
|
void Preferences::setRssMainSplitterState(const QByteArray &state)
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
setValue("GUI/Qt6/RSSWidget/MainSplitterState", state);
|
||||||
|
#else
|
||||||
setValue("GUI/RSSWidget/qt5/splitterMain", state);
|
setValue("GUI/RSSWidget/qt5/splitterMain", state);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Preferences::getSearchTabHeaderState() const
|
QByteArray Preferences::getSearchTabHeaderState() const
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
return value("GUI/Qt6/SearchTab/HeaderState").toByteArray();
|
||||||
|
#else
|
||||||
return value("SearchTab/qt5/HeaderState").toByteArray();
|
return value("SearchTab/qt5/HeaderState").toByteArray();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setSearchTabHeaderState(const QByteArray &state)
|
void Preferences::setSearchTabHeaderState(const QByteArray &state)
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
setValue("GUI/Qt6/SearchTab/HeaderState", state);
|
||||||
|
#else
|
||||||
setValue("SearchTab/qt5/HeaderState", state);
|
setValue("SearchTab/qt5/HeaderState", state);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Preferences::getRegexAsFilteringPatternForSearchJob() const
|
bool Preferences::getRegexAsFilteringPatternForSearchJob() const
|
||||||
@ -1495,12 +1559,20 @@ void Preferences::setTransSelFilter(const int index)
|
|||||||
|
|
||||||
QByteArray Preferences::getTransHeaderState() const
|
QByteArray Preferences::getTransHeaderState() const
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
return value("GUI/Qt6/TransferList/HeaderState").toByteArray();
|
||||||
|
#else
|
||||||
return value("TransferList/qt5/HeaderState").toByteArray();
|
return value("TransferList/qt5/HeaderState").toByteArray();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setTransHeaderState(const QByteArray &state)
|
void Preferences::setTransHeaderState(const QByteArray &state)
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
setValue("GUI/Qt6/TransferList/HeaderState", state);
|
||||||
|
#else
|
||||||
setValue("TransferList/qt5/HeaderState", state);
|
setValue("TransferList/qt5/HeaderState", state);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Preferences::getRegexAsFilteringPatternForTransferList() const
|
bool Preferences::getRegexAsFilteringPatternForTransferList() const
|
||||||
|
@ -82,10 +82,14 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
|
|||||||
, m_ui(new Ui::AddNewTorrentDialog)
|
, m_ui(new Ui::AddNewTorrentDialog)
|
||||||
, m_torrentParams(inParams)
|
, m_torrentParams(inParams)
|
||||||
, m_storeDialogSize(SETTINGS_KEY("DialogSize"))
|
, m_storeDialogSize(SETTINGS_KEY("DialogSize"))
|
||||||
, m_storeSplitterState(SETTINGS_KEY("SplitterState"))
|
|
||||||
, m_storeDefaultCategory(SETTINGS_KEY("DefaultCategory"))
|
, m_storeDefaultCategory(SETTINGS_KEY("DefaultCategory"))
|
||||||
, m_storeRememberLastSavePath(SETTINGS_KEY("RememberLastSavePath"))
|
, m_storeRememberLastSavePath(SETTINGS_KEY("RememberLastSavePath"))
|
||||||
, m_storeTreeHeaderState(SETTINGS_KEY("TreeHeaderState"))
|
, m_storeTreeHeaderState(SETTINGS_KEY("TreeHeaderState"))
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
, m_storeSplitterState("GUI/Qt6/" SETTINGS_KEY("SplitterState"))
|
||||||
|
#else
|
||||||
|
, m_storeSplitterState(SETTINGS_KEY("SplitterState"))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// 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);
|
||||||
@ -715,8 +719,8 @@ void AddNewTorrentDialog::setupTreeview()
|
|||||||
|
|
||||||
// List files in torrent
|
// List files in torrent
|
||||||
m_contentModel->model()->setupModelData(m_torrentInfo);
|
m_contentModel->model()->setupModelData(m_torrentInfo);
|
||||||
if (!m_storeTreeHeaderState.get().isEmpty())
|
if (const QByteArray state = m_storeTreeHeaderState; !state.isEmpty())
|
||||||
m_ui->contentTreeView->header()->restoreState(m_storeTreeHeaderState);
|
m_ui->contentTreeView->header()->restoreState(state);
|
||||||
|
|
||||||
// Hide useless columns after loading the header state
|
// Hide useless columns after loading the header state
|
||||||
m_ui->contentTreeView->hideColumn(PROGRESS);
|
m_ui->contentTreeView->hideColumn(PROGRESS);
|
||||||
|
@ -118,8 +118,8 @@ private:
|
|||||||
BitTorrent::AddTorrentParams m_torrentParams;
|
BitTorrent::AddTorrentParams m_torrentParams;
|
||||||
|
|
||||||
SettingValue<QSize> m_storeDialogSize;
|
SettingValue<QSize> m_storeDialogSize;
|
||||||
SettingValue<QByteArray> m_storeSplitterState;
|
|
||||||
SettingValue<QString> m_storeDefaultCategory;
|
SettingValue<QString> m_storeDefaultCategory;
|
||||||
SettingValue<bool> m_storeRememberLastSavePath;
|
SettingValue<bool> m_storeRememberLastSavePath;
|
||||||
CachedSettingValue<QByteArray> m_storeTreeHeaderState;
|
SettingValue<QByteArray> m_storeTreeHeaderState;
|
||||||
|
SettingValue<QByteArray> m_storeSplitterState;
|
||||||
};
|
};
|
||||||
|
@ -32,20 +32,23 @@
|
|||||||
|
|
||||||
#include "base/global.h"
|
#include "base/global.h"
|
||||||
#include "base/net/downloadmanager.h"
|
#include "base/net/downloadmanager.h"
|
||||||
#include "base/settingsstorage.h"
|
|
||||||
#include "cookiesmodel.h"
|
#include "cookiesmodel.h"
|
||||||
#include "ui_cookiesdialog.h"
|
#include "ui_cookiesdialog.h"
|
||||||
#include "uithememanager.h"
|
#include "uithememanager.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#define SETTINGS_KEY(name) QStringLiteral("CookiesDialog/" name)
|
#define SETTINGS_KEY(name) "CookiesDialog/" name
|
||||||
const QString KEY_SIZE = SETTINGS_KEY("Size");
|
|
||||||
const QString KEY_COOKIESVIEWSTATE = SETTINGS_KEY("CookiesViewState");
|
|
||||||
|
|
||||||
CookiesDialog::CookiesDialog(QWidget *parent)
|
CookiesDialog::CookiesDialog(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, m_ui(new Ui::CookiesDialog)
|
, m_ui(new Ui::CookiesDialog)
|
||||||
, m_cookiesModel(new CookiesModel(Net::DownloadManager::instance()->allCookies(), this))
|
, m_cookiesModel(new CookiesModel(Net::DownloadManager::instance()->allCookies(), this))
|
||||||
|
, m_storeDialogSize(SETTINGS_KEY("Size"))
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
, m_storeViewState("GUI/Qt6/" SETTINGS_KEY("ViewState"))
|
||||||
|
#else
|
||||||
|
, m_storeViewState(SETTINGS_KEY("CookiesViewState"))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
@ -61,16 +64,14 @@ CookiesDialog::CookiesDialog(QWidget *parent)
|
|||||||
m_cookiesModel->index(0, 0),
|
m_cookiesModel->index(0, 0),
|
||||||
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||||
|
|
||||||
Utils::Gui::resize(this, SettingsStorage::instance()->loadValue<QSize>(KEY_SIZE));
|
Utils::Gui::resize(this, m_storeDialogSize);
|
||||||
m_ui->treeView->header()->restoreState(
|
m_ui->treeView->header()->restoreState(m_storeViewState);
|
||||||
SettingsStorage::instance()->loadValue<QByteArray>(KEY_COOKIESVIEWSTATE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CookiesDialog::~CookiesDialog()
|
CookiesDialog::~CookiesDialog()
|
||||||
{
|
{
|
||||||
SettingsStorage::instance()->storeValue(KEY_SIZE, size());
|
m_storeDialogSize = size();
|
||||||
SettingsStorage::instance()->storeValue(
|
m_storeViewState = m_ui->treeView->header()->saveState();
|
||||||
KEY_COOKIESVIEWSTATE, m_ui->treeView->header()->saveState());
|
|
||||||
delete m_ui;
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#include "base/settingvalue.h"
|
||||||
|
|
||||||
class CookiesModel;
|
class CookiesModel;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
@ -55,4 +57,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
Ui::CookiesDialog *m_ui;
|
Ui::CookiesDialog *m_ui;
|
||||||
CookiesModel *m_cookiesModel;
|
CookiesModel *m_cookiesModel;
|
||||||
|
|
||||||
|
SettingValue<QSize> m_storeDialogSize;
|
||||||
|
SettingValue<QByteArray> m_storeViewState;
|
||||||
};
|
};
|
||||||
|
@ -52,7 +52,11 @@ PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, const BitTorrent::Torr
|
|||||||
, m_ui(new Ui::PreviewSelectDialog)
|
, m_ui(new Ui::PreviewSelectDialog)
|
||||||
, m_torrent(torrent)
|
, m_torrent(torrent)
|
||||||
, m_storeDialogSize(SETTINGS_KEY("Size"))
|
, m_storeDialogSize(SETTINGS_KEY("Size"))
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
, m_storeTreeHeaderState("GUI/Qt6/" SETTINGS_KEY("HeaderState"))
|
||||||
|
#else
|
||||||
, m_storeTreeHeaderState(SETTINGS_KEY("HeaderState"))
|
, m_storeTreeHeaderState(SETTINGS_KEY("HeaderState"))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user