Forward port 1214767: Honor font settings in Aurorae.

CCBUG: 249681

svn path=/trunk/KDE/kdebase/workspace/; revision=1214768
This commit is contained in:
Martin Gräßlin 2011-01-16 10:25:22 +00:00
parent c5b05f016c
commit cf553792a9
4 changed files with 37 additions and 0 deletions

View file

@ -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);
}

View file

@ -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
************************************************/

View file

@ -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

View file

@ -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