[vlc-devel] [RFC 28/82] qt: update dialogs to use the new player/playlist API

Pierre Lamot pierre at videolabs.io
Fri Feb 1 14:01:32 CET 2019


  note that bookmarks and playerlist export unimplemented side at the moment due
  to missing support in the new player/playlist
---
 modules/gui/qt/dialogs/bookmarks.cpp          | 274 +++++++++---------
 modules/gui/qt/dialogs/epg.cpp                |  35 +--
 modules/gui/qt/dialogs/extended.cpp           |   8 +-
 modules/gui/qt/dialogs/extended.hpp           |   3 +-
 modules/gui/qt/dialogs/gototime.cpp           |  10 +-
 modules/gui/qt/dialogs/mediainfo.cpp          |  28 +-
 modules/gui/qt/dialogs/messages.cpp           |  39 ++-
 .../gui/qt/dialogs/podcast_configuration.cpp  |  11 +-
 modules/gui/qt/dialogs/toolbar.cpp            |   4 +-
 modules/gui/qt/dialogs_provider.cpp           |  88 ++----
 modules/gui/qt/dialogs_provider.hpp           |   7 +-
 11 files changed, 228 insertions(+), 279 deletions(-)

diff --git a/modules/gui/qt/dialogs/bookmarks.cpp b/modules/gui/qt/dialogs/bookmarks.cpp
index 78d50b335c..082a9a2f90 100644
--- a/modules/gui/qt/dialogs/bookmarks.cpp
+++ b/modules/gui/qt/dialogs/bookmarks.cpp
@@ -25,7 +25,7 @@
 #endif
 
 #include "dialogs/bookmarks.hpp"
-#include "input_manager.hpp"
+#include "components/player_controler.hpp"
 
 #include <QHBoxLayout>
 #include <QSpacerItem>
@@ -80,7 +80,7 @@ BookmarksDialog::BookmarksDialog( intf_thread_t *_p_intf ):QVLCFrame( _p_intf )
     layout->addWidget( buttonsBox );
     layout->addWidget( bookmarksList );
 
