finished the Plasma::Svg api change

ContentType now is simply a bool and related methods now are
containsMultipleImages() and setContainsMultipleImages()

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=797998
This commit is contained in:
Marco Martin 2008-04-17 09:09:48 +00:00
parent b4bdfcd9ec
commit 419277a044
2 changed files with 18 additions and 37 deletions

16
svg.cpp
View File

@ -71,7 +71,7 @@ class Svg::Private
Private(const QString& imagePath, Svg *svg)
: q(svg),
renderer(0),
contentType(Svg::SingleImage),
multipleImages(false),
themed(false)
{
setImagePath(imagePath, q);
@ -128,7 +128,7 @@ class Svg::Private
{
#if SVG_CACHE_BUGFIX
QSizeF localSize;
if (elementId.isEmpty() || contentType == Svg::ImageSet) {
if (elementId.isEmpty() || multipleImages) {
localSize = size;
} else {
localSize = elementSize(elementId);
@ -178,7 +178,7 @@ class Svg::Private
#if !SVG_CACHE_BUGFIX
// we have to re-render this puppy
QSize s;
if (elementId.isEmpty() || contentType == Svg::ImageSet) {
if (elementId.isEmpty() || multipleImages) {
s = size.toSize();
} else {
s = elementSize(elementId);
@ -328,7 +328,7 @@ class Svg::Private
QString path;
QList<QString> ids;
QSizeF size;
Svg::ContentType contentType;
bool multipleImages;
bool themed;
bool applyColors;
};
@ -443,14 +443,14 @@ bool Svg::isValid() const
return d->renderer->isValid();
}
void Svg::setContentType(ContentType contentType)
void Svg::setContainsMultipleImages(bool multiple)
{
d->contentType = contentType;
d->multipleImages = multiple;
}
Svg::ContentType Svg::contentType()
bool Svg::containsMultipleImages() const
{
return d->contentType;
return d->multipleImages;
}
void Svg::setImagePath(const QString &svgFilePath)

39
svg.h
View File

@ -49,26 +49,10 @@ class PLASMA_EXPORT Svg : public QObject
Q_OBJECT
Q_ENUMS( ContentType )
Q_PROPERTY( QSize size READ size )
Q_PROPERTY( ContentType contentType READ contentType WRITE setContentType )
Q_PROPERTY( bool multipleImages READ containsMultipleImages WRITE setContainsMultipleImages )
Q_PROPERTY( QString filePath READ imagePath WRITE setImagePath )
public:
/**
* Describes what is in the Svg document to be loaded. The important
* distinction is whether the Svg is a single image (or group of
* elements) that are meant to be viewed together, such as a clock face
* and hands, or a set of images that are meant to be displayed
* individually, such as a deck of cards.
*/
enum ContentType { SingleImage = 0 /**< A set of elements that together
make an image. Elements may be
drawn separately to accomplish
this. This is the default. */,
ImageSet /**< A set of elements, each of which
constitutes a whole image. Each
element will therefore be rendered
to the set size of the Svg object */
};
/**
* Constructs an SVG object that implicitly shares and caches rendering
@ -178,19 +162,16 @@ class PLASMA_EXPORT Svg : public QObject
**/
Q_INVOKABLE bool isValid() const;
/**
* Sets what sort of content is in the Svg.
* @see ContentType
* @arg contents whether the Svg is a single image or a set of images
*/
void setContentType(ContentType contentType);
/**
* Set if the svg contains a single image or multiple ones.
* @arg multiple true if the svg contains multiple images
*/
void setContainsMultipleImages(bool multiple);
/**
* Returns the content type of the Svg
* @see SetContentType
* @arg contents whether the Svg is a single image or a set of images
*/
ContentType contentType();
/**
* @return whether or not the svg contains multiple images or not
*/
bool containsMultipleImages() const;
/**
* Convenience method for setting the svg file to use for the Svg.