1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 07:18:08 +00:00

Save widget states under different paths when using Qt5. Closes #2340.

This commit is contained in:
sledgehammer999 2015-04-05 20:49:26 +03:00
parent 4612abb41e
commit dcc73afd73

View File

@ -1891,12 +1891,20 @@ void Preferences::setTrayIconStyle(TrayIcon::Style style)
// in the same file. // in the same file.
QByteArray Preferences::getAddNewTorrentDialogState() const QByteArray Preferences::getAddNewTorrentDialogState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
return value("AddNewTorrentDialog/qt5/treeHeaderState").toByteArray();
#else
return value("AddNewTorrentDialog/treeHeaderState").toByteArray(); return value("AddNewTorrentDialog/treeHeaderState").toByteArray();
#endif
} }
void Preferences::setAddNewTorrentDialogState(const QByteArray &state) void Preferences::setAddNewTorrentDialogState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
setValue("AddNewTorrentDialog/qt5/treeHeaderState", state);
#else
setValue("AddNewTorrentDialog/treeHeaderState", state); setValue("AddNewTorrentDialog/treeHeaderState", state);
#endif
} }
int Preferences::getAddNewTorrentDialogPos() const int Preferences::getAddNewTorrentDialogPos() const
@ -1981,12 +1989,20 @@ void Preferences::setMainGeometry(const QByteArray &geometry)
QByteArray Preferences::getMainVSplitterState() const QByteArray Preferences::getMainVSplitterState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
return value("MainWindow/qt5/vsplitterState").toByteArray();
#else
return value("MainWindow/vsplitterState").toByteArray(); return value("MainWindow/vsplitterState").toByteArray();
#endif
} }
void Preferences::setMainVSplitterState(const QByteArray &state) void Preferences::setMainVSplitterState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
setValue("MainWindow/qt5/vsplitterState", state);
#else
setValue("MainWindow/vsplitterState", state); setValue("MainWindow/vsplitterState", state);
#endif
} }
QString Preferences::getMainLastDir() const QString Preferences::getMainLastDir() const
@ -2033,12 +2049,20 @@ void Preferences::setPrefHSplitterSizes(const QStringList &sizes)
QByteArray Preferences::getPeerListState() const QByteArray Preferences::getPeerListState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
return value("TorrentProperties/Peers/qt5/PeerListState").toByteArray();
#else
return value("TorrentProperties/Peers/PeerListState").toByteArray(); return value("TorrentProperties/Peers/PeerListState").toByteArray();
#endif
} }
void Preferences::setPeerListState(const QByteArray &state) void Preferences::setPeerListState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
setValue("TorrentProperties/Peers/qt5/PeerListState", state);
#else
setValue("TorrentProperties/Peers/PeerListState", state); setValue("TorrentProperties/Peers/PeerListState", state);
#endif
} }
QString Preferences::getPropSplitterSizes() const QString Preferences::getPropSplitterSizes() const
@ -2053,12 +2077,20 @@ void Preferences::setPropSplitterSizes(const QString &sizes)
QByteArray Preferences::getPropFileListState() const QByteArray Preferences::getPropFileListState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
return value("TorrentProperties/qt5/FilesListState").toByteArray();
#else
return value("TorrentProperties/FilesListState").toByteArray(); return value("TorrentProperties/FilesListState").toByteArray();
#endif
} }
void Preferences::setPropFileListState(const QByteArray &state) void Preferences::setPropFileListState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
setValue("TorrentProperties/qt5/FilesListState", state);
#else
setValue("TorrentProperties/FilesListState", state); setValue("TorrentProperties/FilesListState", state);
#endif
} }
int Preferences::getPropCurTab() const int Preferences::getPropCurTab() const
@ -2083,12 +2115,20 @@ void Preferences::setPropVisible(const bool visible)
QByteArray Preferences::getPropTrackerListState() const QByteArray Preferences::getPropTrackerListState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
return value("TorrentProperties/Trackers/qt5/TrackerListState").toByteArray();
#else
return value("TorrentProperties/Trackers/TrackerListState").toByteArray(); return value("TorrentProperties/Trackers/TrackerListState").toByteArray();
#endif
} }
void Preferences::setPropTrackerListState(const QByteArray &state) void Preferences::setPropTrackerListState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
setValue("TorrentProperties/Trackers/qt5/TrackerListState", state);
#else
setValue("TorrentProperties/Trackers/TrackerListState", state); setValue("TorrentProperties/Trackers/TrackerListState", state);
#endif
} }
QByteArray Preferences::getRssGeometry() const QByteArray Preferences::getRssGeometry() const
@ -2103,12 +2143,20 @@ void Preferences::setRssGeometry(const QByteArray &geometry)
QByteArray Preferences::getRssHSplitterSizes() const QByteArray Preferences::getRssHSplitterSizes() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
return value("RssFeedDownloader/qt5/hsplitterSizes").toByteArray();
#else
return value("RssFeedDownloader/hsplitterSizes").toByteArray(); return value("RssFeedDownloader/hsplitterSizes").toByteArray();
#endif
} }
void Preferences::setRssHSplitterSizes(const QByteArray &sizes) void Preferences::setRssHSplitterSizes(const QByteArray &sizes)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
setValue("RssFeedDownloader/qt5/hsplitterSizes", sizes);
#else
setValue("RssFeedDownloader/hsplitterSizes", sizes); setValue("RssFeedDownloader/hsplitterSizes", sizes);
#endif
} }
QStringList Preferences::getRssOpenFolders() const QStringList Preferences::getRssOpenFolders() const
@ -2123,22 +2171,38 @@ void Preferences::setRssOpenFolders(const QStringList &folders)
QByteArray Preferences::getRssHSplitterState() const QByteArray Preferences::getRssHSplitterState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
return value("rss/qt5/splitter_h").toByteArray();
#else
return value("rss/splitter_h").toByteArray(); return value("rss/splitter_h").toByteArray();
#endif
} }
void Preferences::setRssHSplitterState(const QByteArray &state) void Preferences::setRssHSplitterState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
setValue("rss/qt5/splitter_h", state);
#else
setValue("rss/splitter_h", state); setValue("rss/splitter_h", state);
#endif
} }
QByteArray Preferences::getRssVSplitterState() const QByteArray Preferences::getRssVSplitterState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
return value("rss/qt5/splitter_v").toByteArray();
#else
return value("rss/splitter_v").toByteArray(); return value("rss/splitter_v").toByteArray();
#endif
} }
void Preferences::setRssVSplitterState(const QByteArray &state) void Preferences::setRssVSplitterState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
setValue("rss/qt5/splitter_v", state);
#else
setValue("rss/splitter_v", state); setValue("rss/splitter_v", state);
#endif
} }
QString Preferences::getSearchColsWidth() const QString Preferences::getSearchColsWidth() const
@ -2273,12 +2337,20 @@ void Preferences::setTransSelFilter(const int &index)
QByteArray Preferences::getTransHeaderState() const QByteArray Preferences::getTransHeaderState() const
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
return value("TransferList/qt5/HeaderState").toByteArray();
#else
return value("TransferList/HeaderState").toByteArray(); return value("TransferList/HeaderState").toByteArray();
#endif
} }
void Preferences::setTransHeaderState(const QByteArray &state) void Preferences::setTransHeaderState(const QByteArray &state)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
setValue("TransferList/qt5/HeaderState", state);
#else
setValue("TransferList/HeaderState", state); setValue("TransferList/HeaderState", state);
#endif
} }
// Temp code. // Temp code.