Add a way to reset font family in settings.

This commit is contained in:
Julien Wadel 2023-02-27 17:02:57 +01:00
parent ee526c262c
commit 6604d2874b
3 changed files with 30 additions and 2 deletions

View file

@ -1456,7 +1456,12 @@ QFont SettingsModel::getTextMessageFont() const{
}
void SettingsModel::setTextMessageFont(const QFont& font){
mConfig->setString(UiSection, "text_message_font", Utils::appStringToCoreString(font.family()));
QString family;
if(font == QFont())
family = Constants::DefaultFont;
else
family = font.family();
mConfig->setString(UiSection, "text_message_font", Utils::appStringToCoreString(family));
setTextMessageFontSize(font.pointSize());
emit textMessageFontChanged(font);
}
@ -1477,7 +1482,12 @@ QFont SettingsModel::getEmojiFont() const{
}
void SettingsModel::setEmojiFont(const QFont& font){
mConfig->setString(UiSection, "emoji_font", Utils::appStringToCoreString(font.family()));
QString family;
if(font == QFont())
family = Constants::DefaultEmojiFont;
else
family = font.family();
mConfig->setString(UiSection, "emoji_font", Utils::appStringToCoreString(family));
emit emojiFontChanged(font);
}

View file

@ -92,6 +92,13 @@ TabContainer {
pointSize: FormTableStyle.entry.text.pointSize
}
}
ActionButton{
isCustom: true
backgroundRadius: 90
colorSet: SettingsUiStyle.cancel
onClicked: SettingsModel.textMessageFont = ''
Layout.preferredWidth: 25
}
}
}

View file

@ -18,4 +18,15 @@ QtObject {
property var foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 's_h_b_fg')
property var foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 's_p_b_fg')
}
property QtObject cancel: QtObject {
property int iconSize: 25
property string icon : 'cancel_custom'
property string name : 'cancel'
property var backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_n', icon, 'me_n_b_bg')
property var backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_h', icon, 'me_h_b_bg')
property var backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_p', icon, 'me_p_b_bg')
property var foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_n', icon, 'me_n_b_fg')
property var foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 'me_h_b_fg')
property var foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 'me_p_b_fg')
}
}