-    CONNECT( THEMIM->getIM(), bookmarksChanged(),
+    CONNECT( THEMIM, bookmarksChanged(),
              this, update() );
 
     CONNECT( bookmarksList, activated( QModelIndex ), this,
@@ -120,150 +120,155 @@ void BookmarksDialog::updateButtons()
 
 void BookmarksDialog::update()
 {
-    if ( b_ignore_updates ) return;
-    input_thread_t *p_input = THEMIM->getInput();
-    if( !p_input ) return;
-
-    seekpoint_t **pp_bookmarks;
-    int i_bookmarks = 0;
-
-    if( bookmarksList->topLevelItemCount() > 0 )
-    {
-        bookmarksList->model()->removeRows( 0, bookmarksList->topLevelItemCount() );
-    }
-
-    if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks,
-                       &i_bookmarks ) != VLC_SUCCESS )
-        return;
-
-    for( int i = 0; i < i_bookmarks; i++ )
-    {
-        vlc_tick_t total = pp_bookmarks[i]->i_time_offset;
-        unsigned hours   = ( total / VLC_TICK_FROM_SEC(3600) );
-        unsigned minutes = ( total % VLC_TICK_FROM_SEC(3600) ) / VLC_TICK_FROM_SEC(60);
-        float    seconds = secf_from_vlc_tick( total % VLC_TICK_FROM_SEC(60) );
-
-        QStringList row;
-        row << QString( qfu( pp_bookmarks[i]->psz_name ) );
-        row << qfu("-");
-        row << QString().sprintf( "%02u:%02u:%06.3f", hours, minutes, seconds );
-
-        QTreeWidgetItem *item = new QTreeWidgetItem( bookmarksList, row );
-        item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable |
-                        Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-        bookmarksList->insertTopLevelItem( i, item );
-        vlc_seekpoint_Delete( pp_bookmarks[i] );
-    }
-    free( pp_bookmarks );
+    //FIXME unimplemented
+    //if ( b_ignore_updates ) return;
+    //input_thread_t *p_input = THEMIM->getInput();
+    //if( !p_input ) return;
+    //
+    //seekpoint_t **pp_bookmarks;
+    //int i_bookmarks = 0;
+    //
+    //if( bookmarksList->topLevelItemCount() > 0 )
+    //{
+    //    bookmarksList->model()->removeRows( 0, bookmarksList->topLevelItemCount() );
+    //}
+    //
+    //if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks,
+    //                   &i_bookmarks ) != VLC_SUCCESS )
+    //    return;
+    //
+    //for( int i = 0; i < i_bookmarks; i++ )
+    //{
+    //    vlc_tick_t total = pp_bookmarks[i]->i_time_offset;
+    //    unsigned hours   = ( total / VLC_TICK_FROM_SEC(3600) );
+    //    unsigned minutes = ( total % VLC_TICK_FROM_SEC(3600) ) / VLC_TICK_FROM_SEC(60);
+    //    float    seconds = secf_from_vlc_tick( total % VLC_TICK_FROM_SEC(60) );
+    //
+    //    QStringList row;
+    //    row << QString( qfu( pp_bookmarks[i]->psz_name ) );
+    //    row << qfu("-");
+    //    row << QString().sprintf( "%02u:%02u:%06.3f", hours, minutes, seconds );
+    //
+    //    QTreeWidgetItem *item = new QTreeWidgetItem( bookmarksList, row );
+    //    item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable |
+    //                    Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+    //    bookmarksList->insertTopLevelItem( i, item );
+    //    vlc_seekpoint_Delete( pp_bookmarks[i] );
+    //}
+    //free( pp_bookmarks );
 }
 
 void BookmarksDialog::add()
 {
-    input_thread_t *p_input = THEMIM->getInput();
-    if( !p_input ) return;
-
-    seekpoint_t bookmark;
-
-    if( !input_Control( p_input, INPUT_GET_BOOKMARK, &bookmark ) )
-    {
-        QString name = THEMIM->getIM()->getName() + " #"
-                     + QString::number( bookmarksList->topLevelItemCount() );
-        QByteArray raw = name.toUtf8();
-        bookmark.psz_name = raw.data();
-
-        input_Control( p_input, INPUT_ADD_BOOKMARK, &bookmark );
-    }
+    //FIXME unimplemented
+    //input_thread_t *p_input = THEMIM->getInput();
+    //if( !p_input ) return;
+    //
+    //seekpoint_t bookmark;
+    //
+    //if( !input_Control( p_input, INPUT_GET_BOOKMARK, &bookmark ) )
+    //{
+    //    QString name = THEMIM->getName() + " #"
+    //                 + QString::number( bookmarksList->topLevelItemCount() );
+    //    QByteArray raw = name.toUtf8();
+    //    bookmark.psz_name = raw.data();
+    //
+    //    input_Control( p_input, INPUT_ADD_BOOKMARK, &bookmark );
+    //}
 }
 
 void BookmarksDialog::del()
 {
-    input_thread_t *p_input = THEMIM->getInput();
-    if( !p_input ) return;
-
-    QModelIndexList selected = bookmarksList->selectionModel()->selectedRows();
-    if ( !selected.empty() )
-    {
-        b_ignore_updates = true;
-        /* Sort needed to make sure that selected elements are deleted in descending
-           order, otherwise the indexes might change and wrong bookmarks are deleted. */
-        qSort( selected.begin(), selected.end() );
-        QModelIndexList::Iterator it = selected.end();
-        for( --it; it != selected.begin(); it-- )
-        {
-            input_Control( p_input, INPUT_DEL_BOOKMARK, (*it).row() );
-        }
-        input_Control( p_input, INPUT_DEL_BOOKMARK, (*it).row() );
-        b_ignore_updates = false;
-        update();
-    }
+    //FIXME unimplemented
+    //input_thread_t *p_input = THEMIM->getInput();
+    //if( !p_input ) return;
+    //
+    //QModelIndexList selected = bookmarksList->selectionModel()->selectedRows();
+    //if ( !selected.empty() )
+    //{
+    //    b_ignore_updates = true;
+    //    /* Sort needed to make sure that selected elements are deleted in descending
+    //       order, otherwise the indexes might change and wrong bookmarks are deleted. */
+    //    qSort( selected.begin(), selected.end() );
+    //    QModelIndexList::Iterator it = selected.end();
+    //    for( --it; it != selected.begin(); it-- )
+    //    {
+    //        input_Control( p_input, INPUT_DEL_BOOKMARK, (*it).row() );
+    //    }
+    //    input_Control( p_input, INPUT_DEL_BOOKMARK, (*it).row() );
+    //    b_ignore_updates = false;
+    //    update();
+    //}
 }
 
 void BookmarksDialog::clear()
 {
-    input_thread_t *p_input = THEMIM->getInput();
-    if( !p_input ) return;
-
-    input_Control( p_input, INPUT_CLEAR_BOOKMARKS );
+    //FIXME unimplemented
+    //input_thread_t *p_input = THEMIM->getInput();
+    //if( !p_input ) return;
+    //
+    //input_Control( p_input, INPUT_CLEAR_BOOKMARKS );
 }
 
 void BookmarksDialog::edit( QTreeWidgetItem *item, int column )
 {
-    QStringList fields;
-    // We can only edit a item if it is the last item selected
-    if( bookmarksList->selectedItems().isEmpty() ||
-        bookmarksList->selectedItems().last() != item )
-        return;
-
-    input_thread_t *p_input = THEMIM->getInput();
-    if( !p_input )
-        return;
-
-    // We get the row number of the item
-    int i_edit = bookmarksList->indexOfTopLevelItem( item );
-
-    // We get the bookmarks list
-    seekpoint_t** pp_bookmarks;
-    seekpoint_t*  p_seekpoint = NULL;
-    int i_bookmarks;
-
-    if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks,
-                       &i_bookmarks ) != VLC_SUCCESS )
-        return;
-
-    if( i_edit >= i_bookmarks )
-        goto clear;
-
-    // We modify the seekpoint
-    p_seekpoint = pp_bookmarks[i_edit];
-    if( column == 0 )
-    {
-        free( p_seekpoint->psz_name );
-        p_seekpoint->psz_name = strdup( qtu( item->text( column ) ) );
-    }
-    else if( column == 2 )
-    {
-        fields = item->text( column ).split( ":", QString::SkipEmptyParts );
-        if( fields.count() == 1 )
-            p_seekpoint->i_time_offset = vlc_tick_from_sec( fields[0].toFloat() );
-        else if( fields.count() == 2 )
-            p_seekpoint->i_time_offset = vlc_tick_from_sec( fields[0].toInt() * 60 + fields[1].toInt() );
-        else if( fields.count() == 3 )
-            p_seekpoint->i_time_offset = vlc_tick_from_sec( fields[0].toInt() * 3600 + fields[1].toInt() * 60 + fields[2].toFloat() );
-        else
-        {
-            msg_Err( p_intf, "Invalid string format for time" );
-            goto clear;
-        }
-    }
-
-    // Send the modification
-    input_Control( p_input, INPUT_CHANGE_BOOKMARK, p_seekpoint, i_edit );
-
-clear:
-    // Clear the bookmark list
-    for( int i = 0; i < i_bookmarks; i++)
-        vlc_seekpoint_Delete( pp_bookmarks[i] );
-    free( pp_bookmarks );
+    //FIXME unimplemented
+    //QStringList fields;
+    //// We can only edit a item if it is the last item selected
+    //if( bookmarksList->selectedItems().isEmpty() ||
+    //    bookmarksList->selectedItems().last() != item )
+    //    return;
+    //
+    //input_thread_t *p_input = THEMIM->getInput();
+    //if( !p_input )
+    //    return;
+    //
+    //// We get the row number of the item
+    //int i_edit = bookmarksList->indexOfTopLevelItem( item );
+    //
+    //// We get the bookmarks list
+    //seekpoint_t** pp_bookmarks;
+    //seekpoint_t*  p_seekpoint = NULL;
+    //int i_bookmarks;
+    //
+    //if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks,
+    //                   &i_bookmarks ) != VLC_SUCCESS )
+    //    return;
+    //
+    //if( i_edit >= i_bookmarks )
+    //    goto clear;
+    //
+    //// We modify the seekpoint
+    //p_seekpoint = pp_bookmarks[i_edit];
+    //if( column == 0 )
+    //{
+    //    free( p_seekpoint->psz_name );
+    //    p_seekpoint->psz_name = strdup( qtu( item->text( column ) ) );
+    //}
+    //else if( column == 2 )
+    //{
+    //    fields = item->text( column ).split( ":", QString::SkipEmptyParts );
+    //    if( fields.count() == 1 )
+    //        p_seekpoint->i_time_offset = vlc_tick_from_sec( fields[0].toFloat() );
+    //    else if( fields.count() == 2 )
+    //        p_seekpoint->i_time_offset = vlc_tick_from_sec( fields[0].toInt() * 60 + fields[1].toInt() );
+    //    else if( fields.count() == 3 )
+    //        p_seekpoint->i_time_offset = vlc_tick_from_sec( fields[0].toInt() * 3600 + fields[1].toInt() * 60 + fields[2].toFloat() );
+    //    else
+    //    {
+    //        msg_Err( p_intf, "Invalid string format for time" );
+    //        goto clear;
+    //    }
+    //}
+    //
+    //// Send the modification
+    //input_Control( p_input, INPUT_CHANGE_BOOKMARK, p_seekpoint, i_edit );
+    //
+    //clear:
+    //// Clear the bookmark list
+    //for( int i = 0; i < i_bookmarks; i++)
+    //    vlc_seekpoint_Delete( pp_bookmarks[i] );
+    //free( pp_bookmarks );
 }
 
 void BookmarksDialog::extract()
