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

View File

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

View File

@ -35,7 +35,7 @@
#include <KDebug> #include <KDebug>
#include <NETRootInfo> #include <NETRootInfo>
#include <plasma/svgpanel.h> #include <plasma/panelsvg.h>
#include <plasma/theme.h> #include <plasma/theme.h>
#ifdef Q_WS_X11 #ifdef Q_WS_X11
@ -53,15 +53,15 @@ public:
* Holds the background SVG, to be re-rendered when the cache is invalidated, * Holds the background SVG, to be re-rendered when the cache is invalidated,
* for example by resizing the dialogue. * for example by resizing the dialogue.
*/ */
Plasma::SvgPanel *background; Plasma::PanelSvg *background;
}; };
Dialog::Dialog( QWidget * parent, Qt::WindowFlags f ) Dialog::Dialog( QWidget * parent, Qt::WindowFlags f )
: QWidget(parent, f), : QWidget(parent, f),
d(new Private) d(new Private)
{ {
d->background = new SvgPanel("dialogs/background", this); d->background = new PanelSvg("dialogs/background", this);
d->background->setBorderFlags(SvgPanel::DrawAllBorders); d->background->setBorderFlags(PanelSvg::DrawAllBorders);
d->background->resize(size()); d->background->resize(size());
connect(d->background, SIGNAL(repaintNeeded()), this, SLOT(update())); 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. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#include "svgpanel.h" #include "panelsvg.h"
#include <QPainter> #include <QPainter>
#include <QSize> #include <QSize>
@ -29,7 +29,7 @@
namespace Plasma namespace Plasma
{ {
class SvgPanel::Private class PanelSvg::Private
{ {
public: public:
Private() Private()
@ -67,7 +67,7 @@ public:
bool tileCenter : 1; bool tileCenter : 1;
}; };
SvgPanel::SvgPanel(const QString& imagePath, QObject* parent) PanelSvg::PanelSvg(const QString& imagePath, QObject* parent)
: QObject(parent), : QObject(parent),
d(new Private) d(new Private)
{ {
@ -78,12 +78,12 @@ SvgPanel::SvgPanel(const QString& imagePath, QObject* parent)
d->panelSize = d->background->size(); d->panelSize = d->background->size();
} }
SvgPanel::~SvgPanel() PanelSvg::~PanelSvg()
{ {
delete d; delete d;
} }
void SvgPanel::setFile(const QString& imagePath) void PanelSvg::setFile(const QString& imagePath)
{ {
if (imagePath == d->background->file()) { if (imagePath == d->background->file()) {
return; return;
@ -93,12 +93,12 @@ void SvgPanel::setFile(const QString& imagePath)
setPrefix(prefix()); setPrefix(prefix());
} }
QString SvgPanel::file() const QString PanelSvg::file() const
{ {
return d->background->file(); return d->background->file();
} }
void SvgPanel::setBorderFlags(const BorderFlags flags) void PanelSvg::setBorderFlags(const BorderFlags flags)
{ {
if (flags == d->bFlags) { if (flags == d->bFlags) {
return; return;
@ -108,22 +108,22 @@ void SvgPanel::setBorderFlags(const BorderFlags flags)
updateSizes(); updateSizes();
} }
SvgPanel::BorderFlags SvgPanel::borderFlags() const PanelSvg::BorderFlags PanelSvg::borderFlags() const
{ {
return d->bFlags; return d->bFlags;
} }
void SvgPanel::setPos(const QPointF& pos) void PanelSvg::setPos(const QPointF& pos)
{ {
d->pos = pos; d->pos = pos;
} }
QPointF SvgPanel::pos() const QPointF PanelSvg::pos() const
{ {
return d->pos; return d->pos;
} }
void SvgPanel::setLocation(Plasma::Location location) void PanelSvg::setLocation(Plasma::Location location)
{ {
switch (location) { switch (location) {
case TopEdge: case TopEdge:
@ -145,12 +145,12 @@ void SvgPanel::setLocation(Plasma::Location location)
d->location = location; d->location = location;
} }
Plasma::Location SvgPanel::location() const Plasma::Location PanelSvg::location() const
{ {
return d->location; return d->location;
} }
void SvgPanel::setPrefix(const QString & prefix) void PanelSvg::setPrefix(const QString & prefix)
{ {
if (!d->background->hasElement(prefix + "-center")) { if (!d->background->hasElement(prefix + "-center")) {
d->prefix.clear(); d->prefix.clear();
@ -168,7 +168,7 @@ void SvgPanel::setPrefix(const QString & prefix)
} }
} }
QString SvgPanel::prefix() QString PanelSvg::prefix()
{ {
if (d->prefix.isEmpty()) { if (d->prefix.isEmpty()) {
return QString(); return QString();
@ -176,7 +176,7 @@ QString SvgPanel::prefix()
return d->prefix.left(d->prefix.size() - 1); 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) { if (!size.isValid() || size.width() < 1 || size.height() < 1 || size == d->panelSize) {
return; return;
@ -186,7 +186,7 @@ void SvgPanel::resize(const QSizeF& size)
updateSizes(); updateSizes();
} }
qreal SvgPanel::marginSize(const Plasma::MarginEdge edge) const qreal PanelSvg::marginSize(const Plasma::MarginEdge edge) const
{ {
if (d->noBorderPadding) { if (d->noBorderPadding) {
return .0; 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) { if (!d->cachedBackground) {
d->generateBackground(); d->generateBackground();
@ -221,7 +221,7 @@ QBitmap SvgPanel::mask() const
return d->cachedBackground->alphaChannel().createMaskFromColor(Qt::black); return d->cachedBackground->alphaChannel().createMaskFromColor(Qt::black);
} }
void SvgPanel::Private::generateBackground() void PanelSvg::Private::generateBackground()
{ {
bool origined = bFlags & ContentAtOrigin; bool origined = bFlags & ContentAtOrigin;
const int topWidth = background->elementSize(prefix + "top").width(); 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) { if (!d->cachedBackground) {
d->generateBackground(); 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)); painter->drawPixmap(rect, *d->cachedBackground, rect.translated(-d->pos.x()-leftOffset,-d->pos.y()-topOffset));
} }
void SvgPanel::updateSizes() void PanelSvg::updateSizes()
{ {
delete d->cachedBackground; delete d->cachedBackground;
d->cachedBackground = 0; d->cachedBackground = 0;
@ -459,4 +459,4 @@ void SvgPanel::updateSizes()
} // Plasma namespace } // Plasma namespace
#include "svgpanel.moc" #include "panelsvg.moc"

View File

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

View File

@ -361,7 +361,7 @@ QSize Svg::size() const
return d->size.toSize(); return d->size.toSize();
} }
void Svg::resize( int width, int height ) void Svg::resize( qreal width, qreal height )
{ {
resize( QSize( width, 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 width the new width
* @arg height the new height * @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 * Resizes the rendered image. Rendering will actually take place on

View File

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