Changeset View
Changeset View
Standalone View
Standalone View
kcms/fonts/fonts.cpp
Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Line(s) | 255 | { | |||
---|---|---|---|---|---|
257 | KFontChooser::FontDiffFlags fontDiffFlags; | 257 | KFontChooser::FontDiffFlags fontDiffFlags; | ||
258 | int ret = KFontChooserDialog::getFontDiff(font, fontDiffFlags, KFontChooser::NoDisplayFlags); | 258 | int ret = KFontChooserDialog::getFontDiff(font, fontDiffFlags, KFontChooser::NoDisplayFlags); | ||
259 | 259 | | |||
260 | if (ret == QDialog::Accepted && fontDiffFlags) { | 260 | if (ret == QDialog::Accepted && fontDiffFlags) { | ||
261 | m_settings->setFont(applyFontDiff(m_settings->font(), font, fontDiffFlags)); | 261 | m_settings->setFont(applyFontDiff(m_settings->font(), font, fontDiffFlags)); | ||
262 | m_settings->setMenuFont(applyFontDiff(m_settings->menuFont(), font, fontDiffFlags)); | 262 | m_settings->setMenuFont(applyFontDiff(m_settings->menuFont(), font, fontDiffFlags)); | ||
263 | m_settings->setToolBarFont(applyFontDiff(m_settings->toolBarFont(), font, fontDiffFlags)); | 263 | m_settings->setToolBarFont(applyFontDiff(m_settings->toolBarFont(), font, fontDiffFlags)); | ||
264 | m_settings->setActiveFont(applyFontDiff(m_settings->activeFont(), font, fontDiffFlags)); | 264 | m_settings->setActiveFont(applyFontDiff(m_settings->activeFont(), font, fontDiffFlags)); | ||
265 | m_settings->setSmallestReadableFont(applyFontDiff(m_settings->smallestReadableFont(), font, fontDiffFlags)); | 265 | | ||
266 | QFont smallerSmallestFont = font; | ||||
267 | smallerSmallestFont.setPointSize(font.pointSize() - 2); | ||||
ahmadsamir: But if the user selects a very small size, then size - 2 will be even tinier. Maybe make it… | |||||
268 | m_settings->setSmallestReadableFont(applyFontDiff(m_settings->smallestReadableFont(), smallerSmallestFont, fontDiffFlags)); | ||||
266 | 269 | | |||
267 | const QFont adjustedFont = applyFontDiff(m_settings->fixed(), font, fontDiffFlags); | 270 | const QFont adjustedFont = applyFontDiff(m_settings->fixed(), font, fontDiffFlags); | ||
268 | if (QFontInfo(adjustedFont).fixedPitch()) { | 271 | if (QFontInfo(adjustedFont).fixedPitch()) { | ||
Nit-pick: I'd store font.pointSize() in a const int, and use that instead of calling pointSize() more than once. ahmadsamir: Nit-pick: I'd store font.pointSize() in a const int, and use that instead of calling pointSize… | |||||
269 | m_settings->setFixed(adjustedFont); | 272 | m_settings->setFixed(adjustedFont); | ||
Nit-pick can we align comment and code either higher than 8pt (comment) or >= 9 on the code bport: Nit-pick can we align comment and code either higher than 8pt (comment) or >= 9 on the code | |||||
270 | } | 273 | } | ||
271 | } | 274 | } | ||
272 | } | 275 | } | ||
273 | 276 | | |||
274 | QFont KFonts::applyFontDiff(const QFont &fnt, const QFont &newFont, int fontDiffFlags) | 277 | QFont KFonts::applyFontDiff(const QFont &fnt, const QFont &newFont, int fontDiffFlags) | ||
275 | { | 278 | { | ||
276 | QFont font(fnt); | 279 | QFont font(fnt); | ||
277 | 280 | | |||
Show All 38 Lines |
But if the user selects a very small size, then size - 2 will be even tinier. Maybe make it conditional for size >= 6 or 8?