51 lines
909 B
C++
Executable File
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;
|
|
}
|