mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-11-25 16:40:34 +01:00
[meta] clang-format literally all of the Qt code (#3706)
I'm tired of dealing with this tbh Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3706 Reviewed-by: Lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
769edbfea3
commit
8678cb06eb
107 changed files with 1457 additions and 1737 deletions
|
|
@ -73,9 +73,7 @@ void GameCard::paint(QPainter* painter, const QStyleOptionViewItem& option,
|
|||
painter->restore();
|
||||
} else {
|
||||
// if there is no icon just draw a blank rect
|
||||
iconRect = QRect(cardRect.left() + padding,
|
||||
cardRect.top() + padding,
|
||||
_iconsize, _iconsize);
|
||||
iconRect = QRect(cardRect.left() + padding, cardRect.top() + padding, _iconsize, _iconsize);
|
||||
}
|
||||
|
||||
if (UISettings::values.show_game_name.GetValue()) {
|
||||
|
|
|
|||
|
|
@ -14,12 +14,10 @@ class GameCard : public QStyledItemDelegate {
|
|||
public:
|
||||
explicit GameCard(QObject* parent = nullptr);
|
||||
|
||||
void paint(QPainter *painter,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override;
|
||||
void paint(QPainter* painter, const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index) const override;
|
||||
|
||||
QSize sizeHint(const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override;
|
||||
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
||||
void setSize(const QSize& newSize, const int padding);
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -218,11 +218,13 @@ void GameList::OnTextChanged(const QString& new_text) {
|
|||
|
||||
for (int i = 0; i < row_count; ++i) {
|
||||
QStandardItem* item = item_model->item(i, 0);
|
||||
if (!item) continue;
|
||||
if (!item)
|
||||
continue;
|
||||
|
||||
children_total++;
|
||||
|
||||
const QString file_path = item->data(GameListItemPath::FullPathRole).toString().toLower();
|
||||
const QString file_path =
|
||||
item->data(GameListItemPath::FullPathRole).toString().toLower();
|
||||
const QString file_title = item->data(GameListItemPath::TitleRole).toString().toLower();
|
||||
const QString file_name = file_path.mid(file_path.lastIndexOf(QLatin1Char{'/'}) + 1) +
|
||||
QLatin1Char{' '} + file_title;
|
||||
|
|
@ -236,7 +238,8 @@ void GameList::OnTextChanged(const QString& new_text) {
|
|||
}
|
||||
search_field->setFilterResult(result_count, children_total);
|
||||
} else if (edit_filter_text.isEmpty()) {
|
||||
hide(0, UISettings::values.favorited_ids.size() == 0, item_model->invisibleRootItem()->index());
|
||||
hide(0, UISettings::values.favorited_ids.size() == 0,
|
||||
item_model->invisibleRootItem()->index());
|
||||
for (int i = 1; i < item_model->rowCount() - 1; ++i) {
|
||||
folder = item_model->item(i, 0);
|
||||
const QModelIndex folder_index = folder->index();
|
||||
|
|
@ -362,7 +365,8 @@ GameList::GameList(FileSys::VirtualFilesystem vfs_, FileSys::ManualContentProvid
|
|||
|
||||
external_watcher = new QFileSystemWatcher(this);
|
||||
ResetExternalWatcher();
|
||||
connect(external_watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshExternalContent);
|
||||
connect(external_watcher, &QFileSystemWatcher::directoryChanged, this,
|
||||
&GameList::RefreshExternalContent);
|
||||
|
||||
this->main_window = parent;
|
||||
layout = new QVBoxLayout;
|
||||
|
|
@ -471,7 +475,7 @@ bool GameList::IsTreeMode() {
|
|||
}
|
||||
|
||||
void GameList::ResetViewMode() {
|
||||
auto &setting = UISettings::values.game_list_mode;
|
||||
auto& setting = UISettings::values.game_list_mode;
|
||||
bool newTreeMode = false;
|
||||
|
||||
switch (setting.GetValue()) {
|
||||
|
|
@ -678,7 +682,7 @@ void GameList::PopupContextMenu(const QPoint& menu_location) {
|
|||
return;
|
||||
|
||||
QMenu blank_menu;
|
||||
QAction *addGameDirAction = blank_menu.addAction(tr("&Add New Game Directory"));
|
||||
QAction* addGameDirAction = blank_menu.addAction(tr("&Add New Game Directory"));
|
||||
|
||||
connect(addGameDirAction, &QAction::triggered, this, &GameList::AddDirectory);
|
||||
blank_menu.exec(m_currentView->viewport()->mapToGlobal(menu_location));
|
||||
|
|
@ -1113,8 +1117,7 @@ const QStringList GameList::supported_file_extensions = {
|
|||
QStringLiteral("nso"), QStringLiteral("nro"), QStringLiteral("nca"),
|
||||
QStringLiteral("xci"), QStringLiteral("nsp"), QStringLiteral("kip")};
|
||||
|
||||
void GameList::RefreshGameDirectory()
|
||||
{
|
||||
void GameList::RefreshGameDirectory() {
|
||||
// Reset the externals watcher whenever the game list is reloaded,
|
||||
// primarily ensures that new titles and external dirs are caught.
|
||||
ResetExternalWatcher();
|
||||
|
|
@ -1142,7 +1145,7 @@ void GameList::ResetExternalWatcher() {
|
|||
external_watcher->removePaths(watch_dirs);
|
||||
}
|
||||
|
||||
for (const std::string &dir : Settings::values.external_content_dirs) {
|
||||
for (const std::string& dir : Settings::values.external_content_dirs) {
|
||||
external_watcher->addPath(QString::fromStdString(dir));
|
||||
}
|
||||
}
|
||||
|
|
@ -1286,8 +1289,8 @@ bool GameList::eventFilter(QObject* obj, QEvent* event) {
|
|||
horizontal_scroll_target = m_currentView->horizontalScrollBar()->value();
|
||||
|
||||
horizontal_scroll_target -= deltaX;
|
||||
horizontal_scroll_target =
|
||||
qBound(0, horizontal_scroll_target, m_currentView->horizontalScrollBar()->maximum());
|
||||
horizontal_scroll_target = qBound(0, horizontal_scroll_target,
|
||||
m_currentView->horizontalScrollBar()->maximum());
|
||||
|
||||
horizontal_scroll->stop();
|
||||
horizontal_scroll->setStartValue(m_currentView->horizontalScrollBar()->value());
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@
|
|||
|
||||
#include "common/common_types.h"
|
||||
#include "core/core.h"
|
||||
#include "frontend_common/play_time_manager.h"
|
||||
#include "qt_common/config/uisettings.h"
|
||||
#include "qt_common/util/game.h"
|
||||
#include "yuzu/compatibility_list.h"
|
||||
#include "frontend_common/play_time_manager.h"
|
||||
|
||||
class QVariantAnimation;
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ signals:
|
|||
void NavigateToGamedbEntryRequested(u64 program_id,
|
||||
const CompatibilityList& compatibility_list);
|
||||
void OpenPerGameGeneralRequested(const std::string& file);
|
||||
void LinkToRyujinxRequested(const u64 &program_id);
|
||||
void LinkToRyujinxRequested(const u64& program_id);
|
||||
void OpenDirectory(const QString& directory);
|
||||
void AddDirectory();
|
||||
void ShowList(bool show);
|
||||
|
|
@ -170,8 +170,8 @@ private:
|
|||
QVBoxLayout* layout = nullptr;
|
||||
|
||||
QTreeView* tree_view = nullptr;
|
||||
QListView *list_view = nullptr;
|
||||
GameCard *m_gameCard = nullptr;
|
||||
QListView* list_view = nullptr;
|
||||
GameCard* m_gameCard = nullptr;
|
||||
|
||||
QStandardItemModel* item_model = nullptr;
|
||||
std::unique_ptr<GameListWorker> current_worker;
|
||||
|
|
@ -194,7 +194,7 @@ private:
|
|||
Core::System& system;
|
||||
|
||||
bool m_isTreeMode = true;
|
||||
QAbstractItemView *m_currentView = tree_view;
|
||||
QAbstractItemView* m_currentView = tree_view;
|
||||
};
|
||||
|
||||
class GameListPlaceholder : public QWidget {
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@
|
|||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QObject>
|
||||
#include <QRegularExpression>
|
||||
#include <QStandardItem>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/logging/log.h"
|
||||
|
|
@ -77,7 +77,7 @@ public:
|
|||
GameListItemPath() = default;
|
||||
GameListItemPath(const QString& game_path, const std::vector<u8>& picture_data,
|
||||
const QString& game_name, const QString& game_type, u64 program_id,
|
||||
u64 play_time, const QString &patch_versions) {
|
||||
u64 play_time, const QString& patch_versions) {
|
||||
setData(type(), TypeRole);
|
||||
setData(game_path, FullPathRole);
|
||||
setData(game_name, TitleRole);
|
||||
|
|
@ -85,14 +85,15 @@ public:
|
|||
setData(game_type, FileTypeRole);
|
||||
|
||||
const auto readable_play_time =
|
||||
play_time > 0
|
||||
? QObject::tr("Play Time: %1").arg(QString::fromStdString(PlayTime::PlayTimeManager::GetReadablePlayTime(play_time)))
|
||||
: QObject::tr("Never Played");
|
||||
play_time > 0 ? QObject::tr("Play Time: %1")
|
||||
.arg(QString::fromStdString(
|
||||
PlayTime::PlayTimeManager::GetReadablePlayTime(play_time)))
|
||||
: QObject::tr("Never Played");
|
||||
|
||||
const auto enabled_update = [patch_versions]() -> QString {
|
||||
const QStringList lines = patch_versions.split(QLatin1Char('\n'));
|
||||
const QRegularExpression regex{QStringLiteral(R"(^Update \(([0-9\.]+)\))")};
|
||||
for (const QString &line : std::as_const(lines)) {
|
||||
for (const QString& line : std::as_const(lines)) {
|
||||
const auto match = regex.match(line);
|
||||
if (match.hasMatch() && match.hasCaptured(1))
|
||||
return QObject::tr("Version: %1").arg(match.captured(1));
|
||||
|
|
@ -100,9 +101,7 @@ public:
|
|||
return QObject::tr("Version: 1.0.0");
|
||||
}();
|
||||
|
||||
const auto tooltip = QStringLiteral("%1\n%2").arg(
|
||||
readable_play_time,
|
||||
enabled_update);
|
||||
const auto tooltip = QStringLiteral("%1\n%2").arg(readable_play_time, enabled_update);
|
||||
|
||||
setData(tooltip, Qt::ToolTipRole);
|
||||
|
||||
|
|
@ -145,7 +144,7 @@ public:
|
|||
return row1.toLower();
|
||||
}
|
||||
|
||||
// None
|
||||
// None
|
||||
if (row2_id == 4) {
|
||||
return row1;
|
||||
}
|
||||
|
|
@ -163,7 +162,6 @@ public:
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return GameListItem::data(role);
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@
|
|||
#include "core/file_sys/romfs.h"
|
||||
#include "core/file_sys/submission_package.h"
|
||||
#include "core/loader/loader.h"
|
||||
#include "qt_common/config/uisettings.h"
|
||||
#include "yuzu/compatibility_list.h"
|
||||
#include "yuzu/game/game_list.h"
|
||||
#include "yuzu/game/game_list_p.h"
|
||||
#include "yuzu/game/game_list_worker.h"
|
||||
#include "qt_common/config/uisettings.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
@ -198,26 +198,24 @@ QString FormatPatchNameVersions(const FileSys::PatchManager& patch_manager,
|
|||
return out;
|
||||
}
|
||||
|
||||
QList<QStandardItem*> MakeGameListEntry(const std::string& path,
|
||||
const std::string& name,
|
||||
const std::size_t size,
|
||||
const std::vector<u8>& icon,
|
||||
Loader::AppLoader& loader,
|
||||
u64 program_id,
|
||||
QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::string& name,
|
||||
const std::size_t size, const std::vector<u8>& icon,
|
||||
Loader::AppLoader& loader, u64 program_id,
|
||||
const CompatibilityList& compatibility_list,
|
||||
const PlayTime::PlayTimeManager& play_time_manager,
|
||||
const FileSys::PatchManager& patch)
|
||||
{
|
||||
const FileSys::PatchManager& patch) {
|
||||
auto const it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
|
||||
// The game list uses 99 as compatibility number for untested games
|
||||
QString compatibility = it != compatibility_list.end() ? it->second.first : QStringLiteral("99");
|
||||
QString compatibility =
|
||||
it != compatibility_list.end() ? it->second.first : QStringLiteral("99");
|
||||
|
||||
auto const file_type = loader.GetFileType();
|
||||
auto const file_type_string = QString::fromStdString(Loader::GetFileTypeString(file_type));
|
||||
|
||||
QString patch_versions = GetGameListCachedObject(fmt::format("{:016X}", patch.GetTitleID()), "pv.txt", [&patch, &loader] {
|
||||
return FormatPatchNameVersions(patch, loader, loader.IsRomFSUpdatable());
|
||||
});
|
||||
QString patch_versions = GetGameListCachedObject(
|
||||
fmt::format("{:016X}", patch.GetTitleID()), "pv.txt", [&patch, &loader] {
|
||||
return FormatPatchNameVersions(patch, loader, loader.IsRomFSUpdatable());
|
||||
});
|
||||
|
||||
u64 play_time = play_time_manager.GetPlayTime(program_id);
|
||||
return QList<QStandardItem*>{
|
||||
|
|
@ -238,13 +236,9 @@ GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs_,
|
|||
const CompatibilityList& compatibility_list_,
|
||||
const PlayTime::PlayTimeManager& play_time_manager_,
|
||||
Core::System& system_)
|
||||
: vfs{std::move(vfs_)}
|
||||
, provider{provider_}
|
||||
, game_dirs{game_dirs_}
|
||||
, compatibility_list{compatibility_list_}
|
||||
, play_time_manager{play_time_manager_}
|
||||
, system{system_}
|
||||
{
|
||||
: vfs{std::move(vfs_)}, provider{provider_}, game_dirs{game_dirs_},
|
||||
compatibility_list{compatibility_list_}, play_time_manager{play_time_manager_},
|
||||
system{system_} {
|
||||
// We want the game list to manage our lifetime.
|
||||
setAutoDelete(false);
|
||||
}
|
||||
|
|
@ -338,15 +332,8 @@ void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
|
|||
GetMetadataFromControlNCA(patch, *control, icon, name);
|
||||
}
|
||||
|
||||
auto entry = MakeGameListEntry(file->GetFullPath(),
|
||||
name,
|
||||
file->GetSize(),
|
||||
icon,
|
||||
*loader,
|
||||
program_id,
|
||||
compatibility_list,
|
||||
play_time_manager,
|
||||
patch);
|
||||
auto entry = MakeGameListEntry(file->GetFullPath(), name, file->GetSize(), icon, *loader,
|
||||
program_id, compatibility_list, play_time_manager, patch);
|
||||
RecordEvent([=](GameList* game_list) { game_list->AddEntry(entry, parent_dir); });
|
||||
}
|
||||
}
|
||||
|
|
@ -424,15 +411,9 @@ void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_pa
|
|||
const FileSys::PatchManager patch{id, system.GetFileSystemController(),
|
||||
system.GetContentProvider()};
|
||||
|
||||
auto entry = MakeGameListEntry(physical_name,
|
||||
name,
|
||||
Common::FS::GetSize(physical_name),
|
||||
icon,
|
||||
*loader,
|
||||
id,
|
||||
compatibility_list,
|
||||
play_time_manager,
|
||||
patch);
|
||||
auto entry = MakeGameListEntry(
|
||||
physical_name, name, Common::FS::GetSize(physical_name), icon, *loader,
|
||||
id, compatibility_list, play_time_manager, patch);
|
||||
|
||||
RecordEvent(
|
||||
[=](GameList* game_list) { game_list->AddEntry(entry, parent_dir); });
|
||||
|
|
@ -447,15 +428,9 @@ void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_pa
|
|||
const FileSys::PatchManager patch{program_id, system.GetFileSystemController(),
|
||||
system.GetContentProvider()};
|
||||
|
||||
auto entry = MakeGameListEntry(physical_name,
|
||||
name,
|
||||
Common::FS::GetSize(physical_name),
|
||||
icon,
|
||||
*loader,
|
||||
program_id,
|
||||
compatibility_list,
|
||||
play_time_manager,
|
||||
patch);
|
||||
auto entry = MakeGameListEntry(
|
||||
physical_name, name, Common::FS::GetSize(physical_name), icon, *loader,
|
||||
program_id, compatibility_list, play_time_manager, patch);
|
||||
|
||||
RecordEvent(
|
||||
[=](GameList* game_list) { game_list->AddEntry(entry, parent_dir); });
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
#include "common/thread.h"
|
||||
#include "core/file_sys/registered_cache.h"
|
||||
#include "frontend_common/play_time_manager.h"
|
||||
#include "qt_common/config/uisettings.h"
|
||||
#include "yuzu/compatibility_list.h"
|
||||
#include "frontend_common/play_time_manager.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue