diff options
| author | 2016-03-16 23:42:24 -0700 | |
|---|---|---|
| committer | 2016-03-16 23:42:24 -0700 | |
| commit | de7ecee51693c2319cb34689ffd5bdd398163299 (patch) | |
| tree | 00466ea8d4ef65a6ac05e9bef120c134a48225fa | |
| parent | Merge pull request #1537 from lioncash/const (diff) | |
| parent | Register ROM started through the gamelist in the list of ROM recently started (diff) | |
| download | yuzu-de7ecee51693c2319cb34689ffd5bdd398163299.tar.gz yuzu-de7ecee51693c2319cb34689ffd5bdd398163299.tar.xz yuzu-de7ecee51693c2319cb34689ffd5bdd398163299.zip | |
Merge pull request #1466 from LittleWhite-tb/gamelist-update-recent
Register ROM started through the gamelist in the list of ROM recently started
Diffstat (limited to '')
| -rw-r--r-- | src/citra_qt/main.cpp | 7 | ||||
| -rw-r--r-- | src/citra_qt/main.h | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 57adbc136..32cceaf7e 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -310,6 +310,7 @@ bool GMainWindow::LoadROM(const std::string& filename) { | |||
| 310 | 310 | ||
| 311 | void GMainWindow::BootGame(const std::string& filename) { | 311 | void GMainWindow::BootGame(const std::string& filename) { |
| 312 | LOG_INFO(Frontend, "Citra starting..."); | 312 | LOG_INFO(Frontend, "Citra starting..."); |
| 313 | StoreRecentFile(filename); // Put the filename on top of the list | ||
| 313 | 314 | ||
| 314 | if (!InitializeSystem()) | 315 | if (!InitializeSystem()) |
| 315 | return; | 316 | return; |
| @@ -374,11 +375,11 @@ void GMainWindow::ShutdownGame() { | |||
| 374 | emulation_running = false; | 375 | emulation_running = false; |
| 375 | } | 376 | } |
| 376 | 377 | ||
| 377 | void GMainWindow::StoreRecentFile(const QString& filename) | 378 | void GMainWindow::StoreRecentFile(const std::string& filename) |
| 378 | { | 379 | { |
| 379 | QSettings settings; | 380 | QSettings settings; |
| 380 | QStringList recent_files = settings.value("recentFiles").toStringList(); | 381 | QStringList recent_files = settings.value("recentFiles").toStringList(); |
| 381 | recent_files.prepend(filename); | 382 | recent_files.prepend(QString::fromStdString(filename)); |
| 382 | recent_files.removeDuplicates(); | 383 | recent_files.removeDuplicates(); |
| 383 | while (recent_files.size() > max_recent_files_item) { | 384 | while (recent_files.size() > max_recent_files_item) { |
| 384 | recent_files.removeLast(); | 385 | recent_files.removeLast(); |
| @@ -426,7 +427,6 @@ void GMainWindow::OnMenuLoadFile() { | |||
| 426 | QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), rom_path, tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)")); | 427 | QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), rom_path, tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)")); |
| 427 | if (!filename.isEmpty()) { | 428 | if (!filename.isEmpty()) { |
| 428 | settings.setValue("romsPath", QFileInfo(filename).path()); | 429 | settings.setValue("romsPath", QFileInfo(filename).path()); |
| 429 | StoreRecentFile(filename); | ||
| 430 | 430 | ||
| 431 | BootGame(filename.toLocal8Bit().data()); | 431 | BootGame(filename.toLocal8Bit().data()); |
| 432 | } | 432 | } |
| @@ -462,7 +462,6 @@ void GMainWindow::OnMenuRecentFile() { | |||
| 462 | QFileInfo file_info(filename); | 462 | QFileInfo file_info(filename); |
| 463 | if (file_info.exists()) { | 463 | if (file_info.exists()) { |
| 464 | BootGame(filename.toLocal8Bit().data()); | 464 | BootGame(filename.toLocal8Bit().data()); |
| 465 | StoreRecentFile(filename); // Put the filename on top of the list | ||
| 466 | } else { | 465 | } else { |
| 467 | // Display an error message and remove the file from the list. | 466 | // Display an error message and remove the file from the list. |
| 468 | QMessageBox::information(this, tr("File not found"), tr("File \"%1\" not found").arg(filename)); | 467 | QMessageBox::information(this, tr("File not found"), tr("File \"%1\" not found").arg(filename)); |
diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 945aea0cd..6e4e56689 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h | |||
| @@ -75,7 +75,7 @@ private: | |||
| 75 | * | 75 | * |
| 76 | * @param filename the filename to store | 76 | * @param filename the filename to store |
| 77 | */ | 77 | */ |
| 78 | void StoreRecentFile(const QString& filename); | 78 | void StoreRecentFile(const std::string& filename); |
| 79 | 79 | ||
| 80 | /** | 80 | /** |
| 81 | * Updates the recent files menu. | 81 | * Updates the recent files menu. |