/*****************************************************************************
- * interface_widgets.cpp : Custom widgets for the main interface
+ * Controller.cpp : Controller for the main interface
****************************************************************************
- * Copyright ( C ) 2006 the VideoLAN team
+ * Copyright ( C ) 2006-2008 the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
#endif
#include <vlc_vout.h>
+#include <vlc_keys.h>
#include "dialogs_provider.hpp"
#include "components/interface_widgets.hpp"
#include <QLabel>
#include <QSpacerItem>
#include <QCursor>
-#include <QPushButton>
#include <QToolButton>
#include <QHBoxLayout>
#include <QMenu>
#include <QPalette>
#include <QResizeEvent>
#include <QDate>
-
-#define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a media")
+#include <QSignalMapper>
+#include <QTimer>
/**********************************************************************
* TEH controls
**********************************************************************/
-static void setupSmallButton( QPushButton *aButton )
+/******
+ * This is an abstract Toolbar/Controller
+ * This has helper to create any toolbar, any buttons and to manage the actions
+ *
+ *****/
+AbstractController::AbstractController( intf_thread_t * _p_i, QWidget *_parent )
+ : QFrame( _parent )
{
- aButton->setMaximumSize( QSize( 26, 26 ) );
- aButton->setMinimumSize( QSize( 26, 26 ) );
- aButton->setIconSize( QSize( 20, 20 ) );
- aButton->setFocusPolicy( Qt::NoFocus );
-}
+ p_intf = _p_i;
+ advControls = NULL;
-/* init static variables in advanced controls */
-mtime_t AdvControlsWidget::timeA = 0;
-mtime_t AdvControlsWidget::timeB = 0;
-
-AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i, bool b_fsCreation = false ) :
- QFrame( NULL ), p_intf( _p_i )
-{
- QHBoxLayout *advLayout = new QHBoxLayout( this );
- advLayout->setMargin( 0 );
- advLayout->setSpacing( 0 );
- advLayout->setAlignment( Qt::AlignBottom );
-
- /* A to B Button */
- ABButton = new QPushButton;
- setupSmallButton( ABButton );
- advLayout->addWidget( ABButton );
- BUTTON_SET_ACT_I( ABButton, "", atob_nob,
- qtr( "Loop from point A to point B continuously.\nClick to set point A" ),
- fromAtoB() );
- timeA = timeB = 0;
- i_last_input_id = 0;
- /* in FS controller we skip this, because we dont want to have it double
- controlled */
- if( !b_fsCreation )
- CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
- this, AtoBLoop( float, int, int ) );
- /* set up synchronization between main controller and fs controller */
- CONNECT( THEMIM->getIM(), advControlsSetIcon(), this, setIcon() );
- connect( this, SIGNAL( timeChanged() ),
- THEMIM->getIM(), SIGNAL( advControlsSetIcon()));
-#if 0
- frameButton = new QPushButton( "Fr" );
- frameButton->setMaximumSize( QSize( 26, 26 ) );
- frameButton->setIconSize( QSize( 20, 20 ) );
- advLayout->addWidget( frameButton );
- BUTTON_SET_ACT( frameButton, "Fr", qtr( "Frame by frame" ), frame() );
-#endif
-
- /* Record Button */
- recordButton = new QPushButton;
- setupSmallButton( recordButton );
- advLayout->addWidget( recordButton );
- BUTTON_SET_ACT_I( recordButton, "", record,
- qtr( "Record" ), record() );
-
- /* Snapshot Button */
- snapshotButton = new QPushButton;
- setupSmallButton( snapshotButton );
- advLayout->addWidget( snapshotButton );
- BUTTON_SET_ACT_I( snapshotButton, "", snapshot,
- qtr( "Take a snapshot" ), snapshot() );
+ /* Main action provider */
+ toolbarActionsMapper = new QSignalMapper( this );
+ CONNECT( toolbarActionsMapper, mapped( int ), this, doAction( int ) );
+ CONNECT( THEMIM->getIM(), statusChanged( int ), this, setStatus( int ) );
}
-AdvControlsWidget::~AdvControlsWidget()
-{}
-
-void AdvControlsWidget::enableInput( bool enable )
+/* Reemit some signals on status Change to activate some buttons */
+void AbstractController::setStatus( int status )
{
- int i_input_id = 0;
- if( THEMIM->getInput() != NULL )
- {
- input_item_t *p_item = input_GetItem( THEMIM->getInput() );
- i_input_id = p_item->i_id;
-
- recordButton->setVisible( var_GetBool( THEMIM->getInput(), "can-record" ) );
- }
- else
- {
- recordButton->setVisible( false );
- }
+ bool b_hasInput = THEMIM->getIM()->hasInput();
+ /* Activate the interface buttons according to the presence of the input */
+ emit inputExists( b_hasInput );
- ABButton->setEnabled( enable );
- recordButton->setEnabled( enable );
+ emit inputPlaying( status == PLAYING_S );
- if( enable && ( i_last_input_id != i_input_id ) )
- {
- timeA = timeB = 0;
- i_last_input_id = i_input_id;
- emit timeChanged();
- }
+ emit inputIsRecordable( b_hasInput &&
+ var_GetBool( THEMIM->getInput(), "can-record" ) );
}
-void AdvControlsWidget::enableVideo( bool enable )
+/* Generic button setup */
+void AbstractController::setupButton( QAbstractButton *aButton )
{
- snapshotButton->setEnabled( enable );
-#if 0
- frameButton->setEnabled( enable );
-#endif
+ static QSizePolicy sizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+ sizePolicy.setHorizontalStretch( 0 );
+ sizePolicy.setVerticalStretch( 0 );
+
+ aButton->setSizePolicy( sizePolicy );
+ aButton->setFixedSize( QSize( 26, 26 ) );
+ aButton->setIconSize( QSize( 20, 20 ) );
+ aButton->setFocusPolicy( Qt::NoFocus );
}
-void AdvControlsWidget::snapshot()
+/* Open the generic config line for the toolbar, parse it
+ * and create the widgets accordingly */
+void AbstractController::parseAndCreate( QString config,
+ QBoxLayout *controlLayout )
{
- vout_thread_t *p_vout =
- (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
- if( p_vout )
+ QStringList list = config.split( ";", QString::SkipEmptyParts ) ;
+ for( int i = 0; i < list.size(); i++ )
{
- vout_Control( p_vout, VOUT_SNAPSHOT );
- vlc_object_release( p_vout );
+ QStringList list2 = list.at( i ).split( "-" );
+ if( list2.size() < 1 )
+ {
+ msg_Warn( p_intf, "Parsing error. Report this" );
+ continue;
+ }
+
+ bool ok;
+ int i_option = WIDGET_NORMAL;
+ buttonType_e i_type = (buttonType_e)list2.at( 0 ).toInt( &ok );
+ if( !ok )
+ {
+ msg_Warn( p_intf, "Parsing error 0. Please report this" );
+ continue;
+ }
+
+ if( list2.size() > 1 )
+ {
+ i_option = list2.at( 1 ).toInt( &ok );
+ if( !ok )
+ {
+ msg_Warn( p_intf, "Parsing error 1. Please report this" );
+ continue;
+ }
+ }
+
+ createAndAddWidget( controlLayout, -1, i_type, i_option );
}
}
-/* Function called when the button is clicked() */
-void AdvControlsWidget::fromAtoB()
+void AbstractController::createAndAddWidget( QBoxLayout *controlLayout,
+ int i_index,
+ buttonType_e i_type,
+ int i_option )
{
- if( !timeA )
+ /* Special case for SPACERS, who aren't QWidgets */
+ if( i_type == WIDGET_SPACER )
{
- timeA = var_GetTime( THEMIM->getInput(), "time" );
- emit timeChanged();
+ controlLayout->insertSpacing( i_index, 16 );
return;
}
- if( !timeB )
+
+ if( i_type == WIDGET_SPACER_EXTEND )
{
- timeB = var_GetTime( THEMIM->getInput(), "time" );
- var_SetTime( THEMIM->getInput(), "time" , timeA );
- emit timeChanged();
+ controlLayout->insertStretch( i_index, 16 );
return;
}
- timeA = 0;
- timeB = 0;
- emit timeChanged();
-}
-/* setting/synchro icons after click on main or fs controller */
-void AdvControlsWidget::setIcon()
-{
- if( !timeA && !timeB)
- {
- ABButton->setIcon( QIcon( ":/atob_nob" ) );
- ABButton->setToolTip( qtr( "Loop from point A to point B continuously\nClick to set point A" ) );
- }
- else if( timeA && !timeB )
- {
- ABButton->setIcon( QIcon( ":/atob_noa" ) );
- ABButton->setToolTip( qtr( "Click to set point B" ) );
- }
- else if( timeA && timeB )
- {
- ABButton->setIcon( QIcon( ":/atob" ) );
- ABButton->setToolTip( qtr( "Stop the A to B loop" ) );
- }
-}
+ QWidget *widg = createWidget( i_type, i_option );
+ if( !widg ) return;
-/* Function called regularly when in an AtoB loop */
-void AdvControlsWidget::AtoBLoop( float f_pos, int i_time, int i_length )
-{
- if( timeB )
- {
- if( ( i_time >= (int)( timeB/1000000 ) )
- || ( i_time < (int)( timeA/1000000 ) ) )
- var_SetTime( THEMIM->getInput(), "time" , timeA );
- }
+ controlLayout->insertWidget( i_index, widg );
}
-void AdvControlsWidget::record()
-{
- input_thread_t *p_input = THEMIM->getInput();
- if( p_input )
- {
- /* This method won't work fine if the stream can't be cut anywhere */
- const bool b_recording = var_GetBool( p_input, "record" );
- var_SetBool( p_input, "record", !b_recording );
-#if 0
- else
- {
- /* 'record' access-filter is not loaded, we open Save dialog */
- input_item_t *p_item = input_GetItem( p_input );
- if( !p_item )
- return;
- char *psz = input_item_GetURI( p_item );
- if( psz )
- THEDP->streamingDialog( NULL, psz, true );
- }
-#endif
- }
-}
+#define CONNECT_MAP( a ) CONNECT( a, clicked(), toolbarActionsMapper, map() )
+#define SET_MAPPING( a, b ) toolbarActionsMapper->setMapping( a , b )
+#define CONNECT_MAP_SET( a, b ) \
+ CONNECT_MAP( a ); \
+ SET_MAPPING( a, b );
+#define BUTTON_SET_BAR( a_button ) \
+ a_button->setToolTip( tooltipL[button] ); \
+ a_button->setIcon( QIcon( iconL[button] ) );
+#define BUTTON_SET_BAR2( button, image, tooltip ) \
+ button->setToolTip( tooltip ); \
+ button->setIcon( QIcon( ":/"#image ) );
-#if 0
-//FIXME Frame by frame function
-void AdvControlsWidget::frame(){}
-#endif
-
-/*****************************
- * DA Control Widget !
- *****************************/
-ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
- MainInterface *_p_mi,
- bool b_advControls,
- bool b_shiny,
- bool b_fsCreation) :
- QFrame( _p_mi ), p_intf( _p_i )
-{
- setSizePolicy( QSizePolicy::Preferred , QSizePolicy::Maximum );
- /** The main Slider **/
- slider = new InputSlider( Qt::Horizontal, NULL );
- /* 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 ) );
+#define ENABLE_ON_VIDEO( a ) \
+ CONNECT( THEMIM->getIM(), voutChanged( bool ), a, setEnabled( bool ) ); \
+ a->setEnabled( THEMIM->getIM()->hasVideo() ); /* TODO: is this necessary? when input is started before the interface? */
- /** Slower and faster Buttons **/
- slowerButton = new QToolButton;
- slowerButton->setAutoRaise( true );
- slowerButton->setMaximumSize( QSize( 26, 20 ) );
- slowerButton->setFocusPolicy( Qt::NoFocus );
+#define ENABLE_ON_INPUT( a ) \
+ CONNECT( this, inputExists( bool ), a, setEnabled( bool ) ); \
+ a->setEnabled( THEMIM->getIM()->hasInput() ); /* TODO: is this necessary? when input is started before the interface? */
- BUTTON_SET_ACT_I( slowerButton, "", slower, qtr( "Slower" ), slower() );
+QWidget *AbstractController::createWidget( buttonType_e button, int options )
+{
- fasterButton = new QToolButton;
- fasterButton->setAutoRaise( true );
- fasterButton->setMaximumSize( QSize( 26, 20 ) );
- fasterButton->setFocusPolicy( Qt::NoFocus );
+ bool b_flat = options & WIDGET_FLAT;
+ bool b_big = options & WIDGET_BIG;
+ bool b_shiny = options & WIDGET_SHINY;
- BUTTON_SET_ACT_I( fasterButton, "", faster, qtr( "Faster" ), faster() );
+ QWidget *widget = NULL;
+ switch( button )
+ {
+ case PLAY_BUTTON: {
+ PlayButton *playButton = new PlayButton;
+ setupButton( playButton );
+ BUTTON_SET_BAR( playButton );
+ CONNECT_MAP_SET( playButton, PLAY_ACTION );
+ CONNECT( this, inputPlaying( bool ),
+ playButton, updateButton( bool ));
+ widget = playButton;
+ }
+ break;
+ case STOP_BUTTON:{
+ QToolButton *stopButton = new QToolButton;
+ setupButton( stopButton );
+ CONNECT_MAP_SET( stopButton, STOP_ACTION );
+ BUTTON_SET_BAR( stopButton );
+ widget = stopButton;
+ }
+ break;
+ case OPEN_BUTTON:{
+ QToolButton *openButton = new QToolButton;
+ setupButton( openButton );
+ CONNECT_MAP_SET( openButton, OPEN_ACTION );
+ BUTTON_SET_BAR( openButton );
+ widget = openButton;
+ }
+ break;
+ case PREVIOUS_BUTTON:{
+ QToolButton *prevButton = new QToolButton;
+ setupButton( prevButton );
+ CONNECT_MAP_SET( prevButton, PREVIOUS_ACTION );
+ BUTTON_SET_BAR( prevButton );
+ widget = prevButton;
+ }
+ break;
+ case NEXT_BUTTON:
+ {
+ QToolButton *nextButton = new QToolButton;
+ setupButton( nextButton );
+ CONNECT_MAP_SET( nextButton, NEXT_ACTION );
+ BUTTON_SET_BAR( nextButton );
+ widget = nextButton;
+ }
+ break;
+ case SLOWER_BUTTON:{
+ QToolButton *slowerButton = new QToolButton;
+ setupButton( slowerButton );
+ CONNECT_MAP_SET( slowerButton, SLOWER_ACTION );
+ BUTTON_SET_BAR( slowerButton );
+ ENABLE_ON_INPUT( slowerButton );
+ widget = slowerButton;
+ }
+ break;
+ case FASTER_BUTTON:{
+ QToolButton *fasterButton = new QToolButton;
+ setupButton( fasterButton );
+ CONNECT_MAP_SET( fasterButton, FASTER_ACTION );
+ BUTTON_SET_BAR( fasterButton );
+ ENABLE_ON_INPUT( fasterButton );
+ widget = fasterButton;
+ }
+ break;
+ case FRAME_BUTTON: {
+ QToolButton *frameButton = new QToolButton;
+ setupButton( frameButton );
+ CONNECT_MAP_SET( frameButton, FRAME_ACTION );
+ BUTTON_SET_BAR( frameButton );
+ ENABLE_ON_VIDEO( frameButton );
+ widget = frameButton;
+ }
+ break;
+ case FULLSCREEN_BUTTON:{
+ QToolButton *fullscreenButton = new QToolButton;
+ setupButton( fullscreenButton );
+ CONNECT_MAP_SET( fullscreenButton, FULLSCREEN_ACTION );
+ BUTTON_SET_BAR( fullscreenButton );
+ ENABLE_ON_VIDEO( fullscreenButton );
+ widget = fullscreenButton;
+ }
+ break;
+ case DEFULLSCREEN_BUTTON:{
+ QToolButton *fullscreenButton = new QToolButton;
+ setupButton( fullscreenButton );
+ CONNECT_MAP_SET( fullscreenButton, FULLSCREEN_ACTION );
+ BUTTON_SET_BAR( fullscreenButton )
+ ENABLE_ON_VIDEO( fullscreenButton );
+ widget = fullscreenButton;
+ }
+ break;
+ case EXTENDED_BUTTON:{
+ QToolButton *extSettingsButton = new QToolButton;
+ setupButton( extSettingsButton );
+ CONNECT_MAP_SET( extSettingsButton, EXTENDED_ACTION );
+ BUTTON_SET_BAR( extSettingsButton )
+ widget = extSettingsButton;
+ }
+ break;
+ case PLAYLIST_BUTTON:{
+ QToolButton *playlistButton = new QToolButton;
+ setupButton( playlistButton );
+ CONNECT_MAP_SET( playlistButton, PLAYLIST_ACTION );
+ BUTTON_SET_BAR( playlistButton );
+ widget = playlistButton;
+ }
+ break;
+ case SNAPSHOT_BUTTON:{
+ QToolButton *snapshotButton = new QToolButton;
+ setupButton( snapshotButton );
+ CONNECT_MAP_SET( snapshotButton, SNAPSHOT_ACTION );
+ BUTTON_SET_BAR( snapshotButton );
+ ENABLE_ON_VIDEO( snapshotButton );
+ widget = snapshotButton;
+ }
+ break;
+ case RECORD_BUTTON:{
+ QToolButton *recordButton = new QToolButton;
+ setupButton( recordButton );
+ CONNECT_MAP_SET( recordButton, RECORD_ACTION );
+ BUTTON_SET_BAR( recordButton );
+ ENABLE_ON_INPUT( recordButton );
+ widget = recordButton;
+ }
+ break;
+ case ATOB_BUTTON: {
+ AtoB_Button *ABButton = new AtoB_Button;
+ setupButton( ABButton );
+ BUTTON_SET_BAR( ABButton );
+ ENABLE_ON_INPUT( ABButton );
+ CONNECT_MAP_SET( ABButton, ATOB_ACTION );
+ CONNECT( THEMIM->getIM(), AtoBchanged( bool, bool),
+ ABButton, setIcons( bool, bool ) );
+ widget = ABButton;
+ }
+ break;
+ case INPUT_SLIDER: {
+ InputSlider *slider = new InputSlider( Qt::Horizontal, NULL );
- /* advanced Controls handling */
- b_advancedVisible = b_advControls;
+ /* 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 ) );
+ widget = slider;
+ }
+ break;
+ case MENU_BUTTONS:
+ widget = discFrame();
+ widget->hide();
+ break;
+ case TELETEXT_BUTTONS:
+ widget = telexFrame();
+ widget->hide();
+ break;
+ case VOLUME:
+ {
+ SoundWidget *snd = new SoundWidget( this, p_intf, b_shiny );
+ widget = snd;
+ }
+ break;
+ case TIME_LABEL:
+ {
+ TimeLabel *timeLabel = new TimeLabel( p_intf );
+ widget = timeLabel;
+ }
+ break;
+ case SPLITTER:
+ {
+ QFrame *line = new QFrame;
+ line->setFrameShape( QFrame::VLine );
+ line->setFrameShadow( QFrame::Raised );
+ line->setLineWidth( 0 );
+ line->setMidLineWidth( 1 );
+ widget = line;
+ }
+ break;
+ case ADVANCED_CONTROLLER:
+ {
+ advControls = new AdvControlsWidget( p_intf, this );
+ widget = advControls;
+ }
+ break;
+ case REVERSE_BUTTON:{
+ QToolButton *reverseButton = new QToolButton;
+ setupButton( reverseButton );
+ CONNECT_MAP_SET( reverseButton, REVERSE_ACTION );
+ BUTTON_SET_BAR( reverseButton );
+ ENABLE_ON_INPUT( reverseButton );
+ widget = reverseButton;
+ }
+ break;
+ case SKIP_BACK_BUTTON: {
+ QToolButton *skipBakButton = new QToolButton;
+ setupButton( skipBakButton );
+ CONNECT_MAP_SET( skipBakButton, SKIP_BACK_ACTION );
+ BUTTON_SET_BAR( skipBakButton );
+ ENABLE_ON_INPUT( skipBakButton );
+ widget = skipBakButton;
+ }
+ break;
+ case SKIP_FW_BUTTON: {
+ QToolButton *skipFwButton = new QToolButton;
+ setupButton( skipFwButton );
+ CONNECT_MAP_SET( skipFwButton, SKIP_FW_ACTION );
+ BUTTON_SET_BAR( skipFwButton );
+ ENABLE_ON_INPUT( skipFwButton );
+ widget = skipFwButton;
+ }
+ break;
+ default:
+ msg_Warn( p_intf, "This should not happen %i", button );
+ break;
+ }
- advControls = new AdvControlsWidget( p_intf, b_fsCreation );
- if( !b_advancedVisible ) advControls->hide();
+ /* Customize Buttons */
+ if( b_flat || b_big )
+ {
+ QToolButton *tmpButton = qobject_cast<QToolButton *>(widget);
+ if( tmpButton )
+ {
+ if( b_flat )
+ tmpButton->setAutoRaise( b_flat );
+ if( b_big )
+ {
+ tmpButton->setFixedSize( QSize( 32, 32 ) );
+ tmpButton->setIconSize( QSize( 26, 26 ) );
+ }
+ }
+ }
+ return widget;
+}
+QWidget *AbstractController::discFrame()
+{
/** Disc and Menus handling */
- discFrame = new QWidget( this );
+ QWidget *discFrame = new QWidget( this );
QHBoxLayout *discLayout = new QHBoxLayout( discFrame );
- discLayout->setSpacing( 0 );
- discLayout->setMargin( 0 );
+ discLayout->setSpacing( 0 ); discLayout->setMargin( 0 );
- prevSectionButton = new QPushButton( discFrame );
- setupSmallButton( prevSectionButton );
+ QToolButton *prevSectionButton = new QToolButton( discFrame );
+ setupButton( prevSectionButton );
+ BUTTON_SET_BAR2( prevSectionButton, dvd_prev,
+ qtr("Previous Chapter/Title" ) );
discLayout->addWidget( prevSectionButton );
- menuButton = new QPushButton( discFrame );
- setupSmallButton( menuButton );
+ QToolButton *menuButton = new QToolButton( discFrame );
+ setupButton( menuButton );
discLayout->addWidget( menuButton );
+ BUTTON_SET_BAR2( menuButton, dvd_menu, qtr( "Menu" ) );
- nextSectionButton = new QPushButton( discFrame );
- setupSmallButton( nextSectionButton );
+ QToolButton *nextSectionButton = new QToolButton( discFrame );
+ setupButton( nextSectionButton );
discLayout->addWidget( nextSectionButton );
-
- BUTTON_SET_IMG( prevSectionButton, "", dvd_prev, "" );
- BUTTON_SET_IMG( nextSectionButton, "", dvd_next, "" );
- BUTTON_SET_IMG( menuButton, "", dvd_menu, qtr( "Menu" ) );
-
- discFrame->hide();
-
- /* Change the navigation button display when the IM navigation changes */
- CONNECT( THEMIM->getIM(), navigationChanged( int ),
- this, setNavigation( int ) );
+ BUTTON_SET_BAR2( nextSectionButton, dvd_next,
+ qtr("Next Chapter/Title" ) );
+
+ /* Change the navigation button display when the IM
+ navigation changes */
+ CONNECT( THEMIM->getIM(), titleChanged( bool ),
+ discFrame, setVisible( bool ) );
+ CONNECT( THEMIM->getIM(), chapterChanged( bool ),
+ menuButton, setVisible( bool ) );
/* Changes the IM navigation when triggered on the nav buttons */
CONNECT( prevSectionButton, clicked(), THEMIM->getIM(),
- sectionPrev() );
+ sectionPrev() );
CONNECT( nextSectionButton, clicked(), THEMIM->getIM(),
- sectionNext() );
+ sectionNext() );
CONNECT( menuButton, clicked(), THEMIM->getIM(),
- sectionMenu() );
+ sectionMenu() );
+ return discFrame;
+}
+
+QWidget *AbstractController::telexFrame()
+{
/**
* Telextext QFrame
- * TODO: Merge with upper menu in a StackLayout
**/
- telexFrame = new QWidget( this );
+ TeletextController *telexFrame = new TeletextController;
QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
- telexLayout->setSpacing( 0 );
- telexLayout->setMargin( 0 );
-
- telexOn = new QPushButton;
- setupSmallButton( telexOn );
+ telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 );
+ CONNECT( THEMIM->getIM(), teletextPossible( bool ),
+ telexFrame, setVisible( bool ) );
+
+ /* On/Off button */
+ QToolButton *telexOn = new QToolButton;
+ telexFrame->telexOn = telexOn;
+ setupButton( telexOn );
+ BUTTON_SET_BAR2( telexOn, tv, qtr( "Teletext Activation" ) );
telexLayout->addWidget( telexOn );
- telexTransparent = new QPushButton;
- setupSmallButton( telexTransparent );
+ /* Teletext Activation and set */
+ CONNECT( telexOn, clicked( bool ),
+ THEMIM->getIM(), activateTeletext( bool ) );
+ CONNECT( THEMIM->getIM(), teletextActivated( bool ),
+ telexFrame, enableTeletextButtons( bool ) );
+
+
+ /* Transparency button */
+ QToolButton *telexTransparent = new QToolButton;
+ telexFrame->telexTransparent = telexTransparent;
+ setupButton( telexTransparent );
+ BUTTON_SET_BAR2( telexTransparent, tvtelx,
+ qtr( "Toggle Transparency " ) );
+ telexTransparent->setEnabled( false );
telexLayout->addWidget( telexTransparent );
- b_telexTransparent = false;
- telexPage = new QSpinBox;
+ /* Transparency change and set */
+ CONNECT( telexTransparent, clicked( bool ),
+ THEMIM->getIM(), telexSetTransparency( bool ) );
+ CONNECT( THEMIM->getIM(), teletextTransparencyActivated( bool ),
+ telexFrame, toggleTeletextTransparency( bool ) );
+
+
+ /* Page setting */
+ QSpinBox *telexPage = new QSpinBox;
+ telexFrame->telexPage = telexPage;
telexPage->setRange( 0, 999 );
telexPage->setValue( 100 );
telexPage->setAccelerated( true );
telexPage->setWrapping( true );
telexPage->setAlignment( Qt::AlignRight );
telexPage->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
- telexLayout->addWidget( telexPage );
-
- telexFrame->hide(); /* default hidden */
-
- CONNECT( telexPage, valueChanged( int ), THEMIM->getIM(),
- telexGotoPage( int ) );
- CONNECT( THEMIM->getIM(), setNewTelexPage( int ),
- telexPage, setValue( int ) );
-
- BUTTON_SET_IMG( telexOn, "", tv, qtr( "Teletext on" ) );
-
- CONNECT( telexOn, clicked(), THEMIM->getIM(),
- telexToggleButtons() );
- CONNECT( telexOn, clicked( bool ), THEMIM->getIM(),
- telexToggle( bool ) );
- CONNECT( THEMIM->getIM(), toggleTelexButtons(),
- this, toggleTeletext() );
- b_telexEnabled = false;
- telexTransparent->setEnabled( false );
telexPage->setEnabled( false );
+ telexLayout->addWidget( telexPage );
- BUTTON_SET_IMG( telexTransparent, "", tvtelx, qtr( "Teletext" ) );
- CONNECT( telexTransparent, clicked( bool ),
- THEMIM->getIM(), telexSetTransparency() );
- CONNECT( THEMIM->getIM(), toggleTelexTransparency(),
- this, toggleTeletextTransparency() );
- CONNECT( THEMIM->getIM(), teletextEnabled( bool ),
- this, enableTeletext( bool ) );
-
- /** Play Buttons **/
- QSizePolicy sizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
- sizePolicy.setHorizontalStretch( 0 );
- sizePolicy.setVerticalStretch( 0 );
-
- /* Play */
- playButton = new QPushButton;
- playButton->setSizePolicy( sizePolicy );
- playButton->setMaximumSize( QSize( 32, 32 ) );
- playButton->setMinimumSize( QSize( 32, 32 ) );
- playButton->setIconSize( QSize( 26, 26 ) );
- playButton->setFocusPolicy( Qt::NoFocus );
-
- /** Prev + Stop + Next Block **/
- controlButLayout = new QHBoxLayout;
- controlButLayout->setSpacing( 0 ); /* Don't remove that, will be useful */
-
- /* Prev */
- QPushButton *prevButton = new QPushButton;
- prevButton->setSizePolicy( sizePolicy );
- setupSmallButton( prevButton );
-
- controlButLayout->addWidget( prevButton );
-
- /* Stop */
- QPushButton *stopButton = new QPushButton;
- stopButton->setSizePolicy( sizePolicy );
- setupSmallButton( stopButton );
-
- controlButLayout->addWidget( stopButton );
-
- /* next */
- QPushButton *nextButton = new QPushButton;
- nextButton->setSizePolicy( sizePolicy );
- setupSmallButton( nextButton );
-
- controlButLayout->addWidget( nextButton );
-
- /* Add this block to the main layout */
-
- BUTTON_SET_ACT_I( playButton, "", play_b, qtr( I_PLAY_TOOLTIP ), play() );
- BUTTON_SET_ACT_I( prevButton, "" , previous_b,
- qtr( "Previous media in the playlist" ), prev() );
- BUTTON_SET_ACT_I( nextButton, "", next_b,
- qtr( "Next media in the playlist" ), next() );
- BUTTON_SET_ACT_I( stopButton, "", stop_b, qtr( "Stop playback" ), stop() );
-
- /*
- * Other first Line buttons
- */
- /* */
- CONNECT( THEMIM->getIM(), voutChanged(bool), this, enableVideo(bool) );
-
- /** Fullscreen/Visualisation **/
- fullscreenButton = new QPushButton;
- BUTTON_SET_ACT_I( fullscreenButton, "", fullscreen,
- qtr( "Toggle the video in fullscreen" ), fullscreen() );
- setupSmallButton( fullscreenButton );
-
- if( !b_fsCreation )
- {
- /** Playlist Button **/
- playlistButton = new QPushButton;
- setupSmallButton( playlistButton );
- BUTTON_SET_IMG( playlistButton, "" , playlist, qtr( "Show playlist" ) );
- CONNECT( playlistButton, clicked(), _p_mi, togglePlaylist() );
-
- /** extended Settings **/
- extSettingsButton = new QPushButton;
- BUTTON_SET_ACT_I( extSettingsButton, "", extended,
- qtr( "Show extended settings" ), extSettings() );
- setupSmallButton( extSettingsButton );
- }
-
- /* Volume */
- hVolLabel = new VolumeClickHandler( p_intf, this );
-
- volMuteLabel = new QLabel;
- volMuteLabel->setPixmap( QPixmap( ":/volume-medium" ) );
- volMuteLabel->installEventFilter( hVolLabel );
-
- if( b_shiny )
- {
- volumeSlider = new SoundSlider( this,
- config_GetInt( p_intf, "volume-step" ),
- config_GetInt( p_intf, "qt-volume-complete" ),
- config_GetPsz( p_intf, "qt-slider-colours" ) );
- }
- else
- {
- volumeSlider = new QSlider( this );
- volumeSlider->setOrientation( Qt::Horizontal );
- }
- volumeSlider->setMaximumSize( QSize( 200, 40 ) );
- volumeSlider->setMinimumSize( QSize( 85, 30 ) );
- volumeSlider->setFocusPolicy( Qt::NoFocus );
-
- /* Set the volume from the config */
- volumeSlider->setValue( ( config_GetInt( p_intf, "volume" ) ) *
- VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
-
- /* Force the update at build time in order to have a muted icon if needed */
- updateVolume( volumeSlider->value() );
-
- /* Volume control connection */
- CONNECT( volumeSlider, valueChanged( int ), this, updateVolume( int ) );
- CONNECT( THEMIM, volumeChanged( void ), this, updateVolume( void ) );
-
- if( !b_fsCreation )
- {
- controlLayout = new QGridLayout( this );
-
- controlLayout->setSpacing( 0 );
- controlLayout->setLayoutMargins( 7, 5, 7, 3, 6 );
-
- controlLayout->addWidget( slider, 0, 1, 1, 18 );
- controlLayout->addWidget( slowerButton, 0, 0 );
- controlLayout->addWidget( fasterButton, 0, 19 );
-
- controlLayout->addWidget( discFrame, 1, 8, 2, 3, Qt::AlignBottom );
- controlLayout->addWidget( telexFrame, 1, 8, 2, 5, Qt::AlignBottom );
-
- controlLayout->addWidget( playButton, 2, 0, 2, 2, Qt::AlignBottom );
- controlLayout->setColumnMinimumWidth( 2, 10 );
- controlLayout->setColumnStretch( 2, 0 );
-
- controlLayout->addLayout( controlButLayout, 3, 3, 1, 3, Qt::AlignBottom );
- /* Column 6 is unused */
- controlLayout->setColumnStretch( 6, 0 );
- controlLayout->setColumnStretch( 7, 0 );
- controlLayout->setColumnMinimumWidth( 7, 10 );
-
- controlLayout->addWidget( fullscreenButton, 3, 8, Qt::AlignBottom );
- controlLayout->addWidget( playlistButton, 3, 9, Qt::AlignBottom );
- controlLayout->addWidget( extSettingsButton, 3, 10, Qt::AlignBottom );
- controlLayout->setColumnStretch( 11, 0 ); /* telex alignment */
-
- controlLayout->setColumnStretch( 12, 0 );
- controlLayout->setColumnMinimumWidth( 12, 10 );
-
- controlLayout->addWidget( advControls, 3, 13, 1, 3, Qt::AlignBottom );
-
- controlLayout->setColumnStretch( 16, 10 );
- controlLayout->setColumnMinimumWidth( 16, 10 );
-
- controlLayout->addWidget( volMuteLabel, 3, 17, Qt::AlignBottom );
- controlLayout->addWidget( volumeSlider, 3, 18, 1 , 2, Qt::AlignBottom );
- }
+ /* Page change and set */
+ CONNECT( telexPage, valueChanged( int ),
+ THEMIM->getIM(), telexSetPage( int ) );
+ CONNECT( THEMIM->getIM(), newTelexPageSet( int ),
+ telexPage, setValue( int ) );
- updateInput();
+ return telexFrame;
}
-
-ControlsWidget::~ControlsWidget()
-{}
-
-void ControlsWidget::toggleTeletext()
+#undef CONNECT_MAP
+#undef SET_MAPPING
+#undef CONNECT_MAP_SET
+#undef BUTTON_SET_BAR
+#undef ENABLE_ON_VIDEO
+#undef ENABLE_ON_INPUT
+
+//* Actions */
+void AbstractController::doAction( int id_action )
{
- bool b_enabled = THEMIM->teletextState();
- if( b_telexEnabled )
+ switch( id_action )
{
- telexTransparent->setEnabled( false );
- telexPage->setEnabled( false );
- b_telexEnabled = false;
- }
- else if( b_enabled )
- {
- telexTransparent->setEnabled( true );
- telexPage->setEnabled( true );
- b_telexEnabled = true;
- }
-}
-
-void ControlsWidget::enableTeletext( bool b_enable )
-{
- telexFrame->setVisible( b_enable );
- bool b_on = THEMIM->teletextState();
-
- telexOn->setChecked( b_on );
- telexTransparent->setEnabled( b_on );
- telexPage->setEnabled( b_on );
- b_telexEnabled = b_on;
-}
-
-void ControlsWidget::toggleTeletextTransparency()
-{
- if( b_telexTransparent )
- {
- telexTransparent->setIcon( QIcon( ":/tvtelx" ) );
- telexTransparent->setToolTip( qtr( "Teletext" ) );
- b_telexTransparent = false;
- }
- else
- {
- telexTransparent->setIcon( QIcon( ":/tvtelx-trans" ) );
- telexTransparent->setToolTip( qtr( "Transparent" ) );
- b_telexTransparent = true;
+ case PLAY_ACTION:
+ play(); break;
+ case PREVIOUS_ACTION:
+ prev(); break;
+ case NEXT_ACTION:
+ next(); break;
+ case STOP_ACTION:
+ stop(); break;
+ case SLOWER_ACTION:
+ slower(); break;
+ case FASTER_ACTION:
+ faster(); break;
+ case FULLSCREEN_ACTION:
+ fullscreen(); break;
+ case EXTENDED_ACTION:
+ extSettings(); break;
+ case PLAYLIST_ACTION:
+ playlist(); break;
+ case SNAPSHOT_ACTION:
+ snapshot(); break;
+ case RECORD_ACTION:
+ record(); break;
+ case ATOB_ACTION:
+ THEMIM->getIM()->setAtoB(); break;
+ case FRAME_ACTION:
+ frame(); break;
+ case REVERSE_ACTION:
+ reverse(); break;
+ case SKIP_BACK_ACTION:
+ var_SetInteger( p_intf->p_libvlc, "key-pressed",
+ ACTIONID_JUMP_BACKWARD_SHORT );
+ break;
+ case SKIP_FW_ACTION:
+ var_SetInteger( p_intf->p_libvlc, "key-pressed",
+ ACTIONID_JUMP_FORWARD_SHORT );
+ break;
+ default:
+ msg_Dbg( p_intf, "Action: %i", id_action );
+ break;
}
}
-void ControlsWidget::stop()
+void AbstractController::stop()
{
THEMIM->stop();
}
-void ControlsWidget::play()
+void AbstractController::play()
{
if( THEPL->current.i_size == 0 )
{
/* The playlist is empty, open a file requester */
THEDP->openFileDialog();
- setStatus( 0 );
return;
}
THEMIM->togglePlayPause();
}
-void ControlsWidget::prev()
+void AbstractController::prev()
{
THEMIM->prev();
}
-void ControlsWidget::next()
+void AbstractController::next()
{
THEMIM->next();
}
-void ControlsWidget::setNavigation( int navigation )
+/**
+ * TODO
+ * This functions toggle the fullscreen mode
+ * If there is no video, it should first activate Visualisations...
+ * This has also to be fixed in enableVideo()
+ */
+void AbstractController::fullscreen()
{
-#define HELP_PCH N_( "Previous chapter" )
-#define HELP_NCH N_( "Next chapter" )
-
- // 1 = chapter, 2 = title, 0 = no
- if( navigation == 0 )
+ vout_thread_t *p_vout =
+ (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
+ if( p_vout)
{
- discFrame->hide();
- } else if( navigation == 1 ) {
- prevSectionButton->setToolTip( qtr( HELP_PCH ) );
- nextSectionButton->setToolTip( qtr( HELP_NCH ) );
- menuButton->show();
- discFrame->show();
- } else {
- prevSectionButton->setToolTip( qtr( HELP_PCH ) );
- nextSectionButton->setToolTip( qtr( HELP_NCH ) );
- menuButton->hide();
- discFrame->show();
+ var_SetBool( p_vout, "fullscreen", !var_GetBool( p_vout, "fullscreen" ) );
+ vlc_object_release( p_vout );
}
}
-static bool b_my_volume;
-void ControlsWidget::updateVolume( int i_sliderVolume )
+void AbstractController::snapshot()
{
- if( !b_my_volume )
- {
- int i_res = i_sliderVolume * (AOUT_VOLUME_MAX / 2) / VOLUME_MAX;
- aout_VolumeSet( p_intf, i_res );
- }
- if( i_sliderVolume == 0 )
+ vout_thread_t *p_vout =
+ (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
+ if( p_vout )
{
- volMuteLabel->setPixmap( QPixmap(":/volume-muted" ) );
- volMuteLabel->setToolTip( qtr( "Unmute" ) );
- return;
+ vout_Control( p_vout, VOUT_SNAPSHOT );
+ vlc_object_release( p_vout );
}
-
- if( i_sliderVolume < VOLUME_MAX / 3 )
- volMuteLabel->setPixmap( QPixmap( ":/volume-low" ) );
- else if( i_sliderVolume > (VOLUME_MAX * 2 / 3 ) )
- volMuteLabel->setPixmap( QPixmap( ":/volume-high" ) );
- else volMuteLabel->setPixmap( QPixmap( ":/volume-medium" ) );
- volMuteLabel->setToolTip( qtr( "Mute" ) );
}
-void ControlsWidget::updateVolume()
+void AbstractController::extSettings()
{
- /* Audio part */
- audio_volume_t i_volume;
- aout_VolumeGet( p_intf, &i_volume );
- i_volume = ( i_volume * VOLUME_MAX )/ (AOUT_VOLUME_MAX/2);
- 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;
- }
+ THEDP->extendedDialog();
}
-void ControlsWidget::updateInput()
+void AbstractController::reverse()
{
- /* Activate the interface buttons according to the presence of the input */
- enableInput( THEMIM->getIM()->hasInput() );
- enableVideo( THEMIM->getIM()->hasVideo() );
+ THEMIM->getIM()->reverse();
}
-void ControlsWidget::setStatus( int status )
+void AbstractController::slower()
{
- if( status == PLAYING_S ) /* Playing */
- {
- playButton->setIcon( QIcon( ":/pause_b" ) );
- playButton->setToolTip( qtr( "Pause the playback" ) );
- }
- else
- {
- playButton->setIcon( QIcon( ":/play_b" ) );
- playButton->setToolTip( qtr( I_PLAY_TOOLTIP ) );
- }
+ THEMIM->getIM()->slower();
}
-/**
- * TODO
- * This functions toggle the fullscreen mode
- * If there is no video, it should first activate Visualisations...
- * This has also to be fixed in enableVideo()
- */
-void ControlsWidget::fullscreen()
+void AbstractController::faster()
{
- vout_thread_t *p_vout =
- (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
- if( p_vout)
- {
- var_SetBool( p_vout, "fullscreen", !var_GetBool( p_vout, "fullscreen" ) );
- vlc_object_release( p_vout );
- }
+ THEMIM->getIM()->faster();
}
-void ControlsWidget::extSettings()
+void AbstractController::playlist()
{
- THEDP->extendedDialog();
+ if( p_intf->p_sys->p_mi ) p_intf->p_sys->p_mi->togglePlaylist();
}
-void ControlsWidget::slower()
+void AbstractController::record()
{
- THEMIM->getIM()->slower();
-}
+ input_thread_t *p_input = THEMIM->getInput();
+ if( p_input )
+ {
+ /* This method won't work fine if the stream can't be cut anywhere */
+ const bool b_recording = var_GetBool( p_input, "record" );
+ var_SetBool( p_input, "record", !b_recording );
+#if 0
+ else
+ {
+ /* 'record' access-filter is not loaded, we open Save dialog */
+ input_item_t *p_item = input_GetItem( p_input );
+ if( !p_item )
+ return;
-void ControlsWidget::faster()
-{
- THEMIM->getIM()->faster();
+ char *psz = input_item_GetURI( p_item );
+ if( psz )
+ THEDP->streamingDialog( NULL, psz, true );
+ }
+#endif
+ }
}
-void ControlsWidget::enableInput( bool enable )
+void AbstractController::frame()
{
- slowerButton->setEnabled( enable );
- slider->setEnabled( enable );
- slider->setSliderPosition ( 0 );
- fasterButton->setEnabled( enable );
-
- /* Advanced Buttons too */
- advControls->enableInput( enable );
+ input_thread_t *p_input = THEMIM->getInput();
+ if( p_input )
+ var_SetVoid( p_input, "frame-next" );
}
-
-void ControlsWidget::enableVideo( bool enable )
+#include <QHBoxLayout>
+/*****************************
+ * DA Control Widget !
+ *****************************/
+ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
+ bool b_advControls,
+ QWidget *_parent ) :
+ AbstractController( _p_i, _parent )
{
- // TODO Later make the fullscreenButton toggle Visualisation and so on.
- fullscreenButton->setEnabled( enable );
+ setSizePolicy( QSizePolicy::Preferred , QSizePolicy::Maximum );
- /* Advanced Buttons too */
- advControls->enableVideo( enable );
+ /* advanced Controls handling */
+ b_advancedVisible = b_advControls;
+
+ QVBoxLayout *controlLayout = new QVBoxLayout( this );
+ controlLayout->setLayoutMargins( 6, 4, 6, 2, 5 );
+ controlLayout->setSpacing( 0 );
+ QHBoxLayout *controlLayout1 = new QHBoxLayout;
+ controlLayout1->setSpacing( 0 );
+
+ QString line1 = getSettings()->value( "MainWindow/MainToolbar1",
+ "64;36;37;38;65").toString();
+ parseAndCreate( line1, controlLayout1 );
+
+ /* QString line2 = QString( "%1-2;%2;%3;%4;%5;%6;%6;%7;%8;%9;%6;%10;%11-4")
+ .arg( PLAY_BUTTON ) .arg( WIDGET_SPACER )
+ .arg( PREVIOUS_BUTTON ) .arg( STOP_BUTTON )
+ .arg( NEXT_BUTTON ) .arg( WIDGET_SPACER )
+ .arg( FULLSCREEN_BUTTON ) .arg( PLAYLIST_BUTTON )
+ .arg( EXTENDED_BUTTON ) .arg( WIDGET_SPACER_EXTEND )
+ .arg( VOLUME );
+ msg_Dbg( p_intf, "%s", qtu( line2 )); */
+
+ QHBoxLayout *controlLayout2 = new QHBoxLayout;
+ controlLayout2->setSpacing( 0 );
+ QString line2 = getSettings()->value( "MainWindow/MainToolbar2",
+ "0-2;64;3;1;4;64;7;10;9;65;34-4" ).toString();
+ parseAndCreate( line2, controlLayout2 );
+
+ if( !b_advancedVisible && advControls ) advControls->hide();
+
+ controlLayout->addLayout( controlLayout1 );
+ controlLayout->addLayout( controlLayout2 );
}
+ControlsWidget::~ControlsWidget()
+{}
+
void ControlsWidget::toggleAdvanced()
{
- if( advControls && !b_advancedVisible )
+ if( !advControls ) return;
+
+ if( !b_advancedVisible )
{
advControls->show();
b_advancedVisible = true;
emit advancedControlsToggled( b_advancedVisible );
}
+AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i, QWidget *_parent ) :
+ AbstractController( _p_i, _parent )
+{
+ controlLayout = new QHBoxLayout( this );
+ controlLayout->setMargin( 0 );
+ controlLayout->setSpacing( 0 );
+
+ /* QString line = QString( "%1;%2;%3").arg( RECORD_BUTTON )
+ .arg( SNAPSHOT_BUTTON )
+ .arg( ATOB_BUTTON )
+ .arg( FRAME_BUTTON ); */
+
+ QString line = getSettings()->value( "MainWindow/AdvToolbar",
+ "12;11;13;14" ).toString();
+ parseAndCreate( line, controlLayout );
+}
+
+InputControlsWidget::InputControlsWidget( intf_thread_t *_p_i, QWidget *_parent ) :
+ AbstractController( _p_i, _parent )
+{
+ controlLayout = new QHBoxLayout( this );
+ controlLayout->setMargin( 0 );
+ controlLayout->setSpacing( 0 );
+
+ /* QString line = QString( "%1-%2;%3;%4-%2")
+ .arg( SLOWER_BUTTON ).arg( WIDGET_FLAT )
+ .arg( INPUT_SLIDER )
+ .arg( FASTER_BUTTON ); */
+ QString line = getSettings()->value( "MainWindow/InputToolbar",
+ "5-1;33;6-1" ).toString();
+ parseAndCreate( line, controlLayout );
+}
/**********************************************************************
* Fullscrenn control widget
**********************************************************************/
-FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
- MainInterface *_p_mi, bool b_advControls, bool b_shiny )
- : ControlsWidget( _p_i, _p_mi, b_advControls, b_shiny, true ),
- i_mouse_last_x( -1 ), i_mouse_last_y( -1 ), b_mouse_over(false),
- b_slow_hide_begin(false), i_slow_hide_timeout(1),
- b_fullscreen( false ), i_hide_timeout( 1 ), p_vout(NULL)
+FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i )
+ : AbstractController( _p_i )
{
+ i_mouse_last_x = -1;
+ i_mouse_last_y = -1;
+ b_mouse_over = false;
i_mouse_last_move_x = -1;
i_mouse_last_move_y = -1;
+#if HAVE_TRANSPARENCY
+ b_slow_hide_begin = false;
+ i_slow_hide_timeout = 1;
+#endif
+ b_fullscreen = false;
+ i_hide_timeout = 1;
+ p_vout = NULL;
+ i_screennumber = -1;
setWindowFlags( Qt::ToolTip );
setMinimumWidth( 600 );
setFrameStyle( QFrame::Sunken );
setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
- QGridLayout *fsLayout = new QGridLayout( this );
- fsLayout->setLayoutMargins( 5, 2, 5, 2, 5 );
+ controlLayout = new QHBoxLayout( this );
+ controlLayout->setLayoutMargins( 5, 2, 5, 2, 5 );
/* First line */
- slider->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum);
- fsLayout->addWidget( slowerButton, 0, 0 );
- fsLayout->addWidget( slider, 0, 1, 1, 11 );
- fsLayout->addWidget( fasterButton, 0, 12 );
+ InputControlsWidget *inputC = new InputControlsWidget( p_intf, this );
+ controlLayout->addWidget( inputC );
/* Second line */
- fsLayout->addWidget( playButton, 1, 0, 1, 2 );
- fsLayout->addLayout( controlButLayout, 1, 2 );
-
- fsLayout->addWidget( discFrame, 1, 3 );
- fsLayout->addWidget( telexFrame, 1, 4 );
- fsLayout->addWidget( fullscreenButton, 1, 5 );
- fsLayout->addWidget( advControls, 1, 6, Qt::AlignVCenter );
-
- fsLayout->setColumnStretch( 7, 10 );
-
- TimeLabel *timeLabel = new TimeLabel( p_intf );
-
- fsLayout->addWidget( timeLabel, 1, 8 );
- fsLayout->addWidget( volMuteLabel, 1, 9 );
- fsLayout->addWidget( volumeSlider, 1, 10, 1, 2 );
+/* QString line = QString( "%1-2;%2;%3;%4;%5;%2;%6;%2;%7;%2;%8;%9;%10-4")
+ .arg( PLAY_BUTTON )
+ .arg( WIDGET_SPACER )
+ .arg( PREVIOUS_BUTTON )
+ .arg( STOP_BUTTON )
+ .arg( NEXT_BUTTON )
+ .arg( MENU_BUTTONS )
+ .arg( TELETEXT_BUTTONS )
+ .arg( DEFULLSCREEN_BUTTON )
+ .arg( WIDGET_SPACER_EXTEND )
+ .arg( TIME_LABEL )
+ .arg( VOLUME ); */
+
+ QString line = getSettings()->value( "MainWindow/FSCtoolbar",
+ "0-2;64;3;1;4;64;36;64;37;64;8;65;35-4;34" ).toString();
+ parseAndCreate( line, controlLayout );
/* hiding timer */
p_hideTimer = new QTimer( this );
adjustSize (); /* need to get real width and height for moving */
- /* center down */
- QWidget * p_desktop = QApplication::desktop()->screen(
- QApplication::desktop()->screenNumber( _p_mi ) );
-
- QPoint pos = QPoint( p_desktop->width() / 2 - width() / 2,
- p_desktop->height() - height() );
-
- getSettings()->beginGroup( "FullScreen" );
- move( getSettings()->value( "pos", pos ).toPoint() );
- getSettings()->endGroup();
-
#ifdef WIN32TRICK
setWindowOpacity( 0.0 );
b_fscHidden = true;
show();
#endif
- fullscreenButton->setIcon( QIcon( ":/defullscreen" ) );
-
vlc_mutex_init_recursive( &lock );
}
FullscreenControllerWidget::~FullscreenControllerWidget()
{
- getSettings()->beginGroup( "FullScreen" );
- getSettings()->setValue( "pos", pos() );
- getSettings()->endGroup();
+ getSettings()->setValue( "FullScreen/pos", pos() );
detachVout();
vlc_mutex_destroy( &lock );
}
void FullscreenControllerWidget::showFSC()
{
adjustSize();
+ /* center down */
+ int number = QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi );
+ if( number != i_screennumber )
+ {
+ msg_Dbg( p_intf, "Calculation fullscreen controllers center");
+ /* screen has changed, calculate new position */
+ QRect screenRes = QApplication::desktop()->screenGeometry(number);
+ QPoint pos = QPoint( screenRes.x() + (screenRes.width() / 2) - (width() / 2),
+ screenRes.y() + screenRes.height() - height());
+ move( pos );
+ i_screennumber = number;
+ }
#ifdef WIN32TRICK
// after quiting and going to fs, we need to call show()
if( isHidden() )
show();
-
if( b_fscHidden )
{
b_fscHidden = false;
vlc_mutex_unlock( &lock );
#ifdef WIN32TRICK
- if( b_fs && b_fscHidden ) // FIXME I am not sure about that one
+ if( b_fs && b_fscHidden )
#else
- if( b_fs && !isVisible() ) // FIXME I am not sure about that one
+ if( b_fs && !isVisible() )
#endif
showFSC();
break;
return VLC_SUCCESS;
}
-
/**
* It is called when video start
*/
var_GetInteger( p_vout, "mouse-hide-timeout" ) );
vlc_mutex_unlock( &lock );
}
+
/**
* It is called after turn off video.
*/