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

Hugo Beauzée-Luyssen hugo at beauzee.fr
Thu Jun 30 14:03:22 CEST 2016


On 06/30/2016 06:43 AM, Yikai Lu wrote:
> ---
>  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

nitpicking: you don't need the '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 );
>
>

LGTM otherwise


More information about the Vlmc-devel mailing list