Commit 6ede975c authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr
Browse files

kDebug -> qDebug.

parent 50ac60cd
......@@ -29,7 +29,7 @@
#include "../src/settings.h"
#include <qtest_kde.h>
#include <KDebug>
#include <QDebug>
#include <KTemporaryFile>
#include <KStandardDirs>
......@@ -97,7 +97,7 @@ void TestCourseFiles::fileLoadSaveCompleteness()
QFile file(outputFile.fileName());
if (!file.open(QIODevice::ReadOnly)) {
kFatal() << "Could not open file to read.";
qFatal() << "Could not open file to read.";
}
//TODO this only works, since the resource manager not checks uniqueness of course ids!
......
......@@ -26,7 +26,7 @@
#include "core/phrase.h"
#include <qtest_kde.h>
#include <KDebug>
#include <QDebug>
#include <KTemporaryFile>
#include <KStandardDirs>
#include <KUrl>
......@@ -61,7 +61,7 @@ QXmlSchema TestLanguageFiles::loadXmlSchema(const QString &schemeName) const
QXmlSchema schema;
if (schema.load(file) == false) {
kWarning() << "Schema at file " << file.toLocalFile() << " is invalid.";
qWarning() << "Schema at file " << file.toLocalFile() << " is invalid.";
}
return schema;
}
......@@ -71,7 +71,7 @@ QDomDocument TestLanguageFiles::loadDomDocument(const KUrl &path, const QXmlSche
QDomDocument document;
QXmlSchemaValidator validator(schema);
if (!validator.validate(path)) {
kWarning() << "Schema is not valid, aborting loading of XML document:" << path.toLocalFile();
qWarning() << "Schema is not valid, aborting loading of XML document:" << path.toLocalFile();
return document;
}
......@@ -79,10 +79,10 @@ QDomDocument TestLanguageFiles::loadDomDocument(const KUrl &path, const QXmlSche
QFile file(path.toLocalFile());
if (file.open(QIODevice::ReadOnly)) {
if (!document.setContent(&file, &errorMsg)) {
kWarning() << errorMsg;
qWarning() << errorMsg;
}
} else {
kWarning() << "Could not open XML document " << path.toLocalFile() << " for reading, aborting.";
qWarning() << "Could not open XML document " << path.toLocalFile() << " for reading, aborting.";
}
return document;
}
......@@ -100,7 +100,7 @@ void TestLanguageFiles::checkIdUniqueness()
ResourceManager manager;
QStringList languageFiles = KGlobal::dirs()->findAllResources("appdata",QString("data/languages/*.xml"));
foreach (const QString &file, languageFiles) {
kDebug() << "File being parsed: " << file;
qDebug() << "File being parsed: " << file;
QStringList idList;
const KUrl &languageFile = KUrl::fromLocalFile(file);
QVERIFY(languageFile.isLocalFile());
......@@ -126,7 +126,7 @@ void TestLanguageFiles::checkIdUniqueness()
phonemeNode = phonemeNode.nextSiblingElement())
{
QString id = phonemeNode.firstChildElement("id").text();
kDebug() << "ID: " << id;
qDebug() << "ID: " << id;
QVERIFY2(!idList.contains(id),"Phoneme ID used more than once in the tested file");
idList.append(id);
}
......
......@@ -24,7 +24,7 @@
#include <QHash>
#include <QFileInfo>
#include <QPixmap>
#include <KDebug>
#include <QDebug>
#include <KGlobal>
#include <KStandardDirs>
......@@ -83,14 +83,14 @@ QString Learner::imageUrl() const
void Learner::importImage(const QString &path)
{
if (!QFileInfo(path).exists()) {
kWarning() << "image path points to a non-existing file, aborting: " << path;
qWarning() << "image path points to a non-existing file, aborting: " << path;
return;
}
QPixmap image = QPixmap(path);
image = image.scaled(120, 120);
image.save(d->imageUrl());
emit imageUrlChanged();
kDebug() << "saved scaled image from " << path << " at " << d->imageUrl();
qDebug() << "saved scaled image from " << path << " at " << d->imageUrl();
}
QList< LearningGoal* > Learner::goals() const
......@@ -112,7 +112,7 @@ void Learner::removeGoal(LearnerProfile::LearningGoal *goal)
{
int index = d->m_goals.indexOf(goal);
if (index < 0) {
kError() << "Cannot remove goal, not found: aborting";
qCritical() << "Cannot remove goal, not found: aborting";
return;
}
emit goalAboutToBeRemoved(index);
......@@ -157,7 +157,7 @@ void Learner::setActiveGoal(Learner::Category categoryLearner, const QString &id
return;
}
}
kError() << "Could not select learning goal with ID " << identifier
qCritical() << "Could not select learning goal with ID " << identifier
<< ": not registered for this learner";
}
......@@ -167,7 +167,7 @@ LearningGoal * Learner::activeGoal(Learner::Category categoryLearner) const
// workaround for Q_INVOKABLE access of enum
LearningGoal::Category category = static_cast<LearningGoal::Category>(categoryLearner);
if (!d->m_activeGoal.contains(category)) {
kWarning() << "(Learner " << identifier() << ") No current learning goal set for category "
qWarning() << "(Learner " << identifier() << ") No current learning goal set for category "
<< category
<< " : fall back to first in list";
foreach (LearningGoal *goal, d->m_goals) {
......@@ -175,7 +175,7 @@ LearningGoal * Learner::activeGoal(Learner::Category categoryLearner) const
return goal;
}
}
kWarning() << "No learning goals of catagory " << category << " registered";
qWarning() << "No learning goals of catagory " << category << " registered";
return 0;
}
return d->m_activeGoal[category];
......
......@@ -26,7 +26,7 @@
#include <QSignalMapper>
#include <KLocale>
#include <KDebug>
#include <QDebug>
using namespace LearnerProfile;
......@@ -209,7 +209,7 @@ void LearningGoalModel::onLearningGoalAboutToBeRemoved(int index)
}
if (index < 0 || d->m_goals.count() <= index) {
kWarning() << "Cannot remove learning goal from model, not registered";
qWarning() << "Cannot remove learning goal from model, not registered";
return;
}
beginRemoveRows(QModelIndex(), index, index);
......
......@@ -24,7 +24,7 @@
#include <QObject>
#include <QList>
#include <KDebug>
#include <QDebug>
#include <KFileDialog>
#include <KLocale>
......@@ -98,7 +98,7 @@ void ProfileManager::removeProfile(Learner *learner)
{
int index = d->m_profiles.indexOf(learner);
if (index < 0) {
kWarning() << "Profile was not found, aborting";
qWarning() << "Profile was not found, aborting";
return;
}
emit profileAboutToBeRemoved(index);
......
......@@ -24,7 +24,7 @@
#include "learner.h"
#include "storage.h"
#include <KDebug>
#include <QDebug>
#include <KConfig>
#include <KConfigGroup>
#include <KStandardDirs>
......@@ -82,13 +82,13 @@ ProfileManagerPrivate::ProfileManagerPrivate()
activeGoalsIdentifiers.at(i));
}
} else {
kError() << "Inconsistent goal category / identifier pairs found: aborting.";
qCritical() << "Inconsistent goal category / identifier pairs found: aborting.";
}
break;
}
}
if (m_activeProfile == 0) {
kDebug() << "No last active profile found, falling back to first found profile";
qDebug() << "No last active profile found, falling back to first found profile";
if (m_profiles.size() > 0) {
m_activeProfile = m_profiles.at(0);
}
......@@ -119,7 +119,7 @@ void ProfileManagerPrivate::sync()
activeProfileGroup.writeEntry("activeGoalsIdentifiers", goalIdentifiers);
}
else {
kError() << "No active profile selected, aborting sync.";
qCritical() << "No active profile selected, aborting sync.";
}
m_config->sync();
......
......@@ -22,7 +22,7 @@
#include "learner.h"
#include <KStandardDirs>
#include <KDebug>
#include <QDebug>
#include <KLocale>
#include <QSqlError>
......@@ -59,7 +59,7 @@ bool Storage::storeProfile(Learner *learner)
idExistsQuery.bindValue(":id", learner->identifier());
idExistsQuery.exec();
if (db.lastError().isValid()) {
kError() << "ExistsQuery: " << db.lastError().text();
qCritical() << "ExistsQuery: " << db.lastError().text();
raiseError(db.lastError());
return false;
}
......@@ -86,7 +86,7 @@ bool Storage::storeProfile(Learner *learner)
updateProfileQuery.bindValue(":name", learner->name());
updateProfileQuery.exec();
if (updateProfileQuery.lastError().isValid()) {
kError() << updateProfileQuery.lastError().text();
qCritical() << updateProfileQuery.lastError().text();
raiseError(updateProfileQuery.lastError());
db.rollback();
return false;
......@@ -106,7 +106,7 @@ bool Storage::storeProfile(Learner *learner)
relationExistsQuery.bindValue(":profileId", learner->identifier());
relationExistsQuery.exec();
if (db.lastError().isValid()) {
kError() << "ExistsQuery: " << db.lastError().text();
qCritical() << "ExistsQuery: " << db.lastError().text();
raiseError(db.lastError());
return false;
}
......@@ -140,7 +140,7 @@ bool Storage::removeProfile(Learner *learner)
removeProfileQuery.exec();
if (removeProfileQuery.lastError().isValid()) {
kError() << removeProfileQuery.lastError().text();
qCritical() << removeProfileQuery.lastError().text();
raiseError(removeProfileQuery.lastError());
db.rollback();
return false;
......@@ -153,7 +153,7 @@ bool Storage::removeProfile(Learner *learner)
removeGoalRelationQuery.exec();
if (removeGoalRelationQuery.lastError().isValid()) {
kError() << removeGoalRelationQuery.lastError().text();
qCritical() << removeGoalRelationQuery.lastError().text();
raiseError(removeGoalRelationQuery.lastError());
db.rollback();
return false;
......@@ -164,7 +164,7 @@ bool Storage::removeProfile(Learner *learner)
bool Storage::removeRelation(Learner *learner, LearningGoal *goal)
{
kDebug() << "remove relation";
qDebug() << "remove relation";
QSqlDatabase db = database();
QSqlQuery removeGoalRelationQuery(db);
removeGoalRelationQuery.prepare(
......@@ -178,7 +178,7 @@ kDebug() << "remove relation";
removeGoalRelationQuery.bindValue(":profileId", learner->identifier());
removeGoalRelationQuery.exec();
if (db.lastError().isValid()) {
kError() << "ExistsQuery: " << db.lastError().text();
qCritical() << "ExistsQuery: " << db.lastError().text();
raiseError(db.lastError());
return false;
}
......@@ -193,7 +193,7 @@ QList< Learner* > Storage::loadProfiles(QList<LearningGoal*> goals)
profileQuery.prepare("SELECT id, name FROM profiles");
profileQuery.exec();
if (profileQuery.lastError().isValid()) {
kError() << profileQuery.lastError().text();
qCritical() << profileQuery.lastError().text();
raiseError(profileQuery.lastError());
return QList<Learner*>();
}
......@@ -210,7 +210,7 @@ QList< Learner* > Storage::loadProfiles(QList<LearningGoal*> goals)
goalRelationQuery.prepare("SELECT goal_category, goal_identifier, profile_id FROM learner_goals");
goalRelationQuery.exec();
if (goalRelationQuery.lastError().isValid()) {
kError() << goalRelationQuery.lastError().text();
qCritical() << goalRelationQuery.lastError().text();
raiseError(goalRelationQuery.lastError());
return QList<Learner*>();
}
......@@ -256,7 +256,7 @@ bool Storage::storeGoal(LearningGoal *goal)
goalExistsQuery.bindValue(":category", static_cast<int>(goal->category()));
goalExistsQuery.exec();
if (db.lastError().isValid()) {
kError() << "ExistsQuery: " << db.lastError().text();
qCritical() << "ExistsQuery: " << db.lastError().text();
raiseError(db.lastError());
return false;
}
......@@ -286,7 +286,7 @@ bool Storage::storeGoal(LearningGoal *goal)
updateGoalQuery.bindValue(":name", goal->name());
updateGoalQuery.exec();
if (updateGoalQuery.lastError().isValid()) {
kError() << updateGoalQuery.lastError().text();
qCritical() << updateGoalQuery.lastError().text();
raiseError(updateGoalQuery.lastError());
db.rollback();
return false;
......@@ -302,7 +302,7 @@ QList< LearningGoal* > Storage::loadGoals()
goalQuery.prepare("SELECT category, identifier, name FROM goals");
goalQuery.exec();
if (goalQuery.lastError().isValid()) {
kError() << goalQuery.lastError().text();
qCritical() << goalQuery.lastError().text();
raiseError(goalQuery.lastError());
return QList<LearningGoal*>();
}
......@@ -326,18 +326,18 @@ QSqlDatabase Storage::database()
}
QString path = KGlobal::dirs()->locateLocal("appdata", "learnerdata.db");
kDebug() << "Database path: " << path;
qDebug() << "Database path: " << path;
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(path);
if (!db.open()) {
kError() << "Could not open database: " << db.lastError().text();
qCritical() << "Could not open database: " << db.lastError().text();
raiseError(db.lastError());
return db;
}
if (!updateSchema()) {
kError() << "Database scheme not correct.";
qCritical() << "Database scheme not correct.";
return db;
}
......@@ -355,14 +355,14 @@ bool Storage::updateSchema()
"value TEXT"
")");
if (db.lastError().isValid()) {
kError() << db.lastError().text();
qCritical() << db.lastError().text();
raiseError(db.lastError());
return false;
}
QSqlQuery versionQuery = db.exec("SELECT value FROM metadata WHERE key = 'version'");
if (db.lastError().isValid()) {
kError() << db.lastError().text();
qCritical() << db.lastError().text();
raiseError(db.lastError());
return false;
}
......@@ -377,18 +377,18 @@ bool Storage::updateSchema()
}
else {
if (!db.transaction()) {
kWarning() << db.lastError().text();
qWarning() << db.lastError().text();
raiseError(db.lastError());
return false;
}
db.exec("INSERT INTO metadata (key, value) VALUES ('version', '1')");
if (db.lastError().isValid()) {
kError() << db.lastError().text();
qCritical() << db.lastError().text();
raiseError(db.lastError());
return false;
}
if (!db.commit()) {
kError() << db.lastError().text();
qCritical() << db.lastError().text();
raiseError(db.lastError());
return false;
}
......@@ -400,7 +400,7 @@ bool Storage::updateSchema()
"name TEXT"
")");
if (db.lastError().isValid()) {
kError() << db.lastError().text();
qCritical() << db.lastError().text();
raiseError(db.lastError());
return false;
}
......@@ -413,7 +413,7 @@ bool Storage::updateSchema()
"PRIMARY KEY ( category, identifier )"
")");
if (db.lastError().isValid()) {
kError() << db.lastError().text();
qCritical() << db.lastError().text();
raiseError(db.lastError());
return false;
}
......@@ -426,7 +426,7 @@ bool Storage::updateSchema()
"profile_id INTEGER " // Learner::Identifier
")");
if (db.lastError().isValid()) {
kError() << db.lastError().text();
qCritical() << db.lastError().text();
raiseError(db.lastError());
return false;
}
......
......@@ -23,7 +23,7 @@
#include <config.h>
#include <QUrl>
#include <QStringList>
#include <KDebug>
#include <QDebug>
/**
* \class CaptureDeviceControllerPrivate
......
......@@ -21,7 +21,7 @@
#include "outputdevicecontroller.h"
#include "qtgstreameroutputbackend.h"
#include <KUrl>
#include <KDebug>
#include <QDebug>
/**
* \class OutputDeviceControllerPrivate
......
......@@ -31,7 +31,7 @@
#include <QGst/Message>
#include <QGst/Bus>
#include <KDebug>
#include <QDebug>
#include <KLocale>
QtGStreamerCaptureBackend::QtGStreamerCaptureBackend()
......@@ -42,7 +42,7 @@ QtGStreamerCaptureBackend::QtGStreamerCaptureBackend()
QGst::ElementPtr src = QGst::ElementFactory::make("autoaudiosrc");
if (!src) {
kError() << "Failed to create element \"autoaudiosrc\". Make sure you have "
qCritical() << "Failed to create element \"autoaudiosrc\". Make sure you have "
<< "gstreamer-plugins-good installed";
return;
}
......@@ -84,7 +84,7 @@ QGst::BinPtr QtGStreamerCaptureBackend::createAudioSrcBin()
audioBin = QGst::Bin::fromDescription("autoaudiosrc name=\"audiosrc\" ! audioconvert ! "
"audioresample ! audiorate ! vorbisenc name=enc quality=0.6 ! queue");
} catch (const QGlib::Error &error) {
kError() << "Failed to create audio source bin:" << error;
qCritical() << "Failed to create audio source bin:" << error;
return QGst::BinPtr();
}
QGst::ElementPtr src = audioBin->getElementByName("audiosrc");
......@@ -99,7 +99,7 @@ void QtGStreamerCaptureBackend::onBusMessage(const QGst::MessagePtr & message)
switch (message->type()) {
case QGst::MessageEos:
//got end-of-stream - stop the pipeline
kDebug() << "EOS signal received, stopping pipeline";
qDebug() << "EOS signal received, stopping pipeline";
stopPipeline();
break;
case QGst::MessageError:
......@@ -108,7 +108,7 @@ void QtGStreamerCaptureBackend::onBusMessage(const QGst::MessagePtr & message)
if (m_pipeline) {
stopPipeline();
}
kError() << "Pipeline Error:"
qCritical() << "Pipeline Error:"
<< message.staticCast<QGst::ErrorMessage>()->error().message();
break;
default:
......@@ -120,7 +120,7 @@ void QtGStreamerCaptureBackend::startCapture(const QString &filePath)
{
// clear pipeline if still existing
if (m_pipeline) {
kWarning() << "removing forgotten pipeline";
qWarning() << "removing forgotten pipeline";
//send an end-of-stream event to flush metadata and cause an EosMessage to be delivered
m_pipeline->sendEvent(QGst::EosEvent::create());
}
......@@ -130,7 +130,7 @@ void QtGStreamerCaptureBackend::startCapture(const QString &filePath)
QGst::ElementPtr sink = QGst::ElementFactory::make("filesink");
if (!audioSrcBin || !mux || !sink) {
kError() << "One or more elements could not be created. "
qCritical() << "One or more elements could not be created. "
<< "Verify that you have all the necessary element plugins installed.";
return;
}
......@@ -164,7 +164,7 @@ void QtGStreamerCaptureBackend::stopCapture()
void QtGStreamerCaptureBackend::stopPipeline()
{
if (!m_pipeline) {
kWarning() << "Stopping non-existing pipeline, aborting";
qWarning() << "Stopping non-existing pipeline, aborting";
return;
}
m_pipeline->setState(QGst::StateNull);
......
......@@ -26,7 +26,7 @@
#include "resourcemanager.h"
#include "phonemegroup.h"
#include <KDebug>
#include <QDebug>
#include <KLocale>
#include <QStringList>
#include <QPair>
......@@ -148,7 +148,7 @@ void Course::addUnit(Unit *unit)
QList<Unit*>::ConstIterator iter = m_unitList.constBegin();
while (iter != m_unitList.constEnd()) {
if (unit->id() == (*iter)->id()) {
kWarning() << "Unit already contained in this course, aborting";
qWarning() << "Unit already contained in this course, aborting";
return;
}
++iter;
......@@ -177,7 +177,7 @@ Unit * Course::createUnit()
QString id = QUuid::createUuid().toString();
while (unitIds.contains(id)) {
id = QUuid::createUuid();
kWarning() << "Unit id generator has found a collision, recreating id.";
qWarning() << "Unit id generator has found a collision, recreating id.";
}
// create unit
......@@ -202,7 +202,7 @@ Phrase * Course::createPhrase(Unit *unit)
QString id = QUuid::createUuid().toString();
while (phraseIds.contains(id)) {
id = QUuid::createUuid();
kWarning() << "Phrase id generator has found a collision, recreating id.";
qWarning() << "Phrase id generator has found a collision, recreating id.";
}
// create unit
......@@ -260,7 +260,7 @@ PhonemeGroup * Course::phonemeGroup(Unit *unit) const
void Course::addPhonemeGroup(PhonemeGroup *phonemeGroup)
{
if (m_phonemeUnitList.contains(phonemeGroup)) {
kWarning() << "Phoneme group already contained in this course, aborting";
qWarning() << "Phoneme group already contained in this course, aborting";
return;
}
emit phonemeGroupAboutToBeAdded(phonemeGroup, m_phonemeGroupList.count());
......@@ -295,7 +295,7 @@ void Course::setModified(bool modified)
void Course::sync()
{
if (!m_file.isValid() || m_file.isEmpty() || m_resource == 0) {
kError() << "Path" << m_file.toLocalFile() << "not valid, aborting sync operation.";
qCritical() << "Path" << m_file.toLocalFile() << "not valid, aborting sync operation.";
return;
}
m_resource->sync();
......@@ -337,5 +337,5 @@ void Course::registerPhrasePhonemes(Phrase *phrase)
void Course::removePhrasePhonemes(Phrase* phrase)
{
kError() << "Not yet implemented!";
qCritical() << "Not yet implemented!";
}
......@@ -22,7 +22,7 @@
#include "models/languagemodel.h"
#include "phoneme.h"
#include "phonemegroup.h"
#include <KDebug>
#include <QDebug>
#include <KLocale>
#include <KGlobal>
......@@ -105,7 +105,7 @@ PhonemeGroup * Language::addPhonemeGroup(const QString &identifier, const QStrin
QList<PhonemeGroup *>::ConstIterator iter = m_phonemeGroups.constBegin();
while (iter != m_phonemeGroups.constEnd()) {
if (QString::compare((*iter)->id(), identifier) == 0) {
kWarning() << "Prononciation Group identifier already registered, aborting";
qWarning() << "Prononciation Group identifier already registered, aborting";
return 0;
}
++iter;
......
......@@ -19,7 +19,7 @@
*/
#include "phoneme.h"
#include <KDebug>
#include <QDebug>
Phoneme::Phoneme(QObject *parent)
: QObject(parent)
......
......@@ -21,7 +21,7 @@
#include "phonemegroup.h"
#include "phoneme.h"
#include <KDebug>
#include <QDebug>
PhonemeGroup::PhonemeGroup(QObject *parent)
: QObject(parent)
......@@ -87,7 +87,7 @@ void PhonemeGroup::addPhoneme(Phoneme *phoneme)
QList<Phoneme *>::ConstIterator iter = m_phonemes.constBegin();
while (iter != m_phonemes.constEnd()) {
if (QString::compare((*iter)->id(), phoneme->id()) == 0) {
kWarning() << "Phoneme identifier already registered in group "<< m_title <<", aborting";
qWarning() << "Phoneme identifier already registered in group "<< m_title <<", aborting";
return;
}
++iter;
......@@ -103,7 +103,7 @@ Phoneme * PhonemeGroup::addPhoneme(const QString &identifier, const QString &tit
QList<Phoneme *>::ConstIterator iter = m_phonemes.constBegin();
while (iter != m_phonemes.constEnd()) {
if (QString::compare((*iter)->id(), identifier) == 0) {
kWarning() << "Phoneme identifier " << identifier <<" already registered in group "
qWarning() << "Phoneme identifier " << identifier <<" already registered in group "
<< m_title <<", aborting";
return 0;
}
......
......@@ -25,7 +25,7 @@
#include "course.h"