Commit 771fe0b8 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - use a docked playlist, remove dead code, don't reinvent the wheel,...

Qt4 - use a docked playlist, remove dead code, don't reinvent the wheel, remove the behaviour where media library hides the video. Don't split the menu between two dialogs, this is weird and anti sane GUI guidelines.
Use enums when you can.
Add the popup menu to the always video cone.
And more...

parent 21791eb5
......@@ -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()
{
......
......@@ -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 );
};
......
......@@ -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 )
......
......@@ -71,6 +71,7 @@ DialogsProvider::~DialogsProvider()
{
PlaylistDialog::killInstance();
MediaInfoDialog::killInstance();
fixed_timer->stop();
}
void DialogsProvider::quit()
......
This diff is collapsed.
......@@ -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 );
......
......@@ -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() ) );
......
......@@ -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 * );
......
......@@ -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" >
......@@ -142,7 +163,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>
......@@ -157,22 +178,26 @@
</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" >
......@@ -217,7 +242,7 @@
<set>Qt::AlignRight</set>
</property>
<property name="suffix" >
<string/>
<string/>
</property>
<property name="minimum" >
<number>0</number>
......@@ -232,22 +257,26 @@
</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" >
......@@ -268,12 +297,12 @@
<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>
......@@ -297,12 +326,12 @@
<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>
......
......@@ -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>
......@@ -22,22 +20,26 @@
<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>
......@@ -106,10 +106,22 @@
<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" >
......@@ -142,7 +154,7 @@
<widget class="QComboBox" name="alignSubComboBox" >
<property name="minimumSize" >
<size>
<width>80</width>
<width>100</width>
<height>0</height>
</size>
</property>
......@@ -199,14 +211,6 @@
</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>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment