[vlc-commits] Qt: add setter for default art background

Francois Cartegnie git at videolan.org
Wed Jan 24 22:40:47 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jan  4 23:41:10 2018 +0100| [b80ae281c47cc27a295a01449e48fbbc3f9c244d] | committer: Francois Cartegnie

Qt: add setter for default art background

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b80ae281c47cc27a295a01449e48fbbc3f9c244d
---

 modules/gui/qt/components/interface_widgets.cpp |  24 +++++++++++++++++++++++-
 modules/gui/qt/components/interface_widgets.hpp |   2 ++
 modules/gui/qt/vlc.qrc                          |   1 +
 share/Makefile.am                               |   3 ++-
 share/icons/128x128/vlc-kb.png                  | Bin 0 -> 13981 bytes
 5 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/components/interface_widgets.cpp b/modules/gui/qt/components/interface_widgets.cpp
index d035734f2e..0fdb888114 100644
--- a/modules/gui/qt/components/interface_widgets.cpp
+++ b/modules/gui/qt/components/interface_widgets.cpp
@@ -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 );
diff --git a/modules/gui/qt/components/interface_widgets.hpp b/modules/gui/qt/components/interface_widgets.hpp
index e56b828021..a4353a0d1d 100644
--- a/modules/gui/qt/components/interface_widgets.hpp
+++ b/modules/gui/qt/components/interface_widgets.hpp
@@ -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
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 8c032779bd..d7623bf96b 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -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>
diff --git a/share/Makefile.am b/share/Makefile.am
index 7e93d0e39b..36ba5a63f6 100644
--- a/share/Makefile.am
+++ b/share/Makefile.am
@@ -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 = \
diff --git a/share/icons/128x128/vlc-kb.png b/share/icons/128x128/vlc-kb.png
new file mode 100644
index 0000000000..20009a9220
Binary files /dev/null and b/share/icons/128x128/vlc-kb.png differ



More information about the vlc-commits mailing list