2424#include < QTabWidget>
2525#include < QVBoxLayout>
2626#include < QDialog>
27+ #include < QFontComboBox>
2728
2829using Quotient::SettingsGroup;
2930
@@ -59,6 +60,42 @@ GeneralPage::GeneralPage(SettingsDialog *parent):
5960{
6061 Ui_GeneralPage::setupUi (this );
6162
63+ // uiFont
64+ const auto curUIFontFamily = SettingsGroup (" UI" ).value (" Fonts/family" , " " ).toString ();
65+ uiFontFamily->insertItem (0 , tr (" system default" ));
66+ if (curUIFontFamily == " " ) {
67+ uiFontFamily->setCurrentIndex (0 );
68+ uiFontPointSize->setDisabled (true );
69+ } else {
70+ uiFontFamily->setCurrentIndex (uiFontFamily->findText (curUIFontFamily));
71+ }
72+
73+ connect (uiFontFamily, &QFontComboBox::currentFontChanged, this , [this ](const QFont &font) {
74+ QString value;
75+ if (font.family () == tr (" system default" )) {
76+ uiFontPointSize->setDisabled (true );
77+ SettingsGroup (" UI" ).setValue (" Fonts/pointSize" , " " );
78+ value = " " ;
79+ } else {
80+ uiFontPointSize->setDisabled (false );
81+ if (uiFontPointSize->currentIndex () == -1 ) {
82+ uiFontPointSize->setCurrentIndex (3 );
83+ SettingsGroup (" UI" ).setValue (" Fonts/pointSize" , " 9" );
84+ }
85+ value = font.family ();
86+ }
87+ SettingsGroup (" UI" ).setValue (" Fonts/family" , value);
88+ });
89+
90+ for (int i = 6 ; i <= 18 ; i++)
91+ uiFontPointSize->addItem (QString::number (i));
92+ const auto curUIFontPointSize = SettingsGroup (" UI" ).value (" Fonts/pointSize" , " " );
93+ uiFontPointSize->setCurrentIndex (curUIFontPointSize.toInt () - 6 );
94+
95+ connect (uiFontPointSize, QOverload<const QString &>::of (&QComboBox::currentIndexChanged), this , [this ](const QString &text) {
96+ SettingsGroup (" UI" ).setValue (" Fonts/pointSize" , text);
97+ });
98+
6299 // closeToTray
63100 closeToTray->setChecked (SettingsGroup (" UI" ).value (" close_to_tray" , false ).toBool ());
64101 connect (closeToTray, &QAbstractButton::toggled, this , [=](bool checked) {
@@ -78,6 +115,44 @@ GeneralPage::GeneralPage(SettingsDialog *parent):
78115 emit timelineChanged ();
79116 });
80117
118+ // timelineFont
119+ const auto curTimelineFontFamily = SettingsGroup (" UI" ).value (" Fonts/timeline_family" , " " ).toString ();
120+ timelineFontFamily->insertItem (0 , tr (" system default" ));
121+ if (curTimelineFontFamily == " " ) {
122+ timelineFontFamily->setCurrentIndex (0 );
123+ timelineFontPointSize->setDisabled (true );
124+ } else {
125+ timelineFontFamily->setCurrentIndex (timelineFontFamily->findText (curTimelineFontFamily));
126+ }
127+
128+ connect (timelineFontFamily, &QFontComboBox::currentFontChanged, this , [this ](const QFont &font) {
129+ QString value;
130+ if (font.family () == tr (" system default" )) {
131+ timelineFontPointSize->setDisabled (true );
132+ SettingsGroup (" UI" ).setValue (" Fonts/timeline_pointSize" , " " );
133+ value = " " ;
134+ } else {
135+ timelineFontPointSize->setDisabled (false );
136+ if (timelineFontPointSize->currentIndex () == -1 ) {
137+ timelineFontPointSize->setCurrentIndex (3 );
138+ SettingsGroup (" UI" ).setValue (" Fonts/timeline_pointSize" , " 9" );
139+ }
140+ value = font.family ();
141+ }
142+ SettingsGroup (" UI" ).setValue (" Fonts/timeline_family" , value);
143+ emit timelineChanged ();
144+ });
145+
146+ for (int i = 6 ; i <= 18 ; i++)
147+ timelineFontPointSize->addItem (QString::number (i));
148+ const auto curTimelineFontPointSize = SettingsGroup (" UI" ).value (" Fonts/timeline_pointSize" , " " );
149+ timelineFontPointSize->setCurrentIndex (curTimelineFontPointSize.toInt () - 6 );
150+
151+ connect (timelineFontPointSize, QOverload<const QString &>::of (&QComboBox::currentIndexChanged), this , [this ](const QString &text) {
152+ SettingsGroup (" UI" ).setValue (" Fonts/timeline_pointSize" , text);
153+ emit timelineChanged ();
154+ });
155+
81156 // useShuttleScrollbar
82157 useShuttleScrollbar->setChecked (SettingsGroup (" UI" ).value (" use_shuttle_dial" , true ).toBool ());
83158 connect (useShuttleScrollbar, &QAbstractButton::toggled, this , [=](bool checked) {
0 commit comments