Commit 4396baf0 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4: Controller Rework.

Introduction of an abstractController, that can:
- create most of the interface controller widgets
- execute their actions

All buttons connect themselve to a mapper and a doAction( id_action )
that centralize everything. The Action could go into a mainActionner, I guess. Opinions?

This cleans a lot the signal and exchanges between MI and Controller,
between Controller and FSC. The buttons do their own cooking and connect
directly to THEMIM or to some of the few signals of the Controller
(inputExist, inputHasVideo, inputCanRecord)

This reworks most of the HACKS of Teletext Buttons and AtoB Buttons

The FSC inherit from AbstractController and not Controller, which remove the b_fscreation HACK.

There will be some regressions, I tried my best to minimize them.

The code is generic enough to be able to customize the toolbars now. HAVE FUN!
parent 08cbd4da
/***************************************************************************** /*****************************************************************************
* 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$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
...@@ -41,13 +41,14 @@ ...@@ -41,13 +41,14 @@
#include <QLabel> #include <QLabel>
#include <QSpacerItem> #include <QSpacerItem>
#include <QCursor> #include <QCursor>
#include <QPushButton> #include <QToolButton>
#include <QToolButton> #include <QToolButton>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QMenu> #include <QMenu>
#include <QPalette> #include <QPalette>
#include <QResizeEvent> #include <QResizeEvent>
#include <QDate> #include <QDate>
#include <QSignalMapper>
#define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a media") #define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a media")
...@@ -55,266 +56,276 @@ ...@@ -55,266 +56,276 @@
* TEH controls * 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 ) : QFrame( NULL )
{ {
aButton->setMaximumSize( QSize( 26, 26 ) ); p_intf = _p_i;
aButton->setMinimumSize( QSize( 26, 26 ) );
aButton->setIconSize( QSize( 20, 20 ) );
aButton->setFocusPolicy( Qt::NoFocus );
}
/* 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 ) : /* We need one layout. An controller without layout is stupid with
QFrame( NULL ), p_intf( _p_i ) current architecture */
{ controlLayout = new QGridLayout( this );
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 */ /* Main action provider */
recordButton = new QPushButton; toolbarActionsMapper = new QSignalMapper();
setupSmallButton( recordButton ); CONNECT( toolbarActionsMapper, mapped( int ),
advLayout->addWidget( recordButton ); this, doAction( int ) );
BUTTON_SET_ACT_I( recordButton, "", record, CONNECT( THEMIM->getIM(), statusChanged( int ), this, setStatus( int ) );
qtr( "Record" ), record() );
/* Snapshot Button */
snapshotButton = new QPushButton;
setupSmallButton( snapshotButton );
advLayout->addWidget( snapshotButton );
BUTTON_SET_ACT_I( snapshotButton, "", snapshot,
qtr( "Take a snapshot" ), snapshot() );
} }
AdvControlsWidget::~AdvControlsWidget() void AbstractController::setStatus( int status )
{}
void AdvControlsWidget::enableInput( bool enable )
{ {
int i_input_id = 0; bool b_hasInput = THEMIM->getIM()->hasInput();
if( THEMIM->getInput() != NULL ) /* Activate the interface buttons according to the presence of the input */
{ emit inputExists( b_hasInput );
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 );
}
ABButton->setEnabled( enable ); emit inputPlaying( status == PLAYING_S );
recordButton->setEnabled( enable );
if( enable && ( i_last_input_id != i_input_id ) ) emit inputIsRecordable( b_hasInput &&
{ var_GetBool( THEMIM->getInput(), "can-record" ) );
timeA = timeB = 0;
i_last_input_id = i_input_id;
emit timeChanged();
}
} }
void AdvControlsWidget::enableVideo( bool enable ) void AbstractController::setupButton( QAbstractButton *aButton )
{ {
snapshotButton->setEnabled( enable ); static QSizePolicy sizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
#if 0 sizePolicy.setHorizontalStretch( 0 );
frameButton->setEnabled( enable ); sizePolicy.setVerticalStretch( 0 );
#endif
}
void AdvControlsWidget::snapshot() aButton->setSizePolicy( sizePolicy );
{ aButton->setFixedSize( QSize( 26, 26 ) );
vout_thread_t *p_vout = aButton->setIconSize( QSize( 20, 20 ) );
(vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE ); aButton->setFocusPolicy( Qt::NoFocus );
if( p_vout )
{
vout_Control( p_vout, VOUT_SNAPSHOT );
vlc_object_release( p_vout );
}
} }
/* Function called when the button is clicked() */ #define CONNECT_MAP( a ) CONNECT( a, clicked(), toolbarActionsMapper, map() )
void AdvControlsWidget::fromAtoB() #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( button, image, tooltip ) \
button->setToolTip( tooltip ); \
button->setIcon( QIcon( ":/"#image ) );
#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? */
#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? */
QWidget *AbstractController::createWidget( buttonType_e button, bool b_flat,
bool b_big, bool b_shiny )
{ {
if( !timeA ) QWidget *widget = NULL;
switch( button )
{ {
timeA = var_GetTime( THEMIM->getInput(), "time" ); case PLAY_BUTTON: {
emit timeChanged(); PlayButton *playButton = new PlayButton;
return; setupButton( playButton );
BUTTON_SET_BAR( playButton, play_b, qtr( I_PLAY_TOOLTIP ) );
CONNECT_MAP_SET( playButton, PLAY_ACTION );
CONNECT( this, inputPlaying( bool ),
playButton, updateButton( bool ));
widget = playButton;
} }
if( !timeB ) break;
{ case STOP_BUTTON:{
timeB = var_GetTime( THEMIM->getInput(), "time" ); QToolButton *stopButton = new QToolButton;
var_SetTime( THEMIM->getInput(), "time" , timeA ); setupButton( stopButton );
emit timeChanged(); CONNECT_MAP_SET( stopButton, STOP_ACTION );
return; BUTTON_SET_BAR( stopButton, stop_b, qtr( "Stop playback" ) );
widget = stopButton;
} }
timeA = 0; break;
timeB = 0; case PREVIOUS_BUTTON:{
emit timeChanged(); QToolButton *prevButton = new QToolButton;
} setupButton( prevButton );
CONNECT_MAP_SET( prevButton, PREVIOUS_ACTION );
/* setting/synchro icons after click on main or fs controller */ BUTTON_SET_BAR( prevButton, previous_b,
void AdvControlsWidget::setIcon() qtr( "Previous media in the playlist" ) );
{ widget = prevButton;
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 ) break;
case NEXT_BUTTON:
{ {
ABButton->setIcon( QIcon( ":/atob_noa" ) ); QToolButton *nextButton = new QToolButton;
ABButton->setToolTip( qtr( "Click to set point B" ) ); setupButton( nextButton );
CONNECT_MAP_SET( nextButton, NEXT_ACTION );
BUTTON_SET_BAR( nextButton, next_b,
qtr( "Next media in the playlist" ) );
widget = nextButton;
} }
else if( timeA && timeB ) break;
{ case SLOWER_BUTTON:{
ABButton->setIcon( QIcon( ":/atob" ) ); QToolButton *slowerButton = new QToolButton;
ABButton->setToolTip( qtr( "Stop the A to B loop" ) ); setupButton( slowerButton );
CONNECT_MAP_SET( slowerButton, SLOWER_ACTION );
BUTTON_SET_BAR( slowerButton, slower, qtr( "Slower" ) );
ENABLE_ON_INPUT( slowerButton );
widget = slowerButton;
} }
} break;
case FASTER_BUTTON:{
/* Function called regularly when in an AtoB loop */ QToolButton *fasterButton = new QToolButton;
void AdvControlsWidget::AtoBLoop( float f_pos, int i_time, int i_length ) setupButton( fasterButton );
{ CONNECT_MAP_SET( fasterButton, SLOWER_ACTION );
if( timeB ) BUTTON_SET_BAR( fasterButton, faster, qtr( "Faster" ) );
{ ENABLE_ON_INPUT( fasterButton );
if( ( i_time >= (int)( timeB/1000000 ) ) widget = fasterButton;
|| ( i_time < (int)( timeA/1000000 ) ) )
var_SetTime( THEMIM->getInput(), "time" , timeA );
} }
} break;
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 #if 0
else case FRAME_BUTTON: {
{ QToolButton *frameButton = new QToolButton( "Fr" );
/* 'record' access-filter is not loaded, we open Save dialog */ setupButton( frameButton );
input_item_t *p_item = input_GetItem( p_input ); BUTTON_SET_BAR( frameButton, "", qtr( "Frame by frame" ) );
if( !p_item ) ENABLE_ON_INPUT( frameButton );
return; widget = frameButton;
char *psz = input_item_GetURI( p_item );
if( psz )
THEDP->streamingDialog( NULL, psz, true );
} }
break;
#endif #endif
case FULLSCREEN_BUTTON:{
QToolButton *fullscreenButton = new QToolButton;
setupButton( fullscreenButton );
CONNECT_MAP_SET( fullscreenButton, FULLSCREEN_ACTION );
BUTTON_SET_BAR( fullscreenButton, fullscreen,
qtr( "Toggle the video in fullscreen" ) );
ENABLE_ON_VIDEO( fullscreenButton );
widget = fullscreenButton;
} }
} break;
case EXTENDED_BUTTON:{
#if 0 QToolButton *extSettingsButton = new QToolButton;
//FIXME Frame by frame function setupButton( extSettingsButton );
void AdvControlsWidget::frame(){} CONNECT_MAP_SET( extSettingsButton, EXTENDED_ACTION );
#endif BUTTON_SET_BAR( extSettingsButton, extended,
qtr( "Show extended settings" ) );
/***************************** widget = extSettingsButton;
* DA Control Widget ! }
*****************************/ break;
ControlsWidget::ControlsWidget( intf_thread_t *_p_i, case PLAYLIST_BUTTON:{
MainInterface *_p_mi, QToolButton *playlistButton = new QToolButton;
bool b_advControls, setupButton( playlistButton );
bool b_shiny, CONNECT_MAP_SET( playlistButton, PLAYLIST_ACTION );
bool b_fsCreation) : BUTTON_SET_BAR( playlistButton, playlist,
QFrame( _p_mi ), p_intf( _p_i ) qtr( "Show playlist" ) );
{ widget = playlistButton;
setSizePolicy( QSizePolicy::Preferred , QSizePolicy::Maximum ); }
break;
/** The main Slider **/ case SNAPSHOT_BUTTON:{
slider = new InputSlider( Qt::Horizontal, NULL ); QToolButton *snapshotButton = new QToolButton;
setupButton( snapshotButton );
CONNECT_MAP_SET( snapshotButton, SNAPSHOT_ACTION );
BUTTON_SET_BAR( snapshotButton, snapshot, qtr( "Take a snapshot" ) );
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, record, qtr( "Record" ) );
ENABLE_ON_INPUT( recordButton );
widget = recordButton;
}
break;
case ATOB_BUTTON: {
AtoB_Button *ABButton = new AtoB_Button;
setupButton( ABButton );
BUTTON_SET_BAR( ABButton, atob_nob, qtr( "Loop from point A to point "
"B continuously.\nClick to set point A" ) );
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 );
/* Update the position when the IM has changed */ /* Update the position when the IM has changed */
CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ), CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
slider, setPosition( float, int, int ) ); slider, setPosition( float, int, int ) );
/* And update the IM, when the position has changed */ /* And update the IM, when the position has changed */
CONNECT( slider, sliderDragged( float ), CONNECT( slider, sliderDragged( float ),
THEMIM->getIM(), sliderUpdate( 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( p_intf, b_shiny );
widget = snd;
}
break;
default:
msg_Warn( p_intf, "This should not happen" );
break;
}
/** Slower and faster Buttons **/ /* Customize Buttons */
slowerButton = new QToolButton; if( b_flat || b_big )
slowerButton->setAutoRaise( true ); {
slowerButton->setMaximumSize( QSize( 26, 20 ) ); QToolButton *tmpButton = qobject_cast<QToolButton *>(widget);
slowerButton->setFocusPolicy( Qt::NoFocus ); if( tmpButton )
{
BUTTON_SET_ACT_I( slowerButton, "", slower, qtr( "Slower" ), slower() ); if( b_flat )
tmpButton->setAutoRaise( b_flat );
fasterButton = new QToolButton; if( b_big )
fasterButton->setAutoRaise( true ); {
fasterButton->setMaximumSize( QSize( 26, 20 ) ); tmpButton->setFixedSize( QSize( 32, 32 ) );
fasterButton->setFocusPolicy( Qt::NoFocus ); tmpButton->setIconSize( QSize( 26, 26 ) );
}
BUTTON_SET_ACT_I( fasterButton, "", faster, qtr( "Faster" ), faster() ); }
}
/* advanced Controls handling */ return widget;
b_advancedVisible = b_advControls; }
advControls = new AdvControlsWidget( p_intf, b_fsCreation );
if( !b_advancedVisible ) advControls->hide();
QWidget *AbstractController::discFrame()
{
/** Disc and Menus handling */ /** Disc and Menus handling */
discFrame = new QWidget( this ); QWidget *discFrame = new QWidget( this );
QHBoxLayout *discLayout = new QHBoxLayout( discFrame ); QHBoxLayout *discLayout = new QHBoxLayout( discFrame );
discLayout->setSpacing( 0 ); discLayout->setSpacing( 0 ); discLayout->setMargin( 0 );
discLayout->setMargin( 0 );
prevSectionButton = new QPushButton( discFrame ); QToolButton *prevSectionButton = new QToolButton( discFrame );
setupSmallButton( prevSectionButton ); setupButton( prevSectionButton );
BUTTON_SET_BAR( prevSectionButton, dvd_prev,
qtr("Previous Chapter/Title" ) );
discLayout->addWidget( prevSectionButton ); discLayout->addWidget( prevSectionButton );
menuButton = new QPushButton( discFrame ); QToolButton *menuButton = new QToolButton( discFrame );
setupSmallButton( menuButton ); setupButton( menuButton );
discLayout->addWidget( menuButton ); discLayout->addWidget( menuButton );
BUTTON_SET_BAR( menuButton, dvd_menu, qtr( "Menu" ) );
nextSectionButton = new QPushButton( discFrame ); QToolButton *nextSectionButton = new QToolButton( discFrame );
setupSmallButton( nextSectionButton ); setupButton( nextSectionButton );
discLayout->addWidget( nextSectionButton ); discLayout->addWidget( nextSectionButton );
BUTTON_SET_BAR( nextSectionButton, dvd_next,
qtr("Next Chapter/Title" ) );
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 */ /* Change the navigation button display when the IM
CONNECT( THEMIM->getIM(), navigationChanged( int ), navigation changes */
this, setNavigation( int ) ); 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 */ /* Changes the IM navigation when triggered on the nav buttons */
CONNECT( prevSectionButton, clicked(), THEMIM->getIM(), CONNECT( prevSectionButton, clicked(), THEMIM->getIM(),
sectionPrev() ); sectionPrev() );
...@@ -323,140 +334,86 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -323,140 +334,86 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
CONNECT( menuButton, clicked(), THEMIM->getIM(), CONNECT( menuButton, clicked(), THEMIM->getIM(),
sectionMenu() ); sectionMenu() );
return discFrame;
}
QWidget *AbstractController::telexFrame()
{
/** /**
* Telextext QFrame * Telextext QFrame
* TODO: Merge with upper menu in a StackLayout
**/ **/
telexFrame = new QWidget( this ); TeletextController *telexFrame = new TeletextController;
QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame ); QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
telexLayout->setSpacing( 0 ); telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 );
telexLayout->setMargin( 0 ); CONNECT( THEMIM->getIM(), teletextPossible( bool ),
telexFrame, setVisible( bool ) );
telexOn = new QPushButton;
setupSmallButton( telexOn ); /* On/Off button */
QToolButton *telexOn = new QToolButton;
telexFrame->telexOn = telexOn;
setupButton( telexOn );
BUTTON_SET_BAR( telexOn, tv, qtr( "Teletext Activation" ) );
telexLayout->addWidget( telexOn ); telexLayout->addWidget( telexOn );
telexTransparent = new QPushButton; /* Teletext Activation and set */
setupSmallButton( telexTransparent ); 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_BAR( telexTransparent, tvtelx,
qtr( "Toggle Transparency " ) );
telexTransparent->setEnabled( false );
telexLayout->addWidget( telexTransparent ); 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->setRange( 0, 999 );
telexPage->setValue( 100 ); telexPage->setValue( 100 );
telexPage->setAccelerated( true ); telexPage->setAccelerated( true );
telexPage->setWrapping( true ); telexPage->setWrapping( true );
telexPage->setAlignment( Qt::AlignRight ); telexPage->setAlignment( Qt::AlignRight );
telexPage->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum ); telexPage->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
telexPage->setEnabled( false );
telexLayout->addWidget( telexPage ); telexLayout->addWidget( telexPage );
telexFrame->hide(); /* default hidden */ /* Page change and set */
CONNECT( telexPage, valueChanged( int ),
CONNECT( telexPage, valueChanged( int ), THEMIM->getIM(), THEMIM->getIM(), telexSetPage( int ) );
telexGotoPage( int ) ); CONNECT( THEMIM->getIM(), newTelexPageSet( int ),
CONNECT( THEMIM->getIM(), setNewTelexPage( int ),
telexPage, setValue( int ) ); telexPage, setValue( int ) );
BUTTON_SET_IMG( telexOn, "", tv, qtr( "Teletext on" ) ); return telexFrame;
}
CONNECT( telexOn, clicked(), THEMIM->getIM(), #undef CONNECT_MAP
telexToggleButtons() ); #undef SET_MAPPING
CONNECT( telexOn, clicked( bool ), THEMIM->getIM(), #undef BUTTON_SET_BAR
telexToggle( bool ) );
CONNECT( THEMIM->getIM(), toggleTelexButtons(),
this, toggleTeletext() );
b_telexEnabled = false;
telexTransparent->setEnabled( false );
telexPage->setEnabled( false );
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 */ SoundWidget::SoundWidget( intf_thread_t * _p_intf, bool b_shiny )
: b_my_volume( false )
{
p_intf = _p_intf;
QHBoxLayout *layout = new QHBoxLayout( this );
layout->setSpacing( 0 ); layout->setMargin( 0 );
hVolLabel = new VolumeClickHandler( p_intf, this ); hVolLabel = new VolumeClickHandler( p_intf, this );
volMuteLabel = new QLabel; volMuteLabel = new QLabel;
volMuteLabel->setPixmap( QPixmap( ":/volume-medium" ) ); volMuteLabel->setPixmap( QPixmap( ":/volume-medium" ) );
volMuteLabel->installEventFilter( hVolLabel ); volMuteLabel->installEventFilter( hVolLabel );
layout->addWidget( volMuteLabel );
if( b_shiny ) if( b_shiny )
{ {
...@@ -473,6 +430,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -473,6 +430,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
volumeSlider->setMaximumSize( QSize( 200, 40 ) ); volumeSlider->setMaximumSize( QSize( 200, 40 ) );
volumeSlider->setMinimumSize( QSize( 85, 30 ) ); volumeSlider->setMinimumSize( QSize( 85, 30 ) );
volumeSlider->setFocusPolicy( Qt::NoFocus ); volumeSlider->setFocusPolicy( Qt::NoFocus );
layout->addWidget( volumeSlider );
/* Set the volume from the config */ /* Set the volume from the config */
volumeSlider->setValue( ( config_GetInt( p_intf, "volume" ) ) * volumeSlider->setValue( ( config_GetInt( p_intf, "volume" ) ) *
...@@ -484,149 +442,9 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -484,149 +442,9 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
/* Volume control connection */ /* Volume control connection */
CONNECT( volumeSlider, valueChanged( int ), this, updateVolume( int ) ); CONNECT( volumeSlider, valueChanged( int ), this, updateVolume( int ) );
CONNECT( THEMIM, volumeChanged( void ), this, updateVolume( void ) ); 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 );
}
updateInput();
}
ControlsWidget::~ControlsWidget()
{}
void ControlsWidget::toggleTeletext()
{
bool b_enabled = THEMIM->teletextState();
if( b_telexEnabled )
{
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;
}
}
void ControlsWidget::stop()
{
THEMIM->stop();
}
void ControlsWidget::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()
{
THEMIM->prev();
} }
void ControlsWidget::next() void SoundWidget::updateVolume( int i_sliderVolume )
{
THEMIM->next();
}
void ControlsWidget::setNavigation( int navigation )
{
#define HELP_PCH N_( "Previous chapter" )
#define HELP_NCH N_( "Next chapter" )
// 1 = chapter, 2 = title, 0 = no
if( navigation == 0 )
{
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();
}
}
static bool b_my_volume;
void ControlsWidget::updateVolume( int i_sliderVolume )
{ {
if( !b_my_volume ) if( !b_my_volume )
{ {
...@@ -648,7 +466,7 @@ void ControlsWidget::updateVolume( int i_sliderVolume ) ...@@ -648,7 +466,7 @@ void ControlsWidget::updateVolume( int i_sliderVolume )
volMuteLabel->setToolTip( qtr( "Mute" ) ); volMuteLabel->setToolTip( qtr( "Mute" ) );
} }
void ControlsWidget::updateVolume() void SoundWidget::updateVolume()
{ {
/* Audio part */ /* Audio part */
audio_volume_t i_volume; audio_volume_t i_volume;
...@@ -664,34 +482,115 @@ void ControlsWidget::updateVolume() ...@@ -664,34 +482,115 @@ void ControlsWidget::updateVolume()
} }
} }
void ControlsWidget::updateInput() void TeletextController::toggleTeletextTransparency( bool b_transparent )
{ {
/* Activate the interface buttons according to the presence of the input */ telexTransparent->setIcon( b_transparent ? QIcon( ":/tvtelx" )
enableInput( THEMIM->getIM()->hasInput() ); : QIcon( ":/tvtelx-trans" ) );
enableVideo( THEMIM->getIM()->hasVideo() ); }
void TeletextController::enableTeletextButtons( bool b_enabled )
{
telexOn->setChecked( b_enabled );
telexTransparent->setEnabled( b_enabled );
telexPage->setEnabled( b_enabled );
}
void PlayButton::updateButton( bool b_playing )
{
setIcon( b_playing ? QIcon( ":/pause_b" ) : QIcon( ":/play_b" ) );
setToolTip( b_playing ? qtr( "Pause the playback" )
: qtr( I_PLAY_TOOLTIP ) );
} }
void ControlsWidget::setStatus( int status ) void AtoB_Button::setIcons( bool timeA, bool timeB )
{ {
if( status == PLAYING_S ) /* Playing */ if( !timeA && !timeB)
{ {
playButton->setIcon( QIcon( ":/pause_b" ) ); setIcon( QIcon( ":/atob_nob" ) );
playButton->setToolTip( qtr( "Pause the playback" ) ); setToolTip( qtr( "Loop from point A to point B continuously\n"
"Click to set point A" ) );
} }
else else if( timeA && !timeB )
{
setIcon( QIcon( ":/atob_noa" ) );
setToolTip( qtr( "Click to set point B" ) );
}
else if( timeA && timeB )
{ {
playButton->setIcon( QIcon( ":/play_b" ) ); setIcon( QIcon( ":/atob" ) );
playButton->setToolTip( qtr( I_PLAY_TOOLTIP ) ); setToolTip( qtr( "Stop the A to B loop" ) );
} }
} }
//* Actions */
void AbstractController::doAction( int id_action )
{
switch( id_action )
{
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;
default:
msg_Dbg( p_intf, "Action: %i", id_action );
break;
}
}
void AbstractController::stop()
{
THEMIM->stop();
}
void AbstractController::play()
{
if( THEPL->current.i_size == 0 )
{
/* The playlist is empty, open a file requester */
THEDP->openFileDialog();
return;
}
THEMIM->togglePlayPause();
}
void AbstractController::prev()
{
THEMIM->prev();
}
void AbstractController::next()
{
THEMIM->next();
}
/** /**
* TODO * TODO
* This functions toggle the fullscreen mode * This functions toggle the fullscreen mode
* If there is no video, it should first activate Visualisations... * If there is no video, it should first activate Visualisations...
* This has also to be fixed in enableVideo() * This has also to be fixed in enableVideo()
*/ */
void ControlsWidget::fullscreen() void AbstractController::fullscreen()
{ {
vout_thread_t *p_vout = vout_thread_t *p_vout =
(vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE ); (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
...@@ -702,41 +601,126 @@ void ControlsWidget::fullscreen() ...@@ -702,41 +601,126 @@ void ControlsWidget::fullscreen()
} }
} }
void ControlsWidget::extSettings() void AbstractController::snapshot()
{
vout_thread_t *p_vout =
(vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
if( p_vout )
{
vout_Control( p_vout, VOUT_SNAPSHOT );
vlc_object_release( p_vout );
}
}
void AbstractController::extSettings()
{ {
THEDP->extendedDialog(); THEDP->extendedDialog();
} }
void ControlsWidget::slower() void AbstractController::slower()
{ {
THEMIM->getIM()->slower(); THEMIM->getIM()->slower();
} }
void ControlsWidget::faster() void AbstractController::faster()
{ {
THEMIM->getIM()->faster(); THEMIM->getIM()->faster();
} }
void ControlsWidget::enableInput( bool enable ) void AbstractController::playlist()
{
if( p_intf->p_sys->p_mi ) p_intf->p_sys->p_mi->togglePlaylist();
}
void AbstractController::record()
{ {
slowerButton->setEnabled( enable ); input_thread_t *p_input = THEMIM->getInput();
slider->setEnabled( enable ); if( p_input )
slider->setSliderPosition ( 0 ); {
fasterButton->setEnabled( enable ); /* 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;
/* Advanced Buttons too */ char *psz = input_item_GetURI( p_item );
advControls->enableInput( enable ); if( psz )
THEDP->streamingDialog( NULL, psz, true );
}
#endif
}
} }
void ControlsWidget::enableVideo( bool enable ) #if 0
//TODO Frame by frame function
void AbstractController::frame(){}
#endif
/*****************************
* DA Control Widget !
*****************************/
ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
bool b_advControls ) :
AbstractController( _p_i )
{ {
// TODO Later make the fullscreenButton toggle Visualisation and so on. setSizePolicy( QSizePolicy::Preferred , QSizePolicy::Maximum );
fullscreenButton->setEnabled( enable );
/* advanced Controls handling */
b_advancedVisible = b_advControls;
/* Advanced Buttons too */ advControls = new AdvControlsWidget( p_intf );
advControls->enableVideo( enable ); if( !b_advancedVisible ) advControls->hide();
controlLayout->setSpacing( 0 );
controlLayout->setLayoutMargins( 7, 5, 7, 3, 6 );
controlLayout->addWidget( createWidget( INPUT_SLIDER ), 0, 1, 1, 18 );
controlLayout->addWidget( createWidget( SLOWER_BUTTON, true ), 0, 0 );
controlLayout->addWidget( createWidget( FASTER_BUTTON, true ), 0, 19 );
controlLayout->addWidget( createWidget( MENU_BUTTONS ), 1, 8, 2, 3 );
controlLayout->addWidget( createWidget( TELETEXT_BUTTONS ), 1, 8, 2, 5, Qt::AlignBottom );
controlLayout->addWidget( createWidget( PLAY_BUTTON, false, true ), 2, 0, 2, 2, Qt::AlignBottom );
controlLayout->setColumnMinimumWidth( 2, 10 );
controlLayout->setColumnStretch( 2, 0 );
controlLayout->addWidget( createWidget( PREVIOUS_BUTTON ), 3, 3, Qt::AlignBottom );
controlLayout->addWidget( createWidget( STOP_BUTTON ), 3, 4, Qt::AlignBottom );
controlLayout->addWidget( createWidget( NEXT_BUTTON ), 3, 5, Qt::AlignBottom );
/* Column 6 is unused */
controlLayout->setColumnStretch( 6, 0 );
controlLayout->setColumnStretch( 7, 0 );
controlLayout->setColumnMinimumWidth( 7, 10 );
controlLayout->addWidget( createWidget( FULLSCREEN_BUTTON ), 3, 8, Qt::AlignBottom );
controlLayout->addWidget( createWidget( PLAYLIST_BUTTON ), 3, 9, Qt::AlignBottom );
controlLayout->addWidget( createWidget( EXTENDED_BUTTON ), 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( createWidget( VOLUME, false, false, true ),
3, 17, 1, 3, Qt::AlignBottom );
} }
ControlsWidget::~ControlsWidget()
{}
void ControlsWidget::toggleAdvanced() void ControlsWidget::toggleAdvanced()
{ {
if( advControls && !b_advancedVisible ) if( advControls && !b_advancedVisible )
...@@ -752,18 +736,39 @@ void ControlsWidget::toggleAdvanced() ...@@ -752,18 +736,39 @@ void ControlsWidget::toggleAdvanced()
emit advancedControlsToggled( b_advancedVisible ); emit advancedControlsToggled( b_advancedVisible );
} }
AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) :
AbstractController( _p_i )
{
controlLayout->setMargin( 0 );
controlLayout->setSpacing( 0 );
controlLayout->addWidget( createWidget( RECORD_BUTTON ), 0, 0 );
controlLayout->addWidget( createWidget( SNAPSHOT_BUTTON ), 0, 1 );
controlLayout->addWidget( createWidget( ATOB_BUTTON ), 0, 2 );
}
AdvControlsWidget::~AdvControlsWidget()
{}
/********************************************************************** /**********************************************************************
* Fullscrenn control widget * Fullscrenn control widget
**********************************************************************/ **********************************************************************/
FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i )
MainInterface *_p_mi, bool b_advControls, bool b_shiny ) : AbstractController( _p_i )
: 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)
{ {
i_mouse_last_x = -1;
i_mouse_last_y = -1;
b_mouse_over = false;
i_mouse_last_move_x = -1; i_mouse_last_move_x = -1;
i_mouse_last_move_y = -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;
setWindowFlags( Qt::ToolTip ); setWindowFlags( Qt::ToolTip );
setMinimumWidth( 600 ); setMinimumWidth( 600 );
...@@ -772,31 +777,33 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, ...@@ -772,31 +777,33 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
setFrameStyle( QFrame::Sunken ); setFrameStyle( QFrame::Sunken );
setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
QGridLayout *fsLayout = new QGridLayout( this ); controlLayout->setLayoutMargins( 5, 2, 5, 2, 5 );
fsLayout->setLayoutMargins( 5, 2, 5, 2, 5 );
/* First line */ /* First line */
slider->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum); controlLayout->addWidget( createWidget( SLOWER_BUTTON ), 0, 0 );
fsLayout->addWidget( slowerButton, 0, 0 ); controlLayout->addWidget( createWidget( INPUT_SLIDER ), 0, 1, 1, 13 );
fsLayout->addWidget( slider, 0, 1, 1, 11 ); controlLayout->addWidget( createWidget( FASTER_BUTTON ), 0, 14 );
fsLayout->addWidget( fasterButton, 0, 12 );
/* Second line */ /* Second line */
fsLayout->addWidget( playButton, 1, 0, 1, 2 ); controlLayout->addWidget( createWidget( PLAY_BUTTON, false, true ), 1, 0, 1, 2 );
fsLayout->addLayout( controlButLayout, 1, 2 ); controlLayout->addWidget( createWidget( PREVIOUS_BUTTON ), 1, 2 );
controlLayout->addWidget( createWidget( STOP_BUTTON ), 1, 3 );
fsLayout->addWidget( discFrame, 1, 3 ); controlLayout->addWidget( createWidget( NEXT_BUTTON ), 1, 4 );
fsLayout->addWidget( telexFrame, 1, 4 );
fsLayout->addWidget( fullscreenButton, 1, 5 ); controlLayout->addWidget( createWidget( MENU_BUTTONS ), 1, 5 );
fsLayout->addWidget( advControls, 1, 6, Qt::AlignVCenter ); controlLayout->addWidget( createWidget( TELETEXT_BUTTONS ), 1, 6 );
QToolButton *fullscreenButton =
qobject_cast<QToolButton *>(createWidget( FULLSCREEN_BUTTON ) );
fullscreenButton->setIcon( QIcon( ":/defullscreen" ) );
controlLayout->addWidget( fullscreenButton, 1, 7 );
fsLayout->setColumnStretch( 7, 10 ); controlLayout->setColumnStretch( 9, 10 );
TimeLabel *timeLabel = new TimeLabel( p_intf ); TimeLabel *timeLabel = new TimeLabel( p_intf );
fsLayout->addWidget( timeLabel, 1, 8 ); controlLayout->addWidget( timeLabel, 1, 10 );
fsLayout->addWidget( volMuteLabel, 1, 9 ); controlLayout->addWidget( createWidget( VOLUME, false, false, true ),
fsLayout->addWidget( volumeSlider, 1, 10, 1, 2 ); 1, 11, 1, 3 );
/* hiding timer */ /* hiding timer */
p_hideTimer = new QTimer( this ); p_hideTimer = new QTimer( this );
...@@ -813,7 +820,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, ...@@ -813,7 +820,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
/* center down */ /* center down */
QWidget * p_desktop = QApplication::desktop()->screen( QWidget * p_desktop = QApplication::desktop()->screen(
QApplication::desktop()->screenNumber( _p_mi ) ); QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi ) );
QPoint pos = QPoint( p_desktop->width() / 2 - width() / 2, QPoint pos = QPoint( p_desktop->width() / 2 - width() / 2,
p_desktop->height() - height() ); p_desktop->height() - height() );
...@@ -829,8 +836,6 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, ...@@ -829,8 +836,6 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
show(); show();
#endif #endif
fullscreenButton->setIcon( QIcon( ":/defullscreen" ) );
vlc_mutex_init_recursive( &lock ); vlc_mutex_init_recursive( &lock );
} }
...@@ -970,9 +975,9 @@ void FullscreenControllerWidget::customEvent( QEvent *event ) ...@@ -970,9 +975,9 @@ void FullscreenControllerWidget::customEvent( QEvent *event )
vlc_mutex_unlock( &lock ); vlc_mutex_unlock( &lock );
#ifdef WIN32TRICK #ifdef WIN32TRICK
if( b_fs && b_fscHidden ) // FIXME I am not sure about that one if( b_fs && b_fscHidden )
#else #else
if( b_fs && !isVisible() ) // FIXME I am not sure about that one if( b_fs && !isVisible() )
#endif #endif
showFSC(); showFSC();
break; break;
......
...@@ -39,108 +39,185 @@ ...@@ -39,108 +39,185 @@
#include <QWidget> #include <QWidget>
#include <QFrame> #include <QFrame>
#include <QToolButton>
class QPixmap; class QPixmap;
class QLabel; class QLabel;
class QHBoxLayout; class QGridLayout;
/* Advanced Button Bar */ class InputSlider;
class QPushButton; class QAbstractSlider;
class AdvControlsWidget : public QFrame
class QAbstractButton;
class VolumeClickHandler;
class QSignalMapper;
typedef enum buttonType_e
{
PLAY_BUTTON,
PAUSE_BUTTON,
STOP_BUTTON,
OPEN_BUTTON,
PREVIOUS_BUTTON,
NEXT_BUTTON,
SLOWER_BUTTON,
FASTER_BUTTON,
FULLSCREEN_BUTTON,
EXTENDED_BUTTON,
PLAYLIST_BUTTON,
SNAPSHOT_BUTTON,
RECORD_BUTTON,
ATOB_BUTTON,
#if 0
FRAME_BUTTON,
#endif
INPUT_SLIDER,
VOLUME_SLIDER,
MENU_BUTTONS,
TELETEXT_BUTTONS,
VOLUME,
} buttonType_e;
typedef enum actionType_e
{
PLAY_ACTION,
PAUSE_ACTION,
STOP_ACTION,
PREVIOUS_ACTION,
NEXT_ACTION,
SLOWER_ACTION,
FASTER_ACTION,
FULLSCREEN_ACTION,
EXTENDED_ACTION,
PLAYLIST_ACTION,
SNAPSHOT_ACTION,
RECORD_ACTION,
ATOB_ACTION
} actionType_e;
class AbstractController : public QFrame
{ {
Q_OBJECT Q_OBJECT
public: public:
AdvControlsWidget( intf_thread_t *, bool ); AbstractController( intf_thread_t *_p_i );
virtual ~AdvControlsWidget(); virtual ~AbstractController() {};
void enableInput( bool );
void enableVideo( bool );
private: protected:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QPushButton *recordButton, *ABButton;
QPushButton *snapshotButton, *frameButton;
static mtime_t timeA, timeB; QSignalMapper *toolbarActionsMapper;
int i_last_input_id; QGridLayout *controlLayout;
QWidget *createWidget( buttonType_e, bool b_flat = false,
bool b_big = false, bool b_shiny = false );
void setupButton( QAbstractButton * );
private:
QWidget *discFrame();
QWidget *telexFrame();
private slots: private slots:
void doAction( int );
protected slots:
void play();
void stop();
void prev();
void next();
void fullscreen();
void extSettings();
void faster();
void slower();
void playlist();
void snapshot(); void snapshot();
void record();
#if 0 #if 0
void frame(); void frame();
#endif #endif
void fromAtoB();
void record(); virtual void setStatus( int );
void AtoBLoop( float, int, int );
void setIcon();
signals: signals:
void timeChanged(); void inputExists( bool ); /// This might be usefull in the IM ?
void inputPlaying( bool ); /// This might be usefull in the IM ?
void inputIsRecordable( bool ); /// same ?
}; };
/* Button Bar */ class PlayButton : public QToolButton
class InputSlider; {
class QSlider; Q_OBJECT
class QGridLayout; private slots:
class VolumeClickHandler; void updateButton( bool );
class SoundSlider; };
class QAbstractSlider;
class QToolButton;
class ControlsWidget : public QFrame class AtoB_Button : public QToolButton
{ {
Q_OBJECT Q_OBJECT
public: private slots:
/* p_intf, advanced control visible or not, blingbling or not */ void setIcons( bool, bool );
ControlsWidget( intf_thread_t *_p_i, MainInterface *_p_mi, };
bool b_advControls, bool b_shiny, bool b_fsCreation = false);
virtual ~ControlsWidget();
QPushButton *playlistButton; class TeletextController : public QWidget
void setStatus( int ); {
void enableInput( bool ); Q_OBJECT
public slots: friend class AbstractController;
void setNavigation( int ); private:
protected: QToolButton *telexTransparent, *telexOn;
friend class MainInterface; QSpinBox *telexPage;
private slots:
void enableTeletextButtons( bool );
void toggleTeletextTransparency( bool );
};
class SoundWidget : public QWidget
{
Q_OBJECT
friend class VolumeClickHandler; friend class VolumeClickHandler;
protected:
public:
SoundWidget( intf_thread_t *_p_i, bool );
private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QWidget *discFrame;
QWidget *telexFrame;
QGridLayout *controlLayout;
InputSlider *slider;
QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
QPushButton *playButton, *fullscreenButton, *extSettingsButton;
QPushButton *telexTransparent, *telexOn;
QSpinBox *telexPage;
QToolButton *slowerButton, *fasterButton;
QHBoxLayout *controlButLayout;
AdvControlsWidget *advControls;
QLabel *volMuteLabel; QLabel *volMuteLabel;
QAbstractSlider *volumeSlider; QAbstractSlider *volumeSlider;
VolumeClickHandler *hVolLabel; VolumeClickHandler *hVolLabel;
bool b_my_volume;
bool b_advancedVisible;
bool b_telexTransparent;
bool b_telexEnabled;
protected slots: protected slots:
void play();
void stop();
void prev();
void next();
void updateVolume( int ); void updateVolume( int );
void updateVolume( void ); void updateVolume( void );
void updateInput(); };
void fullscreen();
void extSettings(); /* Advanced Button Bar */
void faster(); class AdvControlsWidget : public AbstractController
void slower(); {
Q_OBJECT
public:
AdvControlsWidget( intf_thread_t * );
virtual ~AdvControlsWidget();
};
/* Button Bar */
class ControlsWidget : public AbstractController
{
Q_OBJECT
public:
/* p_intf, advanced control visible or not, blingbling or not */
ControlsWidget( intf_thread_t *_p_i, bool b_advControls );
virtual ~ControlsWidget();
protected:
friend class MainInterface;
AdvControlsWidget *advControls;
bool b_advancedVisible;
protected slots:
void toggleAdvanced(); void toggleAdvanced();
void toggleTeletext();
void toggleTeletextTransparency();
void enableTeletext( bool );
void enableVideo( bool );
signals: signals:
void advancedControlsToggled( bool ); void advancedControlsToggled( bool );
}; };
...@@ -166,25 +243,24 @@ signals: ...@@ -166,25 +243,24 @@ signals:
/*********************************** /***********************************
* Fullscreen controller * Fullscreen controller
***********************************/ ***********************************/
class FullscreenControllerWidget : public ControlsWidget class FullscreenControllerWidget : public AbstractController
{ {
Q_OBJECT Q_OBJECT
public: public:
FullscreenControllerWidget( intf_thread_t *, MainInterface*, bool, bool ); FullscreenControllerWidget( intf_thread_t * );
virtual ~FullscreenControllerWidget(); virtual ~FullscreenControllerWidget();
/* */ /* Vout */
vout_thread_t *p_vout;
void attachVout( vout_thread_t *p_vout ); void attachVout( vout_thread_t *p_vout );
void detachVout(); void detachVout();
void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout ); void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout );
vout_thread_t *p_vout;
int i_mouse_last_move_x; int i_mouse_last_move_x;
int i_mouse_last_move_y; int i_mouse_last_move_y;
protected: protected:
friend class MainInterface; friend class MainInterface;
friend class VolumeClickHandler;
virtual void mouseMoveEvent( QMouseEvent *event ); virtual void mouseMoveEvent( QMouseEvent *event );
virtual void mousePressEvent( QMouseEvent *event ); virtual void mousePressEvent( QMouseEvent *event );
...@@ -196,31 +272,25 @@ private slots: ...@@ -196,31 +272,25 @@ private slots:
void showFSC(); void showFSC();
void planHideFSC(); void planHideFSC();
void hideFSC(); void hideFSC();
void slowHideFSC(); void slowHideFSC();
private: private:
virtual void customEvent( QEvent *event );
QTimer *p_hideTimer; QTimer *p_hideTimer;
#if HAVE_TRANSPARENCY #if HAVE_TRANSPARENCY
QTimer *p_slowHideTimer; QTimer *p_slowHideTimer;
bool b_slow_hide_begin;
int i_slow_hide_timeout;
#endif #endif
int i_mouse_last_x; int i_mouse_last_x, i_mouse_last_y;
int i_mouse_last_y;
bool b_mouse_over; bool b_mouse_over;
bool b_slow_hide_begin;
int i_slow_hide_timeout;
#ifdef WIN32TRICK #ifdef WIN32TRICK
bool b_fscHidden; bool b_fscHidden;
#endif #endif
virtual void customEvent( QEvent *event );
/* Shared variable between FSC and VLC (protected by a lock) */ /* Shared variable between FSC and VLC (protected by a lock) */
vlc_mutex_t lock; vlc_mutex_t lock;
bool b_fullscreen; bool b_fullscreen;
......
...@@ -527,7 +527,7 @@ bool VolumeClickHandler::eventFilter( QObject *obj, QEvent *e ) ...@@ -527,7 +527,7 @@ bool VolumeClickHandler::eventFilter( QObject *obj, QEvent *e )
aout_VolumeMute( p_intf, NULL ); aout_VolumeMute( p_intf, NULL );
audio_volume_t i_volume; audio_volume_t i_volume;
aout_VolumeGet( p_intf, &i_volume ); aout_VolumeGet( p_intf, &i_volume );
m->updateVolume( i_volume * VOLUME_MAX / (AOUT_VOLUME_MAX/2) ); // m->updateVolume( i_volume * VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
return true; return true;
} }
return false; return false;
......
...@@ -127,12 +127,12 @@ private slots: ...@@ -127,12 +127,12 @@ private slots:
class VolumeClickHandler : public QObject class VolumeClickHandler : public QObject
{ {
public: public:
VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) : QObject(_m) VolumeClickHandler( intf_thread_t *_p_intf, SoundWidget *_m ) : QObject(_m)
{m = _m; p_intf = _p_intf; } {m = _m; p_intf = _p_intf; }
virtual ~VolumeClickHandler() {}; virtual ~VolumeClickHandler() {};
virtual bool eventFilter( QObject *obj, QEvent *e ); virtual bool eventFilter( QObject *obj, QEvent *e );
private: private:
ControlsWidget *m; SoundWidget *m;
intf_thread_t *p_intf; intf_thread_t *p_intf;
}; };
......
...@@ -72,7 +72,9 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) : ...@@ -72,7 +72,9 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) :
i_rate = 0; i_rate = 0;
i_input_id = 0; i_input_id = 0;
b_video = false; b_video = false;
b_transparentTelextext = false; timeA = 0;
timeB = 0;
} }
InputManager::~InputManager() InputManager::~InputManager()
...@@ -121,6 +123,8 @@ void InputManager::delInput() ...@@ -121,6 +123,8 @@ void InputManager::delInput()
old_name = ""; old_name = "";
artUrl = ""; artUrl = "";
b_video = false; b_video = false;
timeA = 0;
timeB = 0;
emit positionUpdated( -1.0, 0 ,0 ); emit positionUpdated( -1.0, 0 ,0 );
emit statusChanged( END_S ); emit statusChanged( END_S );
emit nameChanged( "" ); emit nameChanged( "" );
...@@ -278,18 +282,19 @@ void InputManager::UpdateNavigation() ...@@ -278,18 +282,19 @@ void InputManager::UpdateNavigation()
{ {
/* Update navigation status */ /* Update navigation status */
vlc_value_t val; val.i_int = 0; vlc_value_t val; val.i_int = 0;
if( hasInput() ) if( hasInput() )
var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL ); var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL );
if( val.i_int > 0 ) if( val.i_int > 0 )
{ {
emit titleChanged( true );
val.i_int = 0; val.i_int = 0;
var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL ); var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL );
emit navigationChanged( (val.i_int > 0) ? 1 : 2 ); emit chapterChanged( (val.i_int > 0) );
} }
else else
{ emit titleChanged( false );
emit navigationChanged( 0 );
}
} }
void InputManager::UpdateStatus() void InputManager::UpdateStatus()
...@@ -386,9 +391,9 @@ void InputManager::UpdateSPU() ...@@ -386,9 +391,9 @@ void InputManager::UpdateSPU()
void InputManager::UpdateTeletext() void InputManager::UpdateTeletext()
{ {
if( hasInput() ) if( hasInput() )
telexToggle( var_GetInteger( p_input, "teletext-es" ) >= 0 ); telexActivation( var_GetInteger( p_input, "teletext-es" ) >= 0 );
else else
telexToggle( false ); telexActivation( false );
} }
void InputManager::UpdateVout() void InputManager::UpdateVout()
...@@ -474,7 +479,12 @@ void InputManager::sectionMenu() ...@@ -474,7 +479,12 @@ void InputManager::sectionMenu()
} }
} }
void InputManager::telexGotoPage( int page ) /*
* Teletext Functions
*/
/* Set a new Teletext Page */
void InputManager::telexSetPage( int page )
{ {
if( hasInput() ) if( hasInput() )
{ {
...@@ -483,80 +493,78 @@ void InputManager::telexGotoPage( int page ) ...@@ -483,80 +493,78 @@ void InputManager::telexGotoPage( int page )
if( i_teletext_es >= 0 && i_teletext_es == i_spu_es ) if( i_teletext_es >= 0 && i_teletext_es == i_spu_es )
{ {
vlc_object_t *p_vbi; vlc_object_t *p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
"zvbi", FIND_ANYWHERE ); "zvbi", FIND_ANYWHERE );
if( p_vbi ) if( p_vbi )
{ {
var_SetInteger( p_vbi, "vbi-page", page ); var_SetInteger( p_vbi, "vbi-page", page );
vlc_object_release( p_vbi ); vlc_object_release( p_vbi );
emit newTelexPageSet( page );
} }
} }
} }
emit setNewTelexPage( page );
} }
void InputManager::telexToggle( bool b_enabled ) /* Set the transparency on teletext */
void InputManager::telexSetTransparency( bool b_transparentTelextext )
{ {
if( hasInput() ) if( hasInput() )
{ {
const int i_teletext_es = var_GetInteger( p_input, "teletext-es" ); vlc_object_t *p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
const int i_spu_es = var_GetInteger( p_input, "spu-es" );
b_enabled = (i_teletext_es >= 0);
emit teletextEnabled( b_enabled );
if( b_enabled && (i_teletext_es == i_spu_es) )
{
vlc_object_t *p_vbi;
int i_page = 100;
p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
"zvbi", FIND_ANYWHERE ); "zvbi", FIND_ANYWHERE );
if( p_vbi ) if( p_vbi )
{ {
i_page = var_GetInteger( p_vbi, "vbi-page" ); var_SetBool( p_vbi, "vbi-opaque", b_transparentTelextext );
vlc_object_release( p_vbi ); vlc_object_release( p_vbi );
i_page = b_enabled ? i_page : 0; emit teletextTransparencyActivated( b_transparentTelextext );
telexGotoPage( i_page );
}
} }
} }
else emit teletextEnabled( b_enabled );
} }
void InputManager::telexToggleButtons() void InputManager::telexActivation( bool b_enabled )
{ {
if( hasInput() ) if( hasInput() )
{ {
const int i_teletext_es = var_GetInteger( p_input, "teletext-es" ); const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
if( i_teletext_es >= 0 )
{
const int i_spu_es = var_GetInteger( p_input, "spu-es" ); const int i_spu_es = var_GetInteger( p_input, "spu-es" );
/* Teletext is possible. Show the buttons */
b_enabled = (i_teletext_es >= 0);
emit teletextPossible( b_enabled );
if( !b_enabled ) return;
/* If Teletext is selected */
if( i_teletext_es == i_spu_es ) if( i_teletext_es == i_spu_es )
var_SetInteger( p_input, "spu-es", -1 ); {
else /* Activate the buttons */
var_SetInteger( p_input, "spu-es", i_teletext_es ); teletextActivated( true );
emit toggleTelexButtons(); /* Then, find the current page */
int i_page = 100;
vlc_object_t *p_vbi = (vlc_object_t *)
vlc_object_find_name( p_input, "zvbi", FIND_ANYWHERE );
if( p_vbi )
{
i_page = var_GetInteger( p_vbi, "vbi-page" );
vlc_object_release( p_vbi );
emit newTelexPageSet( i_page );
} }
} }
}
else
emit teletextPossible( b_enabled );
} }
void InputManager::telexSetTransparency() void InputManager::activateTeletext( bool b_enable )
{ {
if( hasInput() ) if( hasInput() )
{ {
vlc_object_t *p_vbi; const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
p_vbi = (vlc_object_t *) vlc_object_find_name( p_input, if( i_teletext_es >= 0 )
"zvbi", FIND_ANYWHERE );
if( p_vbi )
{ {
var_SetBool( p_vbi, "vbi-opaque", b_transparentTelextext ); var_SetInteger( p_input, "spu-es", b_enable ? i_teletext_es : -1 );
b_transparentTelextext = !b_transparentTelextext;
vlc_object_release( p_vbi );
} }
} }
emit toggleTelexTransparency();
} }
void InputManager::slower() void InputManager::slower()
...@@ -583,6 +591,36 @@ void InputManager::setRate( int new_rate ) ...@@ -583,6 +591,36 @@ void InputManager::setRate( int new_rate )
var_SetInteger( p_input, "rate", new_rate ); var_SetInteger( p_input, "rate", new_rate );
} }
void InputManager::setAtoB()
{
if( !timeA )
{
timeA = var_GetTime( THEMIM->getInput(), "time" );
}
else if( !timeB )
{
timeB = var_GetTime( THEMIM->getInput(), "time" );
var_SetTime( THEMIM->getInput(), "time" , timeA );
}
else
{
timeA = 0;
timeB = 0;
}
emit AtoBchanged( (timeA != 0 ), (timeB != 0 ) );
}
/* Function called regularly when in an AtoB loop */
void InputManager::AtoBLoop( int i_time )
{
if( timeB )
{
if( ( i_time >= (int)( timeB/1000000 ) )
|| ( i_time < (int)( timeA/1000000 ) ) )
var_SetTime( THEMIM->getInput(), "time" , timeA );
}
}
/********************************************************************** /**********************************************************************
* MainInputManager implementation. Wrap an input manager and * MainInputManager implementation. Wrap an input manager and
* take care of updating the main playlist input. * take care of updating the main playlist input.
......
...@@ -70,7 +70,8 @@ public: ...@@ -70,7 +70,8 @@ public:
virtual ~InputManager(); virtual ~InputManager();
void delInput(); void delInput();
bool hasInput() { return p_input && !p_input->b_dead && vlc_object_alive (p_input); } bool hasInput() { return p_input && !p_input->b_dead
&& vlc_object_alive (p_input); }
bool hasAudio(); bool hasAudio();
bool hasVideo() { return hasInput() && b_video; } bool hasVideo() { return hasInput() && b_video; }
...@@ -84,8 +85,8 @@ private: ...@@ -84,8 +85,8 @@ private:
QString old_name; QString old_name;
QString artUrl; QString artUrl;
int i_rate; int i_rate;
bool b_transparentTelextext;
bool b_video; bool b_video;
mtime_t timeA, timeB;
void customEvent( QEvent * ); void customEvent( QEvent * );
void addCallbacks(); void addCallbacks();
...@@ -99,23 +100,31 @@ private: ...@@ -99,23 +100,31 @@ private:
void UpdateTeletext(); void UpdateTeletext();
void UpdateArt(); void UpdateArt();
void UpdateVout(); void UpdateVout();
void UpdateStats(); void UpdateStats(); // FIXME, remove from this file.
void AtoBLoop( int );
public slots: public slots:
void setInput( input_thread_t * ); ///< Our controlled input changed void setInput( input_thread_t * ); ///< Our controlled input changed
void sliderUpdate( float ); ///< User dragged the slider. We get new pos void sliderUpdate( float ); ///< User dragged the slider. We get new pos
void togglePlayPause(); void togglePlayPause();
/* SpeedRate Rate Management */
void slower(); void slower();
void faster(); void faster();
void normalRate(); void normalRate();
void setRate( int ); void setRate( int );
/* Menus */
void sectionNext(); void sectionNext();
void sectionPrev(); void sectionPrev();
void sectionMenu(); void sectionMenu();
void telexGotoPage( int ); ///< Goto teletext page /* Teletext */
void telexToggle( bool ); ///< Enable disable teletext buttons void telexSetPage( int ); ///< Goto teletext page
void telexToggleButtons(); ///< Toggle buttons after click void telexSetTransparency( bool ); ///< Transparency on teletext background
void telexSetTransparency(); ///< Set transparency on teletext background void telexActivation( bool ); ///< Enable disable teletext buttons
void activateTeletext( bool ); ///< Toggle buttons after click
/* A to B Loop */
void setAtoB();
signals: signals:
/// Send new position, new time and new length /// Send new position, new time and new length
...@@ -123,19 +132,20 @@ signals: ...@@ -123,19 +132,20 @@ signals:
void rateChanged( int ); void rateChanged( int );
void nameChanged( QString ); void nameChanged( QString );
/// Used to signal whether we should show navigation buttons /// Used to signal whether we should show navigation buttons
void navigationChanged( int ); void titleChanged( bool );
void chapterChanged( bool );
/// Statistics are updated /// Statistics are updated
void statisticsUpdated( input_item_t* ); void statisticsUpdated( input_item_t* );
/// Play/pause status /// Play/pause status
void statusChanged( int ); void statusChanged( int );
void artChanged( input_item_t* ); void artChanged( input_item_t* );
/// Teletext /// Teletext
void teletextEnabled( bool ); void teletextPossible( bool );
void toggleTelexButtons(); void teletextActivated( bool );
void toggleTelexTransparency(); void teletextTransparencyActivated( bool );
void setNewTelexPage( int ); void newTelexPageSet( int );
/// Advanced buttons /// Advanced buttons
void advControlsSetIcon(); void AtoBchanged( bool, bool );
/// Vout /// Vout
void voutChanged( bool ); void voutChanged( bool );
}; };
......
...@@ -374,10 +374,8 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -374,10 +374,8 @@ void MainInterface::handleMainUi( QSettings *settings )
mainLayout->setMargin( 0 ); mainLayout->setMargin( 0 );
/* Create the CONTROLS Widget */ /* Create the CONTROLS Widget */
bool b_shiny = config_GetInt( p_intf, "qt-blingbling" ); controls = new ControlsWidget( p_intf,
controls = new ControlsWidget( p_intf, this, settings->value( "adv-controls", false ).toBool() );
settings->value( "adv-controls", false ).toBool(),
b_shiny );
CONNECT( controls, advancedControlsToggled( bool ), CONNECT( controls, advancedControlsToggled( bool ),
this, doComponentsUpdate() ); this, doComponentsUpdate() );
...@@ -431,11 +429,7 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -431,11 +429,7 @@ void MainInterface::handleMainUi( QSettings *settings )
/* Create the FULLSCREEN CONTROLS Widget */ /* Create the FULLSCREEN CONTROLS Widget */
if( config_GetInt( p_intf, "qt-fs-controller" ) ) if( config_GetInt( p_intf, "qt-fs-controller" ) )
{ {
fullscreenControls = new FullscreenControllerWidget( p_intf, this, fullscreenControls = new FullscreenControllerWidget( p_intf );
settings->value( "adv-controls", false ).toBool(),
b_shiny );
CONNECT( fullscreenControls, advancedControlsToggled( bool ),
this, doComponentsUpdate() );
} }
} }
...@@ -817,7 +811,7 @@ void MainInterface::doComponentsUpdate() ...@@ -817,7 +811,7 @@ void MainInterface::doComponentsUpdate()
void MainInterface::toggleAdvanced() void MainInterface::toggleAdvanced()
{ {
controls->toggleAdvanced(); controls->toggleAdvanced();
if( fullscreenControls ) fullscreenControls->toggleAdvanced(); // if( fullscreenControls ) fullscreenControls->toggleAdvanced();
} }
/* Get the visibility status of the controls (hidden or not, advanced or not) */ /* Get the visibility status of the controls (hidden or not, advanced or not) */
...@@ -865,16 +859,6 @@ void MainInterface::setStatus( int status ) ...@@ -865,16 +859,6 @@ void MainInterface::setStatus( int status )
{ {
msg_Dbg( p_intf, "Updating the stream status: %i", status ); msg_Dbg( p_intf, "Updating the stream status: %i", status );
/* Forward the status to the controls to toggle Play/Pause */
controls->setStatus( status );
controls->updateInput();
if( fullscreenControls )
{
fullscreenControls->setStatus( status );
fullscreenControls->updateInput();
}
speedControl->setEnable( THEMIM->getIM()->hasInput() ); speedControl->setEnable( THEMIM->getIM()->hasInput() );
/* And in the systray for the menu */ /* And in the systray for the menu */
......
/***************************************************************************** /*****************************************************************************
* main_interface.hpp : Main Interface * main_interface.hpp : Main Interface
**************************************************************************** ****************************************************************************
* Copyright (C) 2006-2007 the VideoLAN team * Copyright (C) 2006-2008 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
......
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