[vlmc-devel] RecentProjects: Add QString mostRecentProjectFile()

Yikai Lu git at videolan.org
Thu Jun 30 14:23:03 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Thu Jun 30 13:39:38 2016 +0900| [42cb4aa52cfcb255b15a9cda052884486556ede9] | committer: Yikai Lu

RecentProjects: Add QString mostRecentProjectFile()

> https://code.videolan.org/videolan/vlmc/commit/42cb4aa52cfcb255b15a9cda052884486556ede9
---

 src/Project/RecentProjects.cpp | 9 +++++++++
 src/Project/RecentProjects.h   | 1 +
 2 files changed, 10 insertions(+)

diff --git a/src/Project/RecentProjects.cpp b/src/Project/RecentProjects.cpp
index 25f43b5..047fa3a 100644
--- a/src/Project/RecentProjects.cpp
+++ b/src/Project/RecentProjects.cpp
@@ -30,6 +30,15 @@ RecentProjects::RecentProjects( Settings* vlmcSettings, QObject *parent )
                                                 "", "", SettingValue::Private );
 }
 
+QString
+RecentProjects::mostRecentProjectFile()
+{
+    auto l = toVariant().toList();
+    if ( l.size() == 0 )
+        return QStringLiteral( "" );
+    return l[0].toMap()["file"].toString();
+}
+
 const QVariant&
 RecentProjects::toVariant() const
 {
diff --git a/src/Project/RecentProjects.h b/src/Project/RecentProjects.h
index 6c5d6b3..b031d18 100644
--- a/src/Project/RecentProjects.h
+++ b/src/Project/RecentProjects.h
@@ -36,6 +36,7 @@ class RecentProjects : public QObject
     public:
         explicit RecentProjects(Settings* vlmcSettings, QObject *parent = 0 );
 
+        QString         mostRecentProjectFile();
         const QVariant& toVariant() const;
         void            remove( const QString& projectFile );
 



More information about the Vlmc-devel mailing list