make setFile actually work
CCMAIL:notmart@gmail.com svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=758400
This commit is contained in:
parent
9db2d7e783
commit
b03a2588d2
38
svg.cpp
38
svg.cpp
@ -64,17 +64,7 @@ class Svg::Private
|
||||
: renderer(0),
|
||||
contentType(Svg::SingleImage)
|
||||
{
|
||||
if (QDir::isAbsolutePath(imagePath)) {
|
||||
path = imagePath;
|
||||
themed = false;
|
||||
|
||||
if (!QFile::exists(path)) {
|
||||
kDebug() << "Plasma::Svg: file '" << path << "' does not exist!";
|
||||
}
|
||||
} else {
|
||||
themePath = imagePath;
|
||||
themed = true;
|
||||
}
|
||||
setImagePath(imagePath);
|
||||
}
|
||||
|
||||
~Private()
|
||||
@ -82,6 +72,22 @@ class Svg::Private
|
||||
eraseRenderer();
|
||||
}
|
||||
|
||||
void setImagePath(const QString &imagePath)
|
||||
{
|
||||
themed = !QDir::isAbsolutePath(imagePath);
|
||||
path = themePath = QString();
|
||||
|
||||
if (themed) {
|
||||
themePath = imagePath;
|
||||
} else {
|
||||
path = imagePath;
|
||||
|
||||
if (!QFile::exists(path)) {
|
||||
kDebug() << "Plasma::Svg: file '" << path << "' does not exist!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void removeFromCache()
|
||||
{
|
||||
if ( id.isEmpty() ) {
|
||||
@ -129,10 +135,12 @@ class Svg::Private
|
||||
} else {
|
||||
renderer->render(&renderPainter, elementId);
|
||||
}
|
||||
|
||||
renderPainter.end();
|
||||
bool inserted = QPixmapCache::insert( id, p );
|
||||
if (!inserted)
|
||||
|
||||
if (!QPixmapCache::insert( id, p )) {
|
||||
kDebug() << "pixmap cache is too small for inserting" << id << "of size" << s;
|
||||
}
|
||||
}
|
||||
|
||||
void createRenderer()
|
||||
@ -141,7 +149,7 @@ class Svg::Private
|
||||
return;
|
||||
}
|
||||
|
||||
if (themed && path.isNull()) {
|
||||
if (themed && path.isEmpty()) {
|
||||
path = Plasma::Theme::self()->image(themePath);
|
||||
}
|
||||
|
||||
@ -318,7 +326,7 @@ Svg::ContentType Svg::contentType()
|
||||
|
||||
void Svg::setFile(const QString &svgFilePath)
|
||||
{
|
||||
d->themePath = svgFilePath;
|
||||
d->setImagePath(svgFilePath);
|
||||
d->eraseRenderer();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user