Commit b9830e9e authored by Michael Pyne's avatar Michael Pyne

Remove KStandardDirs in cover manager.

parent 3081e3ee
......@@ -16,6 +16,7 @@
#include "covermanager.h"
#include <QGlobalStatic>
#include <QTimer>
#include <QPixmap>
#include <QString>
......@@ -28,11 +29,10 @@
#include <QByteArray>
#include <QMap>
#include <QTemporaryFile>
#include <QStandardPaths>
#include <QUrl>
#include <kdemacros.h>
#include <kstandarddirs.h>
#include <kglobal.h>
#include <kio/job.h>
#include "juk.h"
......@@ -174,7 +174,7 @@ public:
// This is responsible for making sure that the CoverManagerPrivate class
// gets properly destructed on shutdown.
K_GLOBAL_STATIC(CoverManagerPrivate, sd)
Q_GLOBAL_STATIC(CoverManagerPrivate, sd)
//
// Implementation of CoverManagerPrivate methods.
......@@ -183,8 +183,7 @@ void CoverManagerPrivate::createDataDir() const
{
QDir dir;
QString dirPath(QDir::cleanPath(coverLocation() + "/.."));
if(!dir.exists(dirPath))
KStandardDirs::makeDir(dirPath);
dir.mkpath(dirPath);
}
void CoverManagerPrivate::saveCovers() const
......@@ -287,7 +286,8 @@ void CoverManagerPrivate::loadCovers()
QString CoverManagerPrivate::coverLocation() const
{
return KGlobal::dirs()->saveLocation("appdata") + "coverdb/covers";
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)
+ "coverdb/covers";
}
coverKey CoverManagerPrivate::nextId() const
......@@ -434,8 +434,8 @@ coverKey CoverManager::addCover(const QUrl &path, const QString &artist, const Q
// Copy it to a local file first.
QString ext = QString("/coverdb/coverID-%1%2").arg(id).arg(fileNameExt);
coverData.path = KGlobal::dirs()->saveLocation("appdata") + ext;
coverData.path = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)
+ ext;
qCDebug(JUK_LOG) << "Saving pixmap to " << coverData.path;
data()->createDataDir();
......@@ -560,11 +560,6 @@ void CoverManager::saveCovers()
data()->saveCovers();
}
void CoverManager::shutdown()
{
sd.destroy();
}
CoverDataMapIterator CoverManager::begin()
{
return data()->covers.begin();
......
......@@ -224,13 +224,6 @@ public:
*/
static void saveCovers();
/**
* This is a hack, as we should be shut down automatically by
* KStaticDeleter, but JuK is crashing for me on shutdown before
* KStaticDeleter gets a chance to run, which is cramping my testing.
*/
static void shutdown();
/**
* @return Iterator pointing to the first element in the cover database.
*/
......
......@@ -530,10 +530,6 @@ void JuK::slotAboutToQuit()
deleteAndClear(m_splitter);
deleteAndClear(m_player);
deleteAndClear(m_statusLabel);
// Playlists depend on CoverManager, so CoverManager should shutdown as
// late as possible
CoverManager::shutdown();
}
void JuK::slotQuit()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment