Api change:

Plasma::Svg(imagePath, parent) -> Plasma::Svg(parent)  and
Plasma::PanelSvg(imagePath, parent) -> Plasma::PanelSvg(parent)
updated as needed every class that was using Svg or PanelSvg

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=800143
This commit is contained in:
Marco Martin 2008-04-23 13:07:41 +00:00
parent 273c045f2d
commit d0ba4e77ec
9 changed files with 24 additions and 18 deletions

View File

@ -782,7 +782,8 @@ void Applet::setDrawStandardBackground(bool drawBackground)
{
if (drawBackground) {
if (!d->background) {
d->background = new Plasma::PanelSvg("widgets/background");
d->background = new Plasma::PanelSvg();
d->background->setImagePath("widgets/background");
d->background->setEnabledBorders(Plasma::PanelSvg::AllBorders);
int left, top, right, bottom;
d->getBorderSize(left, top, right, bottom);

View File

@ -71,7 +71,8 @@ Dialog::Dialog( QWidget * parent, Qt::WindowFlags f )
d(new Private)
{
d->q = this;
d->background = new PanelSvg("dialogs/background", this);
d->background = new PanelSvg(this);
d->background->setImagePath("dialogs/background");
d->background->setEnabledBorders(PanelSvg::AllBorders);
d->background->resize(size());

View File

@ -35,6 +35,7 @@ public:
PanelData()
: enabledBorders(PanelSvg::AllBorders),
cachedBackground(0),
panelSize(-1,-1),
contentAtOrigin(false)
{
}
@ -90,15 +91,13 @@ public:
QHash<QString, PanelData*> panels;
};
PanelSvg::PanelSvg(const QString& imagePath, QObject* parent)
: Svg(imagePath, parent),
PanelSvg::PanelSvg(QObject* parent)
: Svg(parent),
d(new Private(this))
{
connect(this, SIGNAL(repaintNeeded()), this, SLOT(updateSizes()));
d->panels.insert(QString(), new PanelData());
d->updateSizes();
d->panels[QString()]->panelSize = size();
}
PanelSvg::~PanelSvg()
@ -112,9 +111,13 @@ void PanelSvg::setImagePath(const QString& path)
return;
}
Svg::setImagePath(path);
qDeleteAll(d->panels);
setImagePath(path);
d->panels.insert(QString(), new PanelData());
d->updateSizes();
d->panels[QString()]->panelSize = size();
}
void PanelSvg::setEnabledBorders(const EnabledBorders borders)

View File

@ -69,7 +69,7 @@ class PLASMA_EXPORT PanelSvg : public Svg
*
* @related Plasma::Theme
*/
explicit PanelSvg(const QString& imagePath, QObject* parent = 0);
explicit PanelSvg(QObject* parent = 0);
~PanelSvg();
/**

View File

@ -63,13 +63,12 @@ class SharedSvgRenderer : public KSvgRenderer, public QSharedData
class Svg::Private
{
public:
Private(const QString& imagePath, Svg *svg)
Private(Svg *svg)
: q(svg),
renderer(0),
multipleImages(false),
themed(false)
{
setImagePath(imagePath, q);
}
~Private()
@ -290,9 +289,9 @@ class Svg::Private
QHash<QString, SharedSvgRenderer::Ptr> Svg::Private::renderers;
Svg::Svg(const QString& imagePath, QObject* parent)
Svg::Svg(QObject* parent)
: QObject(parent),
d(new Private(imagePath, this))
d(new Private(this))
{
}

2
svg.h
View File

@ -69,7 +69,7 @@ class PLASMA_EXPORT Svg : public QObject
*
* @related Plasma::Theme
*/
explicit Svg(const QString& imagePath = QString(), QObject* parent = 0);
explicit Svg(QObject* parent = 0);
~Svg();

View File

@ -471,11 +471,11 @@ void Icon::layoutIcons(const QStyleOptionGraphicsItem *option)
void Icon::setSvg(const QString &svgFilePath, const QString &elementId)
{
if (!d->iconSvg) {
d->iconSvg = new Plasma::Svg(svgFilePath);
} else {
d->iconSvg->setImagePath(svgFilePath);
d->iconSvg = new Plasma::Svg();
}
d->iconSvg->setImagePath(svgFilePath);
d->iconSvgElement = elementId;
}

View File

@ -243,7 +243,8 @@ void Meter::setSvg(const QString &svg)
{
d->svg = svg;
delete d->image;
d->image = new Plasma::Svg(svg, this);
d->image = new Plasma::Svg(this);
d->image->setImagePath(svg);
// To create renderer and get default size
d->image->resize();
d->setSizePolicyAndPreferredSize();

View File

@ -455,7 +455,8 @@ void SignalPlotter::setSvgBackground(const QString &filename)
if (!d->svgFilename.isEmpty())
{
if (d->svgBackground) delete d->svgBackground;
d->svgBackground = new Svg(d->svgFilename);
d->svgBackground = new Svg();
d->svgBackground->setImagePath(d->svgFilename);
}
}