@@ -273,10 +278,11 @@ void BookmarksDialog::extract()
 
 void BookmarksDialog::activateItem( QModelIndex index )
 {
-    input_thread_t *p_input = THEMIM->getInput();
-    if( !p_input ) return;
-
-    input_Control( p_input, INPUT_SET_BOOKMARK, index.row() );
+    //FIXME unimplemented
+    //input_thread_t *p_input = THEMIM->getInput();
+    //if( !p_input ) return;
+    //
+    //input_Control( p_input, INPUT_SET_BOOKMARK, index.row() );
 }
 
 void BookmarksDialog::toggleVisible()
diff --git a/modules/gui/qt/dialogs/epg.cpp b/modules/gui/qt/dialogs/epg.cpp
index 604752c4ea..3cefa4bf0a 100644
--- a/modules/gui/qt/dialogs/epg.cpp
+++ b/modules/gui/qt/dialogs/epg.cpp
@@ -42,7 +42,7 @@
 #include <QDateTime>
 
 #include "qt.hpp"
-#include "input_manager.hpp"
+#include "components/player_controler.hpp"
 
 EpgDialog::EpgDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
 {
@@ -77,8 +77,8 @@ EpgDialog::EpgDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
     layout->addWidget( descBox );
 
     CONNECT( epg, itemSelectionChanged( EPGItem *), this, displayEvent( EPGItem *) );
-    CONNECT( epg, programActivated(int), THEMIM->getIM(), changeProgram(int) );
-    CONNECT( THEMIM->getIM(), epgChanged(), this, scheduleUpdate() );
+    CONNECT( epg, programActivated(int), THEMIM, changeProgram(int) );
+    CONNECT( THEMIM, epgChanged(), this, scheduleUpdate() );
     CONNECT( THEMIM, inputChanged( bool ), this, inputChanged() );
 
     QDialogButtonBox *buttonsBox = new QDialogButtonBox( this );
@@ -175,24 +175,17 @@ void EpgDialog::displayEvent( EPGItem *epgItem )
 
 void EpgDialog::updateInfos()
 {
-    input_item_t *p_input_item = NULL;
-    playlist_t *p_playlist = THEPL;
-    input_thread_t *p_input_thread = playlist_CurrentInput( p_playlist ); /* w/hold */
-    if( p_input_thread )
+    input_item_t *media = NULL;
     {
-        PL_LOCK; /* as input_GetItem still unfixed */
-        p_input_item = input_GetItem( p_input_thread );
-        if ( p_input_item ) input_item_Hold( p_input_item );
-        PL_UNLOCK;
-        vlc_object_release( p_input_thread );
-        if ( p_input_item )
-        {
-            epg->updateEPG( p_input_item );
-            input_item_Release( p_input_item );
-        }
-        else
-        {
-            epg->reset();
-        }
+        vlc_player_locker lock{ p_intf->p_sys->p_player };
+        media = vlc_player_HoldCurrentMedia( p_intf->p_sys->p_player ); /* w/hold */
     }
+
+    if( media )
+    {
+        epg->updateEPG( media );
+        input_item_Release( media );
+    }
+    else
+        epg->reset();
 }
diff --git a/modules/gui/qt/dialogs/extended.cpp b/modules/gui/qt/dialogs/extended.cpp
index da7b019fc5..f7a28b30b5 100644
--- a/modules/gui/qt/dialogs/extended.cpp
+++ b/modules/gui/qt/dialogs/extended.cpp
@@ -29,7 +29,7 @@
 #include "dialogs/extended.hpp"
 
 #include "main_interface.hpp" /* Needed for external MI size */
-#include "input_manager.hpp"
+#include "components/player_controler.hpp"
 
 #include <QTabWidget>
 #include <QGridLayout>
@@ -144,7 +144,7 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf )
             move ( 450 , 0 );
     }
 
-    CONNECT( THEMIM->getIM(), playingStatusChanged( int ), this, changedItem( int ) );
+    connect( THEMIM, &PlayerControler::playingStateChanged, this, &ExtendedDialog::changedItem );
 }
 
 ExtendedDialog::~ExtendedDialog()
@@ -163,9 +163,9 @@ int ExtendedDialog::currentTab()
     return mainTabW->currentIndex();
 }
 
-void ExtendedDialog::changedItem( int i_status )
+void ExtendedDialog::changedItem( PlayerControler::PlayingState i_status )
 {
-    if( i_status != END_S ) return;
+    if( i_status != PlayerControler::PLAYING_STATE_STOPPED ) return;
     syncW->clean();
     videoEffect->clean();
 }
diff --git a/modules/gui/qt/dialogs/extended.hpp b/modules/gui/qt/dialogs/extended.hpp
index df86bbf8df..b12a86916d 100644
--- a/modules/gui/qt/dialogs/extended.hpp
+++ b/modules/gui/qt/dialogs/extended.hpp
@@ -27,6 +27,7 @@
 
 #include "components/extended_panels.hpp"
 #include "util/singleton.hpp"
+#include "components/player_controler.hpp"
 
 class QTabWidget;
 
@@ -54,7 +55,7 @@ private:
     QPushButton *m_applyButton;
     QHash<QString, QVariant> m_hashConfigs[2];
 private slots:
