Improvements for MRU

avoid duplicates
always put the last file loaded to top of the list
This commit is contained in:
LittleWhite 2015-08-17 22:50:52 +02:00
parent ef7eb8bc4c
commit adee93d784
2 changed files with 33 additions and 11 deletions

View file

@ -60,6 +60,24 @@ private:
void BootGame(const std::string& filename);
void ShutdownGame();
/**
* Stores the filename in the recently loaded files list.
* The new filename is stored at the beginning of the recently loaded files list.
* After inserting the new entry, duplicates are removed meaning that if
* this was inserted from \a OnMenuRecentFile(), the entry will be put on top
* and remove from its previous position.
*
* Finally, this function calls \a UpdateRecentFiles() to update the UI.
*
* @param filename the filename to store
*/
void StoreRecentFile(const QString& filename);
/**
* Updates the recent files menu.
* Menu entries are rebuilt from the configuration file.
* If there is no entry in the menu, the menu is greyed out.
*/
void UpdateRecentFiles();
void closeEvent(QCloseEvent* event) override;