[vlmc-devel] [PATCH 1/2] RecentProjects: Use a child Settings

Hugo Beauzée-Luyssen hugo at beauzee.fr
Sun Apr 10 11:10:54 CEST 2016


> On 10 Apr 2016, at 09:26, Yikai Lu <luyikei.qmltu at gmail.com> wrote:
> 
> ---
> src/Project/RecentProjects.cpp | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/src/Project/RecentProjects.cpp b/src/Project/RecentProjects.cpp
> index 70c5a95..ec4df43 100644
> --- a/src/Project/RecentProjects.cpp
> +++ b/src/Project/RecentProjects.cpp
> @@ -30,10 +30,11 @@
> 
> RecentProjects::RecentProjects( Settings* vlmcSettings, QObject *parent )
>     : QObject(parent)
> -    , m_settings( vlmcSettings )
> +    , m_settings( new Settings )

This is lacking a delete

> {
> -	SettingValue* recentProjects = vlmcSettings->createVar( SettingValue::String, "private/RecentsProjects", "",
> +    SettingValue* recentProjects = m_settings->createVar( SettingValue::String, "private/RecentsProjects", "",
>                                                 "", "", SettingValue::Private );
> +    vlmcSettings->addSettings( "RecentProjects", *m_settings );
> 
> 	connect( recentProjects, SIGNAL( changed( QVariant ) ), this, SLOT( loadRecentProjects( QVariant ) ) );
> }
> @@ -49,7 +50,7 @@ RecentProjects::projectLoaded(const QString& projectName, const QString& project
>     while ( m_recentsProjects.count() > 15 )
>         m_recentsProjects.removeLast();
> 
> -    Core::instance()->settings()->setValue( "private/RecentsProjects", flattenProjectList() );
> +    m_settings->setValue( "private/RecentsProjects", flattenProjectList() );
> }
> 
> const RecentProjects::List&
> @@ -91,7 +92,7 @@ void
> RecentProjects::remove( const QString& projectPath )
> {
>     removeFromRecentProjects( projectPath );
> -    Core::instance()->settings()->setValue( "private/RecentsProjects", flattenProjectList() );
> +    m_settings->setValue( "private/RecentsProjects", flattenProjectList() );
> }
> 
> void
> -- 
> 1.9.1
> 
> _______________________________________________
> Vlmc-devel mailing list
> Vlmc-devel at videolan.org
> https://mailman.videolan.org/listinfo/vlmc-devel

What’s the idea behind this?



More information about the Vlmc-devel mailing list