-    void changedItem( int );
+    void changedItem(PlayerControler::PlayingState );
     void currentTabChanged( int );
     void saveConfig();
     void putAudioConfig( const QString& name, const QVariant value );
diff --git a/modules/gui/qt/dialogs/gototime.cpp b/modules/gui/qt/dialogs/gototime.cpp
index 2375fc015b..5883ef895a 100644
--- a/modules/gui/qt/dialogs/gototime.cpp
+++ b/modules/gui/qt/dialogs/gototime.cpp
@@ -25,7 +25,7 @@
 
 #include "dialogs/gototime.hpp"
 
-#include "input_manager.hpp"
+#include "components/player_controler.hpp"
 
 #include <QTabWidget>
 #include <QLabel>
@@ -85,9 +85,9 @@ GotoTimeDialog::~GotoTimeDialog()
 void GotoTimeDialog::toggleVisible()
 {
     reset();
-    if ( !isVisible() && THEMIM->getIM()->hasInput() )
+    if ( !isVisible() && THEMIM->hasInput() )
     {
-        vlc_tick_t i_time = var_GetInteger( THEMIM->getInput(), "time" );
+        vlc_tick_t i_time = THEMIM->getTime();
         timeEdit->setTime( timeEdit->time().addSecs( SEC_FROM_VLC_TICK(i_time) ) );
     }
     QVLCDialog::toggleVisible();
@@ -103,10 +103,10 @@ void GotoTimeDialog::cancel()
 
 void GotoTimeDialog::close()
 {
-    if ( THEMIM->getIM()->hasInput() )
+    if ( THEMIM->hasInput() )
     {
         int i_time = QTime( 0, 0, 0 ).msecsTo( timeEdit->time() );
-        var_SetInteger( THEMIM->getInput(), "time", VLC_TICK_FROM_MS(i_time) );
+        THEMIM->jumpToTime( VLC_TICK_FROM_MS(i_time) );
     }
     toggleVisible();
 }
diff --git a/modules/gui/qt/dialogs/mediainfo.cpp b/modules/gui/qt/dialogs/mediainfo.cpp
index 98f06a90c9..f8710ad36b 100644
--- a/modules/gui/qt/dialogs/mediainfo.cpp
+++ b/modules/gui/qt/dialogs/mediainfo.cpp
@@ -26,7 +26,7 @@
 #endif
 
 #include "dialogs/mediainfo.hpp"
-#include "input_manager.hpp"
+#include "components/player_controler.hpp"
 
 #include <vlc_url.h>
 
@@ -109,17 +109,16 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf,
          * Connects on the various signals of input_Manager
          * For the currently playing element
          **/
-        DCONNECT( THEMIM->getIM(), infoChanged( input_item_t* ),
-                  IP, update( input_item_t* ) );
-        DCONNECT( THEMIM->getIM(), currentMetaChanged( input_item_t* ),
-                  MP, update( input_item_t* ) );
-        DCONNECT( THEMIM->getIM(), currentMetaChanged( input_item_t* ),
-                  EMP, update( input_item_t* ) );
-        DCONNECT( THEMIM->getIM(), statisticsUpdated( input_item_t* ),
-                  ISP, update( input_item_t* ) );
-
-        if( THEMIM->getInput() )
-            p_item = input_GetItem( THEMIM->getInput() );
+        connect( THEMIM, &PlayerControler::infoChanged,
+                  IP, &InfoPanel::update, Qt::DirectConnection  );
+        connect( THEMIM, &PlayerControler::currentMetaChanged,
+                  MP, &MetaPanel::update, Qt::DirectConnection  );
+        connect( THEMIM, &PlayerControler::currentMetaChanged,
+                  EMP, &ExtraMetaPanel::update, Qt::DirectConnection );
+        connect( THEMIM, &PlayerControler::statisticsUpdated,
+                  ISP, &InputStatsPanel::update, Qt::DirectConnection);
+
+        p_item = THEMIM->getInput();
     }
     else
         msg_Dbg( p_intf, "Using an item specific info windows" );
@@ -155,11 +154,14 @@ void MediaInfoDialog::saveMeta()
 
 void MediaInfoDialog::updateAllTabs( input_item_t *p_item )
 {
+    if (! p_item)
+        return;
+
     IP->update( p_item );
     MP->update( p_item );
     EMP->update( p_item );
 
-    if( isMainInputInfo ) ISP->update( p_item );
+    if( isMainInputInfo && p_item->p_stats ) ISP->update( *p_item->p_stats );
 }
 
 void MediaInfoDialog::clearAllTabs()
