@@ -118,6 +118,25 @@ struct ProxySetting {
118
118
static ProxySetting ParseProxyString (const std::string& proxy);
119
119
static std::string ProxyString (bool is_set, QString ip, QString port);
120
120
121
+ static const QLatin1String fontchoice_str_embedded{" embedded" };
122
+ static const QLatin1String fontchoice_str_best_system{" best_system" };
123
+ static const QString fontchoice_str_custom_prefix{QStringLiteral (" custom, " )};
124
+
125
+ OptionsModel::FontChoice OptionsModel::FontChoiceFromString (const QString& s)
126
+ {
127
+ if (s == fontchoice_str_best_system) {
128
+ return FontChoiceAbstract::BestSystemFont;
129
+ } else if (s == fontchoice_str_embedded) {
130
+ return FontChoiceAbstract::EmbeddedFont;
131
+ } else if (s.startsWith (fontchoice_str_custom_prefix)) {
132
+ QFont f;
133
+ f.fromString (s.mid (fontchoice_str_custom_prefix.size ()));
134
+ return f;
135
+ } else {
136
+ return FontChoiceAbstract::EmbeddedFont; // default
137
+ }
138
+ }
139
+
121
140
OptionsModel::OptionsModel (interfaces::Node& node, QObject *parent) :
122
141
QAbstractListModel(parent), m_node{node}
123
142
{
@@ -215,13 +234,14 @@ bool OptionsModel::Init(bilingual_str& error)
215
234
#endif
216
235
217
236
// Display
218
- if (!settings.contains (" UseEmbeddedMonospacedFont" )) {
219
- settings.setValue (" UseEmbeddedMonospacedFont" , " true" );
220
- }
221
- if (settings.value (" UseEmbeddedMonospacedFont" ).toBool ()) {
222
- m_font_money = FontChoiceAbstract::EmbeddedFont;
223
- } else {
224
- m_font_money = FontChoiceAbstract::BestSystemFont;
237
+ if (settings.contains (" FontForMoney" )) {
238
+ m_font_money = FontChoiceFromString (settings.value (" FontForMoney" ).toString ());
239
+ } else if (settings.contains (" UseEmbeddedMonospacedFont" )) {
240
+ if (settings.value (" UseEmbeddedMonospacedFont" ).toBool ()) {
241
+ m_font_money = FontChoiceAbstract::EmbeddedFont;
242
+ } else {
243
+ m_font_money = FontChoiceAbstract::BestSystemFont;
244
+ }
225
245
}
226
246
Q_EMIT fontForMoneyChanged (getFontForMoney ());
227
247
@@ -615,6 +635,7 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
615
635
m_font_money = FontChoiceAbstract::BestSystemFont;
616
636
}
617
637
settings.setValue (" UseEmbeddedMonospacedFont" , use_embedded_monospaced_font);
638
+ settings.remove (" FontForMoney" );
618
639
Q_EMIT fontForMoneyChanged (getFontForMoney ());
619
640
break ;
620
641
}
0 commit comments