[vlc-devel] [PATCH] Fixing recents not updating with cli
Jean-Baptiste Kempf
jb at videolan.org
Wed Nov 20 17:16:23 CET 2013
On 19 Nov, Gal Vinograd wrote :
> Recents playlist is now updating with command line arguments,
> and decoupled from the qt4 module
> ---
> include/vlc_playlist.h | 12 +++
> .../gui/qt4/components/playlist/standardpanel.cpp | 4 +-
> modules/gui/qt4/dialogs/open.cpp | 2 +-
> modules/gui/qt4/dialogs_provider.cpp | 23 ++---
> modules/gui/qt4/main_interface.cpp | 2 +-
> modules/gui/qt4/recents.cpp | 101 +++++++++------------
> modules/gui/qt4/recents.hpp | 4 +
> src/libvlccore.sym | 2 +
> src/playlist/engine.c | 13 +++
> src/playlist/item.c | 6 ++
> src/playlist/loadsave.c | 37 ++++----
> src/playlist/playlist_internal.h | 4 -
> src/playlist/tree.c | 28 ++++++
Please split src and gui in 2 patches.
> --- a/modules/gui/qt4/components/playlist/standardpanel.cpp
> +++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
> @@ -351,7 +351,7 @@ void StandardPLPanel::popupAction( QAction *action )
> action->setData( QVariant::fromValue( a ) );
> if ( model->action( action, list ) )
> foreach( const QString &file, a.uris )
> - RecentsMRL::getInstance( p_intf )->addRecent( file );
> + RecentsMRL::getInstance( p_intf )->refresh();
> break;
>
> case VLCModelSubInterface::ACTION_ENQUEUEDIR:
> @@ -372,7 +372,7 @@ void StandardPLPanel::popupAction( QAction *action )
> action->setData( QVariant::fromValue( a ) );
> if ( model->action( action, list ) )
> foreach( const QString &file, a.uris )
> - RecentsMRL::getInstance( p_intf )->addRecent( file );
> + RecentsMRL::getInstance( p_intf )->refresh();
> break;
>
> default:
> diff --git a/modules/gui/qt4/dialogs/open.cpp b/modules/gui/qt4/dialogs/open.cpp
> index a10dfac..65da1cd 100644
> --- a/modules/gui/qt4/dialogs/open.cpp
> +++ b/modules/gui/qt4/dialogs/open.cpp
> @@ -405,7 +405,7 @@ void OpenDialog::enqueue( bool b_enqueue )
> vlc_gc_decref( p_input_item );
>
> /* Do not add the current MRL if playlist_AddInput fail */
> - RecentsMRL::getInstance( p_intf )->addRecent( itemsMRL[i] );
> + RecentsMRL::getInstance( p_intf )->refresh();
> }
> }
>
> diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp
> index cc68160..6e8d724 100644
> --- a/modules/gui/qt4/dialogs_provider.cpp
> +++ b/modules/gui/qt4/dialogs_provider.cpp
> @@ -448,7 +448,7 @@ void DialogsProvider::addFromSimple( bool pl, bool go)
> QString url = toURI( toNativeSeparators( file ) );
> playlist_Add( THEPL, qtu( url ), NULL, PLAYLIST_APPEND | mode,
> PLAYLIST_END, pl, pl_Unlocked );
> - RecentsMRL::getInstance( p_intf )->addRecent( url );
> + RecentsMRL::getInstance( p_intf )->refresh();
> mode = PLAYLIST_PREPARSE;
> }
> }
> @@ -485,7 +485,7 @@ void DialogsProvider::openUrlDialog()
> !oud.shouldEnqueue() ? ( PLAYLIST_APPEND | PLAYLIST_GO )
> : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
> PLAYLIST_END, true, false );
> - RecentsMRL::getInstance( p_intf )->addRecent( url );
> + RecentsMRL::getInstance( p_intf )->refresh();
> }
>
> /* Directory */
> @@ -516,7 +516,7 @@ static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
> if( unlikely(uri == NULL) )
> return;
>
> - RecentsMRL::getInstance( p_intf )->addRecent( qfu(uri) );
> + RecentsMRL::getInstance( p_intf )->refresh();
>
> input_item_t *p_input = input_item_New( uri, NULL );
> free( uri );
> @@ -552,7 +552,7 @@ QString DialogsProvider::getDirectoryDialog()
> dir = qfu( uri );
> free( uri );
>
> - RecentsMRL::getInstance( p_intf )->addRecent( dir );
> + RecentsMRL::getInstance( p_intf )->refresh();
>
> return dir;
> }
> @@ -659,16 +659,7 @@ void DialogsProvider::savePlayingToPlaylist()
>
> void DialogsProvider::saveRecentsToPlaylist()
> {
> - playlist_item_t *p_node_recents = RecentsMRL::getInstance(p_intf)->toPlaylist(0);
> -
> - if (p_node_recents == NULL)
> - {
> - msg_Warn(p_intf, "cannot create playlist from recents");
> - return;
> - }
> -
> - saveAPlaylist(THEPL, p_node_recents);
> - playlist_NodeDelete(THEPL, p_node_recents, true, false);
> + saveAPlaylist( THEPL, THEPL->p_recents );
> }
>
> /****************************************************************************
> @@ -738,7 +729,7 @@ void DialogsProvider::streamingDialog( QWidget *parent,
> PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, true, pl_Unlocked );
> vlc_gc_decref( p_input );
>
> - RecentsMRL::getInstance( p_intf )->addRecent( mrl );
> + RecentsMRL::getInstance( p_intf )->refresh();
> }
> }
>
> @@ -820,5 +811,5 @@ void DialogsProvider::playMRL( const QString &mrl )
> {
> playlist_Add( THEPL, qtu(mrl), NULL,
> PLAYLIST_APPEND | PLAYLIST_GO , PLAYLIST_END, true, false );
> - RecentsMRL::getInstance( p_intf )->addRecent( mrl );
> + RecentsMRL::getInstance( p_intf )->refresh();
> }
> diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
> index cab3433..3574d2b 100644
> --- a/modules/gui/qt4/main_interface.cpp
> +++ b/modules/gui/qt4/main_interface.cpp
> @@ -1306,7 +1306,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play, bool b_playli
> PLAYLIST_APPEND | (first ? PLAYLIST_GO: PLAYLIST_PREPARSE),
> PLAYLIST_END, b_playlist, pl_Unlocked );
> first = false;
> - RecentsMRL::getInstance( p_intf )->addRecent( mrl );
> + RecentsMRL::getInstance( p_intf )->refresh();
> }
> }
> }
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the vlc-devel
mailing list