]> git.sesse.net Git - vlc/commitdiff
Qt4 : Changes in the main interface:
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 20 Aug 2007 08:41:55 +0000 (08:41 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 20 Aug 2007 08:41:55 +0000 (08:41 +0000)
 - Don't use the .ui, do all by hand :)
 - Use a ControlWidgets to design all the controls, and implement the functions
 - Change a bit the advanced widget, that must be integrated in the
   controlsWidget
There is a lot of Not Yet Implemented, so feel free to add some.

modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp

index 2590afd38799a6173418d4ad4ea6382c4cfedc5c..0f2c02720003a01bd1686461eeeaef27ab6944f6 100644 (file)
@@ -5,6 +5,7 @@
  * $Id$
  *
  * Authors: Clément Stenac <zorglub@videolan.org>
+ *          Jean-Baptiste Kempf <jb@videolan.org>
  *
  * 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
@@ -27,6 +28,7 @@
 #include "main_interface.hpp"
 #include "input_manager.hpp"
 
+#include "util/input_slider.hpp"
 #include <vlc_vout.h>
 
 #include <QLabel>
@@ -204,7 +206,7 @@ void VisualSelector::next()
 /**********************************************************************
  * More controls
  **********************************************************************/
-ControlsWidget::ControlsWidget( intf_thread_t *_p_i ) :
+AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) :
                                            QFrame( NULL ), p_intf( _p_i )
 {
     QHBoxLayout *layout = new QHBoxLayout( this );
@@ -239,43 +241,304 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i ) :
     fullscreenButton->setMaximumWidth( 35 );
 }
 
-ControlsWidget::~ControlsWidget()
+AdvControlsWidget::~AdvControlsWidget()
 {
 }
 
-void ControlsWidget::enableInput( bool enable )
+void AdvControlsWidget::enableInput( bool enable )
 {
     slowerButton->setEnabled( enable );
     normalButton->setEnabled( enable );
     fasterButton->setEnabled( enable );
 }
-void ControlsWidget::enableVideo( bool enable )
+void AdvControlsWidget::enableVideo( bool enable )
 {
     snapshotButton->setEnabled( enable );
     fullscreenButton->setEnabled( enable );
 }
 
-void ControlsWidget::slower()
+void AdvControlsWidget::slower()
 {
     THEMIM->getIM()->slower();
 }
 
-void ControlsWidget::faster()
+void AdvControlsWidget::faster()
 {
     THEMIM->getIM()->faster();
 }
 
-void ControlsWidget::normal()
+void AdvControlsWidget::normal()
 {
     THEMIM->getIM()->normalRate();
 }
 
-void ControlsWidget::snapshot()
+void AdvControlsWidget::snapshot()
 {
 }
 
+void AdvControlsWidget::fullscreen()
+{
+}
+
+ControlsWidget::ControlsWidget( intf_thread_t *_p_i ) :
+                             QFrame( NULL ), p_intf( _p_i )
+{
+    //QSize size( 500, 200 );
+    //resize( size );
+    controlLayout = new QGridLayout( this );
+
+    /** The main Slider **/
+    slider = new InputSlider( Qt::Horizontal, NULL );
+    controlLayout->addWidget( slider, 0, 1, 1, 14 );
+    /* Update the position when the IM has changed */
+    CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
+             slider, setPosition( float,int, int ) );
+    /* And update the IM, when the position has changed */
+    CONNECT( slider, sliderDragged( float ),
+             THEMIM->getIM(), sliderUpdate( float ) );
+
+    /** Disc and Menus handling */
+    discFrame = new QFrame( this );
+    QHBoxLayout *discLayout = new QHBoxLayout( discFrame );
+
+    QPushButton *menuButton = new QPushButton( discFrame );
+    discLayout->addWidget( menuButton );
+
+    QPushButton *prevSectionButton = new QPushButton( discFrame );
+    discLayout->addWidget( prevSectionButton );
+
+    QPushButton *nextSectionButton = new QPushButton( discFrame );
+    discLayout->addWidget( nextSectionButton );
+
+    controlLayout->addWidget( discFrame, 1, 13, 1, 4 );
+
+    BUTTON_SET_IMG( prevSectionButton, "", previous.png, "" );
+    BUTTON_SET_IMG( nextSectionButton, "", next.png, "" );
+    BUTTON_SET_IMG( menuButton, "", previous.png, "" );
+
+    discFrame->hide();
+
+    /* Change the navigation button display when the IM navigation changes */
+    CONNECT( THEMIM->getIM(), navigationChanged( int ),
+             this, setNavigation(int) );
+    /* Changes the IM navigation when triggered on the nav buttons */
+    CONNECT( prevSectionButton, clicked(), THEMIM->getIM(),
+             sectionPrev() );
+    CONNECT( nextSectionButton, clicked(), THEMIM->getIM(),
+             sectionNext() );
+    CONNECT( menuButton, clicked(), THEMIM->getIM(),
+             sectionMenu() );
+
+    /** Play Buttons **/
+    QSizePolicy sizePolicy( QSizePolicy::Maximum, QSizePolicy::Fixed );
+    sizePolicy.setHorizontalStretch( 0 );
+    sizePolicy.setVerticalStretch( 0 );
+//  sizePolicy.setHeightForWidth( playButton->sizePolicy( ).hasHeightForWidth( ) );
+
+    /* Play */
+    QPushButton *playButton = new QPushButton;
+    playButton->setSizePolicy( sizePolicy );
+    playButton->setMaximumSize( QSize( 45, 45 ) );
+    playButton->setIconSize( QSize( 30, 30 ) );
+
+    controlLayout->addWidget( playButton, 2, 0, 2, 2 );
+
+    /** Prev + Stop + Next Block **/
+    QHBoxLayout *controlButLayout = new QHBoxLayout;
+    controlButLayout->setSpacing( 0 ); /* Don't remove that, will be useful */
+
+    /* Prev */
+    QPushButton *prevButton = new QPushButton;
+    prevButton->setSizePolicy( sizePolicy );
+    prevButton->setMaximumSize( QSize( 26, 26 ) );
+    prevButton->setIconSize( QSize( 20, 20 ) );
+
+    controlButLayout->addWidget( prevButton );
+
+    /* Stop */
+    QPushButton *stopButton = new QPushButton;
+    stopButton->setSizePolicy( sizePolicy );
+    stopButton->setMaximumSize( QSize( 26, 26 ) );
+    stopButton->setIconSize( QSize( 20, 20 ) );
+
+    controlButLayout->addWidget( stopButton );
+
+    /* next */
+    QPushButton *nextButton = new QPushButton;
+    nextButton->setSizePolicy( sizePolicy );
+    nextButton->setMaximumSize( QSize( 26, 26 ) );
+    nextButton->setIconSize( QSize( 20, 20 ) );
+
+    controlButLayout->addWidget( nextButton );
+
+    /* Add this block to the main layout */
+    controlLayout->addLayout( controlButLayout, 3, 3, 1, 3 );
+
+    BUTTON_SET_ACT_I( playButton, "", play.png, qtr("Play"), play() );
+    BUTTON_SET_ACT_I( prevButton, "" , previous.png,
+                      qtr("Previous"), prev() );
+    BUTTON_SET_ACT_I( nextButton, "", next.png, qtr("Next"), next() );
+    BUTTON_SET_ACT_I( stopButton, "", stop.png, qtr("Stop"), stop() );
+
+    /*
+     * Other first Line buttons
+     * Might need to be inside a frame to avoid a few resizing pb
+     * FIXME
+     */
+    /** Playlist Button **/
+    playlistButton = new QPushButton;
+    playlistButton->setMaximumSize(QSize(45, 45));
+
+    controlLayout->addWidget( playlistButton, 3, 10 );
+
+    /** Fullscreen/Visualisation **/
+    QPushButton *fullscreenButton = new QPushButton( "F" );
+    BUTTON_SET_ACT( fullscreenButton, "F", qtr("Fullscreen"), fullscreen() );
+    fullscreenButton->setMaximumSize( QSize( 26, 26 ) );
+    controlLayout->addWidget( fullscreenButton, 3, 11 );
+
+    /** extended Settings **/
+    QPushButton *extSettingsButton = new QPushButton( "F" );
+    BUTTON_SET_ACT( extSettingsButton, "Ex", qtr("Extended Settings"),
+            extSettings() );
+    extSettingsButton->setMaximumSize( QSize( 26, 26 ) );
+    controlLayout->addWidget( extSettingsButton, 3, 12 );
+
+    /** Preferences **/
+    QPushButton *prefsButton = new QPushButton( "P" );
+    BUTTON_SET_ACT( prefsButton, "P", qtr("Preferences / Settings"), prefs() );
+    prefsButton->setMaximumSize( QSize( 26, 26 ) );
+    controlLayout->addWidget( prefsButton, 3, 13 );
+
+    /* Volume */
+    VolumeClickHandler *h = new VolumeClickHandler( p_intf, this );
+
+    QLabel *volMuteLabel = new QLabel;
+    volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
+    volMuteLabel->setToolTip( qtr( "Mute" ) );
+    volMuteLabel->installEventFilter(h);
+
+    volumeSlider = new QSlider;
+    volumeSlider->setSizePolicy( sizePolicy );
+    volumeSlider->setMaximumSize( QSize(80, 200) );
+    volumeSlider->setOrientation( Qt::Horizontal );
+
+    volumeSlider->setMaximum( 100 );
+    volumeSlider->setFocusPolicy( Qt::NoFocus );
+    controlLayout->addWidget( volMuteLabel, 3, 14 );
+    controlLayout->addWidget( volumeSlider, 3, 15, 1, 2 );
+
+    /* Volume control connection */
+    CONNECT( volumeSlider, valueChanged( int ), this, updateVolume( int ) );
+
+}
+ControlsWidget::~ControlsWidget()
+{
+}
+void ControlsWidget::stop()
+{
+    THEMIM->stop();
+}
+
+void ControlsWidget::play()
+{
+    if( playlist_IsEmpty(THEPL) )
+    {
+        /* The playlist is empty, open a file requester */
+        THEDP->openFileDialog();
+        setStatus( 0 );
+        return;
+    }
+    THEMIM->togglePlayPause();
+}
+
+void ControlsWidget::prev()
+{
+    THEMIM->prev();
+}
+
+void ControlsWidget::next()
+{
+    THEMIM->next();
+}
+
+void ControlsWidget::setNavigation( int navigation )
+{
+#define HELP_MENU N_("Menu")
+#define HELP_PCH N_("Previous chapter")
+#define HELP_NCH N_("Next chapter")
+#define HELP_PTR N_("Previous track")
+#define HELP_NTR N_("Next track")
+
+    // 1 = chapter, 2 = title, 0 = no
+    if( navigation == 0 )
+    {
+        discFrame->hide();
+    } else if( navigation == 1 ) {
+        prevSectionButton->show();
+        prevSectionButton->setToolTip( qfu(HELP_PCH) );
+        nextSectionButton->show();
+        nextSectionButton->setToolTip( qfu(HELP_NCH) );
+        menuButton->show();
+        discFrame->show();
+    } else {
+        prevSectionButton->show();
+        prevSectionButton->setToolTip( qfu(HELP_PCH) );
+        nextSectionButton->show();
+        nextSectionButton->setToolTip( qfu(HELP_NCH) );
+        menuButton->hide();
+        discFrame->show();
+    }
+}
+
+static bool b_my_volume;
+void ControlsWidget::updateVolume( int sliderVolume )
+{
+    if( !b_my_volume )
+    {
+        int i_res = sliderVolume * AOUT_VOLUME_MAX /
+                            ( 2*volumeSlider->maximum() );
+        aout_VolumeSet( p_intf, i_res );
+    }
+}
+
+void ControlsWidget::updateOnTimer()
+{
+    audio_volume_t i_volume;
+    aout_VolumeGet( p_intf, &i_volume );
+    i_volume = (i_volume *  200 )/ AOUT_VOLUME_MAX ;
+    int i_gauge = volumeSlider->value();
+    b_my_volume = false;
+    if( i_volume - i_gauge > 1 || i_gauge - i_volume > 1 )
+    {
+        b_my_volume = true;
+        volumeSlider->setValue( i_volume );
+        b_my_volume = false;
+    }
+}
+void ControlsWidget::setStatus( int status )
+{
+    if( status == 1 ) // Playing
+        playButton->setIcon( QIcon( ":/pixmaps/pause.png" ) );
+    else
+        playButton->setIcon( QIcon( ":/pixmaps/play.png" ) ); 
+}
+/*
+ * This functions toggle the fullscreen mode
+ * If there is no video, it should first activate Visualisations... TODO
+ */
 void ControlsWidget::fullscreen()
 {
+    msg_Dbg(p_intf, "Not implemented yet");
+}
+
+void ControlsWidget::extSettings()
+{
+    THEDP->extendedDialog();
+}
+void ControlsWidget::prefs()
+{
+    THEDP->prefsDialog();
 }
 
 /**********************************************************************
index 58577d9eba16ffa83713174181da1da0043686dc..2e79352656d9896f866eb7c8d4dc39d35d1c27dd 100644 (file)
@@ -5,6 +5,7 @@
  * $Id$
  *
  * Authors: Clément Stenac <zorglub@videolan.org>
+ *          Jean-Baptiste Kempf <jb@videolan.org>
  *
  * 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
@@ -27,6 +28,7 @@
 #include <vlc/vlc.h>
 #include <vlc_interface.h>
 
+#include <vlc_aout.h>
 #include "qt4.hpp"
 
 #include <QWidget>
@@ -98,12 +100,12 @@ private slots:
 };
 
 class QPushButton;
-class ControlsWidget : public QFrame
+class AdvControlsWidget : public QFrame
 {
     Q_OBJECT
 public:
-    ControlsWidget( intf_thread_t *);
-    virtual ~ControlsWidget();
+    AdvControlsWidget( intf_thread_t *);
+    virtual ~AdvControlsWidget();
     void enableInput( bool );
     void enableVideo( bool );
 private:
@@ -118,6 +120,64 @@ private slots:
     void fullscreen();
 };
 
+class InputSlider;
+class QSlider;
+class QGridLayout;
+class VolumeClickHandler;
+class ControlsWidget : public QFrame
+{
+    Q_OBJECT
+public:
+    ControlsWidget( intf_thread_t *);
+    virtual ~ControlsWidget();
+
+    QPushButton *playlistButton;
+    QSlider *volumeSlider;
+    void setStatus( int );
+public slots:
+    void setNavigation( int );
+    void updateOnTimer();
+protected:
+    friend class MainInterface;
+    friend class VolumeClickHandler;
+private:
+    intf_thread_t *p_intf;
+    QFrame *discFrame;
+    QGridLayout *controlLayout;
+    InputSlider         *slider;
+    QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
+    QPushButton *playButton;
+private slots:
+    void play();
+    void stop();
+    void prev();
+    void next();
+    void updateVolume( int );
+    void fullscreen();
+    void extSettings();
+    void prefs();
+};
+
+class VolumeClickHandler : public QObject
+{
+public:
+    VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
+    {m = _m; p_intf = _p_intf; }
+    virtual ~VolumeClickHandler() {};
+    bool eventFilter( QObject *obj, QEvent *e )
+    {
+        if (e->type() == QEvent::MouseButtonPress )
+        {
+            aout_VolumeMute( p_intf, NULL );
+            return true;
+        }
+        return false;
+    }
+private:
+    ControlsWidget *m;
+    intf_thread_t *p_intf;
+};
+
 
 /******************** Playlist Widgets ****************/
 #include <QModelIndex>
index 3b5e3920bc96e844abb2d31e59bf4d822e6d57cb..ee0405c6283970443d0a70423d3a3639e2dff894 100644 (file)
@@ -5,6 +5,7 @@
  * $Id$
  *
  * Authors: Clément Stenac <zorglub@videolan.org>
+ *          Jean-Baptiste Kempf <jb@videolan.org>
  *
  * 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
@@ -24,7 +25,6 @@
 #include "qt4.hpp"
 #include "main_interface.hpp"
 #include "input_manager.hpp"
-#include "util/input_slider.hpp"
 #include "util/qvlcframe.hpp"
 #include "util/customwidgets.hpp"
 #include "dialogs_provider.hpp"
@@ -152,6 +152,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
              this, showSpeedMenu( QPoint ) );
     CONNECT( timeLabel, customContextMenuRequested( QPoint ),
              this, showTimeMenu( QPoint ) );
+
     /* Systray */
     sysTray = NULL;
     if( config_GetInt( p_intf, "qt-start-minimized") )
@@ -172,12 +173,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
      * CONNECTs
      **/
 
-    /* Volume control */
-    CONNECT( ui.volumeSlider, valueChanged(int), this, updateVolume(int) );
-
     /* Connect the input manager to the GUI elements it manages */
-    CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
-             slider, setPosition( float,int, int ) );
+    /* It is also connected to the control->slider */
     CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
              this, setDisplay( float, int, int ) );
 
@@ -197,23 +194,11 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     /* PLAY_STATUS */
     CONNECT( THEMIM->getIM(), statusChanged( int ), this, setStatus( int ) );
-    CONNECT( THEMIM->getIM(), navigationChanged( int ),
-             this, setNavigation(int) );
     if( config_GetInt( p_intf, "qt-system-tray" ) && sysTray )
     {
         CONNECT( THEMIM->getIM(), statusChanged( int ), this,
                  updateSystrayTooltipStatus( int ) );
     }
-    CONNECT( slider, sliderDragged( float ),
-             THEMIM->getIM(), sliderUpdate( float ) );
-
-    /* Buttons */
-    CONNECT( ui.prevSectionButton, clicked(), THEMIM->getIM(),
-             sectionPrev() );
-    CONNECT( ui.nextSectionButton, clicked(), THEMIM->getIM(),
-             sectionNext() );
-    CONNECT( ui.menuButton, clicked(), THEMIM->getIM(),
-             sectionMenu() );
 
     /**
      * Callbacks
@@ -281,7 +266,7 @@ void MainInterface::setVLCWindowsTitle( QString aTitle )
 void MainInterface::handleMainUi( QSettings *settings )
 {
     QWidget *main = new QWidget( this );
-    QVBoxLayout *mainLayout = new QVBoxLayout( main );
+    mainLayout = new QVBoxLayout( main );
     setCentralWidget( main );
 
     /* Margins, spacing */
@@ -289,36 +274,13 @@ void MainInterface::handleMainUi( QSettings *settings )
     mainLayout->setMargin( 0 );
 
     /* CONTROLS */
-    QWidget *controls = new QWidget;
-    ui.setupUi( controls );
+    controls = new ControlsWidget( p_intf );
 
     /* Configure the UI */
-    slider = new InputSlider( Qt::Horizontal, NULL );
-    mainLayout->insertWidget( 0, slider );
-    ui.discFrame->hide();
-
-    BUTTON_SET_IMG( ui.prevSectionButton, "", previous.png, "" );
-    BUTTON_SET_IMG( ui.nextSectionButton, "", next.png, "" );
-    BUTTON_SET_IMG( ui.menuButton, "", previous.png, "" );
-
-    BUTTON_SET_ACT_I( ui.prevButton, "" , previous.png,
-                      qtr("Previous"), prev() );
-    BUTTON_SET_ACT_I( ui.nextButton, "", next.png, qtr("Next"), next() );
-    BUTTON_SET_ACT_I( ui.playButton, "", play.png, qtr("Play"), play() );
-    BUTTON_SET_ACT_I( ui.stopButton, "", stop.png, qtr("Stop"), stop() );
-
-    /* Volume */
-    ui.volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
-    ui.volumeSlider->setMaximum( 100 );
-    ui.volMuteLabel->setToolTip( qtr( "Mute" ) );
-    VolumeClickHandler *h = new VolumeClickHandler( p_intf, this );
-    ui.volMuteLabel->installEventFilter(h);
-    ui.volumeSlider->setFocusPolicy( Qt::NoFocus );
-
-    BUTTON_SET_IMG( ui.playlistButton, "" , playlist_icon.png,
+    BUTTON_SET_IMG( controls->playlistButton, "" , playlist_icon.png,
                         playlistEmbeddedFlag ?  qtr( "Show playlist" ) :
                                                 qtr( "Open playlist" ) );
-    BUTTONACT( ui.playlistButton, playlist() );
+    BUTTONACT( controls->playlistButton, playlist() );
 
 #if DEBUG_COLOR
     QPalette palette;
@@ -335,7 +297,7 @@ void MainInterface::handleMainUi( QSettings *settings )
     addSize = QSize( mainLayout->margin() * 2, PREF_H );
 
     /* advanced Controls handling */
-    advControls = new ControlsWidget( p_intf );
+    advControls = new AdvControlsWidget( p_intf );
     mainLayout->insertWidget( 0, advControls );
     advControls->updateGeometry();
     if( !advControlsEnabled ) advControls->hide();
@@ -731,7 +693,7 @@ void MainInterface::playlist()
     {
         PlaylistDialog::killInstance();
         playlistWidget = new PlaylistWidget( p_intf );
-        ui.vboxLayout->insertWidget( 0, playlistWidget );
+        mainLayout->insertWidget( 0, playlistWidget );
         playlistWidget->widgetSize = settings->value( "playlistSize",
                                                QSize( 650, 310 ) ).toSize();
         playlistWidget->hide();
@@ -779,7 +741,7 @@ void MainInterface::undockPlaylist()
     {
         playlistWidget->hide();
         playlistWidget->deleteLater();
-        ui.vboxLayout->removeWidget( playlistWidget );
+        mainLayout->removeWidget( playlistWidget );
         playlistWidget = NULL;
         playlistEmbeddedFlag = false;
 
@@ -897,33 +859,6 @@ void MainInterface::wheelEvent( QWheelEvent *e )
     e->accept();
 }
 
-void MainInterface::stop()
-{
-    THEMIM->stop();
-}
-
-void MainInterface::play()
-{
-    if( playlist_IsEmpty(THEPL) )
-    {
-        /* The playlist is empty, open a file requester */
-        THEDP->openFileDialog();
-        setStatus( 0 );
-        return;
-    }
-    THEMIM->togglePlayPause();
-}
-
-void MainInterface::prev()
-{
-    THEMIM->prev();
-}
-
-void MainInterface::next()
-{
-    THEMIM->next();
-}
-
 void MainInterface::setDisplay( float pos, int time, int length )
 {
     char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
@@ -942,48 +877,15 @@ void MainInterface::setName( QString name )
 
 void MainInterface::setStatus( int status )
 {
-    if( status == 1 ) // Playing
-        ui.playButton->setIcon( QIcon( ":/pixmaps/pause.png" ) );
-    else
-        ui.playButton->setIcon( QIcon( ":/pixmaps/play.png" ) );
+    controls->setStatus( status );
     if( systrayMenu )
         updateSystrayMenu( status );
 }
 
-#define HELP_MENU N_("Menu")
-#define HELP_PCH N_("Previous chapter")
-#define HELP_NCH N_("Next chapter")
-#define HELP_PTR N_("Previous track")
-#define HELP_NTR N_("Next track")
-
-void MainInterface::setNavigation( int navigation )
-{
-    // 1 = chapter, 2 = title, 0 = no
-    if( navigation == 0 )
-    {
-        ui.discFrame->hide();
-    } else if( navigation == 1 ) {
-        ui.prevSectionButton->show();
-        ui.prevSectionButton->setToolTip( qfu(HELP_PCH) );
-        ui.nextSectionButton->show();
-        ui.nextSectionButton->setToolTip( qfu(HELP_NCH) );
-        ui.menuButton->show();
-        ui.discFrame->show();
-    } else {
-        ui.prevSectionButton->show();
-        ui.prevSectionButton->setToolTip( qfu(HELP_PCH) );
-        ui.nextSectionButton->show();
-        ui.nextSectionButton->setToolTip( qfu(HELP_NCH) );
-        ui.menuButton->hide();
-        ui.discFrame->show();
-    }
-}
-
-static bool b_my_volume;
-
 void MainInterface::updateOnTimer()
 {
     /* \todo Make this event-driven */
+    // TO MOVE TO controls
     advControls->enableInput( THEMIM->getIM()->hasInput() );
     advControls->enableVideo( THEMIM->getIM()->hasVideo() );
 
@@ -998,17 +900,7 @@ void MainInterface::updateOnTimer()
         need_components_update = false;
     }
 
-    audio_volume_t i_volume;
-    aout_VolumeGet( p_intf, &i_volume );
-    i_volume = (i_volume *  200 )/ AOUT_VOLUME_MAX ;
-    int i_gauge = ui.volumeSlider->value();
-    b_my_volume = false;
-    if( i_volume - i_gauge > 1 || i_gauge - i_volume > 1 )
-    {
-        b_my_volume = true;
-        ui.volumeSlider->setValue( i_volume );
-        b_my_volume = false;
-    }
+    controls->updateOnTimer();
 }
 
 void MainInterface::closeEvent( QCloseEvent *e )
@@ -1017,16 +909,6 @@ void MainInterface::closeEvent( QCloseEvent *e )
     vlc_object_kill( p_intf );
 }
 
-void MainInterface::updateVolume( int sliderVolume )
-{
-    if( !b_my_volume )
-    {
-        int i_res = sliderVolume * AOUT_VOLUME_MAX /
-                            (2*ui.volumeSlider->maximum() );
-        aout_VolumeSet( p_intf, i_res );
-    }
-}
-
 static int InteractCallback( vlc_object_t *p_this,
                              const char *psz_var, vlc_value_t old_val,
                              vlc_value_t new_val, void *param )
index 77ab8e7102c556f1165844f4413c8770d4054d64..66ac8a9e0675d183690af481e261f98e853be94b 100644 (file)
@@ -5,6 +5,7 @@
  * $Id$
  *
  * Authors: Clément Stenac <zorglub@videolan.org>
+ *          Jean-Baptiste Kempf <jb@videolan.org>
  *
  * 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
@@ -39,12 +40,11 @@ class QKeyEvent;
 class QLabel;
 class QEvent;
 class InputManager;
-class InputSlider;
 class VideoWidget;
 class BackgroundWidget;
 class PlaylistWidget;
-class VolumeClickHandler;
 class VisualSelector;
+class AdvControlsWidget;
 class ControlsWidget;
 class QMenu;
 class QSize;
@@ -70,7 +70,7 @@ protected:
     void dragMoveEvent( QDragMoveEvent * );
     void dragLeaveEvent( QDragLeaveEvent * );
     void closeEvent( QCloseEvent *);
-    Ui::MainInterfaceUI ui;
+    //Ui::MainInterfaceUI ui;
     friend class VolumeClickHandler;
 private:
     QSettings *settings;
@@ -78,6 +78,8 @@ private:
     QSystemTrayIcon *sysTray;
     QMenu *systrayMenu;
     QString input_name;
+    QVBoxLayout *mainLayout;
+    ControlsWidget *controls;
 
     bool need_components_update;
     void calculateInterfaceSize();
@@ -98,7 +100,7 @@ private:
 
     BackgroundWidget    *bgWidget;
     VisualSelector      *visualSelector;
-    ControlsWidget      *advControls;
+    AdvControlsWidget      *advControls;
     PlaylistWidget      *playlistWidget;
 
     bool                 playlistEmbeddedFlag;
@@ -108,7 +110,6 @@ private:
     bool                 visualSelectorEnabled;
 
     InputManager        *main_input_manager;
-    InputSlider         *slider;
     input_thread_t      *p_input;    ///< Main input associated to the playlist
 
     QLabel              *timeLabel;
@@ -122,19 +123,13 @@ public slots:
     void playlist();
     void toggleUpdateSystrayMenu();
 private slots:
-    void setNavigation( int );
     void setStatus( int );
     void setName( QString );
     void setVLCWindowsTitle( QString title = "" );
     void setDisplay( float, int, int );
     void updateOnTimer();
-    void play();
-    void stop();
-    void prev();
-    void next();
     void visual();
     void advanced();
-    void updateVolume( int sliderVolume );
     void handleSystrayClick(  QSystemTrayIcon::ActivationReason );
     void updateSystrayMenu( int );
     void updateSystrayTooltipName( QString );
@@ -143,25 +138,4 @@ private slots:
     void showTimeMenu( QPoint );
 };
 
-
-class VolumeClickHandler : public QObject
-{
-public:
-    VolumeClickHandler( intf_thread_t *_p_intf, MainInterface *_m ) :QObject(_m)
-    {m = _m; p_intf = _p_intf; }
-    virtual ~VolumeClickHandler() {};
-    bool eventFilter( QObject *obj, QEvent *e )
-    {
-        if (e->type() == QEvent::MouseButtonPress )
-        {
-            aout_VolumeMute( p_intf, NULL );
-            return true;
-        }
-        return false;
-    }
-private:
-    MainInterface *m;
-    intf_thread_t *p_intf;
-};
-
 #endif