New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make font size configurable #1872
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,8 @@ LookConfig::LookConfig(Settings &st) : ConfigWidget(st) { | |
qcbLanguage->addItem(displayName, QVariant(cc)); | ||
} | ||
|
||
updateFontInfo(); | ||
|
||
qcbExpand->addItem(tr("None"), Settings::NoChannels); | ||
qcbExpand->addItem(tr("Only with users"), Settings::ChannelsWithUsers); | ||
qcbExpand->addItem(tr("All"), Settings::AllChannels); | ||
|
@@ -103,6 +105,20 @@ LookConfig::LookConfig(Settings &st) : ConfigWidget(st) { | |
} | ||
} | ||
|
||
void LookConfig::updateFontInfo(QLabel *label, const QFont &font) { | ||
label->setText(QString::fromLatin1("%1, %2pt").arg(font.family()).arg(font.pointSize())); | ||
} | ||
|
||
void LookConfig::updateFontInfo() { | ||
updateFontInfo(s); | ||
} | ||
|
||
void LookConfig::updateFontInfo(const Settings &r) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
updateFontInfo(qlFontLogCurrent, r.qfFontLog); | ||
updateFontInfo(qlFontInputCurrent, r.qfFontInput); | ||
updateFontInfo(qlFontTreeCurrent, r.qfFontTree); | ||
} | ||
|
||
QString LookConfig::title() const { | ||
return tr("User Interface"); | ||
} | ||
|
@@ -169,6 +185,8 @@ void LookConfig::load(const Settings &r) { | |
} | ||
} | ||
|
||
updateFontInfo(r); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is this doing? It appears somewhat lonely in the code, so I think there should be a comment |
||
|
||
loadComboBox(qcbAlwaysOnTop, r.aotbAlwaysOnTop); | ||
|
||
loadComboBox(qcbExpand, r.ceExpand); | ||
|
@@ -297,3 +315,39 @@ void LookConfig::on_qcbAbbreviateChannelNames_stateChanged(int state) { | |
qleChannelSeparator->setEnabled(abbreviateNames); | ||
qleAbbreviationReplacement->setEnabled(abbreviateNames); | ||
} | ||
|
||
void LookConfig::changeFont(QFont & font) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a style-thing: There's an additional blank after the |
||
bool ok; | ||
QFont new_font = QFontDialog::getFont(&ok, font); | ||
if (ok) { | ||
font = new_font; | ||
updateFontInfo(); | ||
} | ||
} | ||
|
||
void LookConfig::on_qpbFontLog_clicked() { | ||
changeFont(s.qfFontLog); | ||
} | ||
|
||
void LookConfig::on_qpbFontInput_clicked() { | ||
changeFont(s.qfFontInput); | ||
} | ||
|
||
void LookConfig::on_qpbFontTree_clicked() { | ||
changeFont(s.qfFontTree); | ||
} | ||
|
||
void LookConfig::on_qpbFontAll_clicked() { | ||
QFont initial; | ||
if (s.qfFontLog == s.qfFontInput && s.qfFontInput == s.qfFontTree) { | ||
initial = s.qfFontLog; | ||
} | ||
bool ok; | ||
QFont new_font = QFontDialog::getFont(&ok, initial); | ||
if (ok) { | ||
s.qfFontLog = new_font; | ||
s.qfFontInput = new_font; | ||
s.qfFontTree = new_font; | ||
updateFontInfo(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -315,6 +315,10 @@ struct Settings { | |
/// Name of the style to use from theme. @see Themes | ||
QString themeStyleName; | ||
|
||
QFont qfFontLog; | ||
QFont qfFontInput; | ||
QFont qfFontTree; | ||
Comment on lines
+318
to
+320
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Documentation: A small Doxygen comment stating what these fonts are intended to be used for would improve readability |
||
|
||
QByteArray qbaMainWindowGeometry, qbaMainWindowState, qbaMinimalViewGeometry, qbaMinimalViewState, qbaSplitterState, | ||
qbaHeaderState; | ||
QByteArray qbaConfigGeometry; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's
s
? I think there should be a comment here explaining what this call is supposed to do