Commit 9cd51319 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt, sprefs: correctly implement freetype configurations

Close #5421
parent aa1d5649
...@@ -640,15 +640,25 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -640,15 +640,25 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
encoding ); encoding );
CONFIG_GENERIC( "sub-language", String, ui.subLangLabel, CONFIG_GENERIC( "sub-language", String, ui.subLangLabel,
preferredLanguage ); 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-font", Font, ui.fontLabel, font );
CONFIG_GENERIC_NO_BOOL( "freetype-color", Color, ui.fontColorLabel, CONFIG_GENERIC_NO_BOOL( "freetype-color", Color, ui.fontColorLabel,
fontColor ); fontColor );
CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList,
ui.fontSizeLabel, fontSize );
CONFIG_GENERIC( "freetype-outline-thickness", IntegerList, CONFIG_GENERIC( "freetype-outline-thickness", IntegerList,
ui.fontEffectLabel, effect ); ui.fontEffectLabel, effect );
CONFIG_GENERIC_NO_BOOL( "freetype-outline-color", Color, ui.outlineColorLabel,
outlineColor );
CONFIG_GENERIC_NO_BOOL( "sub-margin", Integer, ui.subsPosLabel, subsPosition ); 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; END_SPREFS_CAT;
case SPrefsHotkeys: case SPrefsHotkeys:
...@@ -827,6 +837,25 @@ void SPrefsPanel::apply() ...@@ -827,6 +837,25 @@ void SPrefsPanel::apply()
config_PutPsz( p_intf, "audio-filter", qtu( qs_filter.join( ":" ) ) ); config_PutPsz( p_intf, "audio-filter", qtu( qs_filter.join( ":" ) ) );
break; 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 );
}
}
} }
} }
......
...@@ -81,6 +81,7 @@ enum { ...@@ -81,6 +81,7 @@ enum {
}; };
enum { inputLE, cachingCoB }; enum { inputLE, cachingCoB };
enum { skinRB, qtRB, styleCB }; enum { skinRB, qtRB, styleCB };
enum { shadowCB, backgroundCB };
class ConfigControl; class ConfigControl;
class QComboBox; class QComboBox;
...@@ -115,6 +116,7 @@ public: ...@@ -115,6 +116,7 @@ public:
virtual ~SPrefsPanel(); virtual ~SPrefsPanel();
void apply(); void apply();
void clean(); void clean();
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QList<ConfigControl *> controls; QList<ConfigControl *> controls;
......
...@@ -7,17 +7,14 @@ ...@@ -7,17 +7,14 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>758</width> <width>778</width>
<height>446</height> <height>614</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>10</number>
</property>
<item> <item>
<widget class="QGroupBox" name="groupBox_3"> <widget class="QGroupBox" name="groupBox_3">
<property name="title"> <property name="title">
...@@ -125,19 +122,9 @@ ...@@ -125,19 +122,9 @@
<property name="title"> <property name="title">
<string>Subtitles effects</string> <string>Subtitles effects</string>
</property> </property>
<layout class="QGridLayout" rowstretch="0,0,0,0,0" columnstretch="0,0"> <layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="1"> <item row="0" column="0">
<widget class="QComboBox" name="effect"> <widget class="QLabel" name="fontLabel">
<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">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>250</width> <width>250</width>
...@@ -145,19 +132,18 @@ ...@@ -145,19 +132,18 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Outline thickness</string> <string>Font</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>effect</cstring> <cstring>font</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="0" column="1" colspan="3">
<widget class="QPushButton" name="fontColor"> <widget class="QFontComboBox" name="font"/>
</widget>
</item> </item>
<item row="2" column="0"> <item row="1" column="0">
<widget class="QLabel" name="fontColorLabel"> <widget class="QLabel" name="fontSizeLabel">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>250</width> <width>250</width>
...@@ -165,10 +151,10 @@ ...@@ -165,10 +151,10 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Font color</string> <string>Font size</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>fontColor</cstring> <cstring>fontSize</cstring>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -182,24 +168,37 @@ ...@@ -182,24 +168,37 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="2">
<widget class="QLabel" name="fontSizeLabel"> <spacer name="horizontalSpacer">
<property name="minimumSize"> <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size> <size>
<width>250</width> <width>20</width>
<height>0</height> <height>20</height>
</size> </size>
</property> </property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QLabel" name="fontColorLabel">
<property name="text"> <property name="text">
<string>Font size</string> <string>Font color</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>fontSize</cstring> <cstring>fontColor</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="1" column="4">
<widget class="QLabel" name="fontLabel"> <widget class="QPushButton" name="fontColor"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="fontEffectLabel">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>250</width> <width>250</width>
...@@ -207,10 +206,47 @@ ...@@ -207,10 +206,47 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Font</string> <string>Outline thickness</string>
</property> </property>
<property name="buddy"> <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> </property>
</widget> </widget>
</item> </item>
...@@ -230,9 +266,6 @@ ...@@ -230,9 +266,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QFontComboBox" name="font"/>
</item>
<item row="4" column="1"> <item row="4" column="1">
<widget class="QSpinBox" name="subsPosition"> <widget class="QSpinBox" name="subsPosition">
<property name="maximumSize"> <property name="maximumSize">
...@@ -270,6 +303,9 @@ ...@@ -270,6 +303,9 @@
<tabstop>fontSize</tabstop> <tabstop>fontSize</tabstop>
<tabstop>fontColor</tabstop> <tabstop>fontColor</tabstop>
<tabstop>effect</tabstop> <tabstop>effect</tabstop>
<tabstop>outlineColor</tabstop>
<tabstop>shadowCheck</tabstop>
<tabstop>backgroundCheck</tabstop>
<tabstop>subsPosition</tabstop> <tabstop>subsPosition</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
......
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