20 const QVariant &data = json.
parse(
m_file.readAll(), &ok);
26 QVariantMap value = data.toMap();
27 const QVariantList &datas = value[
"trackList"].toList();
28 for(
const QVariant &var :
qAsConst(datas))
36 value = value[
"track"].toMap();
38 const QString &path = value[
"location"].toString();
62 for(
int i = 0; i < items.count(); ++i)
69 meta[
"location"] = song.path();
70 meta[
"title"] = song.title();
71 meta[
"creator"] = song.artist();
72 meta[
"duration"] = song.duration();
73 meta[
"album"] = QString();
74 meta[
"trackNum"] = QString();
75 meta[
"year"] = QString();
78 track[
"track"] = meta;
79 tracks.push_back(track);
84 datas[
"trackList"] = tracks;
90 const QByteArray &output = json.
serialize(datas, &ok);
virtual bool writeBuffer(const MusicSongItemList &items) overridefinal
Main class used to convert QVariant objects to JSON data.
virtual bool readBuffer(MusicSongItemList &items) overridefinal
QVariant parse(QIODevice *io, bool *ok=0)
Read JSON string from the I/O Device and converts it to a QVariant object.
The class of the read write interface.
The class of the music song item.
TTK_MODULE_EXPORT QString toString(Record type)
The class of the music song info.
Main class used to convert JSON data to QVariant objects.
The class of the ttk file interface.
void serialize(const QVariant &variant, QIODevice *out, bool *ok)
This method generates a textual JSON representation and outputs it to the passed in I/O Device...