Finish reverting to the right revision.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=693803
This commit is contained in:
parent
adddd535ff
commit
42199d52da
54
applet.cpp
54
applet.cpp
@ -46,7 +46,7 @@
|
|||||||
#include "plasma/widgets/lineedit.h"
|
#include "plasma/widgets/lineedit.h"
|
||||||
#include "plasma/widgets/vboxlayout.h"
|
#include "plasma/widgets/vboxlayout.h"
|
||||||
|
|
||||||
#include "shadowblur.cpp"
|
//#include "stackblur_shadows.cpp"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
@ -134,15 +134,19 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void paintBackground(QPainter* p2, Applet* q, const QColor &shadowColor = Qt::black)
|
void paintBackground(QPainter* p, Applet* q)
|
||||||
{
|
{
|
||||||
//TODO: we should cache this background rather that repaint it over and over
|
//TODO: we should cache this background rather that repaint it over and over
|
||||||
//TODO: get shadow removed from svg
|
|
||||||
QSize contents = contentSize(q).toSize();
|
QSize contents = contentSize(q).toSize();
|
||||||
const int contentWidth = contents.width();
|
const int contentWidth = contents.width();
|
||||||
const int contentHeight = contents.height();
|
const int contentHeight = contents.height();
|
||||||
|
#if 0
|
||||||
|
// this could be used to draw a dynamic shadow
|
||||||
|
QImage image(w, h, QImage::Format_ARGB32_Premultiplied);
|
||||||
|
QPainter* p = new QPainter(&image);
|
||||||
|
p->setCompositionMode(QPainter::CompositionMode_Source);
|
||||||
|
#endif
|
||||||
|
p->setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
background->resize();
|
background->resize();
|
||||||
|
|
||||||
const int topHeight = background->elementSize("top").height();
|
const int topHeight = background->elementSize("top").height();
|
||||||
@ -162,14 +166,6 @@ public:
|
|||||||
const int contentTop = 0;
|
const int contentTop = 0;
|
||||||
const int contentLeft = 0;
|
const int contentLeft = 0;
|
||||||
|
|
||||||
QPixmap backgroundPixmap(leftWidth + contentWidth + rightWidth, topHeight + contentHeight + bottomHeight);
|
|
||||||
backgroundPixmap.fill(Qt::transparent);
|
|
||||||
QPainter* p = new QPainter(&backgroundPixmap);
|
|
||||||
p->translate(leftWidth, topHeight);
|
|
||||||
p->setCompositionMode(QPainter::CompositionMode_Source);
|
|
||||||
|
|
||||||
p->setRenderHint(QPainter::SmoothPixmapTransform);
|
|
||||||
|
|
||||||
background->paint(p, QRect(leftOffset, topOffset, leftWidth, topHeight), "topleft");
|
background->paint(p, QRect(leftOffset, topOffset, leftWidth, topHeight), "topleft");
|
||||||
background->paint(p, QRect(rightOffset, topOffset, rightWidth, topHeight), "topright");
|
background->paint(p, QRect(rightOffset, topOffset, rightWidth, topHeight), "topright");
|
||||||
background->paint(p, QRect(leftOffset, bottomOffset, leftWidth, bottomHeight), "bottomleft");
|
background->paint(p, QRect(leftOffset, bottomOffset, leftWidth, bottomHeight), "bottomleft");
|
||||||
@ -213,16 +209,6 @@ public:
|
|||||||
p->drawTiledPixmap(QRect(contentLeft, bottomOffset, contentWidth, bottomHeight), bottom);
|
p->drawTiledPixmap(QRect(contentLeft, bottomOffset, contentWidth, bottomHeight), bottom);
|
||||||
|
|
||||||
background->paint(p, QRect(contentLeft, contentTop, contentWidth + 1, contentHeight + 1), "center");
|
background->paint(p, QRect(contentLeft, contentTop, contentWidth + 1, contentHeight + 1), "center");
|
||||||
|
|
||||||
QImage shadowImage = backgroundPixmap.toImage();
|
|
||||||
shadowBlur(shadowImage, 5);
|
|
||||||
QPainter* pShadow = new QPainter(&shadowImage);
|
|
||||||
pShadow->setCompositionMode(QPainter::CompositionMode_SourceAtop);
|
|
||||||
pShadow->fillRect(0, 0, shadowImage.size().width(), shadowImage.size().height(), QBrush(shadowColor));
|
|
||||||
QPixmap shadowPixmap = QPixmap::fromImage(shadowImage);
|
|
||||||
//p2->setRenderHint(QPainter::SmoothPixmapTransform);
|
|
||||||
p2->drawPixmap(leftOffset, topOffset, shadowPixmap);
|
|
||||||
p2->drawPixmap(leftOffset, topOffset, backgroundPixmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void paintHover(QPainter* painter, Applet* q)
|
void paintHover(QPainter* painter, Applet* q)
|
||||||
@ -507,7 +493,7 @@ QColor Applet::color() const
|
|||||||
// TODO: add more colors for more categories and
|
// TODO: add more colors for more categories and
|
||||||
// maybe read from config?
|
// maybe read from config?
|
||||||
QString c = category();
|
QString c = category();
|
||||||
int alpha = 100;
|
int alpha = 200;
|
||||||
// Colors taken from Oxygen color palette
|
// Colors taken from Oxygen color palette
|
||||||
if (c == "Date and Time") {
|
if (c == "Date and Time") {
|
||||||
return QColor(191, 94, 0, alpha);
|
return QColor(191, 94, 0, alpha);
|
||||||
@ -552,21 +538,11 @@ void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW
|
|||||||
} else if (zoomLevel == scalingFactor(Plasma::GroupZoom)) { // Show Groups + Applet outline
|
} else if (zoomLevel == scalingFactor(Plasma::GroupZoom)) { // Show Groups + Applet outline
|
||||||
//TODO: make pretty.
|
//TODO: make pretty.
|
||||||
painter->setBrush(QBrush(color(), Qt::SolidPattern));
|
painter->setBrush(QBrush(color(), Qt::SolidPattern));
|
||||||
//painter->drawRoundRect(boundingRect());
|
painter->drawRoundRect(boundingRect());
|
||||||
//normal applet
|
int iconDim = KIconLoader().currentSize(K3Icon::Desktop);
|
||||||
if (d->background) {
|
int midX = (boundingRect().width() / 2) - (iconDim / 2);
|
||||||
d->paintBackground(painter, this, color());
|
int midY = (boundingRect().height() / 2) - (iconDim / 2);
|
||||||
}
|
KIcon(icon()).paint(painter, midX, midY, iconDim, iconDim);
|
||||||
|
|
||||||
if (d->failed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
paintInterface(painter, option, QRect(QPoint(0,0), d->contentSize(this).toSize()));
|
|
||||||
|
|
||||||
// int iconDim = KIconLoader().currentSize(K3Icon::Desktop);
|
|
||||||
// int midX = (boundingRect().width() / 2) - (iconDim / 2);
|
|
||||||
// int midY = (boundingRect().height() / 2) - (iconDim / 2);
|
|
||||||
// KIcon(icon()).paint(painter, midX, midY, iconDim, iconDim);
|
|
||||||
}/* else if (zoomLevel == scalingFactor(Plasma::OverviewZoom)) { //Show Groups only
|
}/* else if (zoomLevel == scalingFactor(Plasma::OverviewZoom)) { //Show Groups only
|
||||||
} */
|
} */
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user