21 lines
510 B
C++
21 lines
510 B
C++
#include "imagemeta.h"
|
|
|
|
ImageMeta::ImageMeta(const std::filesystem::path& path, const QString& text):
|
|
path{path}, text{text}
|
|
{
|
|
|
|
}
|
|
|
|
ImageMeta::ImageMeta(const QJsonObject& json, const std::filesystem::path& dir)
|
|
{
|
|
QJsonValue filename = json["file_name"];
|
|
if(filename == QJsonValue::Undefined || !filename.isString())
|
|
throw ParseException("No or invalid file_name field found");
|
|
path = dir/filename.toString().toStdString();
|
|
|
|
QJsonValue textfrommeta = json["text"];
|
|
text = textfrommeta.toString("");
|
|
}
|
|
|
|
|