GUI: fix recent entry duplication

This commit is contained in:
Nekotekina 2017-07-12 17:22:55 +03:00
parent 3cd4256b9e
commit f7472d59aa
3 changed files with 11 additions and 5 deletions

View File

@ -210,6 +210,11 @@ public:
return m_elf_path;
}
const std::string& GetBoot() const
{
return m_path;
}
const std::string& GetTitleID() const
{
return m_title_id;

View File

@ -376,6 +376,7 @@ void game_list_frame::Refresh(bool fromDrive)
for (auto pair : YAML::Load(fs::file{fs::get_config_dir() + "/games.yml", fs::read + fs::create}.to_string()))
{
path_list.push_back(pair.second.Scalar());
path_list.back().resize(path_list.back().find_last_not_of('/') + 1);
}
// std::set is used to remove duplicates from the list
@ -563,7 +564,7 @@ void game_list_frame::doubleClickedSlot(const QModelIndex& index)
else
{
LOG_SUCCESS(LOADER, "Boot from gamelist per doubleclick: done");
RequestAddRecentGame(q_string_pair(qstr(m_game_data[i].info.path), qstr("[" + m_game_data[i].info.serial + "] " + m_game_data[i].info.name)));
RequestAddRecentGame(q_string_pair(qstr(Emu.GetBoot()), qstr("[" + m_game_data[i].info.serial + "] " + m_game_data[i].info.name)));
}
}
else
@ -696,7 +697,7 @@ void game_list_frame::Boot(int row)
else
{
LOG_SUCCESS(LOADER, "Boot from gamelist per Boot: done");
RequestAddRecentGame(q_string_pair(qstr(m_game_data[row].info.path), qstr("[" + m_game_data[row].info.serial + "] " + m_game_data[row].info.name)));
RequestAddRecentGame(q_string_pair(qstr(Emu.GetBoot()), qstr("[" + m_game_data[row].info.serial + "] " + m_game_data[row].info.name)));
}
}

View File

@ -239,7 +239,7 @@ void main_window::BootElf()
LOG_SUCCESS(LOADER, "(S)ELF: boot done.");
const std::string serial = Emu.GetTitleID().empty() ? "" : "[" + Emu.GetTitleID() + "] ";
AddRecentAction(q_string_pair(qstr(path), qstr(serial + Emu.GetTitle())));
AddRecentAction(q_string_pair(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle())));
}
}
@ -275,7 +275,7 @@ void main_window::BootGame()
LOG_SUCCESS(LOADER, "Boot Game: boot done.");
const std::string serial = Emu.GetTitleID().empty() ? "" : "[" + Emu.GetTitleID() + "] ";
AddRecentAction(q_string_pair(qstr(path), qstr(serial + Emu.GetTitle())));
AddRecentAction(q_string_pair(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle())));
}
}
@ -790,7 +790,7 @@ void main_window::BootRecentAction(const QAction* act)
else
{
LOG_SUCCESS(LOADER, "Boot from Recent List: done");
AddRecentAction(q_string_pair(pth, nam));
AddRecentAction(q_string_pair(qstr(Emu.GetBoot()), nam));
}
};