mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Add methods for getting json from reading lists and labels(tags)
This commit is contained in:
parent
a4072b956c
commit
a9887a2d46
@ -71,4 +71,36 @@ QJsonObject YACReaderServerDataHelper::fullComicToJSON(const qulonglong libraryI
|
||||
return json;
|
||||
}
|
||||
|
||||
QJsonObject YACReaderServerDataHelper::readingListToJSON(const qulonglong libraryId, const ReadingList &readingList)
|
||||
{
|
||||
QJsonObject json;
|
||||
|
||||
json["type"] = "reading_list";
|
||||
json["id"] = QString::number(readingList.getId());
|
||||
json["library_id"] = QString::number(libraryId);
|
||||
json["reading_list_name"] = readingList.getName();
|
||||
|
||||
//TODO
|
||||
//json["num_children"] = readingList.getNumChildren();
|
||||
//json["first_comic_hash"] = readingList.getFirstChildHash();
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
QJsonObject YACReaderServerDataHelper::labelToJSON(const qulonglong libraryId, const Label &label)
|
||||
{
|
||||
QJsonObject json;
|
||||
|
||||
json["type"] = "label";
|
||||
json["id"] = QString::number(label.getId());
|
||||
json["library_id"] = QString::number(libraryId);
|
||||
json["label_list_name"] = label.getName();
|
||||
json["color_id"] = label.getColorID();
|
||||
|
||||
//TODO
|
||||
//json["num_children"] = label.getNumChildren();
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
YACReaderServerDataHelper::YACReaderServerDataHelper() {}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <QtCore>
|
||||
#include "folder.h"
|
||||
#include "comic_db.h"
|
||||
#include "reading_list.h"
|
||||
|
||||
class YACReaderServerDataHelper
|
||||
{
|
||||
@ -14,6 +15,9 @@ public:
|
||||
static QJsonObject folderToJSON(const qulonglong libraryId, const Folder & folder);
|
||||
static QJsonObject comicToJSON(const qulonglong libraryId, const ComicDB & comic);
|
||||
static QJsonObject fullComicToJSON(const qulonglong libraryId, const ComicDB & comic);
|
||||
static QJsonObject readingListToJSON(const qulonglong libraryId, const ReadingList & readingList);
|
||||
static QJsonObject labelToJSON(const qulonglong libraryId, const Label & label);
|
||||
|
||||
|
||||
private:
|
||||
YACReaderServerDataHelper();
|
||||
|
Loading…
x
Reference in New Issue
Block a user