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

@@ -219,17 +219,18 @@ QString ChatItem::toChatLine()
return line;
}
QJsonValue ChatItem::toJson()
json ChatItem::toJson()
{
QJsonObject j;
j["_timestamp"] = (qint64)_timestamp;
j["_address"] = _address;
j["_contact"] = _contact;
j["_memo"] = _memo;
j["_requestZaddr"] = _requestZaddr;
j["_type"] = _type;
j["_cid"] = _cid;
j["_txid"] = _txid;
json j;
j["_timestamp"] = _timestamp;
j["_address"] = _address.toStdString();
j["_contact"] = _contact.toStdString();
j["_memo"] = _memo.toStdString();
j["_requestZaddr"] = _requestZaddr.toStdString();
j["_type"] = _type.toStdString();
j["_cid"] = _cid.toStdString();
j["_txid"] = _txid.toStdString();
j["_confirmations"] = _confirmations;
j["_outgoing"] = _outgoing;
return j;

View File

@@ -5,6 +5,7 @@
#define CHATITEM_H
#include <QString>
using json = nlohmann::json;
class ChatItem
{
@@ -52,7 +53,7 @@ class ChatItem
void notarized();
void contact(bool iscontact);
QString toChatLine();
QJsonValue toJson();
json toJson();
~ChatItem();
};

View File

@@ -86,13 +86,13 @@ QString ContactItem::toQTString()
return _name + "|" + _partnerAddress + "|" + _myAddress + "|" + _cid + "|" + _avatar;
}
QJsonValue ContactItem::toJson()
json ContactItem::toJson()
{
QJsonObject j;
j["_myAddress"] = _myAddress;
j["_partnerAddress"] = _partnerAddress;
j["_name"] = _name;
j["_cid"] = _cid;
j["_avatar"] = _avatar;
json j;
j["_myAddress"] = _myAddress.toStdString();
j["_partnerAddress"] = _partnerAddress.toStdString();
j["_name"] = _name.toStdString();
j["_cid"] = _cid.toStdString();
j["_avatar"] = _avatar.toStdString();
return j;
}

View File

@@ -6,6 +6,7 @@
#include <vector>
#include <QString>
#include "mainwindow.h"
using json = nlohmann::json;
class ContactItem
{
@@ -33,7 +34,7 @@ public:
void setcid(QString cid);
void setAvatar(QString avatar);
QString toQTString();
QJsonValue toJson();
json toJson();
};
#endif

View File

@@ -5,6 +5,7 @@
#define CONTACTREQUEST_H
#include <QString>
using json = nlohmann::json;
class ContactRequest
{