]> git.sesse.net Git - vlc/commitdiff
Qt: Allow disabling or resampling background art.
authorFrancois Cartegnie <fcvlcdev@free.fr>
Sun, 28 Nov 2010 12:42:19 +0000 (13:42 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Sun, 28 Nov 2010 12:42:26 +0000 (13:42 +0100)
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/qt4.cpp

index 8abfb215c7c3eee8dc25a331604866686dabd8ed..084a89cd725ef240144585f52ed357205fa111e3 100644 (file)
@@ -188,7 +188,7 @@ void VideoWidget::release( void )
  **********************************************************************/
 
 BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i )
-                 :QWidget( NULL ), p_intf( _p_i ), b_expandPixmap( false )
+    :QWidget( NULL ), p_intf( _p_i ), b_expandPixmap( false ), b_withart( true )
 {
     /* A dark background */
     setAutoFillBackground( true );
@@ -222,6 +222,13 @@ void BackgroundWidget::updateArt( const QString& url )
 
 void BackgroundWidget::paintEvent( QPaintEvent *e )
 {
+    if ( !b_withart )
+    {
+        /* we just want background autofill */
+        QWidget::paintEvent( e );
+        return;
+    }
+
     int i_maxwidth, i_maxheight;
     QPixmap pixmap = QPixmap( pixmapUrl );
     QPainter painter(this);
index c684f44b97596a7ebfc1040c816e352081bc95eb..dc895ecd8c4ea6e3c45a24c495a87ab629bb92f7 100644 (file)
@@ -87,9 +87,11 @@ class BackgroundWidget : public QWidget
 public:
     BackgroundWidget( intf_thread_t * );
     void setExpandstoHeight( bool b_expand ) { b_expandPixmap = b_expand; }
+    void setWithArt( bool b_withart_ ) { b_withart = b_withart_; };
 private:
     QString pixmapUrl;
     bool b_expandPixmap;
+    bool b_withart;
     virtual void contextMenuEvent( QContextMenuEvent *event );
     intf_thread_t *p_intf;
 protected:
index b7c7147e42da7b811253f60cfcb51e6276ad72d7..88bf4d42798f21ca68ca19b77e8c7dfac4e48347 100644 (file)
@@ -373,6 +373,11 @@ void MainInterface::createMainWidget( QSettings *settings )
     /* Bg Cone */
     bgWidget = new BackgroundWidget( p_intf );
     stackCentralW->addWidget( bgWidget );
+    if ( !var_InheritBool( p_intf, "qt-bgcone" ) )
+        bgWidget->setWithArt( false );
+    else
+        if ( var_InheritBool( p_intf, "qt-bgcone-expands" ) )
+            bgWidget->setExpandstoHeight( true );
 
     /* And video Outputs */
     if( b_videoEmbedded )
index 7a82b6faae99d063b79e2138f8064b3f0cb7e302..6f1ada6588b28da5cf9a41115707c5766e49b891 100644 (file)
@@ -165,6 +165,12 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
 
 #define QT_MINIMAL_MODE_TEXT N_("Start in minimal view (without menus)" )
 
+#define QT_BGCONE_TEXT N_( "Display background cone or art" )
+#define QT_BGCONE_LONGTEXT N_( "Display background cone or current album art " \
+                            "when not playing." \
+                            "Can be disabled to prevent burning screen." )
+#define QT_BGCONE_EXPANDS_TEXT N_( "Expanding background cone or art." )
+#define QT_BGCONE_EXPANDS_LONGTEXT N_( "Background art fits window's size" )
 /**********************************************************************/
 vlc_module_begin ()
     set_shortname( "Qt" )
@@ -238,6 +244,10 @@ vlc_module_begin ()
               QT_AUTOLOAD_EXTENSIONS_TEXT, QT_AUTOLOAD_EXTENSIONS_LONGTEXT,
               false )
 
+    add_bool( "qt-bgcone", true, QT_BGCONE_TEXT, QT_BGCONE_LONGTEXT, true )
+    add_bool( "qt-bgcone-expands", false, QT_BGCONE_EXPANDS_TEXT,
+              QT_BGCONE_EXPANDS_LONGTEXT, true )
+
     add_obsolete_bool( "qt-blingbling" ) /* Suppressed since 1.0.0 */
     add_obsolete_integer( "qt-display-mode" ) /* Suppressed since 1.1.0 */