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

Qt: Allow disabling or resampling background art.

parent c7ba2edb
...@@ -188,7 +188,7 @@ void VideoWidget::release( void ) ...@@ -188,7 +188,7 @@ void VideoWidget::release( void )
**********************************************************************/ **********************************************************************/
BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) 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 */ /* A dark background */
setAutoFillBackground( true ); setAutoFillBackground( true );
...@@ -222,6 +222,13 @@ void BackgroundWidget::updateArt( const QString& url ) ...@@ -222,6 +222,13 @@ void BackgroundWidget::updateArt( const QString& url )
void BackgroundWidget::paintEvent( QPaintEvent *e ) void BackgroundWidget::paintEvent( QPaintEvent *e )
{ {
if ( !b_withart )
{
/* we just want background autofill */
QWidget::paintEvent( e );
return;
}
int i_maxwidth, i_maxheight; int i_maxwidth, i_maxheight;
QPixmap pixmap = QPixmap( pixmapUrl ); QPixmap pixmap = QPixmap( pixmapUrl );
QPainter painter(this); QPainter painter(this);
......
...@@ -87,9 +87,11 @@ class BackgroundWidget : public QWidget ...@@ -87,9 +87,11 @@ class BackgroundWidget : public QWidget
public: public:
BackgroundWidget( intf_thread_t * ); BackgroundWidget( intf_thread_t * );
void setExpandstoHeight( bool b_expand ) { b_expandPixmap = b_expand; } void setExpandstoHeight( bool b_expand ) { b_expandPixmap = b_expand; }
void setWithArt( bool b_withart_ ) { b_withart = b_withart_; };
private: private:
QString pixmapUrl; QString pixmapUrl;
bool b_expandPixmap; bool b_expandPixmap;
bool b_withart;
virtual void contextMenuEvent( QContextMenuEvent *event ); virtual void contextMenuEvent( QContextMenuEvent *event );
intf_thread_t *p_intf; intf_thread_t *p_intf;
protected: protected:
......
...@@ -373,6 +373,11 @@ void MainInterface::createMainWidget( QSettings *settings ) ...@@ -373,6 +373,11 @@ void MainInterface::createMainWidget( QSettings *settings )
/* Bg Cone */ /* Bg Cone */
bgWidget = new BackgroundWidget( p_intf ); bgWidget = new BackgroundWidget( p_intf );
stackCentralW->addWidget( bgWidget ); 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 */ /* And video Outputs */
if( b_videoEmbedded ) if( b_videoEmbedded )
......
...@@ -165,6 +165,12 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * ); ...@@ -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_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 () vlc_module_begin ()
set_shortname( "Qt" ) set_shortname( "Qt" )
...@@ -238,6 +244,10 @@ vlc_module_begin () ...@@ -238,6 +244,10 @@ vlc_module_begin ()
QT_AUTOLOAD_EXTENSIONS_TEXT, QT_AUTOLOAD_EXTENSIONS_LONGTEXT, QT_AUTOLOAD_EXTENSIONS_TEXT, QT_AUTOLOAD_EXTENSIONS_LONGTEXT,
false ) 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_bool( "qt-blingbling" ) /* Suppressed since 1.0.0 */
add_obsolete_integer( "qt-display-mode" ) /* Suppressed since 1.1.0 */ add_obsolete_integer( "qt-display-mode" ) /* Suppressed since 1.1.0 */
......
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