diff --git a/modules/gui/qt/dialogs/messages.cpp b/modules/gui/qt/dialogs/messages.cpp
index 45180b222f..54eb7a3b8c 100644
--- a/modules/gui/qt/dialogs/messages.cpp
+++ b/modules/gui/qt/dialogs/messages.cpp
@@ -373,35 +373,32 @@ void MessagesDialog::MsgCallback( void *self, int type, const vlc_log_t *item,
 }
 
 #ifndef NDEBUG
-static QTreeWidgetItem * PLWalk( playlist_item_t *p_node )
-{
-    QTreeWidgetItem *current = new QTreeWidgetItem();
-    if(p_node->p_input)
-    {
-        current->setText( 0, qfu( p_node->p_input->psz_name ) );
-        current->setToolTip( 0, qfu( p_node->p_input->psz_uri ) );
-        current->setText( 1, QString("%1").arg( p_node->i_id ) );
-        current->setText( 2, QString("%1").arg( (uintptr_t)p_node->p_input ) );
-        current->setText( 3, QString("0x%1").arg( p_node->i_flags, 0, 16 ) );
-        current->setText( 4, QString("0x%1").arg(  p_node->p_input->i_type, 0, 16 ) );
-    }
-    for ( int i = 0; p_node->i_children > 0 && i < p_node->i_children; i++ )
-        current->addChild( PLWalk( p_node->pp_children[ i ] ) );
-    return current;
-}
 
 void MessagesDialog::updatePLTree()
 {
-    playlist_t *p_playlist = THEPL;
     pldebugTree->clear();
-
     {
-        vlc_playlist_locker pl_lock ( THEPL );
-        pldebugTree->addTopLevelItem( PLWalk( &p_playlist->root ) );
+        vlc_playlist_t* playlist = p_intf->p_sys->p_playlist;
+        vlc_playlist_Lock(playlist);
+        size_t count = vlc_playlist_Count( playlist );
+        for (size_t i = 0; i < count; i++)
+        {
+            QTreeWidgetItem *current = new QTreeWidgetItem();
+            vlc_playlist_item_t* item = vlc_playlist_Get( playlist, i );
+            input_item_t* media = vlc_playlist_item_GetMedia( item );
+            current->setText( 0, qfu( media->psz_name ) );
+            current->setToolTip( 0, qfu( media->psz_uri ) );
+            current->setText( 1, QString("%1").arg( i ) );
+            current->setText( 2, QString("%1").arg( (uintptr_t)media ) );
+            //current->setText( 3, QString("0x%1").arg( p_node->i_flags, 0, 16 ) );
+            current->setText( 3, QString("0x%1").arg( media->i_type, 0, 16 ) );
+            pldebugTree->addTopLevelItem( current );
+        }
+        vlc_playlist_Unlock(playlist);
     }
 
     pldebugTree->expandAll();
-    for ( int i=0; i< 5; i++ )
+    for ( int i=0; i< 4; i++ )
         pldebugTree->resizeColumnToContents( i );
 }
 #endif
diff --git a/modules/gui/qt/dialogs/podcast_configuration.cpp b/modules/gui/qt/dialogs/podcast_configuration.cpp
index ffe9bd5ebd..4c9869337e 100644
--- a/modules/gui/qt/dialogs/podcast_configuration.cpp
+++ b/modules/gui/qt/dialogs/podcast_configuration.cpp
@@ -71,11 +71,12 @@ void PodcastConfigDialog::accept()
     }
     config_PutPsz( "podcast-urls", qtu( urls ) );
 
-    if( playlist_IsServicesDiscoveryLoaded( THEPL, "podcast" ) )
-    {
-        var_SetString( THEPL, "podcast-urls", qtu( urls ) );
-        msg_Dbg( p_intf, "You will need to reload the podcast module to take into account deleted podcast urls" );
-    }
+    //FIXME IsServicesDiscoveryLoaded is uninplmented
+    //if( playlist_IsServicesDiscoveryLoaded( THEPL, "podcast" ) )
+    //{
+    //    var_SetString( THEPL, "podcast-urls", qtu( urls ) );
+    //    msg_Dbg( p_intf, "You will need to reload the podcast module to take into account deleted podcast urls" );
+    //}
 }
 
 void PodcastConfigDialog::add()
diff --git a/modules/gui/qt/dialogs/toolbar.cpp b/modules/gui/qt/dialogs/toolbar.cpp
index 4c653bcac0..a919f38cdf 100644
--- a/modules/gui/qt/dialogs/toolbar.cpp
+++ b/modules/gui/qt/dialogs/toolbar.cpp
@@ -36,7 +36,7 @@
 #include "util/imagehelper.hpp"
 
 #include "qt.hpp"
