Commit bb89e917 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: simplify previewWidgets creation.

Btw, you really shouldn't use C cast on QObjects
parent b0b8f87c
...@@ -200,8 +200,7 @@ void ConfigControl::doApply( intf_thread_t *p_intf ) ...@@ -200,8 +200,7 @@ void ConfigControl::doApply( intf_thread_t *p_intf )
/******************************************************* /*******************************************************
* Simple widgets * Simple widgets
*******************************************************/ *******************************************************/
InterfacePreviewWidget::InterfacePreviewWidget InterfacePreviewWidget::InterfacePreviewWidget ( QWidget *parent ) : QLabel( parent )
( QWidget *parent ) : QLabel( parent, 0 )
{ {
setGeometry( 0, 0, 128, 100 ); setGeometry( 0, 0, 128, 100 );
setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
......
...@@ -64,6 +64,10 @@ class InterfacePreviewWidget : public QLabel ...@@ -64,6 +64,10 @@ class InterfacePreviewWidget : public QLabel
public: public:
InterfacePreviewWidget( QWidget * ); InterfacePreviewWidget( QWidget * );
public slots: public slots:
/* 0: sample_classic, aka VLC 0.8.6
1: sample_complete, aka MPC
2: sample_minimal, aka WMP12 minimal
3: sample_skins */
void setPreview( int ); void setPreview( int );
}; };
......
...@@ -542,15 +542,9 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -542,15 +542,9 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
ui.native_zone->setEnabled( ui.qt4->isChecked() ); ui.native_zone->setEnabled( ui.qt4->isChecked() );
CONNECT( ui.qt4, toggled( bool ), ui.native_zone, setEnabled( bool ) ); CONNECT( ui.qt4, toggled( bool ), ui.native_zone, setEnabled( bool ) );
InterfacePreviewWidget *preview = new InterfacePreviewWidget( this );
( (QGridLayout *) ui.LooknfeelBox->layout() )->
addWidget( preview, 1, 0, 1, 2 );
CONNECT( ui.displayModeBox, currentIndexChanged( int ), CONNECT( ui.displayModeBox, currentIndexChanged( int ),
preview, setPreview( int ) ); ui.mainPreview, setPreview( int ) );
InterfacePreviewWidget *skinspreview = new InterfacePreviewWidget( this ); ui.skinsPreview->setPreview( 3 ); /* skins_preview resource index */
skinspreview->setPreview(3); /* skins_preview resource index */
( (QGridLayout *) ui.LooknfeelBox->layout() )->
addWidget( skinspreview, 7, 0, 1, 2 );
CONFIG_GENERIC( "qt-display-mode", IntegerList, ui.displayLabel, CONFIG_GENERIC( "qt-display-mode", IntegerList, ui.displayLabel,
displayModeBox ); displayModeBox );
......
...@@ -61,6 +61,9 @@ ...@@ -61,6 +61,9 @@
<property name="text"> <property name="text">
<string>Album art download policy:</string> <string>Album art download policy:</string>
</property> </property>
<property name="buddy">
<cstring>artFetcher</cstring>
</property>
</widget> </widget>
</item> </item>
<item row="0" column="2" colspan="2"> <item row="0" column="2" colspan="2">
...@@ -126,6 +129,9 @@ ...@@ -126,6 +129,9 @@
<property name="margin"> <property name="margin">
<number>5</number> <number>5</number>
</property> </property>
<property name="buddy">
<cstring>recentlyPlayedFilters</cstring>
</property>
</widget> </widget>
</item> </item>
<item row="2" column="2" colspan="2"> <item row="2" column="2" colspan="2">
...@@ -164,6 +170,9 @@ ...@@ -164,6 +170,9 @@
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
<property name="buddy">
<cstring>language</cstring>
</property>
</widget> </widget>
</item> </item>
<item> <item>
...@@ -392,6 +401,9 @@ ...@@ -392,6 +401,9 @@
<property name="text"> <property name="text">
<string>Force window style:</string> <string>Force window style:</string>
</property> </property>
<property name="buddy">
<cstring>stylesCombo</cstring>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
...@@ -410,11 +422,31 @@ ...@@ -410,11 +422,31 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2">
<widget class="InterfacePreviewWidget" name="mainPreview">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="buddy">
<cstring>displayModeBox</cstring>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="InterfacePreviewWidget" name="skinsPreview"/>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>InterfacePreviewWidget</class>
<extends>QLabel</extends>
<header>components/preferences_widgets.hpp</header>
</customwidget>
</customwidgets>
<tabstops> <tabstops>
<tabstop>OneInterfaceMode</tabstop> <tabstop>OneInterfaceMode</tabstop>
<tabstop>artFetcher</tabstop> <tabstop>artFetcher</tabstop>
......
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