Skip to content
Snippets Groups Projects
Commit de7ecee5 authored by Yuri Kunde Schlesner's avatar Yuri Kunde Schlesner
Browse files

Merge pull request #1466 from LittleWhite-tb/gamelist-update-recent

Register ROM started through the gamelist in the list of ROM recently started
parents 0c0fb463 5912c9c3
No related branches found
No related tags found
No related merge requests found
...@@ -310,6 +310,7 @@ bool GMainWindow::LoadROM(const std::string& filename) { ...@@ -310,6 +310,7 @@ bool GMainWindow::LoadROM(const std::string& filename) {
void GMainWindow::BootGame(const std::string& filename) { void GMainWindow::BootGame(const std::string& filename) {
LOG_INFO(Frontend, "Citra starting..."); LOG_INFO(Frontend, "Citra starting...");
StoreRecentFile(filename); // Put the filename on top of the list
if (!InitializeSystem()) if (!InitializeSystem())
return; return;
...@@ -374,11 +375,11 @@ void GMainWindow::ShutdownGame() { ...@@ -374,11 +375,11 @@ void GMainWindow::ShutdownGame() {
emulation_running = false; emulation_running = false;
} }
void GMainWindow::StoreRecentFile(const QString& filename) void GMainWindow::StoreRecentFile(const std::string& filename)
{ {
QSettings settings; QSettings settings;
QStringList recent_files = settings.value("recentFiles").toStringList(); QStringList recent_files = settings.value("recentFiles").toStringList();
recent_files.prepend(filename); recent_files.prepend(QString::fromStdString(filename));
recent_files.removeDuplicates(); recent_files.removeDuplicates();
while (recent_files.size() > max_recent_files_item) { while (recent_files.size() > max_recent_files_item) {
recent_files.removeLast(); recent_files.removeLast();
...@@ -426,7 +427,6 @@ void GMainWindow::OnMenuLoadFile() { ...@@ -426,7 +427,6 @@ void GMainWindow::OnMenuLoadFile() {
QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), rom_path, tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)")); QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), rom_path, tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)"));
if (!filename.isEmpty()) { if (!filename.isEmpty()) {
settings.setValue("romsPath", QFileInfo(filename).path()); settings.setValue("romsPath", QFileInfo(filename).path());
StoreRecentFile(filename);
BootGame(filename.toLocal8Bit().data()); BootGame(filename.toLocal8Bit().data());
} }
...@@ -462,7 +462,6 @@ void GMainWindow::OnMenuRecentFile() { ...@@ -462,7 +462,6 @@ void GMainWindow::OnMenuRecentFile() {
QFileInfo file_info(filename); QFileInfo file_info(filename);
if (file_info.exists()) { if (file_info.exists()) {
BootGame(filename.toLocal8Bit().data()); BootGame(filename.toLocal8Bit().data());
StoreRecentFile(filename); // Put the filename on top of the list
} else { } else {
// Display an error message and remove the file from the list. // Display an error message and remove the file from the list.
QMessageBox::information(this, tr("File not found"), tr("File \"%1\" not found").arg(filename)); QMessageBox::information(this, tr("File not found"), tr("File \"%1\" not found").arg(filename));
......
...@@ -75,7 +75,7 @@ private: ...@@ -75,7 +75,7 @@ private:
* *
* @param filename the filename to store * @param filename the filename to store
*/ */
void StoreRecentFile(const QString& filename); void StoreRecentFile(const std::string& filename);
/** /**
* Updates the recent files menu. * Updates the recent files menu.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment