]> git.sesse.net Git - vlc/commitdiff
Qt4 - use a docked playlist, remove dead code, don't reinvent the wheel, remove the...
authorJean-Baptiste Kempf <jb@videolan.org>
Wed, 10 Oct 2007 18:59:36 +0000 (18:59 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 10 Oct 2007 18:59:36 +0000 (18:59 +0000)
Use enums when you can.
Add the popup menu to the always video cone.
And more...

modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.hpp
modules/gui/qt4/ui/open_disk.ui
modules/gui/qt4/ui/open_file.ui

index 2652fed8557b7e158341df29e67adf91774a4dbc..875adf2ac03b719cbe899bfe80bfffe02f1fbf99 100644 (file)
@@ -27,7 +27,7 @@
 #include "components/interface_widgets.hpp"
 #include "main_interface.hpp"
 #include "input_manager.hpp"
-
+#include "menus.hpp"
 #include "util/input_slider.hpp"
 #include <vlc_vout.h>
 
@@ -40,7 +40,8 @@
 #include <QPalette>
 #include <QResizeEvent>
 
-#define ICON_SIZE 300
+#define ICON_SIZE 128
+#define MAX_BG_SIZE 300
 
 /**********************************************************************
  * Video Widget. A simple frame on which video is drawn
@@ -120,7 +121,7 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) :
     plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black );
     setPalette( plt );
 
-    label = new QLabel( "" );
+    label = new QLabel;
     label->setMaximumHeight( ICON_SIZE );
     label->setMaximumWidth( ICON_SIZE );
     label->setScaledContents( true );
@@ -157,6 +158,10 @@ void BackgroundWidget::resizeEvent( QResizeEvent *e )
         label->setMaximumWidth( ICON_SIZE );
 }
 
+void BackgroundWidget::contextMenuEvent( QContextMenuEvent *event )
+{
+    QVLCMenu::PopupMenu( p_intf, true );
+}
 /**********************************************************************
  * Visualization selector panel
  **********************************************************************/
@@ -249,7 +254,7 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) :
     recordButton->setMaximumSize( QSize( 26, 26 ) );
     recordButton->setIconSize( QSize( 20, 20 ) );
     advLayout->addWidget( recordButton );
-    BUTTON_SET_ACT_I( recordButton, "", vlc_record_16px.png,
+    BUTTON_SET_ACT_I( recordButton, "", record_16px.png,
             qtr( "Record" ), record() );
 
     normalButton = new QPushButton( "N" );
@@ -300,6 +305,8 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) :
     //QSize size( 500, 200 );
     //resize( size );
     controlLayout = new QGridLayout( this );
+    controlLayout->setSpacing( 0 );
+    setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
 
 #if DEBUG_COLOR
     QPalette palette2;
@@ -382,14 +389,15 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) :
      **/
 
     /** Play Buttons **/
-    QSizePolicy sizePolicy( QSizePolicy::Maximum, QSizePolicy::Fixed );
+    QSizePolicy sizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
     sizePolicy.setHorizontalStretch( 0 );
     sizePolicy.setVerticalStretch( 0 );
 
     /* Play */
     playButton = new QPushButton;
     playButton->setSizePolicy( sizePolicy );
-    playButton->setMaximumSize( QSize( 45, 45 ) );
+    playButton->setMaximumSize( QSize( 38, 38 ) );
+    playButton->setMinimumSize( QSize( 45, 45 ) );
     playButton->setIconSize( QSize( 30, 30 ) );
 
     controlLayout->addWidget( playButton, 2, 0, 2, 2, Qt::AlignBottom );
@@ -449,6 +457,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) :
     playlistButton = new QPushButton;
     setupSmallButton( playlistButton );
     controlLayout->addWidget( playlistButton, 3, 11 );
+    BUTTON_SET_IMG( playlistButton, "" , playlist.png, qtr( "Show playlist" ) );
 
     /** extended Settings **/
     QPushButton *extSettingsButton = new QPushButton( "F" );
@@ -487,6 +496,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) :
 
     /* Volume control connection */
     CONNECT( volumeSlider, valueChanged( int ), this, updateVolume( int ) );
+    msg_Dbg( p_intf, "size: %i - %i", size().height(), size().width() );
 }
 ControlsWidget::~ControlsWidget()
 {
index 54447bd4613b87a1101c93d3146f42063e0f80d0..8e747ce9b640efdbfc3a8903bb4f198c7fa4551a 100644 (file)
@@ -84,10 +84,11 @@ private:
     QLabel *label;
     QHBoxLayout *backgroundLayout;
     virtual void resizeEvent( QResizeEvent *e );
+    virtual void contextMenuEvent( QContextMenuEvent *event );
     int DrawBackground();
     int CleanBackground();
     intf_thread_t *p_intf;
-private slots:
+public slots:
     void setArt( QString );
 };
 
index 8912b2356dc55ac018b740c5911c77923fb12554..7b237fddfbed1795fb0f7b774afcbd8dbe5b1c5a 100644 (file)
@@ -88,15 +88,15 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
     /* Buttons configuration */
     QHBoxLayout *buttons = new QHBoxLayout();
  
-    addButton = new QPushButton( QIcon( ":/pixmaps/vlc_playlist_add.png" ), "", this );
+    addButton = new QPushButton( QIcon( ":/pixmaps/playlist_add.png" ), "", this );
     addButton->setMaximumWidth( 25 );
     BUTTONACT( addButton, popupAdd() );
     buttons->addWidget( addButton );
 
     randomButton = new QPushButton( this );
     randomButton->setIcon( model->hasRandom() ?
-                            QIcon( ":/pixmaps/vlc_playlist_shuffle_on.png" ) :
-                            QIcon( ":/pixmaps/vlc_playlist_shuffle_off.png" ) );
+                            QIcon( ":/pixmaps/playlist_shuffle_on.png" ) :
+                            QIcon( ":/pixmaps/playlist_shuffle_off.png" ) );
     BUTTONACT( randomButton, toggleRandom() );
     buttons->addWidget( randomButton );
 
@@ -105,11 +105,11 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
 
     repeatButton = new QPushButton( this );
     if( model->hasRepeat() ) repeatButton->setIcon(
-                        QIcon( ":/pixmaps/vlc_playlist_repeat_one.png" ) );
+                        QIcon( ":/pixmaps/playlist_repeat_one.png" ) );
     else if( model->hasLoop() ) repeatButton->setIcon(
-                        QIcon( ":/pixmaps/vlc_playlist_repeat_all.png" ) );
+                        QIcon( ":/pixmaps/playlist_repeat_all.png" ) );
     else repeatButton->setIcon(
-                        QIcon( ":/pixmaps/vlc_playlist_repeat_off.png" ) );
+                        QIcon( ":/pixmaps/playlist_repeat_off.png" ) );
     BUTTONACT( repeatButton, toggleRepeat() );
     buttons->addWidget( repeatButton );
 
@@ -136,17 +136,17 @@ void StandardPLPanel::toggleRepeat()
     if( model->hasRepeat() )
     {
         model->setRepeat( false ); model->setLoop( true );
-        repeatButton->setIcon( QIcon( ":/pixmaps/vlc_playlist_repeat_all.png" ) );
+        repeatButton->setIcon( QIcon( ":/pixmaps/playlist_repeat_all.png" ) );
     }
     else if( model->hasLoop() )
     {
         model->setRepeat( false ) ; model->setLoop( false );
-        repeatButton->setIcon( QIcon( ":/pixmaps/vlc_playlist_repeat_off.png" ) );
+        repeatButton->setIcon( QIcon( ":/pixmaps/playlist_repeat_off.png" ) );
     }
     else
     {
         model->setRepeat( true );
-        repeatButton->setIcon( QIcon( ":/pixmaps/vlc_playlist_repeat_one.png" ) );
+        repeatButton->setIcon( QIcon( ":/pixmaps/playlist_repeat_one.png" ) );
     }
 }
 
@@ -155,8 +155,8 @@ void StandardPLPanel::toggleRandom()
     bool prev = model->hasRandom();
     model->setRandom( !prev );
     randomButton->setIcon( prev ?
-                QIcon( ":/pixmaps/vlc_playlist_shuffle_off.png" ) :
-                QIcon( ":/pixmaps/vlc_playlist_shuffle_on.png" ) );
+                QIcon( ":/pixmaps/playlist_shuffle_off.png" ) :
+                QIcon( ":/pixmaps/playlist_shuffle_on.png" ) );
 }
 
 void StandardPLPanel::handleExpansion( const QModelIndex &index )
index 7c4afcaff441b4e12f7f62fddb7b3f64f334091e..421a07896db7f11b1759e8b0e87c6931ab8add7c 100644 (file)
@@ -71,6 +71,7 @@ DialogsProvider::~DialogsProvider()
 {
     PlaylistDialog::killInstance();
     MediaInfoDialog::killInstance();
+    fixed_timer->stop();
 }
 
 void DialogsProvider::quit()
index 858e714701d2e6a4cb730ad4fe428ae085f6c403..d194ce64ba51592a356c0a71c2846184394b843a 100644 (file)
@@ -117,7 +117,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
         alwaysVideoFlag = true;
 
     /* Set the other interface settings */
-    playlistEmbeddedFlag = settings->value( "playlist-embedded", true).toBool();
     visualSelectorEnabled = settings->value( "visual-selector", false ).toBool();
     notificationEnabled = config_GetInt( p_intf, "qt-notification" )
                           ? true : false;
@@ -127,45 +126,51 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     setVLCWindowsTitle();
     handleMainUi( settings );
 
-#if 0 /* dock part */
-    QDockWidget *dock = new QDockWidget( this );
-    PlaylistWidget *plw = new PlaylistWidget( p_intf );
-    dock->setWidget( plw );
-    addDockWidget( Qt::RightDockWidgetArea, dock );
-
-    QToolBar *tb = new QToolBar(this);
-    tb->addAction( "playlist", dock, SLOT( hide() ) );
-    addToolBar(Qt::RightToolBarArea, tb);
-#endif
+    /* Create a Dock to get the playlist */
+    dockPL = new QDockWidget( qtr("Playlist"), this );
+    dockPL->setAllowedAreas( Qt::LeftDockWidgetArea
+                           | Qt::RightDockWidgetArea
+                           | Qt::BottomDockWidgetArea );
+    dockPL->setFeatures( QDockWidget::AllDockWidgetFeatures );
 
     /* Menu Bar */
-    QVLCMenu::createMenuBar( this, p_intf, playlistEmbeddedFlag,
-                             visualSelectorEnabled );
+    QVLCMenu::createMenuBar( this, p_intf, visualSelectorEnabled );
 
-    /* Status Bar */
-    /**
-     * TODO: clicking on the elapsed time should switch to the remaining time
-     **/
-    /**
-     * TODO: do we add a label for the current Volume ?
-     **/
+    /****************
+     *  Status Bar  *
+     ****************/
+
+    /* Widgets Creation*/
     b_remainingTime = false;
     timeLabel = new TimeLabel;
     nameLabel = new QLabel;
     speedLabel = new QLabel( "1.00x" );
+    speedLabel->setContextMenuPolicy ( Qt::CustomContextMenu );
+    timeLabel->setContextMenuPolicy ( Qt::CustomContextMenu );
+
+    /* Styling those labels */
     timeLabel->setFrameStyle( QFrame::Sunken | QFrame::Panel );
     speedLabel->setFrameStyle( QFrame::Sunken | QFrame::Panel );
+    nameLabel->setFrameStyle( QFrame::Sunken | QFrame::StyledPanel);
+
+    /* and adding those */
     statusBar()->addWidget( nameLabel, 8 );
     statusBar()->addPermanentWidget( speedLabel, 0 );
     statusBar()->addPermanentWidget( timeLabel, 2 );
-    speedLabel->setContextMenuPolicy ( Qt::CustomContextMenu );
-    timeLabel->setContextMenuPolicy ( Qt::CustomContextMenu );
+
+    /* timeLabel behaviour:
+       - double clicking opens the goto time dialog 
+       - right-clicking and clicking just toggle between remaining and
+         elapsed time.*/
     CONNECT( timeLabel, timeLabelClicked(), this, toggleTimeDisplay() );
+    CONNECT( timeLabel, customContextMenuRequested( QPoint ),
+             this, toggleTimeDisplay() );
     CONNECT( timeLabel, timeLabelDoubleClicked(), THEDP, gotoTimeDialog() );
+
+    /* Speed Label behaviour:
+       - right click gives the vertical speed slider */
     CONNECT( speedLabel, customContextMenuRequested( QPoint ),
              this, showSpeedMenu( QPoint ) );
-    CONNECT( timeLabel, customContextMenuRequested( QPoint ),
-             this, toggleTimeDisplay() );
 
     /**********************
      * Systray Management *
@@ -177,7 +182,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     {
         if( b_systrayAvailable ){
             b_createSystray = true;
-            hide(); //FIXME
+            hide(); //FIXME BUG HERE
         }
         else msg_Warn( p_intf, "You can't minize if you haven't a system "
                 "tray bar" );
@@ -188,13 +193,18 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     if( b_systrayAvailable && b_createSystray )
             createSystray();
 
+    if( config_GetInt( p_intf, "qt-minimal-view" ) )
+        toggleMenus();
+
     /* Init input manager */
     MainInputManager::getInstance( p_intf );
     ON_TIMEOUT( updateOnTimer() );
+    ON_TIMEOUT( debug() );
 
-    /**
-     * Various CONNECTs
-     **/
+
+    /********************
+     * Various CONNECTs *
+     ********************/
 
     /* Connect the input manager to the GUI elements it manages */
     /* It is also connected to the control->slider, see the ControlsWidget */
@@ -203,7 +213,9 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     CONNECT( THEMIM->getIM(), rateChanged( int ), this, setRate( int ) );
 
-    /** Connects on nameChanged() */
+    /**
+     * Connects on nameChanged()
+     */
     /* Naming in the controller statusbar */
     CONNECT( THEMIM->getIM(), nameChanged( QString ), this,
              setName( QString ) );
@@ -246,6 +258,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
         var_AddCallback( p_playlist, "intf-show", IntfShowCB, p_intf );
         vlc_object_release( p_playlist );
     }
+    // DEBUG FIXME
+    hide();
 }
 
 MainInterface::~MainInterface()
@@ -260,8 +274,8 @@ MainInterface::~MainInterface()
         vlc_object_release( p_playlist );
     }
 
-    settings->setValue( "playlist-embedded", playlistEmbeddedFlag );
-    settings->setValue( "adv-controls", getControlsVisibilityStatus() & 0x1 );
+    settings->setValue( "playlist-embedded", !dockPL->isFloating() );
+    settings->setValue( "adv-controls", getControlsVisibilityStatus() & CONTROLS_ADVANCED );
     settings->setValue( "pos", pos() );
     settings->endGroup();
     delete settings;
@@ -309,10 +323,8 @@ void MainInterface::handleMainUi( QSettings *settings )
     controls = new ControlsWidget( p_intf,
                    settings->value( "adv-controls", false ).toBool() );
 
-    /* Configure the Controls */
-    BUTTON_SET_IMG( controls->playlistButton, "" , playlist_icon.png,
-                    playlistEmbeddedFlag ?  qtr( "Show playlist" ) :
-                                            qtr( "Open playlist" ) );
+    /* Configure the Controls, the playlist button doesn't trigger THEDP
+       but the toggle from this MainInterface */
     BUTTONACT( controls->playlistButton, togglePlaylist() );
 
     /* Add the controls Widget to the main Widget */
@@ -361,6 +373,11 @@ void MainInterface::handleMainUi( QSettings *settings )
     setMinimumSize( PREF_W, addSize.height() );
 }
 
+void MainInterface::debug()
+{
+    msg_Dbg( p_intf, "size: %i - %i", controls->size().height(), controls->size().width() );
+    msg_Dbg( p_intf, "sizeHint: %i - %i", controls->sizeHint().height(), controls->sizeHint().width() );
+}
 /**********************************************************************
  * Handling of sizing of the components
  **********************************************************************/
@@ -371,7 +388,7 @@ void MainInterface::calculateInterfaceSize()
     {
         width = bgWidget->widgetSize.width();
         height = bgWidget->widgetSize.height();
-        assert( !(playlistWidget && playlistWidget->isVisible() ) );
+//        assert( !(playlistWidget));// && playlistWidget->isVisible() ) );
     }
     else if( VISIBLE( playlistWidget ) )
     {
@@ -540,14 +557,45 @@ int MainInterface::controlVideo( void *p_window, int i_query, va_list args )
  **/
 void MainInterface::togglePlaylist()
 {
-    // Toggle the playlist dialog if not embedded and return
+    /* If no playlist exist, then create one and attach it to the DockPL*/
+    if( !playlistWidget )
+    {
+        msg_Dbg( p_intf, "Creating a new playlist" );
+        playlistWidget = new PlaylistWidget( p_intf );
+        if(bgWidget)
+            CONNECT( playlistWidget, artSet( QString ), bgWidget, setArt(QString) );
+
+        playlistWidget->widgetSize = settings->value( "playlistSize",
+                                               QSize( 650, 310 ) ).toSize();
+        /* Add it to the parent DockWidget */
+        dockPL->setWidget( playlistWidget );
+
+        /* Add the dock to the main Interface */
+        addDockWidget( Qt::BottomDockWidgetArea, dockPL );
+
+        msg_Dbg( p_intf, "Creating a new playlist" );
+
+        /* Make the playlist floating is requested. Default is not. */
+        if( !settings->value( "playlist-embedded", true ).toBool() );
+        {
+            msg_Dbg( p_intf, "we don't want it inside");
+            dockPL->setFloating( true );
+        }
+
+    }
+    else
+    {
+    /* toggle the display */
+       TOGGLEV( dockPL );
+    }
+
+#if 0  // Toggle the playlist dialog if not embedded and return
     if( !playlistEmbeddedFlag )
     {
         if( playlistWidget )
         {
             /// \todo Destroy it
         }
-        THEDP->playlistDialog();
         return;
     }
 
@@ -555,13 +603,8 @@ void MainInterface::togglePlaylist()
     if( !playlistWidget )
     {
         PlaylistDialog::killInstance();
-        playlistWidget = new PlaylistWidget( p_intf );
         mainLayout->insertWidget( 0, playlistWidget );
-        playlistWidget->widgetSize = settings->value( "playlistSize",
-                                               QSize( 650, 310 ) ).toSize();
         playlistWidget->hide();
-        if(bgWidget)
-        CONNECT( playlistWidget, artSet( QString ), bgWidget, setArt(QString) );
     }
 
     // And toggle visibility
@@ -589,12 +632,14 @@ void MainInterface::togglePlaylist()
         }
         if( VISIBLE( bgWidget ) ) bgWidget->hide();
     }
-
+#endif
     doComponentsUpdate();
 }
 
 void MainInterface::undockPlaylist()
 {
+    dockPL->setFloating( true );
+#if 0
     if( playlistWidget )
     {
         playlistWidget->hide();
@@ -616,6 +661,7 @@ void MainInterface::undockPlaylist()
         doComponentsUpdate();
         THEDP->playlistDialog();
     }
+#endif
 }
 
 #if 0
@@ -662,8 +708,8 @@ void MainInterface::toggleAdvanced()
 
 int MainInterface::getControlsVisibilityStatus()
 {
-    return( (controls->isVisible() ? 0x2 : 0x0 )
-                + controls->b_advancedVisible );
+    return( (controls->isVisible() ? CONTROLS_VISIBLE : CONTROLS_HIDDEN )
+                + CONTROLS_ADVANCED * controls->b_advancedVisible );
 }
 
 /************************************************************************
@@ -674,7 +720,9 @@ void MainInterface::setDisplayPosition( float pos, int time, int length )
     char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
     secstotimestr( psz_length, length );
     secstotimestr( psz_time, b_remainingTime ? length - time : time );
+
     QString title; title.sprintf( "%s/%s", psz_time, psz_length );
+    /* Add a minus to remaining time*/
     if( b_remainingTime ) timeLabel->setText( " -"+title+" " );
     else timeLabel->setText( " "+title+" " );
 }
@@ -686,15 +734,20 @@ void MainInterface::toggleTimeDisplay()
 
 void MainInterface::setName( QString name )
 {
-    input_name = name;
-    nameLabel->setText( " " + name+" " );
+    input_name = name; /* store it for the QSystray use */
+    /* Display it in the status bar, but also as a Tooltip in case it doesn't
+       fit in the label */
+    nameLabel->setText( " " + name + " " );
+    nameLabel->setToolTip( " " + name +" " );
 }
 
 void MainInterface::setStatus( int status )
 {
+    /* Forward the status to the controls to toggle Play/Pause */
     controls->setStatus( status );
+    /* And in the systray for the menu */
     if( sysTray )
-        updateSystrayMenu( status );
+        QVLCMenu::updateSystrayMenu( this, p_intf );
 }
 
 void MainInterface::setRate( int rate )
@@ -747,16 +800,6 @@ void MainInterface::createSystray()
             this, handleSystrayClick( QSystemTrayIcon::ActivationReason ) );
 }
 
-/**
- * Update the menu of the Systray Icon.
- * May be unneedded, since it just calls QVLCMenu::update
- * FIXME !!!
- **/
-void MainInterface::updateSystrayMenu( int status )
-{
-    QVLCMenu::updateSystrayMenu( this, p_intf ) ;
-}
-
 /**
  * Updates the Systray Icon's menu and toggle the main interface
  */
@@ -818,7 +861,6 @@ void MainInterface::handleSystrayClick(
 /**
  * Updates the name of the systray Icon tooltip.
  * Doesn't check if the systray exists, check before you call it.
- * FIXME !!! Fusion with next function ?
  **/
 void MainInterface::updateSystrayTooltipName( QString name )
 {
@@ -853,7 +895,6 @@ void MainInterface::updateSystrayTooltipStatus( int i_status )
         case PLAYING_S:
             {
                 sysTray->setToolTip( input_name );
-                //+ " - " + qtr( "Playing" ) );
                 break;
             }
         case PAUSE_S:
@@ -916,6 +957,7 @@ void MainInterface::dragLeaveEvent(QDragLeaveEvent *event)
  ************************************************************************/
 void MainInterface::customEvent( QEvent *event )
 {
+#if 0
     if( event->type() == PLDockEvent_Type )
     {
         PlaylistDialog::killInstance();
@@ -924,7 +966,9 @@ void MainInterface::customEvent( QEvent *event )
         QVLCMenu::createMenuBar(this, p_intf, true, visualSelectorEnabled);
         togglePlaylist();
     }
-    else if ( event->type() == SetVideoOnTopEvent_Type )
+#endif
+    /*else */
+    if ( event->type() == SetVideoOnTopEvent_Type )
     {
         SetVideoOnTopQtEvent* p_event = (SetVideoOnTopQtEvent*)event;
         if( p_event->OnTop() )
index 2273455187a54afe7a635518c70102c7857121e0..aafe222d619da4135a730b318feb812ebc40a3bc 100644 (file)
@@ -47,6 +47,13 @@ class ControlsWidget;
 class SpeedControlWidget;
 class QMenu;
 class QSize;
+class QDockWidet;
+
+enum{
+    CONTROLS_HIDDEN = 0x0,
+    CONTROLS_VISIBLE = 0x1,
+    CONTROLS_ADVANCED = 0x2
+};
 
 class MainInterface : public QVLCMW
 {
@@ -104,8 +111,8 @@ private:
     BackgroundWidget    *bgWidget;
     VisualSelector      *visualSelector;
     PlaylistWidget      *playlistWidget;
+    QDockWidget         *dockPL;
 
-    bool                 playlistEmbeddedFlag;
     bool                 videoEmbeddedFlag;
     bool                 alwaysVideoFlag;
     bool                 visualSelectorEnabled;
@@ -114,11 +121,12 @@ private:
     InputManager        *main_input_manager;
     input_thread_t      *p_input;    ///< Main input associated to the playlist
 
+    /* Status Bar */
     QLabel              *timeLabel;
     QLabel              *speedLabel;
     QLabel              *nameLabel;
 
-    bool                 b_remainingTime;
+    bool                 b_remainingTime; /* showing elapsed or remaining time */
 
     void customEvent( QEvent *);
 public slots:
@@ -128,6 +136,7 @@ public slots:
     void toggleUpdateSystrayMenu();
     void toggleAdvanced();
 private slots:
+    void debug();
     void updateOnTimer();
 
     void setStatus( int );
@@ -140,7 +149,6 @@ private slots:
     void visual();
 #endif
     void handleSystrayClick( QSystemTrayIcon::ActivationReason );
-    void updateSystrayMenu( int );
     void updateSystrayTooltipName( QString );
     void updateSystrayTooltipStatus( int );
     void showSpeedMenu( QPoint );
index c9e2b9889ddb7e1edfef7b4219df74fadfe961d0..a621a913f592153418199c57568b487c76717446 100644 (file)
@@ -164,15 +164,11 @@ static int AudioAutoMenuBuilder( vlc_object_t *p_object,
  * Main Menu Bar Creation
  **/
 void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf,
-        bool playlist,
         bool visual_selector_enabled )
 {
     QMenuBar *bar = mi->menuBar();
     BAR_ADD( FileMenu(), qtr( "&Media" ) );
-    if( playlist )
-    {
-        BAR_ADD( PlaylistMenu( mi,p_intf ), qtr( "&Playlist" ) );
-    }
+    BAR_ADD( PlaylistMenu( p_intf, mi ), qtr( "&Playlist" ) );
     BAR_ADD( ToolsMenu( p_intf, mi, visual_selector_enabled, true ), qtr( "&Tools" ) );
     BAR_DADD( AudioMenu( p_intf, NULL ), qtr( "&Audio" ), 2 );
     BAR_DADD( VideoMenu( p_intf, NULL ), qtr( "&Video" ), 1 );
@@ -213,8 +209,7 @@ QMenu *QVLCMenu::FileMenu()
     return menu;
 }
 
-/* Playlist Menu, undocked when playlist is undocked */
-QMenu *QVLCMenu::PlaylistMenu( MainInterface *mi, intf_thread_t *p_intf )
+QMenu *QVLCMenu::PlaylistMenu( intf_thread_t *p_intf, MainInterface *mi )
 {
     QMenu *menu = new QMenu();
     menu->addMenu( SDMenu( p_intf ) );
@@ -264,13 +259,15 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
         QAction *action=menu->addAction( qtr( "Minimal View..." ), mi,
                 SLOT( toggleMenus() ), qtr( "Ctrl+H" ) );
         action->setCheckable( true );
-        if( mi->getControlsVisibilityStatus() & 0x2 ) action->setChecked( true );
+        if( mi->getControlsVisibilityStatus() & CONTROLS_VISIBLE ) 
+            action->setChecked( true );
 
         /* Advanced Controls */
         action = menu->addAction( qtr( "Advanced controls" ), mi,
                 SLOT( toggleAdvanced() ) );
         action->setCheckable( true );
-        if( mi->getControlsVisibilityStatus() & 0x1 ) action->setChecked( true );
+        if( mi->getControlsVisibilityStatus() & CONTROLS_ADVANCED )
+            action->setChecked( true );
      #if 0 /* For Visualisations. Not yet working */
         adv = menu->addAction( qtr( "Visualizations selector" ),
                 mi, SLOT( visual() ) );
index 6f1bb850f74a69b13548ee706251d3b9adf4af55..1ad92690a2bb3e878a2e43172a480dd238e4d379 100644 (file)
@@ -73,12 +73,12 @@ class QVLCMenu : public QObject
     Q_OBJECT;
 public:
     static void createMenuBar( MainInterface *mi, intf_thread_t *,
-                               bool, bool );
+                               bool );
 
     /* Menus */
     static QMenu *FileMenu();
     static QMenu *SDMenu( intf_thread_t * );
-    static QMenu *PlaylistMenu( MainInterface *, intf_thread_t *);
+    static QMenu *PlaylistMenu( intf_thread_t *, MainInterface * );
     static QMenu *ToolsMenu( intf_thread_t *, MainInterface *, bool, bool with = true );
     static QMenu *NavigMenu( intf_thread_t * , QMenu * );
     static QMenu *VideoMenu( intf_thread_t * , QMenu * );
index 7d9a8af863e6f4317113082f89a702d1550ad237..9fd52652d4b9bbaa8ce1daa2e39af5ce12021926 100644 (file)
@@ -6,30 +6,51 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>462</width>
-    <height>407</height>
+    <width>700</width>
+    <height>423</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string>Form</string>
   </property>
   <layout class="QVBoxLayout" >
-   <property name="margin" >
-    <number>9</number>
-   </property>
    <property name="spacing" >
     <number>6</number>
    </property>
+   <property name="leftMargin" >
+    <number>9</number>
+   </property>
+   <property name="topMargin" >
+    <number>9</number>
+   </property>
+   <property name="rightMargin" >
+    <number>9</number>
+   </property>
+   <property name="bottomMargin" >
+    <number>9</number>
+   </property>
    <item>
     <widget class="QGroupBox" name="diskGroupBox" >
      <property name="title" >
       <string>_("Disc selection")</string>
      </property>
      <layout class="QGridLayout" >
-      <property name="margin" >
+      <property name="leftMargin" >
        <number>9</number>
       </property>
-      <property name="spacing" >
+      <property name="topMargin" >
+       <number>9</number>
+      </property>
+      <property name="rightMargin" >
+       <number>9</number>
+      </property>
+      <property name="bottomMargin" >
+       <number>9</number>
+      </property>
+      <property name="horizontalSpacing" >
+       <number>6</number>
+      </property>
+      <property name="verticalSpacing" >
        <number>6</number>
       </property>
       <item row="0" column="7" >
         </property>
        </spacer>
       </item>
-      <item row="1" column="1" colspan="2" >
+      <item row="1" column="1" colspan="3" >
        <widget class="QCheckBox" name="dvdsimple" >
         <property name="toolTip" >
          <string>_("Disable DVD Menus (for compatibility)")</string>
    </item>
    <item>
     <widget class="QGroupBox" name="diskOptionBox" >
-     <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>5</hsizetype>
-       <vsizetype>5</vsizetype>
-       <horstretch>1</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
      <property name="title" >
       <string>_("Starting position")</string>
      </property>
      <layout class="QGridLayout" >
-      <property name="margin" >
+      <property name="leftMargin" >
+       <number>9</number>
+      </property>
+      <property name="topMargin" >
+       <number>9</number>
+      </property>
+      <property name="rightMargin" >
+       <number>9</number>
+      </property>
+      <property name="bottomMargin" >
        <number>9</number>
       </property>
-      <property name="spacing" >
+      <property name="horizontalSpacing" >
+       <number>6</number>
+      </property>
+      <property name="verticalSpacing" >
        <number>6</number>
       </property>
       <item row="1" column="0" >
          <set>Qt::AlignRight</set>
         </property>
         <property name="suffix" >
-<string/>
+         <string/>
         </property>
         <property name="minimum" >
          <number>0</number>
    </item>
    <item>
     <widget class="QGroupBox" name="diskOptionBox_2" >
-     <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>5</hsizetype>
-       <vsizetype>5</vsizetype>
-       <horstretch>1</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
      <property name="title" >
-<string>_("Audio and Subtitles")</string>
+      <string>_("Audio and Subtitles")</string>
      </property>
      <layout class="QGridLayout" >
-      <property name="margin" >
+      <property name="leftMargin" >
+       <number>9</number>
+      </property>
+      <property name="topMargin" >
        <number>9</number>
       </property>
-      <property name="spacing" >
+      <property name="rightMargin" >
+       <number>9</number>
+      </property>
+      <property name="bottomMargin" >
+       <number>9</number>
+      </property>
+      <property name="horizontalSpacing" >
+       <number>6</number>
+      </property>
+      <property name="verticalSpacing" >
        <number>6</number>
       </property>
       <item row="1" column="0" >
         <property name="prefix" >
          <string/>
         </property>
-        <property name="maximum" >
-         <number>7</number>
-        </property>
         <property name="minimum" >
          <number>-1</number>
         </property>
+        <property name="maximum" >
+         <number>7</number>
+        </property>
         <property name="value" >
          <number>-1</number>
         </property>
         <property name="suffix" >
          <string/>
         </property>
-        <property name="maximum" >
-         <number>31</number>
-        </property>
         <property name="minimum" >
          <number>-1</number>
         </property>
+        <property name="maximum" >
+         <number>31</number>
+        </property>
         <property name="value" >
          <number>-1</number>
         </property>
index 2db7563553632996fd18915fbf5fdf1dc2508c0d..01105d4ad069a77b93719229ced1c60d06902d00 100644 (file)
@@ -6,14 +6,12 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>194</height>
+    <width>500</width>
+    <height>216</height>
    </rect>
   </property>
   <property name="sizePolicy" >
-   <sizepolicy>
-    <hsizetype>7</hsizetype>
-    <vsizetype>1</vsizetype>
+   <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
     <horstretch>0</horstretch>
     <verstretch>0</verstretch>
    </sizepolicy>
    <string>_("Open File")</string>
   </property>
   <layout class="QGridLayout" >
-   <property name="margin" >
+   <property name="leftMargin" >
     <number>9</number>
    </property>
-   <property name="spacing" >
+   <property name="topMargin" >
+    <number>9</number>
+   </property>
+   <property name="rightMargin" >
+    <number>9</number>
+   </property>
+   <property name="bottomMargin" >
+    <number>9</number>
+   </property>
+   <property name="horizontalSpacing" >
+    <number>6</number>
+   </property>
+   <property name="verticalSpacing" >
     <number>6</number>
    </property>
    <item row="1" column="1" colspan="2" >
     <widget class="QComboBox" name="fileInput" >
-     <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>7</hsizetype>
-       <vsizetype>0</vsizetype>
-       <horstretch>1</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
      <property name="editable" >
       <bool>true</bool>
      </property>
@@ -95,9 +97,7 @@
    <item row="4" column="0" colspan="3" >
     <widget class="QFrame" name="subFrame" >
      <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>1</hsizetype>
-       <vsizetype>5</vsizetype>
+      <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
       <enum>QFrame::StyledPanel</enum>
      </property>
      <layout class="QGridLayout" >
-      <property name="margin" >
+      <property name="leftMargin" >
+       <number>9</number>
+      </property>
+      <property name="topMargin" >
        <number>9</number>
       </property>
-      <property name="spacing" >
+      <property name="rightMargin" >
+       <number>9</number>
+      </property>
+      <property name="bottomMargin" >
+       <number>9</number>
+      </property>
+      <property name="horizontalSpacing" >
+       <number>6</number>
+      </property>
+      <property name="verticalSpacing" >
        <number>6</number>
       </property>
       <item row="1" column="7" >
        <widget class="QComboBox" name="alignSubComboBox" >
         <property name="minimumSize" >
          <size>
-          <width>80</width>
+          <width>100</width>
           <height>0</height>
          </size>
         </property>
       </item>
       <item row="0" column="0" colspan="6" >
        <widget class="QComboBox" name="subInput" >
-        <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>7</hsizetype>
-          <vsizetype>0</vsizetype>
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
         <property name="editable" >
          <bool>true</bool>
         </property>