Merge remote-tracking branch 'origin/KDE/4.10'
This commit is contained in:
commit
445ccb0bc7
@ -145,10 +145,10 @@ Containment::Containment(const QString &packagePath, uint appletId, const QVaria
|
||||
|
||||
Containment::~Containment()
|
||||
{
|
||||
delete d;
|
||||
// Applet touches our dptr if we are a containment and is the superclass (think of dtors)
|
||||
// so we reset this as we exit the building
|
||||
Applet::d->isContainment = false;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void Containment::init()
|
||||
|
@ -171,9 +171,8 @@ void DataContainer::setNeedsToBeStored(bool store)
|
||||
|
||||
DataEngine* DataContainer::getDataEngine()
|
||||
{
|
||||
QObject *o = NULL;
|
||||
QObject *o = this;
|
||||
DataEngine *de = NULL;
|
||||
o = this;
|
||||
while (de == NULL)
|
||||
{
|
||||
o = dynamic_cast<QObject *> (o->parent());
|
||||
|
@ -43,7 +43,7 @@ class PluginLoaderPrivate;
|
||||
* default PluginLoader implementation will be used. The reimplemented version should
|
||||
* not do more than simply returning a loaded plugin. It should not init() it, and it should not
|
||||
* hang on to it. The associated methods will be called only when a component of Plasma
|
||||
* needs to load a _new_ plugin. (e.g. DataEngine does it's own caching).
|
||||
* needs to load a _new_ plugin. (e.g. DataEngine does its own caching).
|
||||
*
|
||||
* @author Ryan Rix <ry@n.rix.si>
|
||||
* @since 4.6
|
||||
|
@ -237,21 +237,22 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||
|
||||
QLinearGradient g(QPoint(0, 0), QPoint(m_decorationRect.width(), 0));
|
||||
//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) {
|
||||
qreal opaquePoint =
|
||||
(m_background->marginSize(LeftMargin) - translation) / m_decorationRect.width();
|
||||
//kDebug() << "opaquePoint" << opaquePoint
|
||||
// << m_background->marginSize(LeftMargin) << m_decorationRect.width();
|
||||
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(1.0, transparencyColor);
|
||||
} else {
|
||||
qreal opaquePoint =
|
||||
1 - ((m_background->marginSize(RightMargin) + translation) / m_decorationRect.width());
|
||||
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(0.0, transparencyColor);
|
||||
}
|
||||
@ -864,6 +865,41 @@ bool AppletHandle::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
||||
{
|
||||
if (watched == m_applet && event->type() == QEvent::GraphicsSceneHoverLeave) {
|
||||
hoverLeaveEvent(static_cast<QGraphicsSceneHoverEvent*>(event));
|
||||
} else if (watched == m_applet && event->type() == QEvent::GraphicsSceneMousePress) {
|
||||
QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent *>(event);
|
||||
|
||||
QPointF pos = mapFromScene(me->scenePos());
|
||||
if (m_applet->contentsRect().contains(pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
me->setPos(pos);
|
||||
mousePressEvent(me);
|
||||
return true;
|
||||
} else if (watched == m_applet && event->type() == QEvent::GraphicsSceneMouseRelease) {
|
||||
if (m_pressedButton == NoButton) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent *>(event);
|
||||
|
||||
QPointF pos = mapFromScene(me->scenePos());
|
||||
me->setPos(pos);
|
||||
mouseReleaseEvent(me);
|
||||
return true;
|
||||
} else if (watched == m_applet && event->type() == QEvent::GraphicsSceneMouseMove) {
|
||||
if (m_pressedButton == NoButton) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent *>(event);
|
||||
|
||||
QPointF pos = mapFromScene(me->scenePos());
|
||||
|
||||
|
||||
me->setPos(pos);
|
||||
mouseMoveEvent(me);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -987,7 +1023,7 @@ void AppletHandle::startFading(FadeType anim, const QPointF &hoverPos, bool pres
|
||||
|
||||
m_animType = anim;
|
||||
//kDebug() << "animating for " << time << "ms";
|
||||
if (m_animType == FadeIn) {
|
||||
if (m_animType == FadeIn && propAnim) {
|
||||
propAnim->setDirection(QAbstractAnimation::Forward);
|
||||
propAnim->start();
|
||||
} else if (propAnim) {
|
||||
@ -1030,29 +1066,32 @@ void AppletHandle::calculateSize()
|
||||
qreal marginLeft, marginTop, marginRight, marginBottom;
|
||||
m_background->getMargins(marginLeft, marginTop, marginRight, marginBottom);
|
||||
|
||||
int leftShadowWidth = m_background->elementSize("hint-left-shadow").width();
|
||||
int rightShadowWidth = m_background->elementSize("hint-right-shadow").width();
|
||||
|
||||
//no precise hint? let's go for heuristics
|
||||
if (leftShadowWidth <= 0) {
|
||||
leftShadowWidth = marginLeft/1.6;
|
||||
}
|
||||
if (rightShadowWidth <= 0) {
|
||||
rightShadowWidth = marginRight/1.6;
|
||||
}
|
||||
|
||||
if (m_applet->backgroundHints() == Plasma::Applet::NoBackground) {
|
||||
leftShadowWidth = 0;
|
||||
rightShadowWidth = 0;
|
||||
}
|
||||
if (m_buttonsOnRight) {
|
||||
//put the rect on the right of the applet
|
||||
m_rect = QRectF(m_applet->size().width(), top, handleWidth, handleHeight);
|
||||
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, top, handleWidth, handleHeight);
|
||||
m_rect = QRectF(-handleWidth + leftShadowWidth - HANDLE_MARGIN, top, handleWidth, handleHeight);
|
||||
}
|
||||
|
||||
if (m_applet->contentsRect().height() > qreal(minimumHeight()) * 1.25) {
|
||||
int addedMargin = marginLeft / 2;
|
||||
|
||||
// now we check to see if the shape is smaller than the contents,
|
||||
// and that the shape is not just the bounding rect; in those cases
|
||||
// we have a shaped guy and we draw a full panel;
|
||||
// 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_applet->backgroundHints() != Plasma::Applet::NoBackground &&
|
||||
m_applet->contentsRect().height() > qreal(minimumHeight()) * 1.25) {
|
||||
int addedMargin = HANDLE_MARGIN;
|
||||
|
||||
if (m_buttonsOnRight) {
|
||||
marginLeft += addedMargin;
|
||||
|
@ -31,6 +31,7 @@ public:
|
||||
ContainmentActionsPrivate(KService::Ptr service, ContainmentActions *containmentActions) :
|
||||
q(containmentActions),
|
||||
containmentActionsDescription(service),
|
||||
package(0),
|
||||
initialized(false),
|
||||
needsConfig(false),
|
||||
containment(0)
|
||||
|
@ -44,7 +44,8 @@ public:
|
||||
bottomMargin(0),
|
||||
noBorderPadding(false),
|
||||
stretchBorders(false),
|
||||
tileCenter(false)
|
||||
tileCenter(false),
|
||||
composeOverBorder(false)
|
||||
{
|
||||
ref(svg);
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ class ClientPrivate : public QObject
|
||||
public:
|
||||
ClientPrivate(Client *client)
|
||||
: q(client),
|
||||
readerThread(0),
|
||||
error(Client::NoError) {}
|
||||
|
||||
public slots:
|
||||
|
@ -305,6 +305,26 @@ QRect Style::subControlRect(ComplexControl control, const QStyleOptionComplex *o
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CC_ScrollBar: {
|
||||
const bool hasButtons = d->scrollbar->hasElement("arrow-up");
|
||||
switch (subControl) {
|
||||
//If one of the arrows is missing, don't reserve space for them
|
||||
case SC_ScrollBarAddLine:
|
||||
if (!hasButtons) {
|
||||
rect.setRect(0,0,0,0);
|
||||
}
|
||||
break;
|
||||
|
||||
case SC_ScrollBarSubLine:
|
||||
if (!hasButtons) {
|
||||
rect.setRect(0,0,0,0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -331,11 +351,21 @@ int Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWi
|
||||
switch (metric) {
|
||||
case PM_ScrollBarExtent: {
|
||||
d->createScrollbar();
|
||||
const QSizeF hintSize = d->scrollbar->elementSize("hint-scrollbar-size");
|
||||
const QStyleOptionSlider *scrollOption = qstyleoption_cast<const QStyleOptionSlider *>(option);
|
||||
|
||||
if (scrollOption && scrollOption->orientation == Qt::Vertical) {
|
||||
if (hintSize.isEmpty()) {
|
||||
return d->scrollbar->elementSize("arrow-down").width() + 2;
|
||||
} else {
|
||||
return hintSize.width();
|
||||
}
|
||||
} else {
|
||||
if (hintSize.isEmpty()) {
|
||||
return d->scrollbar->elementSize("arrow-left").height() + 2;
|
||||
} else {
|
||||
return hintSize.height();
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
DeclarativeWidgetPrivate(DeclarativeWidget *parent)
|
||||
: q(parent),
|
||||
engine(0),
|
||||
scriptEngine(0),
|
||||
component(0),
|
||||
root(0),
|
||||
delay(false)
|
||||
|
Loading…
Reference in New Issue
Block a user