mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-21 08:09:35 +08:00
Use implicit sharing when getting categories from Session class
This commit is contained in:
parent
865394a59c
commit
e32ef7f5c5
@ -585,7 +585,7 @@ QStringList Session::expandCategory(const QString &category)
|
||||
return result;
|
||||
}
|
||||
|
||||
const QStringMap &Session::categories() const
|
||||
QStringMap Session::categories() const
|
||||
{
|
||||
return m_categories;
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ namespace BitTorrent
|
||||
// returns category itself and all top level categories
|
||||
static QStringList expandCategory(const QString &category);
|
||||
|
||||
const QStringMap &categories() const;
|
||||
QStringMap categories() const;
|
||||
QString categorySavePath(const QString &categoryName) const;
|
||||
bool addCategory(const QString &name, const QString &savePath = "");
|
||||
bool editCategory(const QString &name, const QString &savePath);
|
||||
|
@ -446,7 +446,7 @@ void SyncController::maindataAction()
|
||||
data["torrents"] = torrents;
|
||||
|
||||
QVariantHash categories;
|
||||
const auto &categoriesList = session->categories();
|
||||
const QStringMap categoriesList = session->categories();
|
||||
for (auto it = categoriesList.cbegin(); it != categoriesList.cend(); ++it) {
|
||||
const QString &key = it.key();
|
||||
categories[key] = QVariantMap {
|
||||
|
@ -1077,8 +1077,8 @@ void TorrentsController::removeCategoriesAction()
|
||||
void TorrentsController::categoriesAction()
|
||||
{
|
||||
QJsonObject categories;
|
||||
const auto categoriesList = BitTorrent::Session::instance()->categories();
|
||||
for (auto it = categoriesList.cbegin(); it != categoriesList.cend(); ++it) {
|
||||
const QStringMap categoriesMap = BitTorrent::Session::instance()->categories();
|
||||
for (auto it = categoriesMap.cbegin(); it != categoriesMap.cend(); ++it) {
|
||||
const auto &key = it.key();
|
||||
categories[key] = QJsonObject {
|
||||
{"name", key},
|
||||
|
Loading…
Reference in New Issue
Block a user