early-access version 1606

This commit is contained in:
pineappleEA 2021-04-16 07:33:57 +02:00
parent 0de10206e4
commit a23d4e7b7d
3 changed files with 14 additions and 13 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 1605. This is the source code for early-access 1606.
## Legal Notice ## Legal Notice

View File

@ -85,7 +85,7 @@ void GameListSearchField::setFilterResult(int visible, int total) {
label_filter_result->setText(tr("%1 of %n result(s)", "", total).arg(visible)); label_filter_result->setText(tr("%1 of %n result(s)", "", total).arg(visible));
} }
bool GameListSearchField::SearchFieldEmpty() const { bool GameListSearchField::isEmpty() const {
return edit_filter->text().isEmpty(); return edit_filter->text().isEmpty();
} }
@ -446,7 +446,7 @@ void GameList::DonePopulating(const QStringList& watch_list) {
tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(),
UISettings::values.favorited_ids.size() == 0); UISettings::values.favorited_ids.size() == 0);
tree_view->expand(item_model->invisibleRootItem()->child(0)->index()); tree_view->expand(item_model->invisibleRootItem()->child(0)->index());
for (u64 id : UISettings::values.favorited_ids) { for (const auto id : UISettings::values.favorited_ids) {
AddFavorite(id); AddFavorite(id);
} }
@ -649,7 +649,7 @@ void GameList::AddFavoritesPopup(QMenu& context_menu) {
QAction* clear_all = context_menu.addAction(tr("Clear")); QAction* clear_all = context_menu.addAction(tr("Clear"));
connect(clear_all, &QAction::triggered, [this] { connect(clear_all, &QAction::triggered, [this] {
for (u64 id : UISettings::values.favorited_ids) { for (const auto id : UISettings::values.favorited_ids) {
RemoveFavorite(id); RemoveFavorite(id);
} }
UISettings::values.favorited_ids.clear(); UISettings::values.favorited_ids.clear();
@ -774,7 +774,7 @@ void GameList::RefreshGameDirectory() {
void GameList::ToggleFavorite(u64 program_id) { void GameList::ToggleFavorite(u64 program_id) {
if (!UISettings::values.favorited_ids.contains(program_id)) { if (!UISettings::values.favorited_ids.contains(program_id)) {
tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(),
!search_field->SearchFieldEmpty()); !search_field->isEmpty());
UISettings::values.favorited_ids.append(program_id); UISettings::values.favorited_ids.append(program_id);
AddFavorite(program_id); AddFavorite(program_id);
item_model->sort(tree_view->header()->sortIndicatorSection(), item_model->sort(tree_view->header()->sortIndicatorSection(),
@ -789,12 +789,13 @@ void GameList::ToggleFavorite(u64 program_id) {
} }
void GameList::AddFavorite(u64 program_id) { void GameList::AddFavorite(u64 program_id) {
const 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* folder = item_model->item(i);
for (int j = 0; j < folder->rowCount(); j++) { for (int j = 0; j < folder->rowCount(); j++) {
if (folder->child(j)->data(GameListItemPath::ProgramIdRole) == program_id) { if (folder->child(j)->data(GameListItemPath::ProgramIdRole).toULongLong() ==
program_id) {
QList<QStandardItem*> list; QList<QStandardItem*> list;
for (int k = 0; k < item_model->columnCount(); k++) { for (int k = 0; k < item_model->columnCount(); k++) {
list.append(folder->child(j, k)->clone()); list.append(folder->child(j, k)->clone());
@ -811,11 +812,11 @@ void GameList::AddFavorite(u64 program_id) {
} }
void GameList::RemoveFavorite(u64 program_id) { void GameList::RemoveFavorite(u64 program_id) {
const auto favorites_row = item_model->item(0); auto* favorites_row = item_model->item(0);
for (int i = 0; i < favorites_row->rowCount(); i++) { for (int i = 0; i < favorites_row->rowCount(); i++) {
const auto game = favorites_row->child(i); const auto* game = favorites_row->child(i);
if (game->data(GameListItemPath::ProgramIdRole) == program_id) { if (game->data(GameListItemPath::ProgramIdRole).toULongLong() == program_id) {
favorites_row->removeRow(i); favorites_row->removeRow(i);
return; return;
} }

View File

@ -30,7 +30,7 @@ enum class GameListItemType {
UserNandDir = QStandardItem::UserType + 4, UserNandDir = QStandardItem::UserType + 4,
SysNandDir = QStandardItem::UserType + 5, SysNandDir = QStandardItem::UserType + 5,
AddDir = QStandardItem::UserType + 6, AddDir = QStandardItem::UserType + 6,
Favorites = QStandardItem::UserType + 7 Favorites = QStandardItem::UserType + 7,
}; };
Q_DECLARE_METATYPE(GameListItemType); Q_DECLARE_METATYPE(GameListItemType);
@ -347,7 +347,7 @@ public:
explicit GameListSearchField(GameList* parent = nullptr); explicit GameListSearchField(GameList* parent = nullptr);
void setFilterResult(int visible, int total); void setFilterResult(int visible, int total);
bool SearchFieldEmpty() const; bool isEmpty() const;
void clear(); void clear();
void setFocus(); void setFocus();