-#include "input_manager.hpp"
+#include "components/player_controler.hpp"
 
 #include <QGroupBox>
 #include <QLabel>
@@ -559,7 +559,7 @@ WidgetListing::WidgetListing( intf_thread_t *p_intf, QWidget *_parent )
             widgetItem->setText( qtr("Playback Buttons") );
             break;
         case ASPECT_RATIO_COMBOBOX:
-            widget = new AspectRatioComboBox( p_intf );
+            widget = new AspectRatioComboBox( p_intf, THEMIM->getAspectRatio() );
             widgetItem->setText( qtr("Aspect ratio selector") );
             break;
         case SPEED_LABEL:
diff --git a/modules/gui/qt/dialogs_provider.cpp b/modules/gui/qt/dialogs_provider.cpp
index 084892aa7f..ccaef54124 100644
--- a/modules/gui/qt/dialogs_provider.cpp
+++ b/modules/gui/qt/dialogs_provider.cpp
@@ -29,7 +29,8 @@
 
 #include "qt.hpp"
 #include "dialogs_provider.hpp"
-#include "input_manager.hpp" /* Load Subtitles */
+#include "components/player_controler.hpp" /* Load Subtitles */
+#include "components/playlist/playlist_controler.hpp"
 #include "menus.hpp"
 #include "recents.hpp"
 #include "util/qt_dirs.hpp"
@@ -37,7 +38,6 @@
 #include "main_interface.hpp"
 
 /* The dialogs */
-#include "dialogs/playlist.hpp"
 #include "dialogs/bookmarks.hpp"
 #include "dialogs/preferences.hpp"
 #include "dialogs/mediainfo.hpp"
@@ -76,21 +76,10 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
                                   miscPopupMenu( NULL )
 {
     b_isDying = false;
-
-    /* Various signal mappers for the menus */
-    menusMapper = new QSignalMapper();
-    CONNECT( menusMapper, mapped(QObject *), this, menuAction( QObject *) );
-
-    menusUpdateMapper = new QSignalMapper();
-    CONNECT( menusUpdateMapper, mapped(QObject *),
-             this, menuUpdateAction( QObject *) );
-
-    new DialogHandler (p_intf, this );
 }
 
 DialogsProvider::~DialogsProvider()
 {
-    PlaylistDialog::killInstance();
     MediaInfoDialog::killInstance();
     MessagesDialog::killInstance();
     BookmarksDialog::killInstance();
@@ -104,9 +93,6 @@ DialogsProvider::~DialogsProvider()
     PluginDialog::killInstance();
     EpgDialog::killInstance();
 
-    delete menusMapper;
-    delete menusUpdateMapper;
-
     delete popupMenu;
     delete videoPopupMenu;
     delete audioPopupMenu;
@@ -155,7 +141,9 @@ void DialogsProvider::customEvent( QEvent *event )
         case INTF_DIALOG_DIRECTORY:
             PLAppendDir(); break;
         case INTF_DIALOG_PLAYLIST:
-            playlistDialog(); break;
+            //FIXME
+            //playlistDialog(); break;
+            break;
         case INTF_DIALOG_MESSAGES:
             messagesDialog(); break;
         case INTF_DIALOG_FILEINFO:
@@ -230,11 +218,6 @@ void DialogsProvider::customEvent( QEvent *event )
 const QEvent::Type DialogEvent::DialogEvent_Type =
         (QEvent::Type)QEvent::registerEventType();
 
-void DialogsProvider::playlistDialog()
-{
-    PlaylistDialog::getInstance( p_intf )->toggleVisible();
-}
-
 void DialogsProvider::prefsDialog()
 {
     PrefsDialog *p = new PrefsDialog( (QWidget *)p_intf->p_sys->p_mi, p_intf );
@@ -609,7 +592,8 @@ void DialogsProvider::openAPlaylist()
             msg_Warn( p_intf, "unable to load playlist '%s'", qtu( url ) );
             continue;
         }
-        playlist_Import( THEPL, psz_path );
+        //FIXME implement playlist_Import
+        //playlist_Import( THEPL, psz_path );
         free( psz_path );
     }
 }
@@ -680,8 +664,9 @@ void DialogsProvider::savePlayingToPlaylist()
 
     if ( psz_selected_module )
     {
-        playlist_Export( THEPL, qtu( toNativeSeparators( file ) ),
-                         psz_selected_module );
+        //FIXME implement playlist_Export
+        //playlist_Export( THEPL, qtu( toNativeSeparators( file ) ),
+        //                 psz_selected_module );
         getSettings()->setValue( "last-playlist-ext", psz_last_playlist_ext );
     }
 }
