[vlc-devel] [PATCH 2/2] qt: remove the renderer selection dialog

Steve Lhomme robux4 at videolabs.io
Fri Jun 24 09:55:02 CEST 2016


--
replaces https://patches.videolan.org/patch/13782/ with more cleaning
---
 include/vlc_intf_strings.h               |   1 -
 modules/gui/qt/Makefile.am               |   4 -
 modules/gui/qt/actions_manager.cpp       |   3 -
 modules/gui/qt/actions_manager.hpp       |   1 -
 modules/gui/qt/components/controller.cpp |   4 -
 modules/gui/qt/components/controller.hpp |   7 +-
 modules/gui/qt/dialogs/renderer.cpp      | 257 -------------------------------
 modules/gui/qt/dialogs/renderer.hpp      |  64 --------
 modules/gui/qt/dialogs_provider.cpp      |   8 -
 modules/gui/qt/dialogs_provider.hpp      |   3 -
 modules/gui/qt/menus.cpp                 |   5 -
 modules/gui/qt/ui/renderer.ui            |  54 -------
 12 files changed, 2 insertions(+), 409 deletions(-)
 delete mode 100644 modules/gui/qt/dialogs/renderer.cpp
 delete mode 100644 modules/gui/qt/dialogs/renderer.hpp
 delete mode 100644 modules/gui/qt/ui/renderer.ui

diff --git a/include/vlc_intf_strings.h b/include/vlc_intf_strings.h
index 02f2257..25c57b3 100644
--- a/include/vlc_intf_strings.h
+++ b/include/vlc_intf_strings.h
@@ -58,7 +58,6 @@
 #define I_MENU_GOTOTIME N_("Jump to Specific &Time")
 #define I_MENU_BOOKMARK N_("Custom &Bookmarks")
 #define I_MENU_VLM N_("&VLM Configuration")
-#define I_MENU_RENDERER N_("&Renderer Output")
 
 #define I_MENU_ABOUT N_("&About")
 
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index aac21d7..5db060e 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -67,7 +67,6 @@ libqt_plugin_la_SOURCES = \
 	dialogs/podcast_configuration.cpp dialogs/podcast_configuration.hpp \
 	dialogs/extensions.cpp dialogs/extensions.hpp \
 	dialogs/fingerprintdialog.cpp dialogs/fingerprintdialog.hpp \
-	dialogs/renderer.cpp dialogs/renderer.hpp \
 	components/extended_panels.cpp components/extended_panels.hpp \
 	components/info_panels.cpp components/info_panels.hpp \
 	components/info_widgets.cpp components/info_widgets.hpp \
@@ -167,7 +166,6 @@ nodist_libqt_plugin_la_SOURCES = \
 	dialogs/firstrun.moc.cpp \
 	dialogs/extensions.moc.cpp \
 	dialogs/fingerprintdialog.moc.cpp \
-	dialogs/renderer.moc.cpp \
 	components/extended_panels.moc.cpp \
 	components/info_panels.moc.cpp \
 	components/info_widgets.moc.cpp \
@@ -225,7 +223,6 @@ nodist_libqt_plugin_la_SOURCES += \
 	ui/about.h \
 	ui/update.h \
 	ui/fingerprintdialog.h \
-	ui/renderer.h \
 	ui/sout.h
 
 # User interface compilation
@@ -263,7 +260,6 @@ libqt_plugin_la_UI = \
 	ui/streampanel.ui \
 	ui/messages_panel.ui \
 	ui/about.ui \
-	ui/renderer.ui \
 	ui/update.ui \
 	ui/sout.ui \
 	ui/vlm.ui \
diff --git a/modules/gui/qt/actions_manager.cpp b/modules/gui/qt/actions_manager.cpp
index 8296032..05e1de8 100644
--- a/modules/gui/qt/actions_manager.cpp
+++ b/modules/gui/qt/actions_manager.cpp
@@ -113,9 +113,6 @@ void ActionsManager::doAction( int id_action )
             if( p_intf->p_sys->p_mi )
                 p_intf->p_sys->p_mi->getFullscreenControllerWidget()->toggleFullwidth();
             break;
-        case RENDERER_ACTION:
-            THEDP->rendererDialog(); break;
-            break;
         default:
             msg_Warn( p_intf, "Action not supported: %i", id_action );
             break;
