Merge pull request #4952 from FearlessTobi/backport-everything
Backport various review changes from yuzu
This commit is contained in:
commit
80c9137a02
13 changed files with 105 additions and 101 deletions
|
@ -609,7 +609,7 @@ void Config::SaveValues() {
|
|||
qt_config->beginWriteArray("gamedirs");
|
||||
for (int i = 0; i < UISettings::values.game_dirs.size(); ++i) {
|
||||
qt_config->setArrayIndex(i);
|
||||
const auto& game_dir = UISettings::values.game_dirs.at(i);
|
||||
const auto& game_dir = UISettings::values.game_dirs[i];
|
||||
WriteSetting("path", game_dir.path);
|
||||
WriteSetting("deep_scan", game_dir.deep_scan, false);
|
||||
WriteSetting("expanded", game_dir.expanded, true);
|
||||
|
|
|
@ -49,11 +49,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
|||
if (!new_bg_color.isValid()) {
|
||||
return;
|
||||
}
|
||||
bg_color = new_bg_color;
|
||||
QPixmap pixmap(ui->bg_button->size());
|
||||
pixmap.fill(bg_color);
|
||||
const QIcon color_icon(pixmap);
|
||||
ui->bg_button->setIcon(color_icon);
|
||||
UpdateBackgroundColorButton(new_bg_color);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -71,12 +67,8 @@ void ConfigureGraphics::SetConfiguration() {
|
|||
ui->toggle_linear_filter->setChecked(Settings::values.filter_mode);
|
||||
ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option));
|
||||
ui->swap_screen->setChecked(Settings::values.swap_screen);
|
||||
bg_color = QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green,
|
||||
Settings::values.bg_blue);
|
||||
QPixmap pixmap(ui->bg_button->size());
|
||||
pixmap.fill(bg_color);
|
||||
const QIcon color_icon(pixmap);
|
||||
ui->bg_button->setIcon(color_icon);
|
||||
UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green,
|
||||
Settings::values.bg_blue));
|
||||
}
|
||||
|
||||
void ConfigureGraphics::ApplyConfiguration() {
|
||||
|
@ -117,6 +109,16 @@ void ConfigureGraphics::updateShaders(bool anaglyph) {
|
|||
}
|
||||
}
|
||||
|
||||
void ConfigureGraphics::UpdateBackgroundColorButton(const QColor& color) {
|
||||
bg_color = color;
|
||||
|
||||
QPixmap pixmap(ui->bg_button->size());
|
||||
pixmap.fill(bg_color);
|
||||
|
||||
const QIcon color_icon(pixmap);
|
||||
ui->bg_button->setIcon(color_icon);
|
||||
}
|
||||
|
||||
void ConfigureGraphics::RetranslateUI() {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ public:
|
|||
void RetranslateUI();
|
||||
void SetConfiguration();
|
||||
|
||||
void UpdateBackgroundColorButton(const QColor& color);
|
||||
|
||||
std::unique_ptr<Ui::ConfigureGraphics> ui;
|
||||
QColor bg_color;
|
||||
|
||||
|
|
|
@ -99,16 +99,16 @@ void GameListSearchField::setFilterResult(int visible, int total) {
|
|||
QString("%1 %2 %3 %4").arg(visible).arg(result_of_text).arg(total).arg(result_text));
|
||||
}
|
||||
|
||||
QString GameList::getLastFilterResultItem() {
|
||||
QString GameList::getLastFilterResultItem() const {
|
||||
QStandardItem* folder;
|
||||
QStandardItem* child;
|
||||
QString file_path;
|
||||
int folderCount = item_model->rowCount();
|
||||
const int folderCount = item_model->rowCount();
|
||||
for (int i = 0; i < folderCount; ++i) {
|
||||
folder = item_model->item(i, 0);
|
||||
QModelIndex folder_index = folder->index();
|
||||
int childrenCount = folder->rowCount();
|
||||
for (int j = 0; j < childrenCount; ++j) {
|
||||
const QModelIndex folder_index = folder->index();
|
||||
const int children_count = folder->rowCount();
|
||||
for (int j = 0; j < children_count; ++j) {
|
||||
if (!tree_view->isRowHidden(j, folder_index)) {
|
||||
child = folder->child(j, 0);
|
||||
file_path = child->data(GameListItemPath::FullPathRole).toString();
|
||||
|
@ -175,7 +175,7 @@ static bool ContainsAllWords(const QString& haystack, const QString& userinput)
|
|||
|
||||
// Syncs the expanded state of Game Directories with settings to persist across sessions
|
||||
void GameList::onItemExpanded(const QModelIndex& item) {
|
||||
GameListItemType type = item.data(GameListItem::TypeRole).value<GameListItemType>();
|
||||
const auto type = item.data(GameListItem::TypeRole).value<GameListItemType>();
|
||||
if (type == GameListItemType::CustomDir || type == GameListItemType::InstalledDir ||
|
||||
type == GameListItemType::SystemDir)
|
||||
item.data(GameListDir::GameDirRole).value<UISettings::GameDir*>()->expanded =
|
||||
|
@ -184,32 +184,32 @@ void GameList::onItemExpanded(const QModelIndex& item) {
|
|||
|
||||
// Event in order to filter the gamelist after editing the searchfield
|
||||
void GameList::onTextChanged(const QString& newText) {
|
||||
int folderCount = tree_view->model()->rowCount();
|
||||
const int folderCount = tree_view->model()->rowCount();
|
||||
QString edit_filter_text = newText.toLower();
|
||||
QStandardItem* folder;
|
||||
int childrenTotal = 0;
|
||||
int children_total = 0;
|
||||
|
||||
// If the searchfield is empty every item is visible
|
||||
// Otherwise the filter gets applied
|
||||
if (edit_filter_text.isEmpty()) {
|
||||
for (int i = 0; i < folderCount; ++i) {
|
||||
folder = item_model->item(i, 0);
|
||||
QModelIndex folder_index = folder->index();
|
||||
int childrenCount = folder->rowCount();
|
||||
for (int j = 0; j < childrenCount; ++j) {
|
||||
++childrenTotal;
|
||||
const QModelIndex folder_index = folder->index();
|
||||
const int children_count = folder->rowCount();
|
||||
for (int j = 0; j < children_count; ++j) {
|
||||
++children_total;
|
||||
tree_view->setRowHidden(j, folder_index, false);
|
||||
}
|
||||
}
|
||||
search_field->setFilterResult(childrenTotal, childrenTotal);
|
||||
search_field->setFilterResult(children_total, children_total);
|
||||
} else {
|
||||
int result_count = 0;
|
||||
for (int i = 0; i < folderCount; ++i) {
|
||||
folder = item_model->item(i, 0);
|
||||
QModelIndex folder_index = folder->index();
|
||||
int childrenCount = folder->rowCount();
|
||||
for (int j = 0; j < childrenCount; ++j) {
|
||||
++childrenTotal;
|
||||
const QModelIndex folder_index = folder->index();
|
||||
const int children_count = folder->rowCount();
|
||||
for (int j = 0; j < children_count; ++j) {
|
||||
++children_total;
|
||||
const QStandardItem* child = folder->child(j, 0);
|
||||
const QString file_path =
|
||||
child->data(GameListItemPath::FullPathRole).toString().toLower();
|
||||
|
@ -231,7 +231,7 @@ void GameList::onTextChanged(const QString& newText) {
|
|||
} else {
|
||||
tree_view->setRowHidden(j, folder_index, true);
|
||||
}
|
||||
search_field->setFilterResult(result_count, childrenTotal);
|
||||
search_field->setFilterResult(result_count, children_total);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ void GameList::onUpdateThemedIcons() {
|
|||
case GameListItemType::CustomDir: {
|
||||
const UISettings::GameDir* game_dir =
|
||||
child->data(GameListDir::GameDirRole).value<UISettings::GameDir*>();
|
||||
QString icon_name = QFileInfo::exists(game_dir->path) ? "folder" : "bad_folder";
|
||||
const QString icon_name = QFileInfo::exists(game_dir->path) ? "folder" : "bad_folder";
|
||||
child->setData(QIcon::fromTheme(icon_name).pixmap(48), Qt::DecorationRole);
|
||||
break;
|
||||
}
|
||||
|
@ -353,14 +353,14 @@ void GameList::AddEntry(const QList<QStandardItem*>& entry_items, GameListDir* p
|
|||
}
|
||||
|
||||
void GameList::ValidateEntry(const QModelIndex& item) {
|
||||
auto selected = item.sibling(item.row(), 0);
|
||||
const auto selected = item.sibling(item.row(), 0);
|
||||
|
||||
switch (selected.data(GameListItem::TypeRole).value<GameListItemType>()) {
|
||||
case GameListItemType::Game: {
|
||||
QString file_path = selected.data(GameListItemPath::FullPathRole).toString();
|
||||
const QString file_path = selected.data(GameListItemPath::FullPathRole).toString();
|
||||
if (file_path.isEmpty())
|
||||
return;
|
||||
QFileInfo file_info(file_path);
|
||||
const QFileInfo file_info(file_path);
|
||||
if (!file_info.exists() || file_info.isDir())
|
||||
return;
|
||||
// Users usually want to run a different game after closing one
|
||||
|
@ -374,10 +374,10 @@ void GameList::ValidateEntry(const QModelIndex& item) {
|
|||
}
|
||||
}
|
||||
|
||||
bool GameList::isEmpty() {
|
||||
bool GameList::isEmpty() const {
|
||||
for (int i = 0; i < item_model->rowCount(); i++) {
|
||||
const QStandardItem* child = item_model->invisibleRootItem()->child(i);
|
||||
GameListItemType type = static_cast<GameListItemType>(child->type());
|
||||
const auto type = static_cast<GameListItemType>(child->type());
|
||||
if (!child->hasChildren() &&
|
||||
(type == GameListItemType::InstalledDir || type == GameListItemType::SystemDir)) {
|
||||
item_model->invisibleRootItem()->removeRow(child->row());
|
||||
|
@ -408,16 +408,13 @@ void GameList::DonePopulating(QStringList watch_list) {
|
|||
QCoreApplication::processEvents();
|
||||
}
|
||||
tree_view->setEnabled(true);
|
||||
int folderCount = tree_view->model()->rowCount();
|
||||
int childrenTotal = 0;
|
||||
const int folderCount = tree_view->model()->rowCount();
|
||||
int children_total = 0;
|
||||
for (int i = 0; i < folderCount; ++i) {
|
||||
int childrenCount = item_model->item(i, 0)->rowCount();
|
||||
for (int j = 0; j < childrenCount; ++j) {
|
||||
++childrenTotal;
|
||||
}
|
||||
children_total += item_model->item(i, 0)->rowCount();
|
||||
}
|
||||
search_field->setFilterResult(childrenTotal, childrenTotal);
|
||||
if (childrenTotal > 0) {
|
||||
search_field->setFilterResult(children_total, children_total);
|
||||
if (children_total > 0) {
|
||||
search_field->setFocus();
|
||||
}
|
||||
|
||||
|
@ -429,7 +426,7 @@ void GameList::PopupContextMenu(const QPoint& menu_location) {
|
|||
if (!item.isValid())
|
||||
return;
|
||||
|
||||
auto selected = item.sibling(item.row(), 0);
|
||||
const auto selected = item.sibling(item.row(), 0);
|
||||
QMenu context_menu;
|
||||
switch (selected.data(GameListItem::TypeRole).value<GameListItemType>()) {
|
||||
case GameListItemType::Game:
|
||||
|
@ -528,18 +525,18 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) {
|
|||
QAction* move_down = context_menu.addAction(tr(u8"\U000025bc Move Down "));
|
||||
QAction* open_directory_location = context_menu.addAction(tr("Open Directory Location"));
|
||||
|
||||
int row = selected.row();
|
||||
const int row = selected.row();
|
||||
|
||||
move_up->setEnabled(row > 0);
|
||||
move_down->setEnabled(row < item_model->rowCount() - 2);
|
||||
|
||||
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(selected.row() - 1, 0)
|
||||
.data(GameListDir::GameDirRole)
|
||||
.value<UISettings::GameDir*>()));
|
||||
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<UISettings::GameDir*>())]);
|
||||
// move the treeview items
|
||||
QList<QStandardItem*> item = item_model->takeRow(row);
|
||||
item_model->invisibleRootItem()->insertRow(row - 1, item);
|
||||
|
@ -548,13 +545,13 @@ 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(selected.row() + 1, 0)
|
||||
.data(GameListDir::GameDirRole)
|
||||
.value<UISettings::GameDir*>()));
|
||||
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<UISettings::GameDir*>())]);
|
||||
// move the treeview items
|
||||
QList<QStandardItem*> item = item_model->takeRow(row);
|
||||
const QList<QStandardItem*> item = item_model->takeRow(row);
|
||||
item_model->invisibleRootItem()->insertRow(row + 1, item);
|
||||
tree_view->setExpanded(selected, game_dir.expanded);
|
||||
});
|
||||
|
@ -609,7 +606,7 @@ QStandardItemModel* GameList::GetModel() const {
|
|||
return item_model;
|
||||
}
|
||||
|
||||
void GameList::PopulateAsync(QList<UISettings::GameDir>& game_dirs) {
|
||||
void GameList::PopulateAsync(QVector<UISettings::GameDir>& game_dirs) {
|
||||
tree_view->setEnabled(false);
|
||||
// Delete any rows that might already exist if we're repopulating
|
||||
item_model->removeRows(0, item_model->rowCount());
|
||||
|
@ -677,9 +674,7 @@ QString GameList::FindGameByProgramID(QStandardItem* current_item, u64 program_i
|
|||
}
|
||||
|
||||
GameListPlaceholder::GameListPlaceholder(GMainWindow* parent) : QWidget{parent} {
|
||||
this->main_window = parent;
|
||||
|
||||
connect(main_window, &GMainWindow::UpdateThemedIcons, this,
|
||||
connect(parent, &GMainWindow::UpdateThemedIcons, this,
|
||||
&GameListPlaceholder::onUpdateThemedIcons);
|
||||
|
||||
layout = new QVBoxLayout;
|
||||
|
@ -688,7 +683,7 @@ GameListPlaceholder::GameListPlaceholder(GMainWindow* parent) : QWidget{parent}
|
|||
layout->setAlignment(Qt::AlignCenter);
|
||||
image->setPixmap(QIcon::fromTheme("plus_folder").pixmap(200));
|
||||
|
||||
text->setText(tr("Double-click to add a new folder to the game list "));
|
||||
text->setText(tr("Double-click to add a new folder to the game list"));
|
||||
QFont font = text->font();
|
||||
font.setPointSize(20);
|
||||
text->setFont(font);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <QMenu>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QWidget>
|
||||
#include "citra_qt/compatibility_list.h"
|
||||
#include "common/common_types.h"
|
||||
|
@ -46,15 +47,15 @@ public:
|
|||
explicit GameList(GMainWindow* parent = nullptr);
|
||||
~GameList() override;
|
||||
|
||||
QString getLastFilterResultItem();
|
||||
QString getLastFilterResultItem() const;
|
||||
void clearFilter();
|
||||
void setFilterFocus();
|
||||
void setFilterVisible(bool visibility);
|
||||
void setDirectoryWatcherEnabled(bool enabled);
|
||||
bool isEmpty();
|
||||
bool isEmpty() const;
|
||||
|
||||
void LoadCompatibilityList();
|
||||
void PopulateAsync(QList<UISettings::GameDir>& game_dirs);
|
||||
void PopulateAsync(QVector<UISettings::GameDir>& game_dirs);
|
||||
|
||||
void SaveInterfaceLayout();
|
||||
void LoadInterfaceLayout();
|
||||
|
@ -73,7 +74,7 @@ signals:
|
|||
void OpenFolderRequested(u64 program_id, GameListOpenTarget target);
|
||||
void NavigateToGamedbEntryRequested(u64 program_id,
|
||||
const CompatibilityList& compatibility_list);
|
||||
void OpenDirectory(QString directory);
|
||||
void OpenDirectory(const QString& directory);
|
||||
void AddDirectory();
|
||||
void ShowList(bool show);
|
||||
void PopulatingCompleted();
|
||||
|
@ -127,7 +128,6 @@ protected:
|
|||
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
||||
|
||||
private:
|
||||
GMainWindow* main_window = nullptr;
|
||||
QVBoxLayout* layout = nullptr;
|
||||
QLabel* image = nullptr;
|
||||
QLabel* text = nullptr;
|
||||
|
|
|
@ -350,18 +350,20 @@ public:
|
|||
UISettings::GameDir* game_dir = &directory;
|
||||
setData(QVariant::fromValue(game_dir), GameDirRole);
|
||||
|
||||
int icon_size = IconSizes.at(UISettings::values.game_list_icon_size);
|
||||
const int icon_size = IconSizes.at(UISettings::values.game_list_icon_size);
|
||||
switch (dir_type) {
|
||||
case GameListItemType::InstalledDir:
|
||||
setData(QIcon::fromTheme("sd_card").pixmap(icon_size), Qt::DecorationRole);
|
||||
setData("Installed Titles", Qt::DisplayRole);
|
||||
setData(QIcon::fromTheme(QStringLiteral("sd_card")).pixmap(icon_size),
|
||||
Qt::DecorationRole);
|
||||
setData(QObject::tr("Installed Titles"), Qt::DisplayRole);
|
||||
break;
|
||||
case GameListItemType::SystemDir:
|
||||
setData(QIcon::fromTheme("chip").pixmap(icon_size), Qt::DecorationRole);
|
||||
setData("System Titles", Qt::DisplayRole);
|
||||
setData(QIcon::fromTheme(QStringLiteral("chip")).pixmap(icon_size), Qt::DecorationRole);
|
||||
setData(QObject::tr("System Titles"), Qt::DisplayRole);
|
||||
break;
|
||||
case GameListItemType::CustomDir:
|
||||
QString icon_name = QFileInfo::exists(game_dir->path) ? "folder" : "bad_folder";
|
||||
QString icon_name = QFileInfo::exists(game_dir->path) ? QStringLiteral("folder")
|
||||
: QStringLiteral("bad_folder");
|
||||
setData(QIcon::fromTheme(icon_name).pixmap(icon_size), Qt::DecorationRole);
|
||||
setData(game_dir->path, Qt::DisplayRole);
|
||||
break;
|
||||
|
@ -382,8 +384,8 @@ public:
|
|||
setData(type(), TypeRole);
|
||||
|
||||
int icon_size = IconSizes.at(UISettings::values.game_list_icon_size);
|
||||
setData(QIcon::fromTheme("plus").pixmap(icon_size), Qt::DecorationRole);
|
||||
setData("Add New Game Directory", Qt::DisplayRole);
|
||||
setData(QIcon::fromTheme(QStringLiteral("plus")).pixmap(icon_size), Qt::DecorationRole);
|
||||
setData(QObject::tr("Add New Game Directory"), Qt::DisplayRole);
|
||||
}
|
||||
|
||||
int type() const override {
|
||||
|
@ -409,9 +411,6 @@ public:
|
|||
void clear();
|
||||
void setFocus();
|
||||
|
||||
int visible;
|
||||
int total;
|
||||
|
||||
private:
|
||||
class KeyReleaseEater : public QObject {
|
||||
public:
|
||||
|
@ -425,6 +424,9 @@ private:
|
|||
// EventFilter in order to process systemkeys while editing the searchfield
|
||||
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
};
|
||||
int visible;
|
||||
int total;
|
||||
|
||||
QHBoxLayout* layout_filter = nullptr;
|
||||
QTreeView* tree_view = nullptr;
|
||||
QLabel* label_filter = nullptr;
|
||||
|
|
|
@ -26,7 +26,7 @@ bool HasSupportedFileExtension(const std::string& file_name) {
|
|||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
GameListWorker::GameListWorker(QList<UISettings::GameDir>& game_dirs,
|
||||
GameListWorker::GameListWorker(QVector<UISettings::GameDir>& game_dirs,
|
||||
const CompatibilityList& compatibility_list)
|
||||
: game_dirs(game_dirs), compatibility_list(compatibility_list) {}
|
||||
|
||||
|
@ -134,7 +134,7 @@ void GameListWorker::run() {
|
|||
"00040002";
|
||||
watch_list.append(games_path);
|
||||
watch_list.append(demos_path);
|
||||
GameListDir* game_list_dir = new GameListDir(game_dir, GameListItemType::InstalledDir);
|
||||
auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::InstalledDir);
|
||||
emit DirEntryReady({game_list_dir});
|
||||
AddFstEntriesToGameList(games_path.toStdString(), 2, game_list_dir);
|
||||
AddFstEntriesToGameList(demos_path.toStdString(), 2, game_list_dir);
|
||||
|
@ -143,12 +143,12 @@ void GameListWorker::run() {
|
|||
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)) +
|
||||
"00000000000000000000000000000000/title/00040010";
|
||||
watch_list.append(path);
|
||||
GameListDir* game_list_dir = new GameListDir(game_dir, GameListItemType::SystemDir);
|
||||
auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::SystemDir);
|
||||
emit DirEntryReady({game_list_dir});
|
||||
AddFstEntriesToGameList(path.toStdString(), 2, game_list_dir);
|
||||
} else {
|
||||
watch_list.append(game_dir.path);
|
||||
GameListDir* game_list_dir = new GameListDir(game_dir);
|
||||
auto* const game_list_dir = new GameListDir(game_dir);
|
||||
emit DirEntryReady({game_list_dir});
|
||||
AddFstEntriesToGameList(game_dir.path.toStdString(), game_dir.deep_scan ? 256 : 0,
|
||||
game_list_dir);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <QObject>
|
||||
#include <QRunnable>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include "citra_qt/compatibility_list.h"
|
||||
#include "common/common_types.h"
|
||||
|
||||
|
@ -26,7 +27,7 @@ class GameListWorker : public QObject, public QRunnable {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GameListWorker(QList<UISettings::GameDir>& game_dirs,
|
||||
GameListWorker(QVector<UISettings::GameDir>& game_dirs,
|
||||
const CompatibilityList& compatibility_list);
|
||||
~GameListWorker() override;
|
||||
|
||||
|
@ -57,6 +58,6 @@ private:
|
|||
|
||||
QStringList watch_list;
|
||||
const CompatibilityList& compatibility_list;
|
||||
QList<UISettings::GameDir>& game_dirs;
|
||||
QVector<UISettings::GameDir>& game_dirs;
|
||||
std::atomic_bool stop_processing;
|
||||
};
|
||||
|
|
|
@ -1111,18 +1111,16 @@ void GMainWindow::OnGameListNavigateToGamedbEntry(u64 program_id,
|
|||
QDesktopServices::openUrl(QUrl("https://citra-emu.org/game/" + directory));
|
||||
}
|
||||
|
||||
void GMainWindow::OnGameListOpenDirectory(QString directory) {
|
||||
void GMainWindow::OnGameListOpenDirectory(const QString& directory) {
|
||||
QString path;
|
||||
if (directory == "INSTALLED") {
|
||||
path =
|
||||
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir).c_str() +
|
||||
std::string("Nintendo "
|
||||
"3DS/00000000000000000000000000000000/"
|
||||
"00000000000000000000000000000000/title/00040000"));
|
||||
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir) +
|
||||
"Nintendo "
|
||||
"3DS/00000000000000000000000000000000/"
|
||||
"00000000000000000000000000000000/title/00040000");
|
||||
} else if (directory == "SYSTEM") {
|
||||
path =
|
||||
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir).c_str() +
|
||||
std::string("00000000000000000000000000000000/title/00040010"));
|
||||
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
|
||||
"00000000000000000000000000000000/title/00040010");
|
||||
} else {
|
||||
path = directory;
|
||||
}
|
||||
|
@ -1134,7 +1132,7 @@ void GMainWindow::OnGameListOpenDirectory(QString directory) {
|
|||
}
|
||||
|
||||
void GMainWindow::OnGameListAddDirectory() {
|
||||
QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory"));
|
||||
const QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory"));
|
||||
if (dir_path.isEmpty())
|
||||
return;
|
||||
UISettings::GameDir game_dir{dir_path, false, true};
|
||||
|
|
|
@ -161,7 +161,7 @@ private slots:
|
|||
void OnGameListOpenFolder(u64 program_id, GameListOpenTarget target);
|
||||
void OnGameListNavigateToGamedbEntry(u64 program_id,
|
||||
const CompatibilityList& compatibility_list);
|
||||
void OnGameListOpenDirectory(QString path);
|
||||
void OnGameListOpenDirectory(const QString& directory);
|
||||
void OnGameListAddDirectory();
|
||||
void OnGameListShowList(bool show);
|
||||
void OnMenuLoadFile();
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <QMetaType>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace UISettings {
|
||||
|
@ -100,7 +101,7 @@ struct Values {
|
|||
QString video_dumping_path;
|
||||
QString game_dir_deprecated;
|
||||
bool game_dir_deprecated_deepscan;
|
||||
QList<UISettings::GameDir> game_dirs;
|
||||
QVector<UISettings::GameDir> game_dirs;
|
||||
QStringList recent_files;
|
||||
QString language;
|
||||
|
||||
|
|
|
@ -33,13 +33,13 @@ PerfStats::~PerfStats() {
|
|||
return;
|
||||
}
|
||||
|
||||
std::time_t t = std::time(nullptr);
|
||||
const std::time_t t = std::time(nullptr);
|
||||
std::ostringstream stream;
|
||||
std::copy(perf_history.begin() + IgnoreFrames, perf_history.begin() + current_index,
|
||||
std::ostream_iterator<double>(stream, "\n"));
|
||||
std::string path = FileUtil::GetUserPath(FileUtil::UserPath::LogDir);
|
||||
const std::string& path = FileUtil::GetUserPath(FileUtil::UserPath::LogDir);
|
||||
// %F Date format expanded is "%Y-%m-%d"
|
||||
std::string filename =
|
||||
const std::string filename =
|
||||
fmt::format("{}/{:%F-%H-%M}_{:016X}.csv", path, *std::localtime(&t), title_id);
|
||||
FileUtil::IOFile file(filename, "w");
|
||||
file.WriteString(stream.str());
|
||||
|
@ -74,11 +74,13 @@ void PerfStats::EndGameFrame() {
|
|||
}
|
||||
|
||||
double PerfStats::GetMeanFrametime() {
|
||||
std::lock_guard lock{object_mutex};
|
||||
|
||||
if (current_index <= IgnoreFrames) {
|
||||
return 0;
|
||||
}
|
||||
double sum = std::accumulate(perf_history.begin() + IgnoreFrames,
|
||||
perf_history.begin() + current_index, 0);
|
||||
const double sum = std::accumulate(perf_history.begin() + IgnoreFrames,
|
||||
perf_history.begin() + current_index, 0);
|
||||
return sum / (current_index - IgnoreFrames);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <array>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <mutex>
|
||||
#include "common/common_types.h"
|
||||
#include "common/thread.h"
|
||||
|
|
Loading…
Reference in a new issue