From 957caaae77399aaf02caf0a38a0acf5d6d9ab71e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Tue, 2 Oct 2012 19:28:58 +0200 Subject: [PATCH 1/9] fix grammar in apidocs --- pluginloader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pluginloader.h b/pluginloader.h index 3a648e50e..d20bdcae1 100644 --- a/pluginloader.h +++ b/pluginloader.h @@ -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 * @since 4.6 From 95682718bff40c7beec6de14eb921f066304c0b7 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 9 Oct 2012 17:49:23 +0200 Subject: [PATCH 2/9] hint-scrollbar-size element for scrollbar width/height --- private/style.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/private/style.cpp b/private/style.cpp index adfa9bdee..182e35c8c 100644 --- a/private/style.cpp +++ b/private/style.cpp @@ -331,11 +331,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(option); + if (scrollOption && scrollOption->orientation == Qt::Vertical) { - return d->scrollbar->elementSize("arrow-down").width() + 2; + if (hintSize.isEmpty()) { + return d->scrollbar->elementSize("arrow-down").width() + 2; + } else { + return hintSize.width(); + } } else { - return d->scrollbar->elementSize("arrow-left").height() + 2; + if (hintSize.isEmpty()) { + return d->scrollbar->elementSize("arrow-left").height() + 2; + } else { + return hintSize.height(); + } } } default: From bab9b0a1a3a61d83a455e81c8a23d15319133e45 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 9 Oct 2012 18:21:01 +0200 Subject: [PATCH 3/9] don't put buttons if the theme doesn't have any --- private/style.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/private/style.cpp b/private/style.cpp index 182e35c8c..d3cae152b 100644 --- a/private/style.cpp +++ b/private/style.cpp @@ -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; } From 3cd6781dcae8fe60ae36001fb502e1b15c94c858 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 10 Oct 2012 15:38:43 +0200 Subject: [PATCH 4/9] fix handle geometry in case of big shadows check for a hint about shadow size always draw full frame for applets with no background --- private/applethandle.cpp | 50 ++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/private/applethandle.cpp b/private/applethandle.cpp index f6d51a26f..845b6efbf 100644 --- a/private/applethandle.cpp +++ b/private/applethandle.cpp @@ -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); } @@ -1030,29 +1031,32 @@ void AppletHandle::calculateSize() qreal marginLeft, marginTop, marginRight, marginBottom; m_background->getMargins(marginLeft, marginTop, marginRight, marginBottom); - if (m_buttonsOnRight) { - //put the rect on the right of the applet - m_rect = QRectF(m_applet->size().width(), top, handleWidth, handleHeight); - } else { - //put the rect on the left of the applet - m_rect = QRectF(-handleWidth, top, handleWidth, handleHeight); + 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->contentsRect().height() > qreal(minimumHeight()) * 1.25) { - int addedMargin = marginLeft / 2; + 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() - 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, - // 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; From fe259f19bb078256f4a51df44a4dc0015ecb96a4 Mon Sep 17 00:00:00 2001 From: Jaime Torres Date: Wed, 10 Oct 2012 19:07:06 +0200 Subject: [PATCH 5/9] include missing initializations an uninitialized variable can be the origin of several bugs. unfortunately, not the one I suffer. REVIEW: 106781 --- private/containmentactions_p.h | 1 + private/framesvg_p.h | 3 ++- private/qtjolie-branch/qtjolie/client_p.h | 1 + widgets/declarativewidget.cpp | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/private/containmentactions_p.h b/private/containmentactions_p.h index e683533ca..5afef7ee3 100644 --- a/private/containmentactions_p.h +++ b/private/containmentactions_p.h @@ -31,6 +31,7 @@ public: ContainmentActionsPrivate(KService::Ptr service, ContainmentActions *containmentActions) : q(containmentActions), containmentActionsDescription(service), + package(0), initialized(false), needsConfig(false), containment(0) diff --git a/private/framesvg_p.h b/private/framesvg_p.h index 86eda83aa..567ff085d 100644 --- a/private/framesvg_p.h +++ b/private/framesvg_p.h @@ -44,7 +44,8 @@ public: bottomMargin(0), noBorderPadding(false), stretchBorders(false), - tileCenter(false) + tileCenter(false), + composeOverBorder(false) { ref(svg); } diff --git a/private/qtjolie-branch/qtjolie/client_p.h b/private/qtjolie-branch/qtjolie/client_p.h index dc9c8f161..1cb1be2a4 100644 --- a/private/qtjolie-branch/qtjolie/client_p.h +++ b/private/qtjolie-branch/qtjolie/client_p.h @@ -38,6 +38,7 @@ class ClientPrivate : public QObject public: ClientPrivate(Client *client) : q(client), + readerThread(0), error(Client::NoError) {} public slots: diff --git a/widgets/declarativewidget.cpp b/widgets/declarativewidget.cpp index 93d043898..317607398 100644 --- a/widgets/declarativewidget.cpp +++ b/widgets/declarativewidget.cpp @@ -46,6 +46,7 @@ public: DeclarativeWidgetPrivate(DeclarativeWidget *parent) : q(parent), engine(0), + scriptEngine(0), component(0), root(0), delay(false) From a4f54d65dd1d7f93d0ae848f75b7ca2aef2dfef6 Mon Sep 17 00:00:00 2001 From: Jaime Torres Date: Wed, 10 Oct 2012 19:09:29 +0200 Subject: [PATCH 6/9] change order between delete d and assign property to parent d probably nothing changes --- containment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containment.cpp b/containment.cpp index 5f13c2b50..a454d040f 100644 --- a/containment.cpp +++ b/containment.cpp @@ -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() From 7209fa02e813b8679b95ad9e1c4946f3b8cf689a Mon Sep 17 00:00:00 2001 From: Jaime Torres Date: Wed, 10 Oct 2012 19:10:25 +0200 Subject: [PATCH 7/9] set directly this to the variable instead of o=null and o=this --- datacontainer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/datacontainer.cpp b/datacontainer.cpp index fd1ad8991..d19b1a52c 100644 --- a/datacontainer.cpp +++ b/datacontainer.cpp @@ -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 (o->parent()); From 0e45385db4aba7e6c36b68382ce618f81bafe0b7 Mon Sep 17 00:00:00 2001 From: Jaime Torres Date: Wed, 10 Oct 2012 19:11:21 +0200 Subject: [PATCH 8/9] avoid a possible null pointer ussage propAnim has been already checked for not being null, but was not checked here. REVIEW: 106782 --- private/applethandle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/private/applethandle.cpp b/private/applethandle.cpp index f6d51a26f..afb3a88e2 100644 --- a/private/applethandle.cpp +++ b/private/applethandle.cpp @@ -987,7 +987,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) { From 3c55ec6a2585db4a137011b3bb4ebcc63aa62ff8 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 11 Oct 2012 21:09:14 +0200 Subject: [PATCH 9/9] manage buttons even if they are under applet shadow --- private/applethandle.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/private/applethandle.cpp b/private/applethandle.cpp index 845b6efbf..a24728f08 100644 --- a/private/applethandle.cpp +++ b/private/applethandle.cpp @@ -865,6 +865,41 @@ bool AppletHandle::sceneEventFilter(QGraphicsItem *watched, QEvent *event) { if (watched == m_applet && event->type() == QEvent::GraphicsSceneHoverLeave) { hoverLeaveEvent(static_cast(event)); + } else if (watched == m_applet && event->type() == QEvent::GraphicsSceneMousePress) { + QGraphicsSceneMouseEvent *me = static_cast(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(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(event); + + QPointF pos = mapFromScene(me->scenePos()); + + + me->setPos(pos); + mouseMoveEvent(me); + return true; } return false;