]> git.sesse.net Git - vlc/commitdiff
Fix play/pause icons
authorClément Stenac <zorglub@videolan.org>
Sun, 27 Aug 2006 12:50:32 +0000 (12:50 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 27 Aug 2006 12:50:32 +0000 (12:50 +0000)
Implement integer config control

modules/gui/qt4/components/preferences_widgets.cpp
modules/gui/qt4/components/preferences_widgets.hpp
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/main_interface.cpp

index fa659e0b540efca48a397e8b6b1489c528b66a72..49039f1d066527075fff0e2b10f52c68979aab03 100644 (file)
@@ -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();
+}
index e19cf760c439365996ed7cf1c63530f5f41e49c3..7731ea1d32d4f44123aa276238560e9f616b091b 100644 (file)
@@ -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 );
index 34ab07b5a775b6285e822061fce250e736d67f33..f541210463e2dd5d0785d55915bd51c7911125bd 100644 (file)
@@ -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 */
index dd9a357c66086e15ed3df94cab4b822d623e1d60..f650bb9004d4fd3d7c51ebc993604adceef2c506 100644 (file)
@@ -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<QEvent*>(event) );