From d43b6be00d16cc30b3f33e5657d8860f4e59ec89 Mon Sep 17 00:00:00 2001 From: Francois Cartegnie Date: Fri, 24 Sep 2010 23:01:23 +0200 Subject: [PATCH] Qt: v4l2 control: drop v4l2.ui. auto-detect instance. --- modules/gui/qt4/Modules.am | 2 -- .../gui/qt4/components/extended_panels.cpp | 28 +++++++++------ .../gui/qt4/components/extended_panels.hpp | 3 +- modules/gui/qt4/ui/v4l2.ui | 34 ------------------- 4 files changed, 18 insertions(+), 49 deletions(-) delete mode 100644 modules/gui/qt4/ui/v4l2.ui diff --git a/modules/gui/qt4/Modules.am b/modules/gui/qt4/Modules.am index 0222e59c8b..60355813d1 100644 --- a/modules/gui/qt4/Modules.am +++ b/modules/gui/qt4/Modules.am @@ -69,7 +69,6 @@ nodist_SOURCES_qt4 = \ util/qvlcapp.moc.cpp \ resources.cpp \ ui/equalizer.h \ - ui/v4l2.h \ ui/video_effects.h \ ui/open_file.h \ ui/open_disk.h \ @@ -344,7 +343,6 @@ noinst_HEADERS = \ EXTRA_DIST += \ vlc.qrc \ ui/equalizer.ui \ - ui/v4l2.ui \ ui/video_effects.ui \ ui/open_file.ui \ ui/open_disk.ui \ diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp index 3d363a1a46..18a10dd245 100644 --- a/modules/gui/qt4/components/extended_panels.cpp +++ b/modules/gui/qt4/components/extended_panels.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include "components/extended_panels.hpp" #include "dialogs/preferences.hpp" @@ -633,13 +634,16 @@ void ExtVideo::gotoConf( QObject* src ) **********************************************************************/ ExtV4l2::ExtV4l2( intf_thread_t *_p_intf, QWidget *_parent ) - : QWidget( _parent ), p_intf( _p_intf ) + : QWidget( _parent ), p_intf( _p_intf ), box( NULL ) { - ui.setupUi( this ); - - BUTTONACT( ui.refresh, Refresh() ); - - box = NULL; + QVBoxLayout *layout = new QVBoxLayout( this ); + help = new QLabel( qtr("No v4l2 instance found.\n" + "Please check that the device has been opened with VLC and is playing.\n\n" + "Controls will automatically appear here.") + , this ); + help->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); + layout->addWidget( help ); + setLayout( layout ); } void ExtV4l2::showEvent( QShowEvent *event ) @@ -651,10 +655,10 @@ void ExtV4l2::showEvent( QShowEvent *event ) void ExtV4l2::Refresh( void ) { vlc_object_t *p_obj = (vlc_object_t*)vlc_object_find_name( p_intf, "v4l2", FIND_ANYWHERE ); - ui.help->hide(); + help->hide(); if( box ) { - ui.vboxLayout->removeWidget( box ); + layout()->removeWidget( box ); delete box; box = NULL; } @@ -666,13 +670,13 @@ void ExtV4l2::Refresh( void ) if( i_ret < 0 ) { msg_Err( p_intf, "Oops, v4l2 object doesn't have a 'controls' variable." ); - ui.help->show(); + help->show(); vlc_object_release( p_obj ); return; } box = new QGroupBox( this ); - ui.vboxLayout->addWidget( box ); + layout()->addWidget( box ); QVBoxLayout *layout = new QVBoxLayout( box ); box->setLayout( layout ); @@ -780,7 +784,9 @@ void ExtV4l2::Refresh( void ) else { msg_Dbg( p_intf, "Couldn't find v4l2 instance" ); - ui.help->show(); + help->show(); + if ( isVisible() ) + QTimer::singleShot( 2000, this, SLOT(Refresh()) ); } } diff --git a/modules/gui/qt4/components/extended_panels.hpp b/modules/gui/qt4/components/extended_panels.hpp index 89721a47bb..d38d138f6f 100644 --- a/modules/gui/qt4/components/extended_panels.hpp +++ b/modules/gui/qt4/components/extended_panels.hpp @@ -33,7 +33,6 @@ #include "ui/equalizer.h" #include "ui/video_effects.h" -#include "ui/v4l2.h" #include @@ -75,8 +74,8 @@ public: private: intf_thread_t *p_intf; - Ui::ExtV4l2Widget ui; QGroupBox *box; + QLabel *help; private slots: void Refresh( void ); diff --git a/modules/gui/qt4/ui/v4l2.ui b/modules/gui/qt4/ui/v4l2.ui deleted file mode 100644 index ec18b20d12..0000000000 --- a/modules/gui/qt4/ui/v4l2.ui +++ /dev/null @@ -1,34 +0,0 @@ - - ExtV4l2Widget - - - - 0 - 0 - 405 - 300 - - - - Form - - - - - - Refresh - - - - - - - No v4l2 instance found. Press the refresh button to try again. - - - - - - - - -- 2.39.2