From 2fe13ef6f75e31db2542f8433d53a5c319da7c5b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cl=C3=A9ment=20Stenac?= Date: Sun, 27 Aug 2006 12:50:32 +0000 Subject: [PATCH] Fix play/pause icons Implement integer config control --- .../qt4/components/preferences_widgets.cpp | 50 ++++++++++++++++++- .../qt4/components/preferences_widgets.hpp | 13 +++-- modules/gui/qt4/input_manager.cpp | 6 +-- modules/gui/qt4/main_interface.cpp | 4 +- 4 files changed, 63 insertions(+), 10 deletions(-) diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp index fa659e0b54..49039f1d06 100644 --- a/modules/gui/qt4/components/preferences_widgets.cpp +++ b/modules/gui/qt4/components/preferences_widgets.cpp @@ -60,6 +60,14 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this, else fprintf(stderr, "TODO\n" ); break; + case CONFIG_ITEM_INTEGER: + if( p_item->i_list ) + fprintf( stderr, "Todo\n" ); + else if( p_item->i_min || p_item->i_max ) + fprintf( stderr, "Todo\n" ); + else + p_control = new IntegerConfigControl( p_this, p_item, parent ); + break; default: break; } @@ -96,6 +104,7 @@ StringConfigControl::StringConfigControl( vlc_object_t *_p_this, void StringConfigControl::finish( QLabel *label ) { + text->setText( qfu(p_item->psz_value) ); text->setToolTip( qfu(p_item->psz_longtext) ); label->setToolTip( qfu(p_item->psz_longtext) ); } @@ -165,9 +174,46 @@ void ModuleConfigControl::finish( QLabel *label, bool bycat ) label->setToolTip( qfu(p_item->psz_longtext) ); } -ModuleConfigControl::~ModuleConfigControl() {}; - QString ModuleConfigControl::getValue() { return combo->itemData( combo->currentIndex() ).toString(); } + +/************************************************************************** + * Integer-based controls + *************************************************************************/ + +/*********** Integer **************/ +IntegerConfigControl::IntegerConfigControl( vlc_object_t *_p_this, + module_config_t *_p_item, + QWidget *_parent ) : + VIntConfigControl( _p_this, _p_item, _parent ) +{ + QLabel *label = new QLabel( qfu(p_item->psz_text) ); + spin = new QSpinBox; + finish( label ); + + QHBoxLayout *layout = new QHBoxLayout(); + layout->addWidget( label, 0 ); layout->addWidget( spin, 1 ); + widget->setLayout( layout ); +} +IntegerConfigControl::IntegerConfigControl( vlc_object_t *_p_this, + module_config_t *_p_item, + QLabel *label, QSpinBox *_spin ) : + VIntConfigControl( _p_this, _p_item ) +{ + spin = _spin; + finish(label); +} + +void IntegerConfigControl::finish( QLabel *label ) +{ + spin->setValue( p_item->i_value ); + spin->setToolTip( qfu(p_item->psz_longtext) ); + label->setToolTip( qfu(p_item->psz_longtext) ); +} + +int IntegerConfigControl::getValue() +{ + return spin->value(); +} diff --git a/modules/gui/qt4/components/preferences_widgets.hpp b/modules/gui/qt4/components/preferences_widgets.hpp index e19cf760c4..7731ea1d32 100644 --- a/modules/gui/qt4/components/preferences_widgets.hpp +++ b/modules/gui/qt4/components/preferences_widgets.hpp @@ -74,21 +74,26 @@ class VIntConfigControl : public ConfigControl public: VIntConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) : ConfigControl(a,b,c) {}; + VIntConfigControl( vlc_object_t *a, module_config_t *b ) : + ConfigControl(a,b) {}; virtual ~VIntConfigControl() {}; virtual int getValue() = 0; }; -#if 0 class IntegerConfigControl : public VIntConfigControl { public: IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget * ); - virtual ~IntegerConfigControl(); + IntegerConfigControl( vlc_object_t *, module_config_t *, + QLabel*, QSpinBox* ); + virtual ~IntegerConfigControl() {}; virtual int getValue(); private: QSpinBox *spin; + void finish( QLabel * ); }; +#if 0 class BoolConfigControl : public VIntConfigControl { public: @@ -108,6 +113,8 @@ class VFloatConfigControl : public ConfigControl public: VFloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) : ConfigControl(a,b,c) {}; + VFloatConfigControl( vlc_object_t *a, module_config_t *b ) : + ConfigControl(a,b) {}; virtual ~VFloatConfigControl() {}; virtual float getValue() = 0; }; @@ -160,7 +167,7 @@ public: bycat ); ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *, QComboBox*, bool ); - virtual ~ModuleConfigControl(); + virtual ~ModuleConfigControl() {}; virtual QString getValue(); private: void finish( QLabel *, bool ); diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp index 34ab07b5a7..f541210463 100644 --- a/modules/gui/qt4/input_manager.cpp +++ b/modules/gui/qt4/input_manager.cpp @@ -53,13 +53,13 @@ void InputManager::setInput( input_thread_t *_p_input ) void InputManager::update() { /// \todo Emit the signals only if it changed - if( !p_input || p_input->b_die ) return; + if( !p_input ) return; - if( p_input->b_dead ) + if( p_input->b_dead || p_input->b_die ) { emit positionUpdated( 0.0, 0, 0 ); emit navigationChanged( 0 ); - emit statusChanged( 0 ); // 0 = STOPPED, 1 = PAUSE, 2 = PLAY + emit statusChanged( 0 ); // 0 = STOPPED, 1 = PLAY, 2 = PAUSE } /* Update position */ diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp index dd9a357c66..f650bb9004 100644 --- a/modules/gui/qt4/main_interface.cpp +++ b/modules/gui/qt4/main_interface.cpp @@ -200,7 +200,7 @@ void MainInterface::setName( QString name ) void MainInterface::setStatus( int status ) { - if( status == 2 ) // Playing + if( status == 1 ) // Playing ui.playButton->setIcon( QIcon( ":/pixmaps/pause.png" ) ); else ui.playButton->setIcon( QIcon( ":/pixmaps/play.png" ) ); @@ -249,7 +249,7 @@ static int InteractCallback( vlc_object_t *p_this, { intf_dialog_args_t *p_arg = new intf_dialog_args_t; p_arg->p_dialog = (interaction_dialog_t *)(new_val.p_address); - + MainInterface *p_interface = (MainInterface*)param; DialogEvent *event = new DialogEvent( INTF_DIALOG_INTERACTION, 0, p_arg ); QApplication::postEvent( THEDP, static_cast(event) ); -- 2.39.2