Change QList to QVector
This commit is contained in:
parent
5aaafa6a56
commit
13891fd62d
5 changed files with 19 additions and 16 deletions
|
@ -537,11 +537,11 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) {
|
||||||
|
|
||||||
connect(move_up, &QAction::triggered, [this, selected, row, &game_dir] {
|
connect(move_up, &QAction::triggered, [this, selected, row, &game_dir] {
|
||||||
// find the indices of the items in settings and swap them
|
// find the indices of the items in settings and swap them
|
||||||
UISettings::values.game_dirs.swap(
|
std::swap(UISettings::values.game_dirs[UISettings::values.game_dirs.indexOf(game_dir)],
|
||||||
UISettings::values.game_dirs.indexOf(game_dir),
|
UISettings::values.game_dirs[UISettings::values.game_dirs.indexOf(
|
||||||
UISettings::values.game_dirs.indexOf(*selected.sibling(row - 1, 0)
|
*selected.sibling(row - 1, 0)
|
||||||
.data(GameListDir::GameDirRole)
|
.data(GameListDir::GameDirRole)
|
||||||
.value<UISettings::GameDir*>()));
|
.value<UISettings::GameDir*>())]);
|
||||||
// move the treeview items
|
// move the treeview items
|
||||||
QList<QStandardItem*> item = item_model->takeRow(row);
|
QList<QStandardItem*> item = item_model->takeRow(row);
|
||||||
item_model->invisibleRootItem()->insertRow(row - 1, item);
|
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] {
|
connect(move_down, &QAction::triggered, [this, selected, row, &game_dir] {
|
||||||
// find the indices of the items in settings and swap them
|
// find the indices of the items in settings and swap them
|
||||||
UISettings::values.game_dirs.swap(
|
std::swap(UISettings::values.game_dirs[UISettings::values.game_dirs.indexOf(game_dir)],
|
||||||
UISettings::values.game_dirs.indexOf(game_dir),
|
UISettings::values.game_dirs[UISettings::values.game_dirs.indexOf(
|
||||||
UISettings::values.game_dirs.indexOf(*selected.sibling(row + 1, 0)
|
*selected.sibling(row + 1, 0)
|
||||||
.data(GameListDir::GameDirRole)
|
.data(GameListDir::GameDirRole)
|
||||||
.value<UISettings::GameDir*>()));
|
.value<UISettings::GameDir*>())]);
|
||||||
// move the treeview items
|
// move the treeview items
|
||||||
const QList<QStandardItem*> item = item_model->takeRow(row);
|
const QList<QStandardItem*> item = item_model->takeRow(row);
|
||||||
item_model->invisibleRootItem()->insertRow(row + 1, item);
|
item_model->invisibleRootItem()->insertRow(row + 1, item);
|
||||||
|
@ -609,7 +609,7 @@ void GameList::LoadCompatibilityList() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameList::PopulateAsync(QList<UISettings::GameDir>& game_dirs) {
|
void GameList::PopulateAsync(QVector<UISettings::GameDir>& game_dirs) {
|
||||||
tree_view->setEnabled(false);
|
tree_view->setEnabled(false);
|
||||||
|
|
||||||
// Update the columns in case UISettings has changed
|
// Update the columns in case UISettings has changed
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QVector>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
@ -62,7 +63,7 @@ public:
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
|
|
||||||
void LoadCompatibilityList();
|
void LoadCompatibilityList();
|
||||||
void PopulateAsync(QList<UISettings::GameDir>& game_dirs);
|
void PopulateAsync(QVector<UISettings::GameDir>& game_dirs);
|
||||||
|
|
||||||
void SaveInterfaceLayout();
|
void SaveInterfaceLayout();
|
||||||
void LoadInterfaceLayout();
|
void LoadInterfaceLayout();
|
||||||
|
|
|
@ -224,7 +224,7 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri
|
||||||
|
|
||||||
GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs,
|
GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs,
|
||||||
FileSys::ManualContentProvider* provider,
|
FileSys::ManualContentProvider* provider,
|
||||||
QList<UISettings::GameDir>& game_dirs,
|
QVector<UISettings::GameDir>& game_dirs,
|
||||||
const CompatibilityList& compatibility_list)
|
const CompatibilityList& compatibility_list)
|
||||||
: vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs),
|
: vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs),
|
||||||
compatibility_list(compatibility_list) {}
|
compatibility_list(compatibility_list) {}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QRunnable>
|
#include <QRunnable>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "yuzu/compatibility_list.h"
|
#include "yuzu/compatibility_list.h"
|
||||||
|
@ -35,7 +36,7 @@ class GameListWorker : public QObject, public QRunnable {
|
||||||
public:
|
public:
|
||||||
explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs,
|
explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs,
|
||||||
FileSys::ManualContentProvider* provider,
|
FileSys::ManualContentProvider* provider,
|
||||||
QList<UISettings::GameDir>& game_dirs,
|
QVector<UISettings::GameDir>& game_dirs,
|
||||||
const CompatibilityList& compatibility_list);
|
const CompatibilityList& compatibility_list);
|
||||||
~GameListWorker() override;
|
~GameListWorker() override;
|
||||||
|
|
||||||
|
@ -76,6 +77,6 @@ private:
|
||||||
FileSys::ManualContentProvider* provider;
|
FileSys::ManualContentProvider* provider;
|
||||||
QStringList watch_list;
|
QStringList watch_list;
|
||||||
const CompatibilityList& compatibility_list;
|
const CompatibilityList& compatibility_list;
|
||||||
QList<UISettings::GameDir>& game_dirs;
|
QVector<UISettings::GameDir>& game_dirs;
|
||||||
std::atomic_bool stop_processing;
|
std::atomic_bool stop_processing;
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QVector>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
namespace UISettings {
|
namespace UISettings {
|
||||||
|
@ -70,7 +71,7 @@ struct Values {
|
||||||
QString screenshot_path;
|
QString screenshot_path;
|
||||||
QString game_dir_deprecated;
|
QString game_dir_deprecated;
|
||||||
bool game_dir_deprecated_deepscan;
|
bool game_dir_deprecated_deepscan;
|
||||||
QList<UISettings::GameDir> game_dirs;
|
QVector<UISettings::GameDir> game_dirs;
|
||||||
QStringList recent_files;
|
QStringList recent_files;
|
||||||
|
|
||||||
QString theme;
|
QString theme;
|
||||||
|
|
Loading…
Reference in a new issue