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,
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 ) \
p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \
if( p_config ) \
......@@ -127,7 +137,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
if( p_config ) \
{ \
control = new type ## ConfigControl( VLC_OBJECT(p_intf), \
p_config, label, ui.qcontrol, ui.qbutton, \
p_config, label, qcontrol, qbutton, \
false ); \
controls.append( control ); \
}
......@@ -186,7 +196,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
#endif
CONFIG_GENERIC_FILE( "snapshot-path", Directory, NULL,
snapshotsDirectory, snapshotsDirectoryBrowse );
ui.snapshotsDirectory, ui.snapshotsDirectoryBrowse );
CONFIG_GENERIC( "snapshot-prefix", String, NULL, snapshotsPrefix );
CONFIG_GENERIC( "snapshot-sequential", Bool, NULL,
snapshotsSequentialNumbering );
......@@ -201,18 +211,48 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
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 */
#ifdef WIN32
ui.OSSControl->hide();
ui.alsaControl->hide();
#else
ui.DirectXControl->hide();
#endif
ui.lastfm_user_edit->hide();
ui.lastfm_user_label->hide();
ui.lastfm_pass_edit->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 */
CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL,
defaultVolume );
......@@ -239,28 +279,26 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONNECT( ui.outputModule, currentIndexChanged( int ),
this, updateAudioOptions( int ) );
/* platform specifics */
#ifdef WIN32
CONFIG_GENERIC( "directx-audio-device", IntegerList,
ui.DirectXLabel, DirectXDevice );
CONFIG_GENERIC2( "directx-audio-device", IntegerList,
DirectXLabel, DirectXDevice );
#else
if( module_Exists( p_intf, "alsa" ) )
{
CONFIG_GENERIC( "alsadev" , StringList , ui.alsaLabel,
CONFIG_GENERIC2( "alsadev" , StringList , alsaLabel,
alsaDevice );
}
if( module_Exists( p_intf, "oss" ) )
{
CONFIG_GENERIC_FILE( "dspdev" , File , ui.OSSLabel, OSSDevice,
CONFIG_GENERIC_FILE( "dspdev" , File , OSSLabel, OSSDevice,
OSSBrowse );
}
#endif
// File exists everywhere
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.outputModule );
optionWidgets.append( ui.volNormBox );
......@@ -438,8 +476,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONFIG_GENERIC( "qt-display-mode", IntegerList, NULL,
displayModeBox );
CONFIG_GENERIC( "embedded-video", Bool, NULL, embedVideo );
CONFIG_GENERIC_FILE( "skins2-last", File, NULL, fileSkin,
skinBrowse );
CONFIG_GENERIC_FILE( "skins2-last", File, NULL, ui.fileSkin,
ui.skinBrowse );
CONFIG_GENERIC( "album-art", IntegerList, ui.artFetchLabel,
artFetcher );
......@@ -471,8 +509,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONFIG_GENERIC( "subsdec-encoding", StringList, NULL, encoding );
CONFIG_GENERIC( "sub-language", String, NULL, preferredLanguage );
CONFIG_GENERIC_FILE( "freetype-font", File, NULL, font,
fontBrowse );
CONFIG_GENERIC_FILE( "freetype-font", File, NULL, ui.font,
ui.fontBrowse );
CONFIG_GENERIC( "freetype-color", IntegerList, NULL, fontColor );
CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList, NULL,
fontSize );
......@@ -510,7 +548,6 @@ void SPrefsPanel::updateAudioOptions( int number)
{
QString value = qobject_cast<QComboBox *>(optionWidgets[audioOutCoB])
->itemData( number ).toString();
#ifdef WIN32
optionWidgets[directxW]->setVisible( ( value == "directx" ) );
#else
......
......@@ -61,7 +61,17 @@ enum {
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 { skinRB, qtRB };
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>550</width>
<height>732</height>
<width>541</width>
<height>607</height>
</rect>
</property>
<property name="windowTitle" >
......@@ -25,7 +25,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3" >
<widget class="QGroupBox" name="audioBox" >
<property name="title" >
<string>_("General Audio")</string>
</property>
......@@ -153,11 +153,11 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2" >
<widget class="QGroupBox" name="outputAudioBox" >
<property name="title" >
<string>Output</string>
</property>
<layout class="QGridLayout" >
<layout class="QGridLayout" name="outputAudioLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_3" >
<property name="minimumSize" >
......@@ -176,73 +176,9 @@
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="outputModule" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<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 name="enabled" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="DirectXDevice" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
......@@ -251,44 +187,15 @@
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QWidget" native="1" name="OSSControl" >
<item row="1" column="0" colspan="2" >
<widget class="QWidget" native="1" name="fileControl" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="OSSLabel" >
<property name="minimumSize" >
<size>
<width>100</width>
<height>0</height>
</size>
<property name="spacing">
<number>0</number>
</property>
<property name="text" >
<string>_("Device")</string>
</property>
<property name="buddy" >
<cstring>OSSDevice</cstring>
<property name="margin">
<number>0</number>
</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" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="fileLabel" >
<property name="minimumSize" >
......@@ -365,7 +272,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4" >
<widget class="QGroupBox" name="lastFMBox" >
<property name="title" >
<string>_("Last.fm")</string>
</property>
......@@ -421,10 +328,6 @@
<tabstop>detectionDolby</tabstop>
<tabstop>preferredAudioLanguage</tabstop>
<tabstop>outputModule</tabstop>
<tabstop>alsaDevice</tabstop>
<tabstop>DirectXDevice</tabstop>
<tabstop>OSSDevice</tabstop>
<tabstop>OSSBrowse</tabstop>
<tabstop>fileName</tabstop>
<tabstop>fileBrowseButton</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