switch back to json lohman - qtjson in new branch for more testing
This commit is contained in:
@@ -59,16 +59,15 @@ void ChatDataStore::setPassword(QString password)
|
||||
|
||||
QString ChatDataStore::dump()
|
||||
{
|
||||
QJsonObject chats;
|
||||
chats["count"] = (qint64)this->data.size();
|
||||
QJsonArray j;
|
||||
json chats;
|
||||
chats["count"] = this->data.size();
|
||||
json j = {};
|
||||
for (auto &c: this->data)
|
||||
{
|
||||
j.push_back(c.second.toJson());
|
||||
}
|
||||
chats["chatitems"] = j;
|
||||
QJsonDocument jd_chats = QJsonDocument(chats);
|
||||
return QLatin1String(jd_chats.toJson(QJsonDocument::Compact));
|
||||
return QString::fromStdString(chats.dump());
|
||||
}
|
||||
|
||||
std::map<QString, ChatItem> ChatDataStore::getAllRawChatItems()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef CHATDATASTORE_H
|
||||
#define CHATDATASTORE_H
|
||||
#include "../chatmodel.h"
|
||||
using json = nlohmann::json;
|
||||
|
||||
class ChatDataStore
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define CONTACTDATASTORE_H
|
||||
#include "../Model/ContactItem.h"
|
||||
#include <string>
|
||||
using json = nlohmann::json;
|
||||
|
||||
class ContactDataStore
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef SIETCHDATASTORE_H
|
||||
#define SIETCHDATASTORE_H
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
class SietchDataStore
|
||||
{
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user