forked from suyu/suyu
feat: Reduced clutter on game list
This commit is contained in:
parent
45eac175db
commit
60d62a9277
7 changed files with 33 additions and 56 deletions
|
@ -611,7 +611,6 @@ struct Values {
|
||||||
Category::Network};
|
Category::Network};
|
||||||
|
|
||||||
// WebService
|
// WebService
|
||||||
Setting<bool> enable_telemetry{linkage, false, "enable_telemetry", Category::WebService};
|
|
||||||
Setting<std::string> web_api_url{linkage, "http://74.113.97.71:3000", "web_api_url",
|
Setting<std::string> web_api_url{linkage, "http://74.113.97.71:3000", "web_api_url",
|
||||||
Category::WebService};
|
Category::WebService};
|
||||||
Setting<std::string> suyu_username{linkage, std::string(), "suyu_username",
|
Setting<std::string> suyu_username{linkage, std::string(), "suyu_username",
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
// Modified by palfaiate on <2024/03/07>
|
// Modified by palfaiate on <2024/03/07>
|
||||||
|
|
||||||
#include <regex>
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
@ -413,6 +412,10 @@ void GameList::AddEntry(const QList<QStandardItem*>& entry_items, GameListDir* p
|
||||||
parent->appendRow(entry_items);
|
parent->appendRow(entry_items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameList::AddRootEntry(const QList<QStandardItem*>& entry_items) {
|
||||||
|
item_model->invisibleRootItem()->appendRow(entry_items);
|
||||||
|
}
|
||||||
|
|
||||||
void GameList::ValidateEntry(const QModelIndex& item) {
|
void GameList::ValidateEntry(const QModelIndex& item) {
|
||||||
const auto selected = item.sibling(item.row(), 0);
|
const auto selected = item.sibling(item.row(), 0);
|
||||||
|
|
||||||
|
@ -468,7 +471,7 @@ bool GameList::IsEmpty() const {
|
||||||
void GameList::DonePopulating(const QStringList& watch_list) {
|
void GameList::DonePopulating(const QStringList& watch_list) {
|
||||||
emit ShowList(!IsEmpty());
|
emit ShowList(!IsEmpty());
|
||||||
|
|
||||||
item_model->invisibleRootItem()->appendRow(new GameListAddDir());
|
// item_model->invisibleRootItem()->appendRow(new GameListAddDir());
|
||||||
|
|
||||||
// Add favorites row
|
// Add favorites row
|
||||||
item_model->invisibleRootItem()->insertRow(0, new GameListFavorites());
|
item_model->invisibleRootItem()->insertRow(0, new GameListFavorites());
|
||||||
|
@ -887,22 +890,21 @@ void GameList::AddFavorite(u64 program_id) {
|
||||||
auto* favorites_row = item_model->item(0);
|
auto* favorites_row = item_model->item(0);
|
||||||
|
|
||||||
for (int i = 1; i < item_model->rowCount() - 1; i++) {
|
for (int i = 1; i < item_model->rowCount() - 1; i++) {
|
||||||
const auto* folder = item_model->item(i);
|
const auto* game = item_model->item(i);
|
||||||
for (int j = 0; j < folder->rowCount(); j++) {
|
if (game->data(GameListItemPath::ProgramIdRole).toULongLong() != program_id) {
|
||||||
if (folder->child(j)->data(GameListItemPath::ProgramIdRole).toULongLong() ==
|
continue;
|
||||||
program_id) {
|
|
||||||
QList<QStandardItem*> list;
|
|
||||||
for (int k = 0; k < COLUMN_COUNT; k++) {
|
|
||||||
list.append(folder->child(j, k)->clone());
|
|
||||||
}
|
|
||||||
list[0]->setData(folder->child(j)->data(GameListItem::SortRole),
|
|
||||||
GameListItem::SortRole);
|
|
||||||
list[0]->setText(folder->child(j)->data(Qt::DisplayRole).toString());
|
|
||||||
|
|
||||||
favorites_row->appendRow(list);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<QStandardItem*> list;
|
||||||
|
for (int j = 0; j < COLUMN_COUNT; j++) {
|
||||||
|
list.append(item_model->item(i, j)->clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
list[0]->setData(game->data(GameListItem::SortRole), GameListItem::SortRole);
|
||||||
|
list[0]->setText(game->data(Qt::DisplayRole).toString());
|
||||||
|
|
||||||
|
favorites_row->appendRow(list);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,7 @@ private:
|
||||||
|
|
||||||
void AddDirEntry(GameListDir* entry_items);
|
void AddDirEntry(GameListDir* entry_items);
|
||||||
void AddEntry(const QList<QStandardItem*>& entry_items, GameListDir* parent);
|
void AddEntry(const QList<QStandardItem*>& entry_items, GameListDir* parent);
|
||||||
|
void AddRootEntry(const QList<QStandardItem*>& entry_items);
|
||||||
void DonePopulating(const QStringList& watch_list);
|
void DonePopulating(const QStringList& watch_list);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -234,8 +234,8 @@ GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs_,
|
||||||
const PlayTime::PlayTimeManager& play_time_manager_,
|
const PlayTime::PlayTimeManager& play_time_manager_,
|
||||||
Core::System& system_)
|
Core::System& system_)
|
||||||
: vfs{std::move(vfs_)}, provider{provider_}, game_dirs{game_dirs_},
|
: vfs{std::move(vfs_)}, provider{provider_}, game_dirs{game_dirs_},
|
||||||
compatibility_list{compatibility_list_}, play_time_manager{play_time_manager_}, system{
|
compatibility_list{compatibility_list_}, play_time_manager{play_time_manager_},
|
||||||
system_} {
|
system{system_} {
|
||||||
// We want the game list to manage our lifetime.
|
// We want the game list to manage our lifetime.
|
||||||
setAutoDelete(false);
|
setAutoDelete(false);
|
||||||
}
|
}
|
||||||
|
@ -330,13 +330,13 @@ void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
|
||||||
|
|
||||||
auto entry = MakeGameListEntry(file->GetFullPath(), name, file->GetSize(), icon, *loader,
|
auto entry = MakeGameListEntry(file->GetFullPath(), name, file->GetSize(), icon, *loader,
|
||||||
program_id, compatibility_list, play_time_manager, patch);
|
program_id, compatibility_list, play_time_manager, patch);
|
||||||
RecordEvent([=](GameList* game_list) { game_list->AddEntry(entry, parent_dir); });
|
RecordEvent([=](GameList* game_list) { game_list->AddRootEntry(entry); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_path, bool deep_scan,
|
void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_path, bool deep_scan,
|
||||||
GameListDir* parent_dir) {
|
GameListDir* parent_dir) {
|
||||||
const auto callback = [this, target, parent_dir](const std::filesystem::path& path) -> bool {
|
const auto callback = [this, target](const std::filesystem::path& path) -> bool {
|
||||||
if (stop_requested) {
|
if (stop_requested) {
|
||||||
// Breaks the callback loop.
|
// Breaks the callback loop.
|
||||||
return false;
|
return false;
|
||||||
|
@ -408,8 +408,7 @@ void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_pa
|
||||||
physical_name, name, Common::FS::GetSize(physical_name), icon, *loader,
|
physical_name, name, Common::FS::GetSize(physical_name), icon, *loader,
|
||||||
id, compatibility_list, play_time_manager, patch);
|
id, compatibility_list, play_time_manager, patch);
|
||||||
|
|
||||||
RecordEvent(
|
RecordEvent([=](GameList* game_list) { game_list->AddRootEntry(entry); });
|
||||||
[=](GameList* game_list) { game_list->AddEntry(entry, parent_dir); });
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::vector<u8> icon;
|
std::vector<u8> icon;
|
||||||
|
@ -425,8 +424,7 @@ void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_pa
|
||||||
physical_name, name, Common::FS::GetSize(physical_name), icon, *loader,
|
physical_name, name, Common::FS::GetSize(physical_name), icon, *loader,
|
||||||
program_id, compatibility_list, play_time_manager, patch);
|
program_id, compatibility_list, play_time_manager, patch);
|
||||||
|
|
||||||
RecordEvent(
|
RecordEvent([=](GameList* game_list) { game_list->AddRootEntry(entry); });
|
||||||
[=](GameList* game_list) { game_list->AddEntry(entry, parent_dir); });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (is_dir) {
|
} else if (is_dir) {
|
||||||
|
@ -448,9 +446,11 @@ void GameListWorker::run() {
|
||||||
watch_list.clear();
|
watch_list.clear();
|
||||||
provider->ClearAllEntries();
|
provider->ClearAllEntries();
|
||||||
|
|
||||||
|
/*
|
||||||
const auto DirEntryReady = [&](GameListDir* game_list_dir) {
|
const auto DirEntryReady = [&](GameListDir* game_list_dir) {
|
||||||
RecordEvent([=](GameList* game_list) { game_list->AddDirEntry(game_list_dir); });
|
RecordEvent([=](GameList* game_list) { game_list->AddDirEntry(game_list_dir); });
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
for (UISettings::GameDir& game_dir : game_dirs) {
|
for (UISettings::GameDir& game_dir : game_dirs) {
|
||||||
if (stop_requested) {
|
if (stop_requested) {
|
||||||
|
@ -459,20 +459,20 @@ void GameListWorker::run() {
|
||||||
|
|
||||||
if (game_dir.path == std::string("SDMC")) {
|
if (game_dir.path == std::string("SDMC")) {
|
||||||
auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::SdmcDir);
|
auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::SdmcDir);
|
||||||
DirEntryReady(game_list_dir);
|
// DirEntryReady(game_list_dir);
|
||||||
AddTitlesToGameList(game_list_dir);
|
AddTitlesToGameList(game_list_dir);
|
||||||
} else if (game_dir.path == std::string("UserNAND")) {
|
} else if (game_dir.path == std::string("UserNAND")) {
|
||||||
auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::UserNandDir);
|
auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::UserNandDir);
|
||||||
DirEntryReady(game_list_dir);
|
// DirEntryReady(game_list_dir);
|
||||||
AddTitlesToGameList(game_list_dir);
|
AddTitlesToGameList(game_list_dir);
|
||||||
} else if (game_dir.path == std::string("SysNAND")) {
|
} else if (game_dir.path == std::string("SysNAND")) {
|
||||||
auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::SysNandDir);
|
auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::SysNandDir);
|
||||||
DirEntryReady(game_list_dir);
|
// DirEntryReady(game_list_dir);
|
||||||
AddTitlesToGameList(game_list_dir);
|
AddTitlesToGameList(game_list_dir);
|
||||||
} else {
|
} else {
|
||||||
watch_list.append(QString::fromStdString(game_dir.path));
|
watch_list.append(QString::fromStdString(game_dir.path));
|
||||||
auto* const game_list_dir = new GameListDir(game_dir);
|
auto* const game_list_dir = new GameListDir(game_dir);
|
||||||
DirEntryReady(game_list_dir);
|
// DirEntryReady(game_list_dir);
|
||||||
ScanFileSystem(ScanTarget::FillManualContentProvider, game_dir.path, game_dir.deep_scan,
|
ScanFileSystem(ScanTarget::FillManualContentProvider, game_dir.path, game_dir.deep_scan,
|
||||||
game_list_dir);
|
game_list_dir);
|
||||||
ScanFileSystem(ScanTarget::PopulateGameList, game_dir.path, game_dir.deep_scan,
|
ScanFileSystem(ScanTarget::PopulateGameList, game_dir.path, game_dir.deep_scan,
|
||||||
|
|
|
@ -186,28 +186,9 @@ constexpr size_t CopyBufferSize = 1_MiB;
|
||||||
* user. This is 32-bits - if we have more than 32 callouts, we should retire and recycle old ones.
|
* user. This is 32-bits - if we have more than 32 callouts, we should retire and recycle old ones.
|
||||||
*/
|
*/
|
||||||
enum class CalloutFlag : uint32_t {
|
enum class CalloutFlag : uint32_t {
|
||||||
Telemetry = 0x1,
|
|
||||||
DRDDeprecation = 0x2,
|
DRDDeprecation = 0x2,
|
||||||
};
|
};
|
||||||
|
|
||||||
void GMainWindow::ShowTelemetryCallout() {
|
|
||||||
if (UISettings::values.callout_flags.GetValue() &
|
|
||||||
static_cast<uint32_t>(CalloutFlag::Telemetry)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UISettings::values.callout_flags =
|
|
||||||
UISettings::values.callout_flags.GetValue() | static_cast<uint32_t>(CalloutFlag::Telemetry);
|
|
||||||
const QString telemetry_message =
|
|
||||||
tr("<a href='https://suyu.dev/help/feature/telemetry/'>Anonymous "
|
|
||||||
"data is collected</a> to help improve suyu. "
|
|
||||||
"<br/><br/>Would you like to share your usage data with us?");
|
|
||||||
if (!question(this, tr("Telemetry"), telemetry_message)) {
|
|
||||||
Settings::values.enable_telemetry = false;
|
|
||||||
system->ApplySettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const int GMainWindow::max_recent_files_item;
|
const int GMainWindow::max_recent_files_item;
|
||||||
|
|
||||||
static void RemoveCachedContents() {
|
static void RemoveCachedContents() {
|
||||||
|
@ -415,9 +396,6 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk
|
||||||
game_list->LoadCompatibilityList();
|
game_list->LoadCompatibilityList();
|
||||||
game_list->PopulateAsync(UISettings::values.game_dirs);
|
game_list->PopulateAsync(UISettings::values.game_dirs);
|
||||||
|
|
||||||
// Show one-time "callout" messages to the user
|
|
||||||
ShowTelemetryCallout();
|
|
||||||
|
|
||||||
// make sure menubar has the arrow cursor instead of inheriting from this
|
// make sure menubar has the arrow cursor instead of inheriting from this
|
||||||
ui->menubar->setCursor(QCursor());
|
ui->menubar->setCursor(QCursor());
|
||||||
statusBar()->setCursor(QCursor());
|
statusBar()->setCursor(QCursor());
|
||||||
|
@ -3606,8 +3584,6 @@ void GMainWindow::OnConfigure() {
|
||||||
|
|
||||||
SetDefaultUIGeometry();
|
SetDefaultUIGeometry();
|
||||||
RestoreUIState();
|
RestoreUIState();
|
||||||
|
|
||||||
ShowTelemetryCallout();
|
|
||||||
}
|
}
|
||||||
InitializeHotkeys();
|
InitializeHotkeys();
|
||||||
|
|
||||||
|
|
|
@ -275,7 +275,6 @@ private:
|
||||||
void BootGameFromList(const QString& filename, StartGameType with_config);
|
void BootGameFromList(const QString& filename, StartGameType with_config);
|
||||||
void ShutdownGame();
|
void ShutdownGame();
|
||||||
|
|
||||||
void ShowTelemetryCallout();
|
|
||||||
void SetDiscordEnabled(bool state);
|
void SetDiscordEnabled(bool state);
|
||||||
void LoadAmiibo(const QString& filename);
|
void LoadAmiibo(const QString& filename);
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1280</width>
|
<width>1280</width>
|
||||||
<height>22</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menu_File">
|
<widget class="QMenu" name="menu_File">
|
||||||
|
|
Loading…
Reference in a new issue