mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
plasma: remove check for non-existing iconRepresentation property in widget snapshotter
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
3586873aa9
commit
b0becab9c2
3 changed files with 9 additions and 41 deletions
|
@ -22,7 +22,7 @@
|
||||||
#include <QGraphicsWidget>
|
#include <QGraphicsWidget>
|
||||||
#include <QParallelAnimationGroup>
|
#include <QParallelAnimationGroup>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <QtCore/qsharedpointer.h>
|
#include <QWeakPointer>
|
||||||
|
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ void PulseAnimation::setCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_under.data()) {
|
if (!m_under.data()) {
|
||||||
m_under = new WidgetSnapShot;
|
m_under = new WidgetSnapShot();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_under.data()->setTarget(target);
|
m_under.data()->setTarget(target);
|
||||||
|
@ -97,14 +97,8 @@ void PulseAnimation::updateState(QAbstractAnimation::State newState, QAbstractAn
|
||||||
setCopy();
|
setCopy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_under.data()->isIconBigger()) {
|
m_scale = 0;
|
||||||
m_under.data()->setScale(0);
|
m_endScale = 1.5;
|
||||||
m_endScale = 1.0;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
m_scale = 0;
|
|
||||||
m_endScale = 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_under.data()->isVisible() == false) {
|
if (m_under.data()->isVisible() == false) {
|
||||||
m_under.data()->setVisible(true);
|
m_under.data()->setVisible(true);
|
||||||
|
@ -122,13 +116,9 @@ void PulseAnimation::updateEffectiveTime(int currentTime)
|
||||||
if (m_under.data()) {
|
if (m_under.data()) {
|
||||||
qreal delta = currentTime / qreal(duration());
|
qreal delta = currentTime / qreal(duration());
|
||||||
|
|
||||||
if (m_under.data()->isIconBigger()) {
|
m_under.data()->setScale(delta);
|
||||||
m_under.data()->setScale(delta);
|
delta = (1 - m_endScale) * delta;
|
||||||
} else {
|
m_under.data()->setScale(1 - delta);
|
||||||
m_under.data()->setScale(delta);
|
|
||||||
delta = (1 - m_endScale) * delta;
|
|
||||||
m_under.data()->setScale(1 - delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
delta = currentTime / qreal(duration());
|
delta = currentTime / qreal(duration());
|
||||||
if (direction() == Forward) {
|
if (direction() == Forward) {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QtGui/qstyleoption.h>
|
#include <QStyleOptionGraphicsItem>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
static const int RECURSION_MAX = 20;
|
static const int RECURSION_MAX = 20;
|
||||||
|
@ -30,9 +30,8 @@ namespace Plasma
|
||||||
|
|
||||||
WidgetSnapShot::WidgetSnapShot(QGraphicsItem *parent)
|
WidgetSnapShot::WidgetSnapShot(QGraphicsItem *parent)
|
||||||
: QGraphicsWidget(parent),
|
: QGraphicsWidget(parent),
|
||||||
m_iconBig(false),
|
|
||||||
stack(0),
|
stack(0),
|
||||||
m_target(0)
|
m_target(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,18 +76,6 @@ void WidgetSnapShot::setTarget(QGraphicsWidget *target)
|
||||||
m_target = target;
|
m_target = target;
|
||||||
setParentItem(target);
|
setParentItem(target);
|
||||||
QSize size(target->size().toSize());
|
QSize size(target->size().toSize());
|
||||||
m_iconBig = false;
|
|
||||||
|
|
||||||
if (m_target->property("iconRepresentation").isValid()) {
|
|
||||||
m_iconBig = true;
|
|
||||||
m_snapShot = QPixmap::fromImage(
|
|
||||||
m_target->property("iconRepresentation").value<QImage>());
|
|
||||||
if ((m_snapShot.height() > 0) && (m_snapShot.width() > 0)) {
|
|
||||||
resize(m_snapShot.size());
|
|
||||||
setTransformOriginPoint(target->geometry().center());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resize(target->size());
|
resize(target->size());
|
||||||
|
|
||||||
|
@ -114,12 +101,6 @@ QGraphicsWidget *WidgetSnapShot::target() const
|
||||||
return m_target;
|
return m_target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool WidgetSnapShot::isIconBigger() const
|
|
||||||
{
|
|
||||||
return m_iconBig;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap WidgetSnapShot::snapShot() const
|
QPixmap WidgetSnapShot::snapShot() const
|
||||||
{
|
{
|
||||||
return m_snapShot;
|
return m_snapShot;
|
||||||
|
|
|
@ -39,8 +39,6 @@ public:
|
||||||
const QStyleOptionGraphicsItem *option,
|
const QStyleOptionGraphicsItem *option,
|
||||||
QWidget *widget);
|
QWidget *widget);
|
||||||
|
|
||||||
bool isIconBigger() const;
|
|
||||||
|
|
||||||
QPixmap snapShot() const;
|
QPixmap snapShot() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -48,7 +46,6 @@ private:
|
||||||
const QStyleOptionGraphicsItem *option,
|
const QStyleOptionGraphicsItem *option,
|
||||||
QGraphicsItem *target);
|
QGraphicsItem *target);
|
||||||
|
|
||||||
bool m_iconBig;
|
|
||||||
int stack;
|
int stack;
|
||||||
QPixmap m_snapShot;
|
QPixmap m_snapShot;
|
||||||
QGraphicsWidget *m_target;
|
QGraphicsWidget *m_target;
|
||||||
|
|
Loading…
Add table
Reference in a new issue