diff options
author | ConfuSomu | 2024-06-01 18:14:55 -0400 |
---|---|---|
committer | ConfuSomu | 2024-06-01 18:16:16 -0400 |
commit | 456293a8ef286fa9db9b44bdd466a00e81c8e14f (patch) | |
tree | 84bbddc6ecefd72ee8a5166d658db279e679a749 | |
parent | 48a338b1321d9e169c73b71c01cd2f9ba00f9c53 (diff) | |
download | ActorViewer-456293a8ef286fa9db9b44bdd466a00e81c8e14f.tar ActorViewer-456293a8ef286fa9db9b44bdd466a00e81c8e14f.tar.gz ActorViewer-456293a8ef286fa9db9b44bdd466a00e81c8e14f.zip |
Present a shorter path to user in recent file list
-rw-r--r-- | src/recent_files.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/recent_files.cpp b/src/recent_files.cpp index 2382f1a..57ecb6c 100644 --- a/src/recent_files.cpp +++ b/src/recent_files.cpp @@ -1,5 +1,6 @@ #include "recent_files.h" #include <QFileInfo> +#include <QDir> RecentFiles::RecentFiles(unsigned int size, bool force_empty) : size(size) { if (not force_empty) @@ -28,7 +29,13 @@ void RecentFiles::generate_menu_actions() { if (not list.isEmpty()) { int i = 1; for (const QString& path : list) { - Action* action = new Action(QStringLiteral("&%1. %2").arg(i++).arg(QFileInfo(path).fileName())); + QFileInfo file(path); + + // Showing the parent directory's name allows knowing from which archive the file comes from + Action* action = new Action(QStringLiteral("&%1. %2").arg(i++).arg( + file.dir().dirName() + QStringLiteral("/") + file.fileName() + )); + action->file_path = path; menu->addAction(action); } |