| 1 |
/* |
| 2 |
SPDX-FileCopyrightText: 2013 Andreas Cord-Landwehr <[email protected]> |
| 3 |
|
| 4 |
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 5 |
*/ |
| 6 |
|
| 7 |
#include "learninggoal.h" |
| 8 |
|
| 9 |
using namespace LearnerProfile; |
| 10 |
|
| 11 |
// private class LearningGoalPrivate |
| 12 |
class LearningGoalPrivate |
| 13 |
{ |
| 14 |
public: |
| 15 |
LearningGoalPrivate() |
| 16 |
: m_name(QString()) |
| 17 |
, m_identifier(QString()) |
| 18 |
, m_category(LearningGoal::Unspecified) |
| 19 |
{ |
| 20 |
} |
| 21 |
~LearningGoalPrivate() |
| 22 |
{ |
| 23 |
} |
| 24 |
|
| 25 |
QString m_name; |
| 26 |
QString m_identifier; |
| 27 |
LearningGoal::Category m_category; |
| 28 |
}; |
| 29 |
|
| 30 |
// methods of LearningGoal |
| 31 |
LearningGoal::LearningGoal(QObject *parent) |
| 32 |
: QObject(parent) |
| 33 |
, d(new LearningGoalPrivate) |
| 34 |
{ |
| 35 |
// create goal of unspecified category |
| 36 |
} |
| 37 |
|
| 38 |
LearningGoal::LearningGoal(LearningGoal::Category category, const QString &identifier, QObject *parent) |
| 39 |
: QObject(parent) |
| 40 |
, d(new LearningGoalPrivate) |
| 41 |
{ |
| 42 |
d->m_category = category; |
| 43 |
d->m_identifier = identifier; |
| 44 |
} |
| 45 |
|
| 46 |
QString LearningGoal::name() const |
| 47 |
{ |
| 48 |
return d->m_name; |
| 49 |
} |
| 50 |
|
| 51 |
LearningGoal::~LearningGoal() |
| 52 |
{ |
| 53 |
} |
| 54 |
|
| 55 |
void LearningGoal::setName(const QString &name) |
| 56 |
{ |
| 57 |
if (name == d->m_name) { |
| 58 |
return; |
| 59 |
} |
| 60 |
d->m_name = name; |
| 61 |
Q_EMIT nameChanged(); |
| 62 |
} |
| 63 |
|
| 64 |
QString LearningGoal::identifier() const |
| 65 |
{ |
| 66 |
return d->m_identifier; |
| 67 |
} |
| 68 |
|
| 69 |
void LearningGoal::setIdentifier(const QString &identifier) |
| 70 |
{ |
| 71 |
if (identifier == d->m_identifier) { |
| 72 |
return; |
| 73 |
} |
| 74 |
d->m_identifier = identifier; |
| 75 |
Q_EMIT identifierChanged(); |
| 76 |
} |
| 77 |
|
| 78 |
LearningGoal::Category LearningGoal::category() const |
| 79 |
{ |
| 80 |
return d->m_category; |
| 81 |
} |