switch back to json lohman - qtjson in new branch for more testing

This commit is contained in:
DenioD
2020-07-05 20:06:35 +02:00
parent 362e93f0b3
commit 460974f594
28 changed files with 19342 additions and 466 deletions

View File

@@ -33,9 +33,9 @@ ContactItem ContactDataStore::getData(QString key)
QString ContactDataStore::dump()
{
QJsonObject contacts;
contacts["count"] = (qint64)this->data.size();
QJsonArray j = {};
json contacts;
contacts["count"] = this->data.size();
json j = {};
for (auto &c: this->data)
{
qDebug() << c.second.toQTString();
@@ -43,10 +43,7 @@ QString ContactDataStore::dump()
j.push_back(c.second.toJson());
}
contacts["contacts"] = j;
QJsonDocument jd_contacts = QJsonDocument(contacts);
return QLatin1String(jd_contacts.toJson(QJsonDocument::Compact));
// return QString::fromStdString(contacts.dump(4));
return QString::fromStdString(contacts.dump(4));
}
ContactDataStore* ContactDataStore::instance = nullptr;