[vlc-devel] commit: Qt: simplify previewWidgets creation. (Jean-Baptiste Kempf )
git version control
git at videolan.org
Fri Oct 16 11:23:11 CEST 2009
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Oct 12 15:00:44 2009 +0200| [bb89e917f8776892d417addf38599dd234624d17] | committer: Jean-Baptiste Kempf
Qt: simplify previewWidgets creation.
Btw, you really shouldn't use C cast on QObjects
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bb89e917f8776892d417addf38599dd234624d17
---
modules/gui/qt4/components/preferences_widgets.cpp | 3 +-
modules/gui/qt4/components/preferences_widgets.hpp | 4 ++
modules/gui/qt4/components/simple_preferences.cpp | 10 +-----
modules/gui/qt4/ui/sprefs_interface.ui | 32 ++++++++++++++++++++
4 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp
index 7e09a0e..396da64 100644
--- a/modules/gui/qt4/components/preferences_widgets.cpp
+++ b/modules/gui/qt4/components/preferences_widgets.cpp
@@ -200,8 +200,7 @@ void ConfigControl::doApply( intf_thread_t *p_intf )
/*******************************************************
* Simple widgets
*******************************************************/
-InterfacePreviewWidget::InterfacePreviewWidget
- ( QWidget *parent ) : QLabel( parent, 0 )
+InterfacePreviewWidget::InterfacePreviewWidget ( QWidget *parent ) : QLabel( parent )
{
setGeometry( 0, 0, 128, 100 );
setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
diff --git a/modules/gui/qt4/components/preferences_widgets.hpp b/modules/gui/qt4/components/preferences_widgets.hpp
index 1b235e8..420f835 100644
--- a/modules/gui/qt4/components/preferences_widgets.hpp
+++ b/modules/gui/qt4/components/preferences_widgets.hpp
@@ -64,6 +64,10 @@ class InterfacePreviewWidget : public QLabel
public:
InterfacePreviewWidget( QWidget * );
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 );
};
diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp
index f0e5647..3ffe3b3 100644
--- a/modules/gui/qt4/components/simple_preferences.cpp
+++ b/modules/gui/qt4/components/simple_preferences.cpp
@@ -542,15 +542,9 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
ui.native_zone->setEnabled( ui.qt4->isChecked() );
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 ),
- preview, setPreview( int ) );
- InterfacePreviewWidget *skinspreview = new InterfacePreviewWidget( this );
- skinspreview->setPreview(3); /* skins_preview resource index */
- ( (QGridLayout *) ui.LooknfeelBox->layout() )->
- addWidget( skinspreview, 7, 0, 1, 2 );
+ ui.mainPreview, setPreview( int ) );
+ ui.skinsPreview->setPreview( 3 ); /* skins_preview resource index */
CONFIG_GENERIC( "qt-display-mode", IntegerList, ui.displayLabel,
displayModeBox );
diff --git a/modules/gui/qt4/ui/sprefs_interface.ui b/modules/gui/qt4/ui/sprefs_interface.ui
index 6a4d576..b279c84 100644
--- a/modules/gui/qt4/ui/sprefs_interface.ui
+++ b/modules/gui/qt4/ui/sprefs_interface.ui
@@ -61,6 +61,9 @@
<property name="text">
<string>Album art download policy:</string>
</property>
+ <property name="buddy">
+ <cstring>artFetcher</cstring>
+ </property>
</widget>
</item>
<item row="0" column="2" colspan="2">
@@ -126,6 +129,9 @@
<property name="margin">
<number>5</number>
</property>
+ <property name="buddy">
+ <cstring>recentlyPlayedFilters</cstring>
+ </property>
</widget>
</item>
<item row="2" column="2" colspan="2">
@@ -164,6 +170,9 @@
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
+ <property name="buddy">
+ <cstring>language</cstring>
+ </property>
</widget>
</item>
<item>
@@ -392,6 +401,9 @@
<property name="text">
<string>Force window style:</string>
</property>
+ <property name="buddy">
+ <cstring>stylesCombo</cstring>
+ </property>
</widget>
</item>
</layout>
@@ -410,11 +422,31 @@
</property>
</widget>
</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>
</widget>
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>InterfacePreviewWidget</class>
+ <extends>QLabel</extends>
+ <header>components/preferences_widgets.hpp</header>
+ </customwidget>
+ </customwidgets>
<tabstops>
<tabstop>OneInterfaceMode</tabstop>
<tabstop>artFetcher</tabstop>
More information about the vlc-devel
mailing list