From 32f7fa1068f28c6c4342d29888a64b3b72695504 Mon Sep 17 00:00:00 2001 From: Jean-Paul Saman Date: Mon, 9 Mar 2009 11:30:25 +0100 Subject: [PATCH 1/1] qt4: Catch INPUT_EVENT_PROGRAM updates and show icon when "program-scrambled" is set. --- modules/gui/qt4/input_manager.cpp | 20 ++++++++++++++++---- modules/gui/qt4/input_manager.hpp | 9 ++++----- modules/gui/qt4/main_interface.cpp | 7 +------ modules/gui/qt4/main_interface.hpp | 4 ---- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp index adb58f1369..14490b676a 100644 --- a/modules/gui/qt4/input_manager.cpp +++ b/modules/gui/qt4/input_manager.cpp @@ -138,9 +138,8 @@ void InputManager::delInput() emit artChanged( NULL ); emit infoChanged( NULL ); emit metaChanged( (input_item_t *)NULL ); -#if 0 + emit encryptionChanged( false ); -#endif } /* Convert the event from the callbacks in actions */ @@ -229,6 +228,9 @@ void InputManager::customEvent( QEvent *event ) case RecordingEvent_Type: UpdateRecord(); break; + case ProgramChanged_Type: + UpdateProgramEvent(); + break; default: msg_Warn( p_intf, "This shouldn't happen: %i", i_type ); assert(0); @@ -328,8 +330,9 @@ static int InputEvent( vlc_object_t *p_this, const char *, case INPUT_EVENT_PROGRAM: /* This is for PID changes */ - /* event = new IMEvent( ProgramChanged_Type, 0 ); - break; */ + event = new IMEvent( ProgramChanged_Type, 0 ); + break; + case INPUT_EVENT_SIGNAL: /* This is for capture-card signals */ /* event = new IMEvent( SignalChanged_Type, 0 ); @@ -628,6 +631,15 @@ void InputManager::UpdateRecord() } } +void InputManager::UpdateProgramEvent() +{ + if( hasInput() ) + { + bool b_scrambled = var_GetBool( p_input, "program-scrambled" ); + emit encryptionChanged( b_scrambled ); + } +} + /* User update of the slider */ void InputManager::sliderUpdate( float new_pos ) { diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp index bc478e1404..961d2d758a 100644 --- a/modules/gui/qt4/input_manager.hpp +++ b/modules/gui/qt4/input_manager.hpp @@ -58,8 +58,8 @@ enum { CachingEvent_Type, BookmarksChanged_Type, RecordingEvent_Type, -/* ProgramChanged_Type, - SignalChanged_Type, */ + ProgramChanged_Type, +/* SignalChanged_Type, */ FullscreenControlToggle_Type = QEvent::User + IMEventType + 20, FullscreenControlShow_Type, @@ -135,7 +135,7 @@ private: void UpdateStats(); void UpdateCaching(); void UpdateRecord(); - + void UpdateProgramEvent(); public slots: void setInput( input_thread_t * ); ///< Our controlled input changed @@ -197,9 +197,8 @@ signals: void synchroChanged(); void bookmarksChanged(); void cachingChanged( float ); -#if 0 + /// Program Event changes void encryptionChanged( bool ); -#endif }; class MainInputManager : public QObject diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp index d31d5e596a..54e0bbadc3 100644 --- a/modules/gui/qt4/main_interface.cpp +++ b/modules/gui/qt4/main_interface.cpp @@ -81,9 +81,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) playlistVisible = false; input_name = ""; fullscreenControls = NULL; -#if 0 cryptedLabel = NULL; -#endif /* Ask for privacy */ askForPrivacy(); @@ -353,12 +351,10 @@ inline void MainInterface::createStatusBar() - right-clicking and clicking just toggle between remaining and elapsed time.*/ CONNECT( timeLabel, timeLabelDoubleClicked(), THEDP, gotoTimeDialog() ); -#if 0 + CONNECT( THEMIM->getIM(), encryptionChanged( bool ) , this, showCryptedLabel( bool ) ); -#endif } -#if 0 void MainInterface::showCryptedLabel( bool ) { if( cryptedLabel == NULL ) @@ -370,7 +366,6 @@ void MainInterface::showCryptedLabel( bool ) cryptedLabel->show(); } -#endif inline void MainInterface::initSystray() { diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp index fd66a5d7f7..ff96d353e3 100644 --- a/modules/gui/qt4/main_interface.hpp +++ b/modules/gui/qt4/main_interface.hpp @@ -142,9 +142,7 @@ private: /* Status Bar */ QLabel *nameLabel; -#if 0 QLabel *cryptedLabel; -#endif virtual void customEvent( QEvent *); virtual void keyPressEvent( QKeyEvent *); @@ -177,9 +175,7 @@ private slots: void updateSystrayTooltipName( QString ); void updateSystrayTooltipStatus( int ); -#if 0 void showCryptedLabel( bool ); -#endif signals: void askReleaseVideo( ); void askVideoToResize( unsigned int, unsigned int ); -- 2.39.2