aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Cord-Landwehr <[email protected]>2015-09-07 08:54:40 +0200
committerAndreas Cord-Landwehr <[email protected]>2015-09-07 08:55:40 +0200
commit3cdb31b078e66b8a05a7ac780ac09fde5443df74 (patch)
tree410ab19c9440838be2cce1e3f72465b466d604d5
parente04ce978a6a2a173e4490bc8c5d11a5f531809b9 (diff)
Use nullptr.
-rw-r--r--src/core/resourcemanager.cpp20
-rw-r--r--src/models/languagemodel.h3
2 files changed, 12 insertions, 11 deletions
diff --git a/src/core/resourcemanager.cpp b/src/core/resourcemanager.cpp
index 557c43d..b1ab119 100644
--- a/src/core/resourcemanager.cpp
+++ b/src/core/resourcemanager.cpp
@@ -195,11 +195,11 @@ Language * ResourceManager::language(int index) const
Language * ResourceManager::language(LearnerProfile::LearningGoal *learningGoal) const
{
if (!learningGoal) {
- return 0;
+ return nullptr;
}
if (learningGoal->category() != LearnerProfile::LearningGoal::Language) {
qCritical() << "Cannot translate non-language learning goal to language";
- return 0;
+ return nullptr;
}
foreach (LanguageResource *resource, m_languageResources) {
if (resource->identifier() == learningGoal->identifier()) {
@@ -207,7 +207,7 @@ Language * ResourceManager::language(LearnerProfile::LearningGoal *learningGoal)
}
}
qCritical() << "No language registered with identifier " << learningGoal->identifier() << ": aborting";
- return 0;
+ return nullptr;
}
QList< CourseResource* > ResourceManager::courseResources(Language *language)
@@ -267,7 +267,7 @@ void ResourceManager::updateCourseFromSkeleton(Course *course)
qCritical() << "No skeleton ID specified, aborting update.";
return;
}
- Course *skeleton = 0;
+ Course *skeleton = nullptr;
QList<SkeletonResource *>::ConstIterator iter = m_skeletonResources.constBegin();
while (iter != m_skeletonResources.constEnd()) {
if ((*iter)->identifier() == course->foreignId()) {
@@ -284,7 +284,7 @@ void ResourceManager::updateCourseFromSkeleton(Course *course)
// update now
foreach (Unit *unitSkeleton, skeleton->unitList()) {
// import unit if not exists
- Unit *currentUnit = 0;
+ Unit *currentUnit = nullptr;
bool found = false;
foreach (Unit *unit, course->unitList()) {
if (unit->foreignId() == unitSkeleton->id()) {
@@ -339,12 +339,12 @@ CourseResource * ResourceManager::addCourse(const QUrl &courseFile)
CourseResource *resource = new CourseResource(this, courseFile);
if (resource->language().isEmpty()) {
qCritical() << "Could not load course, language unknown:" << courseFile.toLocalFile();
- return 0;
+ return nullptr;
}
// skip already loaded resources
if (m_loadedResources.contains(courseFile.toLocalFile())) {
- return 0;
+ return nullptr;
}
m_loadedResources.append(courseFile.toLocalFile());
addCourseResource(resource);
@@ -369,7 +369,7 @@ void ResourceManager::addCourseResource(CourseResource *resource)
void ResourceManager::removeCourse(Course *course)
{
- for (int index=0; index < m_courseResources[course->language()->id()].length(); index++) {
+ for (int index = 0; index < m_courseResources[course->language()->id()].length(); ++index) {
if (m_courseResources[course->language()->id()].at(index)->course() == course) {
emit courseResourceAboutToBeRemoved(index);
m_courseResources[course->language()->id()].removeAt(index);
@@ -382,7 +382,7 @@ void ResourceManager::removeCourse(Course *course)
void ResourceManager::newCourseDialog(Language *language)
{
QPointer<NewCourseDialog> dialog = new NewCourseDialog(this);
- if (language != 0) {
+ if (language != nullptr) {
dialog->setLanguage(language);
}
if (dialog->exec() == QDialog::Accepted) {
@@ -413,7 +413,7 @@ void ResourceManager::addSkeletonResource(SkeletonResource *resource)
void ResourceManager::removeSkeleton(Skeleton *skeleton)
{
- for (int index=0; index < m_skeletonResources.length(); ++index) {
+ for (int index = 0; index < m_skeletonResources.length(); ++index) {
if (m_skeletonResources.at(index)->identifier() == skeleton->id()) {
emit skeletonAboutToBeRemoved(index, index);
m_skeletonResources.removeAt(index);
diff --git a/src/models/languagemodel.h b/src/models/languagemodel.h
index 4c9aeca..394bd8b 100644
--- a/src/models/languagemodel.h
+++ b/src/models/languagemodel.h
@@ -42,7 +42,7 @@ public:
AllLanguages
};
- explicit LanguageModel(QObject *parent = 0);
+ explicit LanguageModel(QObject *parent = nullptr);
LanguageResourceModel * resourceModel() const;
void setResourceModel(LanguageResourceModel *resourceModel);
virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
@@ -60,3 +60,4 @@ private:
};
#endif
+