Create filter dialog, board description
This commit is contained in:
@@ -3,16 +3,18 @@
|
||||
#define NAME_KEY "name"
|
||||
#define TASKS_KEY "tasks"
|
||||
#define UUID_KEY "uuid"
|
||||
#define DESCRIPTION_KEY "description"
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonValue>
|
||||
#include <QUuid>
|
||||
|
||||
Board::Board(QString name)
|
||||
Board::Board(QString name, QString description)
|
||||
{
|
||||
QUuid uuid = QUuid::createUuid();
|
||||
this->uuid = uuid.toString(QUuid::WithoutBraces);
|
||||
this->name = name;
|
||||
this->description = description;
|
||||
}
|
||||
|
||||
Board::Board(QJsonObject obj)
|
||||
@@ -20,8 +22,9 @@ Board::Board(QJsonObject obj)
|
||||
QUuid uuid = QUuid::createUuid();
|
||||
this->uuid = obj[UUID_KEY].toString(uuid.toString(QUuid::WithoutBraces));
|
||||
this->name = obj[NAME_KEY].toString("!Missing name!");
|
||||
this->description = obj[DESCRIPTION_KEY].toString("");
|
||||
QJsonArray jsonTasks = obj[TASKS_KEY].toArray();
|
||||
for (QJsonValue value : jsonTasks) {
|
||||
foreach (QJsonValue value, jsonTasks) {
|
||||
Task *t = new Task(value.toObject());
|
||||
this->tasks.append(t);
|
||||
}
|
||||
@@ -46,11 +49,21 @@ const QString Board::getName()
|
||||
return name;
|
||||
}
|
||||
|
||||
const QString Board::getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
void Board::setName(const QString name)
|
||||
{
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
void Board::setDescription(const QString description)
|
||||
{
|
||||
this->description = description;
|
||||
}
|
||||
|
||||
void Board::add(Task t)
|
||||
{
|
||||
tasks.append(new Task(t));
|
||||
@@ -87,6 +100,7 @@ const QJsonObject Board::toJson()
|
||||
QJsonObject obj;
|
||||
obj[NAME_KEY] = this->name;
|
||||
obj[TASKS_KEY] = array;
|
||||
obj[DESCRIPTION_KEY] = description;
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user