Files
WorkPad/src/models/note.cpp
Aurélie Delhaie 7b17dfb044 Add folder support
2022-10-22 19:33:54 +02:00

51 lines
909 B
C++
Executable File

#include "note.h"
Note::Note(QString name)
{
QUuid uid = QUuid::createUuid();
this->uuid = uid.toString(QUuid::StringFormat::WithoutBraces);
this->title = name;
}
Note::Note(QJsonObject obj)
{
QUuid uid = QUuid::createUuid();
QString newUuid = uid.toString(QUuid::StringFormat::WithoutBraces);
this->uuid = obj["uuid"].toString(newUuid);
this->title = obj["title"].toString("<untitled note>");
this->content = obj["content"].toString();
}
QJsonObject Note::toJson()
{
QJsonObject o;
o["uuid"] = this->uuid;
o["title"] = this->title;
o["content"] = this->content;
return o;
}
QString Note::getUUID()
{
return uuid;
}
QString Note::getTitle()
{
return title;
}
QString Note::getContent()
{
return content;
}
void Note::setTitle(QString value)
{
this->title = value;
}
void Note::setContent(QString value)
{
this->content = value;
}