Make Aurorae themes with title on left/right somewhat work for shaded windows.
svn path=/trunk/KDE/kdebase/workspace/; revision=1129816
This commit is contained in:
parent
13f78bd02d
commit
a2d331cc56
2 changed files with 34 additions and 10 deletions
|
@ -332,8 +332,12 @@ void AuroraeScene::updateLayout()
|
|||
const int right = sceneRect().width() - m_rightButtons->preferredWidth() - config.paddingRight();
|
||||
const qreal titleHeight = qMax((qreal)config.titleHeight(),
|
||||
config.buttonHeight()*m_theme->buttonSizeFactor() + config.buttonMarginTop());
|
||||
DecorationPosition decoPos = (DecorationPosition)config.decorationPosition();
|
||||
if (isShade()) {
|
||||
decoPos = DecorationTop;
|
||||
}
|
||||
if (m_maximizeMode == KDecorationDefines::MaximizeFull) { // TODO: check option
|
||||
switch ((DecorationPosition)config.decorationPosition()) {
|
||||
switch (decoPos) {
|
||||
case DecorationTop: {
|
||||
const int top = genericTop + config.titleEdgeTopMaximized();
|
||||
m_leftButtons->setGeometry(QRectF(QPointF(left + config.titleEdgeLeftMaximized(), top),
|
||||
|
@ -393,7 +397,7 @@ void AuroraeScene::updateLayout()
|
|||
}
|
||||
m_title->layout()->invalidate();
|
||||
} else {
|
||||
switch ((DecorationPosition)config.decorationPosition()) {
|
||||
switch (decoPos) {
|
||||
case DecorationTop: {
|
||||
const int top = genericTop + config.titleEdgeTop();
|
||||
m_leftButtons->setGeometry(QRectF(QPointF(left + config.titleEdgeLeft(), top), m_leftButtons->size()));
|
||||
|
@ -734,6 +738,27 @@ void AuroraeScene::setShade(bool shade)
|
|||
}
|
||||
}
|
||||
}
|
||||
if ((DecorationPosition)m_theme->themeConfig().decorationPosition() != DecorationTop) {
|
||||
Qt::Orientation orientation = Qt::Horizontal;
|
||||
switch ((DecorationPosition)m_theme->themeConfig().decorationPosition()) {
|
||||
case DecorationLeft: // fall through
|
||||
case DecorationRight:
|
||||
orientation = Qt::Vertical;
|
||||
break;
|
||||
case DecorationTop: // fall through
|
||||
case DecorationBottom: // fall through
|
||||
default: // fall through
|
||||
orientation = Qt::Horizontal;
|
||||
break;
|
||||
}
|
||||
if (m_shade) {
|
||||
orientation = Qt::Horizontal;
|
||||
}
|
||||
static_cast<QGraphicsLinearLayout *>(m_rightButtons->layout())->setOrientation(orientation);
|
||||
static_cast<QGraphicsLinearLayout *>(m_leftButtons->layout())->setOrientation(orientation);
|
||||
static_cast<QGraphicsLinearLayout *>(m_title->layout())->setOrientation(orientation);
|
||||
updateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
int AuroraeScene::leftButtonsWidth() const
|
||||
|
|
|
@ -94,6 +94,7 @@ void AuroraeTab::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||
const bool useTabs = (s->tabCount() > 1);
|
||||
const bool focused = s->isFocusedTab(m_index);
|
||||
const ThemeConfig &conf = m_theme->themeConfig();
|
||||
const DecorationPosition decoPos = s->isShade() ? DecorationTop : m_theme->decorationPosition();
|
||||
if (useTabs) {
|
||||
painter->save();
|
||||
Plasma::FrameSvg *decoration = m_theme->decoration();
|
||||
|
@ -102,8 +103,7 @@ void AuroraeTab::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||
painter->setPen(color);
|
||||
QPointF point1 = rect().topRight();
|
||||
QPointF point2 = rect().bottomRight();
|
||||
if (m_theme->decorationPosition() == DecorationLeft ||
|
||||
m_theme->decorationPosition() == DecorationRight) {
|
||||
if (decoPos == DecorationLeft || decoPos == DecorationRight) {
|
||||
point1 = rect().topRight();
|
||||
point2 = rect().topLeft();
|
||||
}
|
||||
|
@ -144,8 +144,7 @@ void AuroraeTab::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||
}
|
||||
qreal w = rect().width();
|
||||
qreal h = rect().height();
|
||||
if (m_theme->themeConfig().decorationPosition() == DecorationLeft ||
|
||||
m_theme->themeConfig().decorationPosition() == DecorationRight) {
|
||||
if (decoPos == DecorationLeft || decoPos == DecorationRight) {
|
||||
h = rect().width();
|
||||
w = rect().height();
|
||||
}
|
||||
|
@ -159,10 +158,10 @@ void AuroraeTab::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||
haloRect.setWidth(w);
|
||||
}
|
||||
painter->save();
|
||||
if (m_theme->themeConfig().decorationPosition() == DecorationLeft) {
|
||||
if (decoPos == DecorationLeft) {
|
||||
painter->translate(rect().bottomLeft());
|
||||
painter->rotate(270);
|
||||
} else if (m_theme->themeConfig().decorationPosition() == DecorationRight) {
|
||||
} else if (decoPos == DecorationRight) {
|
||||
painter->translate(rect().topRight());
|
||||
painter->rotate(90);
|
||||
}
|
||||
|
@ -209,10 +208,10 @@ void AuroraeTab::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||
p.fillRect(r, alphaGradient);
|
||||
}
|
||||
p.end();
|
||||
if (m_theme->themeConfig().decorationPosition() == DecorationLeft) {
|
||||
if (decoPos == DecorationLeft) {
|
||||
painter->translate(rect().bottomLeft());
|
||||
painter->rotate(270);
|
||||
} else if (m_theme->themeConfig().decorationPosition() == DecorationRight) {
|
||||
} else if (decoPos == DecorationRight) {
|
||||
painter->translate(rect().topRight());
|
||||
painter->rotate(90);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue