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

Modernize code.

parent c1b7d892
......@@ -33,8 +33,10 @@ Learner::Learner(QObject *parent)
: QObject(parent)
, d(new LearnerPrivate)
{
connect(this, SIGNAL(goalAdded()), this, SIGNAL(goalCountChanged()));
connect(this, SIGNAL(goalRemoved()), this, SIGNAL(goalCountChanged()));
connect(this, &Learner::goalAdded,
this, &Learner::goalCountChanged);
connect(this, static_cast<void (Learner::*)()>(&Learner::goalRemoved),
this, &Learner::goalCountChanged);
}
Learner::~Learner()
......@@ -197,7 +199,7 @@ LearningGoal * Learner::activeGoal(Learner::Category categoryLearner) const
}
}
qCWarning(LIBLEARNER_LOG) << "No learning goals of catagory " << category << " registered";
return 0;
return nullptr;
}
return d->m_activeGoal[category];
}
......@@ -46,8 +46,10 @@ public:
Language = 1
};
explicit LearningGoal(QObject *parent = 0);
explicit LearningGoal(LearningGoal::Category category, const QString &identifier, QObject *parent = 0);
explicit LearningGoal(QObject *parent = nullptr);
explicit LearningGoal(LearningGoal::Category category,
const QString &identifier,
QObject *parent = nullptr);
~LearningGoal();
QString name() const;
......
......@@ -216,8 +216,8 @@ QList< Learner* > Storage::loadProfiles(QList<LearningGoal*> goals)
return QList<Learner*>();
}
while (goalRelationQuery.next()) {
Learner *learner = 0;
LearningGoal *goal = 0;
Learner *learner = nullptr;
LearningGoal *goal = nullptr;
foreach (Learner *cmpProfile, profiles) {
if (cmpProfile->identifier() == goalRelationQuery.value(2).toInt()) {
......@@ -238,7 +238,7 @@ QList< Learner* > Storage::loadProfiles(QList<LearningGoal*> goals)
continue;
}
if (goal != 0 && learner != 0) {
if (goal && learner) {
learner->addGoal(goal);
}
}
......
......@@ -38,7 +38,7 @@ class Storage : public QObject
Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged)
public:
explicit Storage(QObject* parent = 0);
explicit Storage(QObject* parent = nullptr);
QString errorMessage() const;
/**
......
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