[vlmc-devel] [PATCH 1/3] RecentProjects: Add QString mostRecentProjectFile()

Yikai Lu luyikei.qmltu at gmail.com
Thu Jun 30 06:43:18 CEST 2016


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

diff --git a/src/Project/RecentProjects.cpp b/src/Project/RecentProjects.cpp
index 25f43b5..75d12f1 100644
--- a/src/Project/RecentProjects.cpp
+++ b/src/Project/RecentProjects.cpp
@@ -30,6 +30,16 @@ RecentProjects::RecentProjects( Settings* vlmcSettings, QObject *parent )
                                                 "", "", SettingValue::Private );
 }
 
+QString
+RecentProjects::mostRecentProjectFile()
+{
+    auto l = toVariant().toList();
+    if ( l.size() == 0 )
+        return QStringLiteral( "" );
+    else
+        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 );
 
-- 
1.9.1



More information about the Vlmc-devel mailing list