Merge remote-tracking branch 'origin/KDE/4.9' into KDE/4.10
This commit is contained in:
commit
2118a77f73
@ -237,21 +237,22 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
|
|
||||||
QLinearGradient g(QPoint(0, 0), QPoint(m_decorationRect.width(), 0));
|
QLinearGradient g(QPoint(0, 0), QPoint(m_decorationRect.width(), 0));
|
||||||
//fading out panel
|
//fading out panel
|
||||||
if (m_rect.height() > qreal(minimumHeight()) * 1.25) {
|
if (m_applet->backgroundHints() != Plasma::Applet::NoBackground &&
|
||||||
|
m_rect.height() > qreal(minimumHeight()) * 1.25) {
|
||||||
if (m_buttonsOnRight) {
|
if (m_buttonsOnRight) {
|
||||||
qreal opaquePoint =
|
qreal opaquePoint =
|
||||||
(m_background->marginSize(LeftMargin) - translation) / m_decorationRect.width();
|
(m_background->marginSize(LeftMargin) - translation) / m_decorationRect.width();
|
||||||
//kDebug() << "opaquePoint" << opaquePoint
|
//kDebug() << "opaquePoint" << opaquePoint
|
||||||
// << m_background->marginSize(LeftMargin) << m_decorationRect.width();
|
// << m_background->marginSize(LeftMargin) << m_decorationRect.width();
|
||||||
g.setColorAt(0.0, Qt::transparent);
|
g.setColorAt(0.0, Qt::transparent);
|
||||||
g.setColorAt(qMax(0.0, opaquePoint - 0.05), Qt::transparent); //krazy:exclude=qminmax
|
g.setColorAt(qMax(0.0, opaquePoint - 0.01), Qt::transparent); //krazy:exclude=qminmax
|
||||||
g.setColorAt(opaquePoint, transparencyColor);
|
g.setColorAt(opaquePoint, transparencyColor);
|
||||||
g.setColorAt(1.0, transparencyColor);
|
g.setColorAt(1.0, transparencyColor);
|
||||||
} else {
|
} else {
|
||||||
qreal opaquePoint =
|
qreal opaquePoint =
|
||||||
1 - ((m_background->marginSize(RightMargin) + translation) / m_decorationRect.width());
|
1 - ((m_background->marginSize(RightMargin) + translation) / m_decorationRect.width());
|
||||||
g.setColorAt(1.0, Qt::transparent);
|
g.setColorAt(1.0, Qt::transparent);
|
||||||
g.setColorAt(opaquePoint + 0.05, Qt::transparent);
|
g.setColorAt(opaquePoint + 0.01, Qt::transparent);
|
||||||
g.setColorAt(qMax(qreal(0), opaquePoint), transparencyColor);
|
g.setColorAt(qMax(qreal(0), opaquePoint), transparencyColor);
|
||||||
g.setColorAt(0.0, transparencyColor);
|
g.setColorAt(0.0, transparencyColor);
|
||||||
}
|
}
|
||||||
@ -1030,29 +1031,32 @@ void AppletHandle::calculateSize()
|
|||||||
qreal marginLeft, marginTop, marginRight, marginBottom;
|
qreal marginLeft, marginTop, marginRight, marginBottom;
|
||||||
m_background->getMargins(marginLeft, marginTop, marginRight, marginBottom);
|
m_background->getMargins(marginLeft, marginTop, marginRight, marginBottom);
|
||||||
|
|
||||||
if (m_buttonsOnRight) {
|
int leftShadowWidth = m_background->elementSize("hint-left-shadow").width();
|
||||||
//put the rect on the right of the applet
|
int rightShadowWidth = m_background->elementSize("hint-right-shadow").width();
|
||||||
m_rect = QRectF(m_applet->size().width(), top, handleWidth, handleHeight);
|
|
||||||
} else {
|
//no precise hint? let's go for heuristics
|
||||||
//put the rect on the left of the applet
|
if (leftShadowWidth <= 0) {
|
||||||
m_rect = QRectF(-handleWidth, top, handleWidth, handleHeight);
|
leftShadowWidth = marginLeft/1.6;
|
||||||
|
}
|
||||||
|
if (rightShadowWidth <= 0) {
|
||||||
|
rightShadowWidth = marginRight/1.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_applet->contentsRect().height() > qreal(minimumHeight()) * 1.25) {
|
if (m_applet->backgroundHints() == Plasma::Applet::NoBackground) {
|
||||||
int addedMargin = marginLeft / 2;
|
leftShadowWidth = 0;
|
||||||
|
rightShadowWidth = 0;
|
||||||
|
}
|
||||||
|
if (m_buttonsOnRight) {
|
||||||
|
//put the rect on the right of the applet
|
||||||
|
m_rect = QRectF(m_applet->size().width() - rightShadowWidth + HANDLE_MARGIN, top, handleWidth, handleHeight);
|
||||||
|
} else {
|
||||||
|
//put the rect on the left of the applet
|
||||||
|
m_rect = QRectF(-handleWidth + leftShadowWidth - HANDLE_MARGIN, top, handleWidth, handleHeight);
|
||||||
|
}
|
||||||
|
|
||||||
// now we check to see if the shape is smaller than the contents,
|
if (m_applet->backgroundHints() != Plasma::Applet::NoBackground &&
|
||||||
// and that the shape is not just the bounding rect; in those cases
|
m_applet->contentsRect().height() > qreal(minimumHeight()) * 1.25) {
|
||||||
// we have a shaped guy and we draw a full panel;
|
int addedMargin = HANDLE_MARGIN;
|
||||||
// TODO: allow applets to mark when they have translucent areas and
|
|
||||||
// should therefore skip this test?
|
|
||||||
if (!m_applet->shape().contains(m_applet->contentsRect())) {
|
|
||||||
QPainterPath p;
|
|
||||||
p.addRect(m_applet->boundingRect());
|
|
||||||
if (m_applet->shape() != p) {
|
|
||||||
addedMargin = m_applet->contentsRect().width() / 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_buttonsOnRight) {
|
if (m_buttonsOnRight) {
|
||||||
marginLeft += addedMargin;
|
marginLeft += addedMargin;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user