hide();
/* Set the policy to expand in both directions */
- setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
+// setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
/* Black background is more coherent for a Video Widget */
QPalette plt = palette();
VideoWidget::~VideoWidget()
{
vout_thread_t *p_vout = i_vout ?
- (vout_thread_t *)vlc_object_get( i_vout ) : NULL;
+ (vout_thread_t *)vlc_object_get( p_intf->p_libvlc, i_vout ) : NULL;
if( p_vout )
{
- if( !p_intf->psz_switch_intf )
- {
- if( vout_Control( p_vout, VOUT_CLOSE ) != VLC_SUCCESS )
- vout_Control( p_vout, VOUT_REPARENT );
- }
- else
- {
- if( vout_Control( p_vout, VOUT_REPARENT ) != VLC_SUCCESS )
- vout_Control( p_vout, VOUT_CLOSE );
- }
+ if( vout_Control( p_vout, VOUT_CLOSE ) != VLC_SUCCESS )
+ vout_Control( p_vout, VOUT_REPARENT );
vlc_object_release( p_vout );
}
}
**********************************************************************/
#define ICON_SIZE 128
#define MAX_BG_SIZE 400
-#define MIN_BG_SIZE 64
+#define MIN_BG_SIZE 128
BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i )
:QWidget( NULL ), p_intf( _p_i )
/* A dark background */
setAutoFillBackground( true );
- plt = palette();
+ plt = palette();
plt.setColor( QPalette::Active, QPalette::Window , Qt::black );
plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black );
setPalette( plt );
backgroundLayout->setColumnStretch( 0, 1 );
backgroundLayout->setColumnStretch( 2, 1 );
- CONNECT( THEMIM->getIM(), artChanged( QString ), this, updateArt( QString ) );
+ CONNECT( THEMIM->getIM(), artChanged( input_item_t* ),
+ this, updateArt( input_item_t* ) );
}
BackgroundWidget::~BackgroundWidget()
label->show();
}
-void BackgroundWidget::updateArt( QString url )
+void BackgroundWidget::updateArt( input_item_t *p_item )
{
+ QString url;
+ if( p_item )
+ {
+ char *psz_art = input_item_GetArtURL( p_item );
+ url = psz_art;
+ free( psz_art );
+ }
+
if( url.isEmpty() )
{
if( QDate::currentDate().dayOfYear() >= 354 )
label->setPixmap( QPixmap( ":/vlc128-christmas.png" ) );
else
label->setPixmap( QPixmap( ":/vlc128.png" ) );
- return;
}
else
{
+ url = url.replace( "file://", QString("" ) );
+ /* Taglib seems to define a attachment://, It won't work yet */
+ url = url.replace( "attachment://", QString("" ) );
label->setPixmap( QPixmap( url ) );
}
}
#endif
/* Record Button */
+#if 0
recordButton = new QPushButton;
setupSmallButton( recordButton );
advLayout->addWidget( recordButton );
BUTTON_SET_ACT_I( recordButton, "", record,
qtr( "Record" ), record() );
+#endif
/* Snapshot Button */
snapshotButton = new QPushButton;
{
input_item_t *p_item = input_GetItem( THEMIM->getInput() );
i_input_id = p_item->i_id;
-
- if( var_Type( THEMIM->getInput(), "record-toggle" ) == VLC_VAR_VOID )
- recordButton->setVisible( true );
- else
- recordButton->setVisible( false );
+#if 0
+ recordButton->setVisible( var_GetBool( THEMIM->getInput(), "can-record" ) );
}
else
+ {
recordButton->setVisible( false );
+#endif
+ }
ABButton->setEnabled( enable );
+#if 0
recordButton->setEnabled( enable );
+#endif
if( enable && ( i_last_input_id != i_input_id ) )
{
{
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 );
+ if( p_vout )
+ {
+ vout_Control( p_vout, VOUT_SNAPSHOT );
+ vlc_object_release( p_vout );
+ }
}
/* Function called when the button is clicked() */
}
}
-/* FIXME Record function */
+// TODO: On-the-fly record needs to be reimplemented
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 */
- if( var_Type( p_input, "record-toggle" ) == VLC_VAR_VOID )
- var_TriggerCallback( p_input, "record-toggle" );
+ const bool b_recording = var_GetBool( p_input, "record" );
+ var_SetBool( p_input, "record", !b_recording );
#if 0
else
{
/*
* Other first Line buttons
*/
+ /* */
+ CONNECT( THEMIM->getIM(), voutChanged(bool), this, enableVideo(bool) );
+
/** Fullscreen/Visualisation **/
fullscreenButton = new QPushButton;
BUTTON_SET_ACT_I( fullscreenButton, "", fullscreen,
}
else
{
- telexTransparent->setIcon( QIcon( ":/tvtelx-transparent" ) );
+ telexTransparent->setIcon( QIcon( ":/tvtelx-trans" ) );
telexTransparent->setToolTip( qtr( "Transparent" ) );
b_telexTransparent = true;
}
{
discFrame->hide();
} else if( navigation == 1 ) {
- prevSectionButton->setToolTip( qfu( HELP_PCH ) );
- nextSectionButton->setToolTip( qfu( HELP_NCH ) );
+ prevSectionButton->setToolTip( qtr( HELP_PCH ) );
+ nextSectionButton->setToolTip( qtr( HELP_NCH ) );
menuButton->show();
discFrame->show();
} else {
- prevSectionButton->setToolTip( qfu( HELP_PCH ) );
- nextSectionButton->setToolTip( qfu( HELP_NCH ) );
+ prevSectionButton->setToolTip( qtr( HELP_PCH ) );
+ nextSectionButton->setToolTip( qtr( HELP_NCH ) );
menuButton->hide();
discFrame->show();
}
{
/* Activate the interface buttons according to the presence of the input */
enableInput( THEMIM->getIM()->hasInput() );
- enableVideo( THEMIM->getIM()->hasVideo() && THEMIM->getIM()->hasInput() );
+ enableVideo( THEMIM->getIM()->hasVideo() );
}
void ControlsWidget::setStatus( int status )
emit advancedControlsToggled( b_advancedVisible );
}
-
/**********************************************************************
* Fullscrenn control widget
**********************************************************************/
setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
QGridLayout *fsLayout = new QGridLayout( this );
- fsLayout->setLayoutMargins( 5, 1, 5, 1, 5 );
+ fsLayout->setLayoutMargins( 5, 2, 5, 2, 5 );
/* First line */
slider->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum);
+ slider->setMinimumWidth( 220 );
fsLayout->addWidget( slowerButton, 0, 0 );
- fsLayout->addWidget( slider, 0, 1, 1, 8 );
- fsLayout->addWidget( fasterButton, 0, 9 );
+ fsLayout->addWidget( slider, 0, 1, 1, 9 );
+ fsLayout->addWidget( fasterButton, 0, 10 );
fsLayout->addWidget( playButton, 1, 0, 1, 2 );
fsLayout->addLayout( controlButLayout, 1, 2 );
fsLayout->addWidget( fullscreenButton, 1, 5 );
fsLayout->addWidget( advControls, 1, 6, Qt::AlignVCenter );
- fsLayout->addWidget( volMuteLabel, 1, 7 );
- fsLayout->addWidget( volumeSlider, 1, 8, 1, 2 );
+ fsLayout->setColumnStretch( 7, 10 );
+ fsLayout->addWidget( volMuteLabel, 1, 8 );
+ fsLayout->addWidget( volumeSlider, 1, 9, 1, 2 );
/* hiding timer */
p_hideTimer = new QTimer( this );
{
THEMIM->getIM()->setRate(INPUT_RATE_DEFAULT);
}
+
+
+
+static int downloadCoverCallback( vlc_object_t *p_this,
+ char const *psz_var,
+ vlc_value_t oldvar, vlc_value_t newvar,
+ void *data )
+{
+ if( !strcmp( psz_var, "item-change" ) )
+ {
+ CoverArtLabel *art = static_cast< CoverArtLabel* >( data );
+ if( art )
+ art->requestUpdate();
+ }
+ return VLC_SUCCESS;
+}
+
+CoverArtLabel::CoverArtLabel( QWidget *parent,
+ vlc_object_t *_p_this,
+ input_item_t *_p_input )
+ : QLabel( parent ), p_this( _p_this), p_input( _p_input ), prevArt()
+{
+ setContextMenuPolicy( Qt::ActionsContextMenu );
+ CONNECT( this, updateRequested(), this, doUpdate() );
+
+ playlist_t *p_playlist = pl_Yield( p_this );
+ var_AddCallback( p_playlist, "item-change",
+ downloadCoverCallback, this );
+ pl_Release( p_this );
+
+ setMinimumHeight( 128 );
+ setMinimumWidth( 128 );
+ setMaximumHeight( 128 );
+ setMaximumWidth( 128 );
+ setScaledContents( true );
+
+ doUpdate();
+}
+
+void CoverArtLabel::downloadCover()
+{
+ if( p_input )
+ {
+ playlist_t *p_playlist = pl_Yield( p_this );
+ playlist_AskForArtEnqueue( p_playlist, p_input );
+ pl_Release( p_this );
+ }
+}
+
+void CoverArtLabel::doUpdate()
+{
+ if( !p_input )
+ {
+ setPixmap( QPixmap( ":/noart.png" ) );
+ QList< QAction* > artActions = actions();
+ if( !artActions.isEmpty() )
+ foreach( QAction *act, artActions )
+ removeAction( act );
+ prevArt = "";
+ }
+ else
+ {
+ char *psz_meta = input_item_GetArtURL( p_input );
+ if( psz_meta && !strncmp( psz_meta, "file://", 7 ) )
+ {
+ QString artUrl = qfu( psz_meta ).replace( "file://", "" );
+ if( artUrl != prevArt )
+ setPixmap( QPixmap( artUrl ) );
+ QList< QAction* > artActions = actions();
+ if( !artActions.isEmpty() )
+ {
+ foreach( QAction *act, artActions )
+ removeAction( act );
+ }
+ prevArt = artUrl;
+ }
+ else
+ {
+ if( prevArt != "" )
+ setPixmap( QPixmap( ":/noart.png" ) );
+ prevArt = "";
+ QList< QAction* > artActions = actions();
+ if( artActions.isEmpty() )
+ {
+ QAction *action = new QAction( qtr( "Download cover art" ),
+ this );
+ addAction( action );
+ CONNECT( action, triggered(),
+ this, downloadCover() );
+ }
+ }
+ free( psz_meta );
+ }
+}
+