From cf553792a9aaa87f699e36465130192d994705ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 16 Jan 2011 10:25:22 +0000 Subject: [PATCH] Forward port 1214767: Honor font settings in Aurorae. CCBUG: 249681 svn path=/trunk/KDE/kdebase/workspace/; revision=1214768 --- clients/aurorae/src/aurorae.cpp | 6 ++++++ clients/aurorae/src/lib/auroraescene.cpp | 14 ++++++++++++++ clients/aurorae/src/lib/auroraescene.h | 15 +++++++++++++++ clients/aurorae/src/lib/auroraetab.cpp | 2 ++ 4 files changed, 37 insertions(+) diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index 6d8a5c0ce2..60ec2b2c1a 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -203,6 +203,8 @@ void AuroraeClient::init() m_scene->setShade(isShade()); m_scene->setKeepAbove(keepAbove()); m_scene->setKeepBelow(keepBelow()); + m_scene->setFont(KDecoration::options()->font(true), true); + m_scene->setFont(KDecoration::options()->font(false), false); AuroraeFactory::instance()->theme()->setCompositingActive(compositingActive()); } @@ -321,6 +323,10 @@ void AuroraeClient::reset(long unsigned int changed) m_scene->setButtons(options()->customButtonPositions() ? options()->titleButtonsLeft() : AuroraeFactory::instance()->theme()->defaultButtonsLeft(), options()->customButtonPositions() ? options()->titleButtonsRight() : AuroraeFactory::instance()->theme()->defaultButtonsRight()); } + if (changed & SettingFont) { + m_scene->setFont(KDecoration::options()->font(true), true); + m_scene->setFont(KDecoration::options()->font(false), false); + } KDecoration::reset(changed); } diff --git a/clients/aurorae/src/lib/auroraescene.cpp b/clients/aurorae/src/lib/auroraescene.cpp index d16aa0cb1f..597dde19ba 100644 --- a/clients/aurorae/src/lib/auroraescene.cpp +++ b/clients/aurorae/src/lib/auroraescene.cpp @@ -1092,6 +1092,20 @@ const QString &AuroraeScene::rightButtons() const return m_rightButtonOrder; } +const QFont &AuroraeScene::font(bool active) const +{ + return active ? m_activeFont : m_inactiveFont; +} + +void AuroraeScene::setFont(const QFont &font, bool active) +{ + if (active) { + m_activeFont = font; + } else { + m_inactiveFont = font; + } +} + /************************************************* * AuroraeTabData ************************************************/ diff --git a/clients/aurorae/src/lib/auroraescene.h b/clients/aurorae/src/lib/auroraescene.h index 5446cb91f4..c0548c1adf 100644 --- a/clients/aurorae/src/lib/auroraescene.h +++ b/clients/aurorae/src/lib/auroraescene.h @@ -148,6 +148,19 @@ public: void setUniqueTabDragId(int index, long int id); const QString &leftButtons() const; const QString &rightButtons() const; + /** + * @param active Whether the active or inactive title font should be returned + * @return the (in)active title font. + * @since 4.6 + **/ + const QFont &font(bool active) const; + /** + * Sets a new title font. + * @param font The new font + * @param active Whether the active or inactive title font should be set + * @since 4.6 + **/ + void setFont(const QFont &font, bool active); Q_SIGNALS: void menuClicked(); @@ -211,6 +224,8 @@ private: bool m_contextHelp; int m_tabCount; int m_focusedTab; + QFont m_activeFont; + QFont m_inactiveFont; }; } // namespace diff --git a/clients/aurorae/src/lib/auroraetab.cpp b/clients/aurorae/src/lib/auroraetab.cpp index 2f09ba73aa..d903de3417 100644 --- a/clients/aurorae/src/lib/auroraetab.cpp +++ b/clients/aurorae/src/lib/auroraetab.cpp @@ -113,6 +113,7 @@ void AuroraeTab::paint(QPainter *painter, const QStyleOptionGraphicsItem *option const bool focused = s->isFocusedTab(m_index); const ThemeConfig &conf = m_theme->themeConfig(); const DecorationPosition decoPos = s->isShade() ? DecorationTop : m_theme->decorationPosition(); + painter->setFont(s->font(active)); if (useTabs) { painter->save(); Plasma::FrameSvg *decoration = m_theme->decoration(); @@ -202,6 +203,7 @@ void AuroraeTab::paint(QPainter *painter, const QStyleOptionGraphicsItem *option } } p.setPen(color); + p.setFont(s->font(active)); p.drawText(pix.rect(), align | conf.verticalAlignment() | Qt::TextSingleLine, m_caption); if (textRect.width() > w) { // Fade out effect