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

Simple Preferences - Audio: Don't build widget not useful for your platform...

Simple Preferences - Audio: Don't build widget not useful for your platform instead of hiding them. Will remove some weirdness on windows for resizing.
parent f98ea953
...@@ -113,6 +113,16 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -113,6 +113,16 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
controls.append( control ); \ controls.append( control ); \
} }
#define CONFIG_GENERIC2( option, type, label, qcontrol ) \
p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \
if( p_config ) \
{ \
control = new type ## ConfigControl( VLC_OBJECT(p_intf), \
p_config, label, qcontrol, false ); \
controls.append( control ); \
}
#define CONFIG_GENERIC_NO_BOOL( option, type, label, qcontrol ) \ #define CONFIG_GENERIC_NO_BOOL( option, type, label, qcontrol ) \
p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \ p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \
if( p_config ) \ if( p_config ) \
...@@ -127,7 +137,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -127,7 +137,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
if( p_config ) \ if( p_config ) \
{ \ { \
control = new type ## ConfigControl( VLC_OBJECT(p_intf), \ control = new type ## ConfigControl( VLC_OBJECT(p_intf), \
p_config, label, ui.qcontrol, ui.qbutton, \ p_config, label, qcontrol, qbutton, \
false ); \ false ); \
controls.append( control ); \ controls.append( control ); \
} }
...@@ -186,7 +196,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -186,7 +196,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
#endif #endif
CONFIG_GENERIC_FILE( "snapshot-path", Directory, NULL, CONFIG_GENERIC_FILE( "snapshot-path", Directory, NULL,
snapshotsDirectory, snapshotsDirectoryBrowse ); ui.snapshotsDirectory, ui.snapshotsDirectoryBrowse );
CONFIG_GENERIC( "snapshot-prefix", String, NULL, snapshotsPrefix ); CONFIG_GENERIC( "snapshot-prefix", String, NULL, snapshotsPrefix );
CONFIG_GENERIC( "snapshot-sequential", Bool, NULL, CONFIG_GENERIC( "snapshot-sequential", Bool, NULL,
snapshotsSequentialNumbering ); snapshotsSequentialNumbering );
...@@ -201,18 +211,48 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -201,18 +211,48 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONFIG_GENERIC( "audio", Bool, NULL, enableAudio ); CONFIG_GENERIC( "audio", Bool, NULL, enableAudio );
#define audioCommon( name ) \
QWidget * name ## Control = new QWidget( ui.outputAudioBox ); \
QHBoxLayout * name ## Layout = new QHBoxLayout( name ## Control); \
name ## Layout->setMargin( 0 ); \
name ## Layout->setSpacing( 0 ); \
QLabel * name ## Label = new QLabel( qtr( "Device:" ), name ## Control ); \
name ## Label->setMinimumSize(QSize(100, 0)); \
name ## Layout->addWidget( name ## Label ); \
#define audioControl( name) \
audioCommon( name ) \
QComboBox * name ## Device = new QComboBox( name ## Control ); \
name ## Layout->addWidget( name ## Device ); \
name ## Label->setBuddy( name ## Device ); \
ui.outputAudioLayout->addWidget( name ## Control, ui.outputAudioLayout->rowCount(), 0, 1, -1 );
#define audioControl2( name) \
audioCommon( name ) \
QLineEdit * name ## Device = new QLineEdit( name ## Control ); \
name ## Layout->addWidget( name ## Device ); \
name ## Label->setBuddy( name ## Device ); \
QPushButton * name ## Browse = new QPushButton( qtr( "Browse..." ), name ## Control); \
name ## Layout->addWidget( name ## Browse ); \
ui.outputAudioLayout->addWidget( name ## Control, ui.outputAudioLayout->rowCount(), 0, 1, -1 );
/* hide if necessary */ /* hide if necessary */
#ifdef WIN32
ui.OSSControl->hide();
ui.alsaControl->hide();
#else
ui.DirectXControl->hide();
#endif
ui.lastfm_user_edit->hide(); ui.lastfm_user_edit->hide();
ui.lastfm_user_label->hide(); ui.lastfm_user_label->hide();
ui.lastfm_pass_edit->hide(); ui.lastfm_pass_edit->hide();
ui.lastfm_pass_label->hide(); ui.lastfm_pass_label->hide();
/* Build if necessary */
#ifdef WIN32
audioControl( DirectX );
optionWidgets.append( DirectXControl );
#else
audioControl( alsa );
optionWidgets.append( alsaControl );
audioControl2( OSS );
optionWidgets.append( OSSControl );
#endif
/* General Audio Options */ /* General Audio Options */
CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL, CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL,
defaultVolume ); defaultVolume );
...@@ -239,28 +279,26 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -239,28 +279,26 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONNECT( ui.outputModule, currentIndexChanged( int ), CONNECT( ui.outputModule, currentIndexChanged( int ),
this, updateAudioOptions( int ) ); this, updateAudioOptions( int ) );
/* platform specifics */
#ifdef WIN32 #ifdef WIN32
CONFIG_GENERIC( "directx-audio-device", IntegerList, CONFIG_GENERIC2( "directx-audio-device", IntegerList,
ui.DirectXLabel, DirectXDevice ); DirectXLabel, DirectXDevice );
#else #else
if( module_Exists( p_intf, "alsa" ) ) if( module_Exists( p_intf, "alsa" ) )
{ {
CONFIG_GENERIC( "alsadev" , StringList , ui.alsaLabel, CONFIG_GENERIC2( "alsadev" , StringList , alsaLabel,
alsaDevice ); alsaDevice );
} }
if( module_Exists( p_intf, "oss" ) ) if( module_Exists( p_intf, "oss" ) )
{ {
CONFIG_GENERIC_FILE( "dspdev" , File , ui.OSSLabel, OSSDevice, CONFIG_GENERIC_FILE( "dspdev" , File , OSSLabel, OSSDevice,
OSSBrowse ); OSSBrowse );
} }
#endif #endif
// File exists everywhere // File exists everywhere
CONFIG_GENERIC_FILE( "audiofile-file" , File , ui.fileLabel, CONFIG_GENERIC_FILE( "audiofile-file" , File , ui.fileLabel,
fileName, fileBrowseButton ); ui.fileName, ui.fileBrowseButton );
optionWidgets.append( ui.alsaControl );
optionWidgets.append( ui.OSSControl );
optionWidgets.append( ui.DirectXControl );
optionWidgets.append( ui.fileControl ); optionWidgets.append( ui.fileControl );
optionWidgets.append( ui.outputModule ); optionWidgets.append( ui.outputModule );
optionWidgets.append( ui.volNormBox ); optionWidgets.append( ui.volNormBox );
...@@ -438,8 +476,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -438,8 +476,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONFIG_GENERIC( "qt-display-mode", IntegerList, NULL, CONFIG_GENERIC( "qt-display-mode", IntegerList, NULL,
displayModeBox ); displayModeBox );
CONFIG_GENERIC( "embedded-video", Bool, NULL, embedVideo ); CONFIG_GENERIC( "embedded-video", Bool, NULL, embedVideo );
CONFIG_GENERIC_FILE( "skins2-last", File, NULL, fileSkin, CONFIG_GENERIC_FILE( "skins2-last", File, NULL, ui.fileSkin,
skinBrowse ); ui.skinBrowse );
CONFIG_GENERIC( "album-art", IntegerList, ui.artFetchLabel, CONFIG_GENERIC( "album-art", IntegerList, ui.artFetchLabel,
artFetcher ); artFetcher );
...@@ -471,8 +509,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -471,8 +509,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONFIG_GENERIC( "subsdec-encoding", StringList, NULL, encoding ); CONFIG_GENERIC( "subsdec-encoding", StringList, NULL, encoding );
CONFIG_GENERIC( "sub-language", String, NULL, preferredLanguage ); CONFIG_GENERIC( "sub-language", String, NULL, preferredLanguage );
CONFIG_GENERIC_FILE( "freetype-font", File, NULL, font, CONFIG_GENERIC_FILE( "freetype-font", File, NULL, ui.font,
fontBrowse ); ui.fontBrowse );
CONFIG_GENERIC( "freetype-color", IntegerList, NULL, fontColor ); CONFIG_GENERIC( "freetype-color", IntegerList, NULL, fontColor );
CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList, NULL, CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList, NULL,
fontSize ); fontSize );
...@@ -510,7 +548,6 @@ void SPrefsPanel::updateAudioOptions( int number) ...@@ -510,7 +548,6 @@ void SPrefsPanel::updateAudioOptions( int number)
{ {
QString value = qobject_cast<QComboBox *>(optionWidgets[audioOutCoB]) QString value = qobject_cast<QComboBox *>(optionWidgets[audioOutCoB])
->itemData( number ).toString(); ->itemData( number ).toString();
#ifdef WIN32 #ifdef WIN32
optionWidgets[directxW]->setVisible( ( value == "directx" ) ); optionWidgets[directxW]->setVisible( ( value == "directx" ) );
#else #else
......
...@@ -61,7 +61,17 @@ enum { ...@@ -61,7 +61,17 @@ enum {
CachingHigher = 500 CachingHigher = 500
}; };
enum { alsaW = 0, ossW, directxW, fileW, audioOutCoB, normalizerChB, volLW }; enum {
#ifdef WIN32
directxW,
#else
alsaW,
ossW,
#endif
fileW,
audioOutCoB,
normalizerChB,
volLW };
enum { recordChB, dumpChB, bandwidthChB, timeshiftChB, inputLE, cachingCoB }; enum { recordChB, dumpChB, bandwidthChB, timeshiftChB, inputLE, cachingCoB };
enum { skinRB, qtRB }; enum { skinRB, qtRB };
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>550</width> <width>541</width>
<height>732</height> <height>607</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_3" > <widget class="QGroupBox" name="audioBox" >
<property name="title" > <property name="title" >
<string>_("General Audio")</string> <string>_("General Audio")</string>
</property> </property>
...@@ -153,11 +153,11 @@ ...@@ -153,11 +153,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_2" > <widget class="QGroupBox" name="outputAudioBox" >
<property name="title" > <property name="title" >
<string>Output</string> <string>Output</string>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout" name="outputAudioLayout" >
<item row="0" column="0" > <item row="0" column="0" >
<widget class="QLabel" name="label_3" > <widget class="QLabel" name="label_3" >
<property name="minimumSize" > <property name="minimumSize" >
...@@ -176,6 +176,9 @@ ...@@ -176,6 +176,9 @@
</item> </item>
<item row="0" column="1" > <item row="0" column="1" >
<widget class="QComboBox" name="outputModule" > <widget class="QComboBox" name="outputModule" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" > <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch> <horstretch>0</horstretch>
...@@ -185,110 +188,14 @@ ...@@ -185,110 +188,14 @@
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2" > <item row="1" column="0" colspan="2" >
<widget class="QWidget" native="1" name="alsaControl" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="alsaLabel" >
<property name="minimumSize" >
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>_("Device")</string>
</property>
<property name="buddy" >
<cstring>alsaDevice</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="alsaDevice" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2" >
<widget class="QWidget" native="1" name="DirectXControl" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="DirectXLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>_("Device")</string>
</property>
<property name="buddy" >
<cstring>DirectXDevice</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="DirectXDevice" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QWidget" native="1" name="OSSControl" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="OSSLabel" >
<property name="minimumSize" >
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>_("Device")</string>
</property>
<property name="buddy" >
<cstring>OSSDevice</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="OSSDevice" />
</item>
<item>
<widget class="QPushButton" name="OSSBrowse" >
<property name="text" >
<string>_("Browse...")</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="2" >
<widget class="QWidget" native="1" name="fileControl" > <widget class="QWidget" native="1" name="fileControl" >
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="fileLabel" > <widget class="QLabel" name="fileLabel" >
<property name="minimumSize" > <property name="minimumSize" >
...@@ -365,7 +272,7 @@ ...@@ -365,7 +272,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_4" > <widget class="QGroupBox" name="lastFMBox" >
<property name="title" > <property name="title" >
<string>_("Last.fm")</string> <string>_("Last.fm")</string>
</property> </property>
...@@ -421,10 +328,6 @@ ...@@ -421,10 +328,6 @@
<tabstop>detectionDolby</tabstop> <tabstop>detectionDolby</tabstop>
<tabstop>preferredAudioLanguage</tabstop> <tabstop>preferredAudioLanguage</tabstop>
<tabstop>outputModule</tabstop> <tabstop>outputModule</tabstop>
<tabstop>alsaDevice</tabstop>
<tabstop>DirectXDevice</tabstop>
<tabstop>OSSDevice</tabstop>
<tabstop>OSSBrowse</tabstop>
<tabstop>fileName</tabstop> <tabstop>fileName</tabstop>
<tabstop>fileBrowseButton</tabstop> <tabstop>fileBrowseButton</tabstop>
<tabstop>headphoneEffect</tabstop> <tabstop>headphoneEffect</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