#define MIN_BG_SIZE 64
BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) :
- QFrame( NULL ), p_intf( _p_i )
+ QWidget( NULL ), p_intf( _p_i )
{
/* We should use that one to take the more size it can */
- setSizePolicy( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding );
+ setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
/* A dark background */
setAutoFillBackground( true );
/* A cone in the middle */
label = new QLabel;
- label->setScaledContents( true );
label->setMargin( 5 );
label->setMaximumHeight( MAX_BG_SIZE );
label->setMaximumWidth( MAX_BG_SIZE );
else
label->setPixmap( QPixmap( ":/vlc128.png" ) );
- QHBoxLayout *backgroundLayout = new QHBoxLayout( this );
- backgroundLayout->addWidget( label );
+ QGridLayout *backgroundLayout = new QGridLayout( this );
+ backgroundLayout->addWidget( label, 0, 1 );
+ backgroundLayout->setColumnStretch( 0, 1 );
+ backgroundLayout->setColumnStretch( 2, 1 );
- resize( 300, 150 );
- updateGeometry();
CONNECT( THEMIM, inputChanged( input_thread_t *),
this, update( input_thread_t * ) );
+ resize( 300, 150 );
}
BackgroundWidget::~BackgroundWidget()
{
}
-
void BackgroundWidget::update( input_thread_t *p_input )
{
if( !p_input || p_input->b_dead )
return;
}
-
vlc_object_yield( p_input );
char *psz_arturl = input_item_GetArtURL( input_GetItem(p_input) );
vlc_object_release( p_input );
- QString url = qfu( psz_arturl );
- QString arturl = url.replace( "file://",QString("" ) );
+
+ QString arturl = qfu( psz_arturl ).replace( "file://",QString("" ) );
if( arturl.isNull() )
{
if( QDate::currentDate().dayOfYear() >= 354 )
free( psz_arturl );
}
-QSize BackgroundWidget::sizeHint() const
-{
- return label->size();
-}
-
-void BackgroundWidget::resizeEvent( QResizeEvent *e )
-{
- if( e->size().height() < MAX_BG_SIZE -1 )
- {
- label->setMaximumWidth( e->size().height() );
- label->setMaximumHeight( e->size().width() );
- }
- else
- {
- label->setMaximumHeight( MAX_BG_SIZE );
- label->setMaximumWidth( MAX_BG_SIZE );
- }
-}
-
void BackgroundWidget::contextMenuEvent( QContextMenuEvent *event )
{
QVLCMenu::PopupMenu( p_intf, true );
};
/******************** Background Widget ****************/
-class BackgroundWidget : public QFrame
+class BackgroundWidget : public QWidget
{
Q_OBJECT
public:
BackgroundWidget( intf_thread_t * );
virtual ~BackgroundWidget();
- QSize widgetSize;
- QSize sizeHint() const;
- bool b_need_update;
+
private:
QPalette plt;
QLabel *label;
- virtual void resizeEvent( QResizeEvent *e );
virtual void contextMenuEvent( QContextMenuEvent *event );
intf_thread_t *p_intf;
- int i_runs;
+
public slots:
void toggle(){ TOGGLEV( this ); }
void update( input_thread_t * );
getControlsVisibilityStatus() & CONTROLS_ADVANCED );
settings->setValue( "pos", pos() );
settings->setValue( "size", size() );
+ if( bgWidget )
+ settings->setValue( "backgroundSize", bgWidget->size() );
settings->endGroup();
delete settings;
if( alwaysVideoFlag )
{
bgWidget = new BackgroundWidget( p_intf );
- bgWidget->widgetSize = settings->value( "backgroundSize",
- QSize( 300, 200 ) ).toSize();
- bgWidget->resize( bgWidget->widgetSize );
+ bgWidget->resize(
+ settings->value( "backgroundSize", QSize( 300, 150 ) ).toSize() );
bgWidget->updateGeometry();
mainLayout->insertWidget( 0, bgWidget );
CONNECT( this, askBgWidgetToToggle(), bgWidget, toggle() );
{
nheight += bgWidget->size().height();
nwidth = bgWidget->size().width();
+ msg_Dbg( p_intf, "1b %i %i", nheight, nwidth );
}
else if( videoIsActive )
{
vlc_value_t old_val, vlc_value_t new_val, void *param )
{
intf_thread_t *p_intf = (intf_thread_t *)param;
+ msg_Dbg( p_this, "Menu Requested" ); // DEBUG to track the non disparition of the menu...
if( p_intf->pf_show_dialog )
{
vlc_value_t old_val, vlc_value_t new_val, void *param )
{
intf_thread_t *p_intf = (intf_thread_t *)param;
+ msg_Dbg( p_this, "Intf Show Requested" ); // DEBUG to track the non disparition of the menu...
//p_intf->p_sys->b_intf_show = VLC_TRUE;
return VLC_SUCCESS;