vlc | branch: master | Jean-Baptiste Kempf <[email protected]> | Tue Nov 1 02:13:15 2011 +0100| [9cd51319488d6a2054cfb3f81c6f0a1eebce18eb] | committer: Jean-Baptiste Kempf
Qt, sprefs: correctly implement freetype configurations Close #5421 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9cd51319488d6a2054cfb3f81c6f0a1eebce18eb --- modules/gui/qt4/components/simple_preferences.cpp | 33 ++++++- modules/gui/qt4/components/simple_preferences.hpp | 2 + modules/gui/qt4/ui/sprefs_subtitles.ui | 120 +++++++++++++------- 3 files changed, 111 insertions(+), 44 deletions(-) diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp index 0735d0a..6a15dc2 100644 --- a/modules/gui/qt4/components/simple_preferences.cpp +++ b/modules/gui/qt4/components/simple_preferences.cpp @@ -640,15 +640,25 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, encoding ); CONFIG_GENERIC( "sub-language", String, ui.subLangLabel, preferredLanguage ); + + CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList, + ui.fontSizeLabel, fontSize ); + CONFIG_GENERIC_NO_BOOL( "freetype-font", Font, ui.fontLabel, font ); CONFIG_GENERIC_NO_BOOL( "freetype-color", Color, ui.fontColorLabel, fontColor ); - CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList, - ui.fontSizeLabel, fontSize ); CONFIG_GENERIC( "freetype-outline-thickness", IntegerList, ui.fontEffectLabel, effect ); + CONFIG_GENERIC_NO_BOOL( "freetype-outline-color", Color, ui.outlineColorLabel, + outlineColor ); + CONFIG_GENERIC_NO_BOOL( "sub-margin", Integer, ui.subsPosLabel, subsPosition ); + ui.shadowCheck->setChecked( config_GetInt( p_intf, "freetype-shadow-opacity" ) > 0 ); + ui.backgroundCheck->setChecked( config_GetInt( p_intf, "freetype-background-opacity" ) > 0 ); + optionWidgets.append( ui.shadowCheck ); + optionWidgets.append( ui.backgroundCheck ); + END_SPREFS_CAT; case SPrefsHotkeys: @@ -827,6 +837,25 @@ void SPrefsPanel::apply() config_PutPsz( p_intf, "audio-filter", qtu( qs_filter.join( ":" ) ) ); break; } + case SPrefsSubtitles: + { + bool b_checked = qobject_cast<QCheckBox *>(optionWidgets[shadowCB])->isChecked(); + if( b_checked && config_GetInt( p_intf, "freetype-shadow-opacity" ) == 0 ) { + config_PutInt( p_intf, "freetype-shadow-opacity", 128 ); + } + else if (!b_checked ) { + config_PutInt( p_intf, "freetype-shadow-opacity", 0 ); + } + + b_checked = qobject_cast<QCheckBox *>(optionWidgets[backgroundCB])->isChecked(); + if( b_checked && config_GetInt( p_intf, "freetype-background-opacity" ) == 0 ) { + config_PutInt( p_intf, "freetype-background-opacity", 128 ); + } + else if (!b_checked ) { + config_PutInt( p_intf, "freetype-background-opacity", 0 ); + } + + } } } diff --git a/modules/gui/qt4/components/simple_preferences.hpp b/modules/gui/qt4/components/simple_preferences.hpp index e3e7e71..50996fb 100644 --- a/modules/gui/qt4/components/simple_preferences.hpp +++ b/modules/gui/qt4/components/simple_preferences.hpp @@ -81,6 +81,7 @@ enum { }; enum { inputLE, cachingCoB }; enum { skinRB, qtRB, styleCB }; +enum { shadowCB, backgroundCB }; class ConfigControl; class QComboBox; @@ -115,6 +116,7 @@ public: virtual ~SPrefsPanel(); void apply(); void clean(); + private: intf_thread_t *p_intf; QList<ConfigControl *> controls; diff --git a/modules/gui/qt4/ui/sprefs_subtitles.ui b/modules/gui/qt4/ui/sprefs_subtitles.ui index 033f4bd..95313dd 100644 --- a/modules/gui/qt4/ui/sprefs_subtitles.ui +++ b/modules/gui/qt4/ui/sprefs_subtitles.ui @@ -7,17 +7,14 @@ <rect> <x>0</x> <y>0</y> - <width>758</width> - <height>446</height> + <width>778</width> + <height>614</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> - <layout class="QVBoxLayout"> - <property name="spacing"> - <number>10</number> - </property> + <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QGroupBox" name="groupBox_3"> <property name="title"> @@ -125,19 +122,9 @@ <property name="title"> <string>Subtitles effects</string> </property> - <layout class="QGridLayout" rowstretch="0,0,0,0,0" columnstretch="0,0"> - <item row="3" column="1"> - <widget class="QComboBox" name="effect"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="fontEffectLabel"> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="fontLabel"> <property name="minimumSize"> <size> <width>250</width> @@ -145,19 +132,18 @@ </size> </property> <property name="text"> - <string>Outline thickness</string> + <string>Font</string> </property> <property name="buddy"> - <cstring>effect</cstring> + <cstring>font</cstring> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QPushButton" name="fontColor"> - </widget> + <item row="0" column="1" colspan="3"> + <widget class="QFontComboBox" name="font"/> </item> - <item row="2" column="0"> - <widget class="QLabel" name="fontColorLabel"> + <item row="1" column="0"> + <widget class="QLabel" name="fontSizeLabel"> <property name="minimumSize"> <size> <width>250</width> @@ -165,10 +151,10 @@ </size> </property> <property name="text"> - <string>Font color</string> + <string>Font size</string> </property> <property name="buddy"> - <cstring>fontColor</cstring> + <cstring>fontSize</cstring> </property> </widget> </item> @@ -182,24 +168,37 @@ </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="fontSizeLabel"> - <property name="minimumSize"> + <item row="1" column="2"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Preferred</enum> + </property> + <property name="sizeHint" stdset="0"> <size> - <width>250</width> - <height>0</height> + <width>20</width> + <height>20</height> </size> </property> + </spacer> + </item> + <item row="1" column="3"> + <widget class="QLabel" name="fontColorLabel"> <property name="text"> - <string>Font size</string> + <string>Font color</string> </property> <property name="buddy"> - <cstring>fontSize</cstring> + <cstring>fontColor</cstring> </property> </widget> </item> - <item row="0" column="0"> - <widget class="QLabel" name="fontLabel"> + <item row="1" column="4"> + <widget class="QPushButton" name="fontColor"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="fontEffectLabel"> <property name="minimumSize"> <size> <width>250</width> @@ -207,10 +206,47 @@ </size> </property> <property name="text"> - <string>Font</string> + <string>Outline thickness</string> </property> <property name="buddy"> - <cstring>font</cstring> + <cstring>effect</cstring> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="effect"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLabel" name="outlineColorLabel"> + <property name="text"> + <string>Outline color</string> + </property> + <property name="buddy"> + <cstring>outlineColor</cstring> + </property> + </widget> + </item> + <item row="2" column="4"> + <widget class="QPushButton" name="outlineColor"/> + </item> + <item row="3" column="0"> + <widget class="QCheckBox" name="shadowCheck"> + <property name="text"> + <string>Add a shadow</string> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QCheckBox" name="backgroundCheck"> + <property name="text"> + <string>Add a background</string> </property> </widget> </item> @@ -230,9 +266,6 @@ </property> </widget> </item> - <item row="0" column="1"> - <widget class="QFontComboBox" name="font"/> - </item> <item row="4" column="1"> <widget class="QSpinBox" name="subsPosition"> <property name="maximumSize"> @@ -270,6 +303,9 @@ <tabstop>fontSize</tabstop> <tabstop>fontColor</tabstop> <tabstop>effect</tabstop> + <tabstop>outlineColor</tabstop> + <tabstop>shadowCheck</tabstop> + <tabstop>backgroundCheck</tabstop> <tabstop>subsPosition</tabstop> </tabstops> <resources/> _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
