[vlc-devel] [RFC 41/82] qt: port Recent manager to the new player/playlist API
Pierre Lamot
pierre at videolabs.io
Fri Feb 1 14:01:45 CET 2019
---
modules/gui/qt/recents.cpp | 37 ++++++++-----------------------------
1 file changed, 8 insertions(+), 29 deletions(-)
diff --git a/modules/gui/qt/recents.cpp b/modules/gui/qt/recents.cpp
index 44b700479b..d98b97942b 100644
--- a/modules/gui/qt/recents.cpp
+++ b/modules/gui/qt/recents.cpp
@@ -26,6 +26,8 @@
#include "dialogs_provider.hpp"
#include "menus.hpp"
#include "util/qt_dirs.hpp"
+#include <vlc_cxx_helpers.hpp>
+#include "components/playlist/playlist_controler.hpp"
#include <QStringList>
#include <QRegExp>
@@ -192,37 +194,14 @@ int Open::openMRLwithOptions( intf_thread_t* p_intf,
bool b_start,
const char *title)
{
- /* Options */
- const char **ppsz_options = NULL;
- int i_options = 0;
-
- if( options != NULL && options->count() > 0 )
- {
- ppsz_options = new const char *[options->count()];
- for( int j = 0; j < options->count(); j++ ) {
- QString option = colon_unescape( options->at(j) );
- if( !option.isEmpty() ) {
- ppsz_options[i_options] = strdup(qtu(option));
- i_options++;
- }
- }
- }
-
- /* Add to playlist */
- int i_ret = playlist_AddExt( THEPL, qtu(mrl), title, b_start,
- i_options, ppsz_options, VLC_INPUT_OPTION_TRUSTED );
+ QVector<vlc::playlist::Media> medias {
+ {mrl, qfu(title), options}
+ };
+ THEMPL->append(medias, b_start);
/* Add to recent items, only if played */
- if( i_ret == VLC_SUCCESS && b_start )
+ if( b_start )
RecentsMRL::getInstance( p_intf )->addRecent( mrl );
- /* Free options */
- if ( ppsz_options != NULL )
- {
- for ( int i = 0; i < i_options; ++i )
- free( (char*)ppsz_options[i] );
- delete[] ppsz_options;
- }
- return i_ret;
+ return VLC_SUCCESS;
}
-
--
2.19.1
More information about the vlc-devel
mailing list