From 13891fd62dc67292c9157f52b5a1bad1541f120e Mon Sep 17 00:00:00 2001 From: fearlessTobi Date: Sat, 8 Jun 2019 00:51:58 +0200 Subject: Change QList to QVector --- src/yuzu/game_list.cpp | 22 +++++++++++----------- src/yuzu/game_list.h | 3 ++- src/yuzu/game_list_worker.cpp | 2 +- src/yuzu/game_list_worker.h | 5 +++-- src/yuzu/uisettings.h | 3 ++- 5 files changed, 19 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index cab982385..c525d3f17 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -537,11 +537,11 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) { connect(move_up, &QAction::triggered, [this, selected, row, &game_dir] { // find the indices of the items in settings and swap them - UISettings::values.game_dirs.swap( - UISettings::values.game_dirs.indexOf(game_dir), - UISettings::values.game_dirs.indexOf(*selected.sibling(row - 1, 0) - .data(GameListDir::GameDirRole) - .value())); + std::swap(UISettings::values.game_dirs[UISettings::values.game_dirs.indexOf(game_dir)], + UISettings::values.game_dirs[UISettings::values.game_dirs.indexOf( + *selected.sibling(row - 1, 0) + .data(GameListDir::GameDirRole) + .value())]); // move the treeview items QList item = item_model->takeRow(row); item_model->invisibleRootItem()->insertRow(row - 1, item); @@ -550,11 +550,11 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) { connect(move_down, &QAction::triggered, [this, selected, row, &game_dir] { // find the indices of the items in settings and swap them - UISettings::values.game_dirs.swap( - UISettings::values.game_dirs.indexOf(game_dir), - UISettings::values.game_dirs.indexOf(*selected.sibling(row + 1, 0) - .data(GameListDir::GameDirRole) - .value())); + std::swap(UISettings::values.game_dirs[UISettings::values.game_dirs.indexOf(game_dir)], + UISettings::values.game_dirs[UISettings::values.game_dirs.indexOf( + *selected.sibling(row + 1, 0) + .data(GameListDir::GameDirRole) + .value())]); // move the treeview items const QList item = item_model->takeRow(row); item_model->invisibleRootItem()->insertRow(row + 1, item); @@ -609,7 +609,7 @@ void GameList::LoadCompatibilityList() { } } -void GameList::PopulateAsync(QList& game_dirs) { +void GameList::PopulateAsync(QVector& game_dirs) { tree_view->setEnabled(false); // Update the columns in case UISettings has changed diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index 7ed77fd9c..e781afb16 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "common/common_types.h" @@ -62,7 +63,7 @@ public: bool isEmpty() const; void LoadCompatibilityList(); - void PopulateAsync(QList& game_dirs); + void PopulateAsync(QVector& game_dirs); void SaveInterfaceLayout(); void LoadInterfaceLayout(); diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index c715bcef4..fd21a9761 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp @@ -224,7 +224,7 @@ QList MakeGameListEntry(const std::string& path, const std::stri GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvider* provider, - QList& game_dirs, + QVector& game_dirs, const CompatibilityList& compatibility_list) : vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs), compatibility_list(compatibility_list) {} diff --git a/src/yuzu/game_list_worker.h b/src/yuzu/game_list_worker.h index 46ec96516..6e52fca89 100644 --- a/src/yuzu/game_list_worker.h +++ b/src/yuzu/game_list_worker.h @@ -14,6 +14,7 @@ #include #include #include +#include #include "common/common_types.h" #include "yuzu/compatibility_list.h" @@ -35,7 +36,7 @@ class GameListWorker : public QObject, public QRunnable { public: explicit GameListWorker(std::shared_ptr vfs, FileSys::ManualContentProvider* provider, - QList& game_dirs, + QVector& game_dirs, const CompatibilityList& compatibility_list); ~GameListWorker() override; @@ -76,6 +77,6 @@ private: FileSys::ManualContentProvider* provider; QStringList watch_list; const CompatibilityList& compatibility_list; - QList& game_dirs; + QVector& game_dirs; std::atomic_bool stop_processing; }; diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 76348db69..c57290006 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h @@ -11,6 +11,7 @@ #include #include #include +#include #include "common/common_types.h" namespace UISettings { @@ -70,7 +71,7 @@ struct Values { QString screenshot_path; QString game_dir_deprecated; bool game_dir_deprecated_deepscan; - QList game_dirs; + QVector game_dirs; QStringList recent_files; QString theme; -- cgit v1.2.3