@@ -721,8 +706,7 @@ void DialogsProvider::streamingDialog( QWidget *parent,
         {
             /* Clear the playlist.  This is because we're going to be populating
                it */
-            playlist_Clear( THEPL, pl_Unlocked );
-
+            THEMPL->clear();
             outputMRLs = s->getMrls();
             delete s;
         }
@@ -735,27 +719,12 @@ void DialogsProvider::streamingDialog( QWidget *parent,
     /* Get SoutMRL(s) */
     if( !outputMRLs.isEmpty() )
     {
-        /* For all of our MRLs */
-        for(int i = 0; i < outputMRLs.length(); i++)
-        {
-
-            /* Duplicate the options list.  This is because we need to have a
-             copy for every file we add to the playlist.*/
-            QStringList optionsCopy;
-            for(int j = 0; j < options.length(); j++)
-            {
-                optionsCopy.append(options[j]);
-            }
-
-            optionsCopy+= outputMRLs[i].split( " :");
-            QString title = "Converting " + mrls[i];
-
-            /* Add each file to convert to our playlist, making sure to not attempt to start playing it.*/
-            Open::openMRLwithOptions( p_intf, mrls[i], &optionsCopy, false, qtu( title ) );
-        }
-
-        /* Start the playlist from the beginning */
-        playlist_Control(THEPL,PLAYLIST_PLAY,pl_Unlocked);
+        QVector<vlc::playlist::Media> outputMedias;
+        std::transform(outputMRLs.cbegin(), outputMRLs.cend(), std::back_inserter(outputMedias), [&](const QString& mrl) {
+            QString title = "Converting " + mrl;
+            return vlc::playlist::Media(mrl, title, &options);
+        });
+        THEMPL->append(outputMedias, true);
     }
 }
 
@@ -773,10 +742,7 @@ void DialogsProvider::openAndTranscodingDialogs()
 
 void DialogsProvider::loadSubtitlesFile()
 {
-    input_thread_t *p_input = THEMIM->getInput();
-    if( !p_input ) return;
-
-    input_item_t *p_item = input_GetItem( p_input );
+    input_item_t *p_item = THEMIM->getInput();
     if( !p_item ) return;
 
     char *path = input_item_GetURI( p_item );
@@ -796,9 +762,9 @@ void DialogsProvider::loadSubtitlesFile()
 
     foreach( const QString &qsUrl, qsl )
     {
-        if( input_AddSlave( p_input, SLAVE_TYPE_SPU, qtu( qsUrl ), true, true, false ) )
-            msg_Warn( p_intf, "unable to load subtitles from '%s'",
-                      qtu( qsUrl ) );
+
+        if ( THEMIM->AddAssociatedMedia( SPU_ES, qsUrl, true, true, false ) )
+            msg_Warn( p_intf, "unable to load subtitles from '%s'", qtu( qsUrl ) );
     }
 }
 
@@ -807,18 +773,6 @@ void DialogsProvider::loadSubtitlesFile()
  * Menus
  ****************************************************************************/
 
-void DialogsProvider::menuAction( QObject *data )
-{
-    VLCMenuBar::DoAction( data );
-}
-
-void DialogsProvider::menuUpdateAction( QObject *data )
-{
-    MenuFunc *func = qobject_cast<MenuFunc *>(data);
-    assert( func );
-    func->doFunc( p_intf );
-}
-
 void DialogsProvider::sendKey( int key )
 {
      // translate from a vlc keycode into a Qt sequence
diff --git a/modules/gui/qt/dialogs_provider.hpp b/modules/gui/qt/dialogs_provider.hpp
index c234a1b32a..7f48007e6a 100644
--- a/modules/gui/qt/dialogs_provider.hpp
+++ b/modules/gui/qt/dialogs_provider.hpp
@@ -98,8 +98,6 @@ public:
                                     QString *selectedFilter = NULL );
 
 protected:
-    QSignalMapper *menusMapper;
-    QSignalMapper *menusUpdateMapper;
     void customEvent( QEvent *);
 
 private:
@@ -120,7 +118,6 @@ private:
     void openDialog( int );
 
 public slots:
-    void playlistDialog();
     void bookmarksDialog();
     void mediaInfoDialog();
     void mediaCodecDialog();
@@ -172,9 +169,7 @@ public slots:
     void loadSubtitlesFile();
 
     void quit();
-private slots:
-    void menuAction( QObject *);
-    void menuUpdateAction( QObject * );
+
 signals:
     void  toolBarConfUpdated();
     void releaseMouseEvents();
-- 
2.19.1



More information about the vlc-devel mailing list