Commit 019df1d8 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr
Browse files

Port KStandardDirs to QStandardPaths.

parent 4f811b66
......@@ -31,7 +31,6 @@
#include <qtest_kde.h>
#include <QDebug>
#include <KTemporaryFile>
#include <KStandardDirs>
#include <QIODevice>
#include <QFile>
......
......@@ -28,7 +28,6 @@
#include <qtest_kde.h>
#include <QDebug>
#include <KTemporaryFile>
#include <KStandardDirs>
#include <QUrl>
#include <QIODevice>
......@@ -36,6 +35,7 @@
#include <QXmlSchema>
#include <QXmlSchemaValidator>
#include <QDomDocument>
#include <QStandardPaths>
TestLanguageFiles::TestLanguageFiles()
{
......@@ -57,7 +57,7 @@ void TestLanguageFiles::cleanup()
QXmlSchema TestLanguageFiles::loadXmlSchema(const QString &schemeName) const
{
QString relPath = QString("schemes/%1.xsd").arg(schemeName);
QUrl file = QUrl::fromLocalFile(KGlobal::dirs()->findResource("appdata", relPath));
QUrl file = QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::DataLocation, relPath));
QXmlSchema schema;
if (schema.load(file) == false) {
......@@ -98,7 +98,7 @@ void TestLanguageFiles::languageSchemeValidationTest()
void TestLanguageFiles::checkIdUniqueness()
{
ResourceManager manager;
QStringList languageFiles = KGlobal::dirs()->findAllResources("appdata",QString("data/languages/*.xml"));
QStringList languageFiles = QStandardPaths::locateAll(QStandardPaths::DataLocation, QString("data/languages/*.xml"));
foreach (const QString &file, languageFiles) {
qDebug() << "File being parsed: " << file;
QStringList idList;
......
......@@ -26,7 +26,6 @@
#include <QPixmap>
#include <QDebug>
#include <KGlobal>
#include <KStandardDirs>
using namespace LearnerProfile;
......
......@@ -24,8 +24,7 @@
#include <QString>
#include <QList>
#include <QHash>
#include <KGlobal>
#include <KStandardDirs>
#include <QStandardPaths>
#include "learninggoal.h"
namespace LearnerProfile
......@@ -45,7 +44,7 @@ public:
QString imageUrl() const
{
QString relPath = QString("images/learner%1.png").arg(m_identifier);
return KGlobal::dirs()->locateLocal("appdata", relPath);
return QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + relPath;
}
QString m_name;
......
......@@ -27,7 +27,6 @@
#include <QDebug>
#include <KConfig>
#include <KConfigGroup>
#include <KStandardDirs>
#include <QString>
#include <QList>
......
......@@ -21,13 +21,13 @@
#include "storage.h"
#include "learner.h"
#include <KStandardDirs>
#include <QDebug>
#include <KLocale>
#include <QSqlError>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QStandardPaths>
using namespace LearnerProfile;
......@@ -325,7 +325,7 @@ QSqlDatabase Storage::database()
return QSqlDatabase::database(QSqlDatabase::defaultConnection);
}
QString path = KGlobal::dirs()->locateLocal("appdata", "learnerdata.db");
QString path = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "learnerdata.db";
qDebug() << "Database path: " << path;
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
......
......@@ -44,9 +44,9 @@
#include <QDir>
#include <KGlobal>
#include <KStandardDirs>
#include <QDebug>
#include <QUrl>
#include <QStandardPaths>
ResourceManager::ResourceManager(QObject *parent)
: QObject(parent)
......@@ -110,7 +110,7 @@ void ResourceManager::loadCourseResources()
}
// register GHNS course resources
QStringList courseFiles = KGlobal::dirs()->findAllResources("data",QString("artikulate/courses/*/*/*.xml"));
QStringList courseFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QString("artikulate/courses/*/*/*.xml"));
foreach (const QString &file, courseFiles) {
QUrl courseFile = QUrl::fromLocalFile(file);
// get directory name, which is the language identifier for this course
......@@ -128,7 +128,7 @@ void ResourceManager::loadLanguageResources()
{
// load language resources
// all other resources are only loaded on demand
QStringList languageFiles = KGlobal::dirs()->findAllResources("appdata",QString("languages/*.xml"));
QStringList languageFiles = QStandardPaths::locateAll(QStandardPaths::DataLocation, QString("languages/*.xml"));
foreach (const QString &file, languageFiles) {
addLanguage(QUrl::fromLocalFile(file));
}
......
......@@ -21,14 +21,13 @@
#include "resourceinterface.h"
#include <QDebug>
#include <KStandardDirs>
#include <QUrl>
#include <QIODevice>
#include <QXmlSchema>
#include <QXmlSchemaValidator>
#include <QDomDocument>
#include <QFile>
#include <QStandardPaths>
ResourceInterface::ResourceInterface(ResourceManager *resourceManager)
: QObject()
......@@ -65,7 +64,7 @@ void ResourceInterface::reload()
QXmlSchema ResourceInterface::loadXmlSchema(const QString &schemeName) const
{
QString relPath = QString("schemes/%1.xsd").arg(schemeName);
QUrl file = QUrl::fromLocalFile(KGlobal::dirs()->findResource("appdata", relPath));
QUrl file = QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::DataLocation, relPath));
QXmlSchema schema;
if (schema.load(file) == false) {
......
......@@ -39,7 +39,6 @@
#include <KGlobal>
#include <KIcon>
#include <KLocale>
#include <KStandardDirs>
#include <kdeclarative.h>
#include <KConfigDialog>
#include <QDebug>
......@@ -56,6 +55,7 @@
#include <QCloseEvent>
#include <QtCore/QCoreApplication>
#include <QtCore/QPointer>
#include <QStandardPaths>
using namespace LearnerProfile;
......@@ -106,7 +106,7 @@ MainWindow::MainWindow()
m_view->setStyleSheet("background-color: transparent;");
// set starting screen
m_view->setSource(QUrl::fromLocalFile(KGlobal::dirs()->findResource("appdata", "qml/Main.qml")));
m_view->setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::DataLocation, "qml/Main.qml")));
// settings from kcfg values
updateTrainingPhraseFont();
......
......@@ -24,7 +24,7 @@
#include "settings.h"
#include <KLocale>
#include <KStandardDirs>
#include <QStandardPaths>
SoundDeviceDialogPage::SoundDeviceDialogPage()
: QWidget(0)
......@@ -99,7 +99,7 @@ void SoundDeviceDialogPage::playTestSound()
OutputDeviceController::self().stop();
return;
}
QString testsoundFile = KGlobal::dirs()->findResource("appdata", QString("sounds/testsound.ogg"));
QString testsoundFile = QStandardPaths::locate(QStandardPaths::DataLocation, QString("sounds/testsound.ogg"));
OutputDeviceController::self().setVolume(ui->kcfg_AudioOutputVolume->value());
OutputDeviceController::self().play(QUrl::fromLocalFile(testsoundFile));
}
......
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