Rename SvnPanel into PanelSvg and update accordingly who is using that,

as discussed in api reviews

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=797663
This commit is contained in:
Marco Martin 2008-04-16 17:23:58 +00:00
parent b237019d4f
commit d07a60c581
9 changed files with 50 additions and 50 deletions

View File

@ -45,7 +45,7 @@ set(plasma_LIB_SRCS
searchcontext.cpp
shadowitem.cpp
svg.cpp
svgpanel.cpp
panelsvg.cpp
theme.cpp
toolbox.cpp
paneltoolbox.cpp
@ -114,7 +114,7 @@ set(plasma_LIB_INCLUDES
searchcontext.h
shadowitem_p.h
svg.h
svgpanel.h
panelsvg.h
theme.h
uiloader.h
view.h
@ -168,7 +168,7 @@ install(FILES
includes/SearchContext
includes/SearchMatch
includes/Svg
includes/SvgPanel
includes/PanelSvg
includes/UiLoader
includes/PackageMetadata
includes/View

View File

@ -65,7 +65,7 @@
#include "plasma/scripting/appletscript.h"
#include "plasma/shadowitem_p.h"
#include "plasma/svg.h"
#include "plasma/svgpanel.h"
#include "plasma/panelsvg.h"
#include "plasma/theme.h"
#include "plasma/view.h"
@ -309,7 +309,7 @@ public:
QList<QObject*> watchedForFocus;
QList<QGraphicsItem*> watchedForMouseMove;
QStringList loadedEngines;
Plasma::SvgPanel *background;
Plasma::PanelSvg *background;
//Plasma::LineEdit *failureText;
AppletScript *script;
ConfigXml* configXml;
@ -725,8 +725,8 @@ void Applet::setDrawStandardBackground(bool drawBackground)
{
if (drawBackground) {
if (!d->background) {
d->background = new Plasma::SvgPanel("widgets/background");
d->background->setBorderFlags(Plasma::SvgPanel::DrawAllBorders);
d->background = new Plasma::PanelSvg("widgets/background");
d->background->setBorderFlags(Plasma::PanelSvg::DrawAllBorders);
int left, top, right, bottom;
d->getBorderSize(left, top, right, bottom);
QSizeF fitSize(left + right, top + bottom);

View File

@ -35,7 +35,7 @@
#include <KDebug>
#include <NETRootInfo>
#include <plasma/svgpanel.h>
#include <plasma/panelsvg.h>
#include <plasma/theme.h>
#ifdef Q_WS_X11
@ -53,15 +53,15 @@ public:
* Holds the background SVG, to be re-rendered when the cache is invalidated,
* for example by resizing the dialogue.
*/
Plasma::SvgPanel *background;
Plasma::PanelSvg *background;
};
Dialog::Dialog( QWidget * parent, Qt::WindowFlags f )
: QWidget(parent, f),
d(new Private)
{
d->background = new SvgPanel("dialogs/background", this);
d->background->setBorderFlags(SvgPanel::DrawAllBorders);
d->background = new PanelSvg("dialogs/background", this);
d->background->setBorderFlags(PanelSvg::DrawAllBorders);
d->background->resize(size());
connect(d->background, SIGNAL(repaintNeeded()), this, SLOT(update()));

View File

@ -1 +1 @@
#include "../../plasma/svgpanel.h"
#include "../../plasma/panelsvg.h"

View File

@ -18,7 +18,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "svgpanel.h"
#include "panelsvg.h"
#include <QPainter>
#include <QSize>
@ -29,7 +29,7 @@
namespace Plasma
{
class SvgPanel::Private
class PanelSvg::Private
{
public:
Private()
@ -67,7 +67,7 @@ public:
bool tileCenter : 1;
};
SvgPanel::SvgPanel(const QString& imagePath, QObject* parent)
PanelSvg::PanelSvg(const QString& imagePath, QObject* parent)
: QObject(parent),
d(new Private)
{
@ -78,12 +78,12 @@ SvgPanel::SvgPanel(const QString& imagePath, QObject* parent)
d->panelSize = d->background->size();
}
SvgPanel::~SvgPanel()
PanelSvg::~PanelSvg()
{
delete d;
}
void SvgPanel::setFile(const QString& imagePath)
void PanelSvg::setFile(const QString& imagePath)
{
if (imagePath == d->background->file()) {
return;
@ -93,12 +93,12 @@ void SvgPanel::setFile(const QString& imagePath)
setPrefix(prefix());
}
QString SvgPanel::file() const
QString PanelSvg::file() const
{
return d->background->file();
}
void SvgPanel::setBorderFlags(const BorderFlags flags)
void PanelSvg::setBorderFlags(const BorderFlags flags)
{
if (flags == d->bFlags) {
return;
@ -108,22 +108,22 @@ void SvgPanel::setBorderFlags(const BorderFlags flags)
updateSizes();
}
SvgPanel::BorderFlags SvgPanel::borderFlags() const
PanelSvg::BorderFlags PanelSvg::borderFlags() const
{
return d->bFlags;
}
void SvgPanel::setPos(const QPointF& pos)
void PanelSvg::setPos(const QPointF& pos)
{
d->pos = pos;
}
QPointF SvgPanel::pos() const
QPointF PanelSvg::pos() const
{
return d->pos;
}
void SvgPanel::setLocation(Plasma::Location location)
void PanelSvg::setLocation(Plasma::Location location)
{
switch (location) {
case TopEdge:
@ -145,12 +145,12 @@ void SvgPanel::setLocation(Plasma::Location location)
d->location = location;
}
Plasma::Location SvgPanel::location() const
Plasma::Location PanelSvg::location() const
{
return d->location;
}
void SvgPanel::setPrefix(const QString & prefix)
void PanelSvg::setPrefix(const QString & prefix)
{
if (!d->background->hasElement(prefix + "-center")) {
d->prefix.clear();
@ -168,7 +168,7 @@ void SvgPanel::setPrefix(const QString & prefix)
}
}
QString SvgPanel::prefix()
QString PanelSvg::prefix()
{
if (d->prefix.isEmpty()) {
return QString();
@ -176,7 +176,7 @@ QString SvgPanel::prefix()
return d->prefix.left(d->prefix.size() - 1);
}
void SvgPanel::resize(const QSizeF& size)
void PanelSvg::resize(const QSizeF& size)
{
if (!size.isValid() || size.width() < 1 || size.height() < 1 || size == d->panelSize) {
return;
@ -186,7 +186,7 @@ void SvgPanel::resize(const QSizeF& size)
updateSizes();
}
qreal SvgPanel::marginSize(const Plasma::MarginEdge edge) const
qreal PanelSvg::marginSize(const Plasma::MarginEdge edge) const
{
if (d->noBorderPadding) {
return .0;
@ -212,7 +212,7 @@ qreal SvgPanel::marginSize(const Plasma::MarginEdge edge) const
}
}
QBitmap SvgPanel::mask() const
QBitmap PanelSvg::mask() const
{
if (!d->cachedBackground) {
d->generateBackground();
@ -221,7 +221,7 @@ QBitmap SvgPanel::mask() const
return d->cachedBackground->alphaChannel().createMaskFromColor(Qt::black);
}
void SvgPanel::Private::generateBackground()
void PanelSvg::Private::generateBackground()
{
bool origined = bFlags & ContentAtOrigin;
const int topWidth = background->elementSize(prefix + "top").width();
@ -404,7 +404,7 @@ void SvgPanel::Private::generateBackground()
}
}
void SvgPanel::paint(QPainter* painter, const QRectF& rect)
void PanelSvg::paint(QPainter* painter, const QRectF& rect)
{
if (!d->cachedBackground) {
d->generateBackground();
@ -420,7 +420,7 @@ void SvgPanel::paint(QPainter* painter, const QRectF& rect)
painter->drawPixmap(rect, *d->cachedBackground, rect.translated(-d->pos.x()-leftOffset,-d->pos.y()-topOffset));
}
void SvgPanel::updateSizes()
void PanelSvg::updateSizes()
{
delete d->cachedBackground;
d->cachedBackground = 0;
@ -459,4 +459,4 @@ void SvgPanel::updateSizes()
} // Plasma namespace
#include "svgpanel.moc"
#include "panelsvg.moc"

View File

@ -18,8 +18,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PLASMA_SVGPANEL_H
#define PLASMA_SVGPANEL_H
#ifndef PLASMA_PANELSVG_H
#define PLASMA_PANELSVG_H
#include <QtCore/QObject>
#include <QtGui/QPixmap>
@ -41,7 +41,7 @@ class QMatrix;
namespace Plasma
{
class PLASMA_EXPORT SvgPanel : public QObject
class PLASMA_EXPORT PanelSvg : public QObject
{
Q_OBJECT
public:
@ -59,7 +59,7 @@ class PLASMA_EXPORT SvgPanel : public QObject
Q_DECLARE_FLAGS(BorderFlags, BorderFlag)
/**
* Constructs a new SvgPanel that paints the proper named subelements
* Constructs a new PanelSvg that paints the proper named subelements
* as borders
*
* The size is initialized to be the SVG's native size.
@ -70,8 +70,8 @@ class PLASMA_EXPORT SvgPanel : public QObject
*
* @related Plasma::Theme
*/
explicit SvgPanel(const QString& imagePath = QString(), QObject* parent = 0);
~SvgPanel();
explicit PanelSvg(const QString& imagePath = QString(), QObject* parent = 0);
~PanelSvg();
/**
* Loads a new Svg
@ -111,13 +111,13 @@ class PLASMA_EXPORT SvgPanel : public QObject
qreal marginSize(const Plasma::MarginEdge edge) const;
/**
* Sets the position of the SvgPanel
* Sets the position of the PanelSvg
* @arg pos where it should be positioned at
*/
void setPos( const QPointF& pos );
/**
* Returns the position of the SvgPanel
* Returns the position of the PanelSvg
* @return the position
*/
QPointF pos() const;
@ -131,7 +131,7 @@ class PLASMA_EXPORT SvgPanel : public QObject
void setLocation(Plasma::Location location);
/**
* Returns the set location for the SvgPanel. Returns 0 if no location is set
* Returns the set location for the PanelSvg. Returns 0 if no location is set
* or a custom prefix is set (@see setPrefix)
* @return the location
*/
@ -153,7 +153,7 @@ class PLASMA_EXPORT SvgPanel : public QObject
void setPrefix(const QString & prefix);
/**
* Returns the prefix for SVG elements of the SvgPanel
* Returns the prefix for SVG elements of the PanelSvg
* @return the prefix
*/
QString prefix();
@ -185,6 +185,6 @@ class PLASMA_EXPORT SvgPanel : public QObject
} // Plasma namespace
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::SvgPanel::BorderFlags)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::PanelSvg::BorderFlags)
#endif // multiple inclusion guard

View File

@ -361,7 +361,7 @@ QSize Svg::size() const
return d->size.toSize();
}
void Svg::resize( int width, int height )
void Svg::resize( qreal width, qreal height )
{
resize( QSize( width, height ) );
}

2
svg.h
View File

@ -129,7 +129,7 @@ class PLASMA_EXPORT Svg : public QObject
* @arg width the new width
* @arg height the new height
**/
Q_INVOKABLE void resize( int width, int height );
Q_INVOKABLE void resize( qreal width, qreal height );
/**
* Resizes the rendered image. Rendering will actually take place on

View File

@ -34,7 +34,7 @@
#include <KGlobal>
#include <KWindowSystem>
#include <plasma/theme.h>
#include <plasma/svgpanel.h>
#include <plasma/panelsvg.h>
#ifdef Q_WS_X11
#include <X11/Xlib.h>
@ -70,7 +70,7 @@ class ToolTip::Private
QTimer *showTimer;
QTimer *hideTimer;
SvgPanel *background;
PanelSvg *background;
};
@ -203,8 +203,8 @@ ToolTip::ToolTip()
d->imageLabel = new QLabel;
d->imageLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
d->background = new SvgPanel("widgets/tooltip", this);
d->background->setBorderFlags(SvgPanel::DrawAllBorders);
d->background = new PanelSvg("widgets/tooltip", this);
d->background->setBorderFlags(PanelSvg::DrawAllBorders);
connect(d->background, SIGNAL(repaintNeeded()), this, SLOT(update()));