diff --git a/modules/gui/qt/actions_manager.hpp b/modules/gui/qt/actions_manager.hpp
index 5b5b3e6..b11c076 100644
--- a/modules/gui/qt/actions_manager.hpp
+++ b/modules/gui/qt/actions_manager.hpp
@@ -59,7 +59,6 @@ typedef enum actionType_e
     LOOP_ACTION,
     INFO_ACTION,
     OPEN_SUB_ACTION,
-    RENDERER_ACTION,
 } actionType_e;
 
 class ActionsManager : public QObject, public Singleton<ActionsManager>
diff --git a/modules/gui/qt/components/controller.cpp b/modules/gui/qt/components/controller.cpp
index c13ab35..c846f25 100644
--- a/modules/gui/qt/components/controller.cpp
+++ b/modules/gui/qt/components/controller.cpp
@@ -478,10 +478,6 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
         CONNECT_MAP_SET( play, PLAY_ACTION );
         }
         break;
-    case RENDERER_BUTTON:{
-        NORMAL_BUTTON( RENDERER );
-        }
-        break;
     case ASPECT_RATIO_COMBOBOX:
         widget = new AspectRatioComboBox( p_intf );
         widget->setMinimumHeight( 26 );
diff --git a/modules/gui/qt/components/controller.hpp b/modules/gui/qt/components/controller.hpp
index dab36fd..4d75d16 100644
--- a/modules/gui/qt/components/controller.hpp
+++ b/modules/gui/qt/components/controller.hpp
@@ -81,7 +81,6 @@ typedef enum buttonType_e
     NEXT_BUTTON,
     OPEN_SUB_BUTTON,
     FULLWIDTH_BUTTON,
-    RENDERER_BUTTON,
     BUTTON_MAX,
 
     SPLITTER = 0x20,
@@ -111,7 +110,7 @@ static const char* const nameL[BUTTON_MAX] = { N_("Play"), N_("Stop"), N_("Open"
     N_("Record"), N_("A→B Loop"), N_("Frame By Frame"), N_("Trickplay Reverse"),
     N_("Step backward" ), N_("Step forward"), N_("Quit"), N_("Random"),
     N_("Loop / Repeat"), N_("Information"), N_("Previous"), N_("Next"),
-    N_("Open subtitles"), N_("Dock fullscreen controller"), N_("Renderer output")
+    N_("Open subtitles"), N_("Dock fullscreen controller")
 };
 static const char* const tooltipL[BUTTON_MAX] = { I_PLAY_TOOLTIP,
     N_("Stop playback"), N_("Open a medium"),
@@ -126,7 +125,6 @@ static const char* const tooltipL[BUTTON_MAX] = { I_PLAY_TOOLTIP,
     N_("Previous media in the playlist"), N_("Next media in the playlist"),
     N_("Open subtitle file"),
     N_("Dock/undock fullscreen controller to/from bottom of screen"),
-    N_("Select a Renderer device to output video/audio")
 };
 static const QString iconL[BUTTON_MAX] ={ ":/toolbar/play_b", ":/toolbar/stop_b",
     ":/toolbar/eject", ":/toolbar/previous_b", ":/toolbar/next_b",
@@ -136,8 +134,7 @@ static const QString iconL[BUTTON_MAX] ={ ":/toolbar/play_b", ":/toolbar/stop_b"
     ":/toolbar/frame", ":/toolbar/reverse", ":/toolbar/skip_back",
     ":/toolbar/skip_fw", ":/toolbar/clear", ":/buttons/playlist/shuffle_on",
     ":/buttons/playlist/repeat_all", ":/menu/info",
-    ":/toolbar/previous_b", ":/toolbar/next_b", ":/toolbar/eject", ":/toolbar/space",
-    ":/toolbar/renderer"
+    ":/toolbar/previous_b", ":/toolbar/next_b", ":/toolbar/eject", ":/toolbar/space"
 };
 
 enum
diff --git a/modules/gui/qt/dialogs/renderer.cpp b/modules/gui/qt/dialogs/renderer.cpp
deleted file mode 100644
index 37f5342..0000000
--- a/modules/gui/qt/dialogs/renderer.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-/*****************************************************************************
- * renderer.cpp : Renderer output dialog
- ****************************************************************************
- * Copyright (C) 2015-2016 the VideoLAN team
- *
- * $Id$
- *
- * Authors: Steve Lhomme <robux4 at videolabs.io>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * ( at your option ) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <QListWidget>
-#include <QListWidgetItem>
-#include <sstream>
-
-#include <vlc_common.h>
-#include <vlc_access.h>
-#include <vlc_renderer_discovery.h>
-#include <vlc_url.h>
-
-#include "dialogs/renderer.hpp"
-
-class RendererItem : public QListWidgetItem
-{
-public:
-    RendererItem(vlc_renderer_item *obj)
-        : QListWidgetItem( vlc_renderer_item_flags(obj) & VLC_RENDERER_CAN_VIDEO ? QIcon( ":/sidebar/movie" ) : QIcon( ":/sidebar/music" ),
-                           qfu( vlc_renderer_item_name(obj) ))
-    {
-        m_obj = vlc_renderer_item_hold(obj);
-    }
-    ~RendererItem()
-    {
-        vlc_renderer_item_release(m_obj);
-    }
-
-    bool isItemSout( const char *psz_sout, bool as_output ) const;
-
-protected:
-    vlc_renderer_item* m_obj;
-
-    friend class RendererDialog;
-};
-
-void RendererDialog::renderer_event_received( const vlc_event_t * p_event, void * user_data )
-{
-    RendererDialog *p_this = reinterpret_cast<RendererDialog*>(user_data);
-    p_this->discoveryEventReceived( p_event );
-}
-
-RendererDialog::RendererDialog( intf_thread_t *_p_intf )
-               : QVLCDialog( (QWidget*)_p_intf->p_sys->p_mi, _p_intf )
-               , p_rd( NULL )
-               , b_rd_started( false )
-{
-    setWindowTitle( qtr( "Renderer Output" ) );
-    setWindowRole( "vlc-renderer" );
-
-    /* Build Ui */
-    ui.setupUi( this );
-
-    CONNECT( ui.buttonBox, accepted(), this, accept() );
-    CONNECT( ui.buttonBox, rejected(), this, onReject() );
-    CONNECT( ui.receiversListWidget, itemDoubleClicked(QListWidgetItem*), this, accept());
-
-    QVLCTools::restoreWidgetPosition( p_intf, "Renderer", this, QSize( 400 , 440 ) );
-}
-
-RendererDialog::~RendererDialog()
-{
-    if ( p_rd != NULL )
-        vlc_rd_release( p_rd );
-}
-
-void RendererDialog::onReject()
-{
-    setSout( NULL );
-
-    QVLCDialog::reject();
-}
-
-void RendererDialog::close()
-{
-    QVLCTools::saveWidgetPosition( p_intf, "Renderer", this );
-
-    QVLCDialog::close();
-}
-
-void RendererDialog::setVisible(bool visible)
-{
-    QVLCDialog::setVisible(visible);
-
-    if (visible)
-    {
-        /* SD subnodes */
-        char **ppsz_longnames;
-        char **ppsz_names;
-        if( vlc_rd_get_names( THEPL, &ppsz_names, &ppsz_longnames ) != VLC_SUCCESS )
-            return;
-
-        char **ppsz_name = ppsz_names, **ppsz_longname = ppsz_longnames;
-        for( ; *ppsz_name; ppsz_name++, ppsz_longname++ )
-        {
-            /* TODO launch all discovery services for renderers */
-            msg_Dbg( p_intf, "starting renderer discovery service %s", *ppsz_longname );
-            if ( p_rd == NULL )
-            {
-                p_rd = vlc_rd_new( VLC_OBJECT(p_intf), *ppsz_name );
-                if( !p_rd )
-                    msg_Err( p_intf, "Could not start renderer discovery services" );
-            }
-            break;
-        }
-        free( ppsz_names );
-        free( ppsz_longnames );
-
-        if ( p_rd != NULL )
-        {
-            int row = -1;
-            char *psz_renderer = var_InheritString( THEPL, "sout" );
-            if ( psz_renderer != NULL )
-            {
-                for ( row = 0 ; row < ui.receiversListWidget->count(); row++ )
-                {
-                    RendererItem *rowItem = reinterpret_cast<RendererItem*>( ui.receiversListWidget->item( row ) );
-                    if ( rowItem->isItemSout( psz_renderer, false ) )
-                        break;
-                }
-                if ( row == ui.receiversListWidget->count() )
-                    row = -1;
-                free( psz_renderer );
-            }
-            ui.receiversListWidget->setCurrentRow( row );
-
-            if ( !b_rd_started )
-            {
-                vlc_event_manager_t *em = vlc_rd_event_manager( p_rd );
-                vlc_event_attach( em, vlc_RendererDiscoveryItemAdded, renderer_event_received, this );
-                vlc_event_attach( em, vlc_RendererDiscoveryItemRemoved, renderer_event_received, this );
-
-                b_rd_started = vlc_rd_start( p_rd ) == VLC_SUCCESS;
-                if ( !b_rd_started )
-                {
-                    vlc_event_detach( em, vlc_RendererDiscoveryItemAdded, renderer_event_received, this);
-                    vlc_event_detach( em, vlc_RendererDiscoveryItemRemoved, renderer_event_received, this);
-                }
-            }
-        }
-    }
-    else
-    {
-        if ( p_rd != NULL )
-        {
-            if ( b_rd_started )
-            {
-                vlc_event_manager_t *em = vlc_rd_event_manager( p_rd );
-                vlc_event_detach( em, vlc_RendererDiscoveryItemAdded, renderer_event_received, this);
-                vlc_event_detach( em, vlc_RendererDiscoveryItemRemoved, renderer_event_received, this);
-
-                vlc_rd_stop( p_rd );
-                b_rd_started = false;
-            }
-        }
-        ui.receiversListWidget->clear();
-    }
-}
-
-void RendererDialog::accept()
-{
-    /* get the selected one in the listview if any */
-    QListWidgetItem *current = ui.receiversListWidget->currentItem();
-    if (current != NULL)
-    {
-        RendererItem *rowItem = reinterpret_cast<RendererItem*>(current);
-        msg_Dbg( p_intf, "selecting Renderer %s", vlc_renderer_item_name(rowItem->m_obj) );
-
-        setSout( rowItem->m_obj );
-    }
-
-    QVLCDialog::accept();
-}
-
-void RendererDialog::discoveryEventReceived( const vlc_event_t * p_event )
-{
-    if ( p_event->type == vlc_RendererDiscoveryItemAdded )
-    {
-        vlc_renderer_item *p_item =  p_event->u.renderer_discovery_item_added.p_new_item;
-
-        int row = 0;
-        for ( ; row < ui.receiversListWidget->count(); row++ )
-        {
-            RendererItem *rowItem = reinterpret_cast<RendererItem*>( ui.receiversListWidget->item( row ) );
-            if ( rowItem->isItemSout( vlc_renderer_item_sout( p_item ), false ) )
-                return;
-        }
-
-        RendererItem *newItem = new RendererItem(p_item);
-        ui.receiversListWidget->addItem( newItem );
-
-        char *psz_renderer = var_InheritString( THEPL, "sout" );
-        if ( psz_renderer != NULL )
-        {
-            if ( newItem->isItemSout( psz_renderer, true ) )
-                ui.receiversListWidget->setCurrentItem( newItem );
-            free( psz_renderer );
-        }
-    }
-}
-
-void RendererDialog::setSout( const vlc_renderer_item *p_item )
-{
-    std::stringstream s_sout;
-    if ( p_item )
-    {
-        const char *psz_out = vlc_renderer_item_sout( p_item );
-        if ( psz_out )
-            s_sout << '#' << psz_out;
-    }
-
-    msg_Dbg( p_intf, "using sout: '%s'", s_sout.str().c_str() );
-    var_SetString( THEPL, "sout", s_sout.str().c_str() );
-}
-
-bool RendererItem::isItemSout( const char *psz_sout, bool as_output ) const
-{
-    std::stringstream s_sout;
-    if ( psz_sout == NULL )
-        psz_sout = "";
-    if ( m_obj )
-    {
-        const char *psz_out = vlc_renderer_item_sout( m_obj );
-        if ( likely( psz_out != NULL ) )
-        {
-            if ( as_output )
-                s_sout << '#';
-            s_sout << psz_out;
-        }
-    }
-    return s_sout.str() == psz_sout;
-}
diff --git a/modules/gui/qt/dialogs/renderer.hpp b/modules/gui/qt/dialogs/renderer.hpp
deleted file mode 100644
index 4090bfe..0000000
--- a/modules/gui/qt/dialogs/renderer.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*****************************************************************************
- * renderer.hpp : Renderer output dialog
- ****************************************************************************
- * Copyright ( C ) 2015 the VideoLAN team
- * $Id$
- *
- * Authors: Steve Lhomme <robux4 at videolabs.io>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * ( at your option ) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef QVLC_RENDERER_DIALOG_H_
-#define QVLC_RENDERER_DIALOG_H_ 1
-
-#include "util/qvlcframe.hpp"
-#include "util/singleton.hpp"
-#include "ui/renderer.h"
-
-class MsgEvent;
-
-class RendererDialog : public QVLCDialog, public Singleton<RendererDialog>
-{
-    Q_OBJECT
-
-public:
-    void discoveryEventReceived( const vlc_event_t * p_event );
-    void setVisible(bool visible);
-
-private:
-    RendererDialog( intf_thread_t * );
-    virtual ~RendererDialog();
-
-    Ui::rendererWidget ui;
-    void sinkMessage( const MsgEvent * );
-
-private slots:
-    void accept();
-    void onReject();
-    void close();
-
-private:
-
-    friend class          Singleton<RendererDialog>;
-    vlc_renderer_discovery *p_rd;
-    bool                  b_rd_started;
-    void                  setSout( const vlc_renderer_item *p_item );
-
-    static void           renderer_event_received( const vlc_event_t * p_event, void * user_data );
-};
-
-
-#endif
diff --git a/modules/gui/qt/dialogs_provider.cpp b/modules/gui/qt/dialogs_provider.cpp
index d7a50ca..5951b65 100644
--- a/modules/gui/qt/dialogs_provider.cpp
+++ b/modules/gui/qt/dialogs_provider.cpp
@@ -57,7 +57,6 @@
 #include "dialogs/external.hpp"
 #include "dialogs/epg.hpp"
 #include "dialogs/errors.hpp"
-#include "dialogs/renderer.hpp"
 
 #include <QEvent>
 #include <QApplication>
@@ -154,8 +153,6 @@ void DialogsProvider::customEvent( QEvent *event )
            bookmarksDialog(); break;
         case INTF_DIALOG_EXTENDED:
            extendedDialog(); break;
-        case INTF_DIALOG_RENDERER:
-           rendererDialog(); break;
         case INTF_DIALOG_SENDKEY:
            sendKey( de->i_arg ); break;
 #ifdef ENABLE_VLM
@@ -237,11 +234,6 @@ void DialogsProvider::extendedDialog()
         extDialog->hide();
 }
 
-void DialogsProvider::rendererDialog()
-{
-    RendererDialog::getInstance( p_intf )->toggleVisible();
-}
-
 void DialogsProvider::synchroDialog()
 {
     ExtendedDialog *extDialog = ExtendedDialog::getInstance(p_intf );
diff --git a/modules/gui/qt/dialogs_provider.hpp b/modules/gui/qt/dialogs_provider.hpp
index 8de4fb5..01faa11 100644
--- a/modules/gui/qt/dialogs_provider.hpp
+++ b/modules/gui/qt/dialogs_provider.hpp
@@ -124,9 +124,6 @@ public slots:
     void mediaCodecDialog();
     void prefsDialog();
     void extendedDialog();
-#if defined(ENABLE_SOUT)
-    void rendererDialog();
-#endif
     void synchroDialog();
     void messagesDialog();
     void sendKey( int key );
diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp
index c770995..799aa5a 100644
--- a/modules/gui/qt/menus.cpp
+++ b/modules/gui/qt/menus.cpp
@@ -430,11 +430,6 @@ QMenu *VLCMenuBar::ToolsMenu( intf_thread_t *p_intf, QMenu *menu )
         "Ctrl+Shift+W" );
 #endif
 
-#if defined(ENABLE_SOUT)
-    addDPStaticEntry( menu, qtr( I_MENU_RENDERER ), "", SLOT( rendererDialog() ),
-        "Ctrl+Shift+R" );
-#endif
-
     addDPStaticEntry( menu, qtr( "Program Guide" ), "", SLOT( epgDialog() ),
         "" );
 
diff --git a/modules/gui/qt/ui/renderer.ui b/modules/gui/qt/ui/renderer.ui
deleted file mode 100644
index cc32ce0..0000000
--- a/modules/gui/qt/ui/renderer.ui
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>rendererWidget</class>
- <widget class="QWidget" name="rendererWidget">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>570</width>
-    <height>440</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Renderer Output</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout_2">
-   <item>
-    <widget class="QLabel" name="label">
-     <property name="text">
-      <string>Available Renderers</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QListWidget" name="receiversListWidget">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-       <horstretch>0</horstretch>
-       <verstretch>1</verstretch>
-      </sizepolicy>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
-- 
2.7.2.windows.1



More information about the vlc-devel mailing list