build, though wallpaper is still broken

This commit is contained in:
Aaron Seigo 2011-07-21 14:39:02 +02:00
parent a4187dc0a7
commit 3d5fa3ca43
2 changed files with 8 additions and 10 deletions

View File

@ -198,7 +198,6 @@ WallpaperPackage::WallpaperPackage(Wallpaper *paper)
{ {
if (paper) { if (paper) {
connect(paper, SIGNAL(renderHintsChanged()), this, SLOT(renderHintsChanged())); connect(paper, SIGNAL(renderHintsChanged()), this, SLOT(renderHintsChanged()));
connect(paper, SIGNAL(destroyed(QObject*)), this, SLOT(paperDestroyed()));
} }
} }
@ -222,7 +221,7 @@ void WallpaperPackage::renderHintsChanged()
} }
if (m_fullPackage) { if (m_fullPackage) {
findBestPaper(paper, packages.value(paper)); //FIXME: findBestPaper(packages.value(paper));
} }
} }
@ -243,7 +242,7 @@ void WallpaperPackage::pathChanged(Package *package)
if (m_fullPackage) { if (m_fullPackage) {
package->setContentsPrefixPaths(QStringList() << "contents/"); package->setContentsPrefixPaths(QStringList() << "contents/");
findBestPaper(package, papers.value(package)); findBestPaper(package);
} else { } else {
// dirty trick to support having a file passed in instead of a directory // dirty trick to support having a file passed in instead of a directory
package->addFileDefinition("preferred", info.fileName(), i18n("Recommended wallpaper file")); package->addFileDefinition("preferred", info.fileName(), i18n("Recommended wallpaper file"));
@ -257,12 +256,12 @@ void WallpaperPackage::pathChanged(Package *package)
QSize WallpaperPackage::resSize(const QString &str) const QSize WallpaperPackage::resSize(const QString &str) const
{ {
int index = str.indexOf('x'); const int index = str.indexOf('x');
if (index != -1) { if (index != -1) {
return QSize(str.left(index).toInt(), str.mid(index + 1).toInt()); return QSize(str.left(index).toInt(), str.mid(index + 1).toInt());
} else {
return QSize();
} }
return QSize();
} }
void WallpaperPackage::findBestPaper(Package *package) void WallpaperPackage::findBestPaper(Package *package)
@ -279,7 +278,7 @@ void WallpaperPackage::findBestPaper(Package *package)
QString bestImage; QString bestImage;
foreach (const QString &entry, images) { foreach (const QString &entry, images) {
QSize candidate = resSize(QFileInfo(entry).baseName()); const QSize candidate = resSize(QFileInfo(entry).baseName());
if (candidate == QSize()) { if (candidate == QSize()) {
continue; continue;
} }
@ -297,7 +296,7 @@ void WallpaperPackage::findBestPaper(Package *package)
} }
//kDebug() << "best image" << bestImage; //kDebug() << "best image" << bestImage;
package->addFileDefinition("preferred", filePath("images") + bestImage, i18n("Recommended wallpaper file")); package->addFileDefinition("preferred", package->filePath("images") + bestImage, i18n("Recommended wallpaper file"));
} }
float WallpaperPackage::distance(const QSize& size, const QSize& desired, float WallpaperPackage::distance(const QSize& size, const QSize& desired,

View File

@ -68,12 +68,11 @@ public:
private: private:
QSize resSize(const QString &str) const; QSize resSize(const QString &str) const;
void findBestPaper(); void findBestPaper(Package *package);
float distance(const QSize& size, const QSize& desired, float distance(const QSize& size, const QSize& desired,
Plasma::Wallpaper::ResizeMethod method) const; Plasma::Wallpaper::ResizeMethod method) const;
private Q_SLOTS: private Q_SLOTS:
void paperDestroyed();
void renderHintsChanged(); void renderHintsChanged();
private: private: