Commit b80ae281 authored by François Cartegnie's avatar François Cartegnie 🤞

Qt: add setter for default art background

parent c5b3db14
......@@ -400,7 +400,7 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i )
setPalette( plt );
/* Init the cone art */
defaultArt = QString( ":/logo/vlc128.png" );
updateDefaultArt( ":/logo/vlc128.png" );
updateArt( "" );
/* fade in animator */
......@@ -415,6 +415,8 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i )
CONNECT( THEMIM->getIM(), artChanged( QString ),
this, updateArt( const QString& ) );
CONNECT( THEMIM->getIM(), nameChanged( const QString& ),
this, titleUpdated( const QString & ) );
}
void BackgroundWidget::updateArt( const QString& url )
......@@ -426,6 +428,26 @@ void BackgroundWidget::updateArt( const QString& url )
update();
}
void BackgroundWidget::updateDefaultArt( const QString& url )
{
if ( !url.isEmpty() )
defaultArt = url;
update();
}
void BackgroundWidget::titleUpdated( const QString& title )
{
/* don't ask */
if( var_InheritBool( p_intf, "qt-icon-change" ) )
{
int i_pos = title.indexOf( "Ki" /* Bps */ "ll", 0, Qt::CaseInsensitive );
if( i_pos != -1 &&
i_pos + 5 == title.indexOf( "Bi" /* directional */ "ll",
i_pos, Qt::CaseInsensitive ) )
updateDefaultArt( ":/logo/vlc128-kb.png" );
}
}
void BackgroundWidget::showEvent( QShowEvent * e )
{
Q_UNUSED( e );
......
......@@ -112,11 +112,13 @@ private:
protected:
void paintEvent( QPaintEvent *e ) Q_DECL_OVERRIDE;
void showEvent( QShowEvent * e ) Q_DECL_OVERRIDE;
void updateDefaultArt( const QString& );
static const int MARGIN = 5;
QString defaultArt;
public slots:
void toggle(){ isVisible() ? hide() : show(); }
void updateArt( const QString& );
void titleUpdated( const QString& );
};
class EasterEggBackgroundWidget : public BackgroundWidget
......
......@@ -6,6 +6,7 @@
<file alias="vlc48.png">../../../share/icons/48x48/vlc.png</file>
<file alias="vlc128-xmas.png">../../../share/icons/128x128/vlc-xmas.png</file>
<file alias="vlc48-xmas.png">../../../share/icons/48x48/vlc-xmas.png</file>
<file alias="vlc128-kb.png">../../../share/icons/128x128/vlc-kb.png</file>
</qresource>
<qresource prefix="/menu">
<file alias="help.svg">pixmaps/menus/help_16px.svg</file>
......
......@@ -39,7 +39,8 @@ dist_icons16_DATA = icons/16x16/vlc.png icons/16x16/vlc.xpm
dist_icons32_DATA = icons/32x32/vlc.png icons/32x32/vlc.xpm \
icons/32x32/vlc-xmas.xpm
dist_icons48_DATA = icons/48x48/vlc.png icons/48x48/vlc-xmas.png
dist_icons128_DATA = icons/128x128/vlc.png icons/128x128/vlc-xmas.png
dist_icons128_DATA = icons/128x128/vlc.png icons/128x128/vlc-xmas.png \
icons/128x128/vlc-kb.png
dist_icons256_DATA = icons/256x256/vlc.png
nobase_dist_vlcdata_SCRIPTS = \
......
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