update// implemented dump method to each datastoretype

This commit is contained in:
Strider
2020-05-17 14:12:27 +02:00
parent 4f584ac86e
commit d4bf7a83c8
14 changed files with 183 additions and 1 deletions

View File

@@ -150,6 +150,22 @@ QString ChatItem::toChatLine()
return line;
}
json ChatItem::toJson()
{
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;
}
ChatItem::~ChatItem()
{

View File

@@ -5,6 +5,7 @@
#define CHATITEM_H
#include <QString>
using json = nlohmann::json;
class ChatItem
{
@@ -45,6 +46,7 @@ class ChatItem
void setConfirmations(int confirmations);
void toggleOutgo();
QString toChatLine();
json toJson();
~ChatItem();
};

View File

@@ -63,4 +63,15 @@ void ContactItem::setAvatar(QString avatar)
QString ContactItem::toQTString()
{
return _name + "|" + _partnerAddress + "|" + _myAddress + "|" + _cid + "|" + _avatar;
}
json ContactItem::toJson()
{
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

@@ -3,6 +3,7 @@
#include <vector>
#include <QString>
using json = nlohmann::json;
class ContactItem
{
@@ -27,6 +28,7 @@ public:
void setcid(QString cid);
void setAvatar(QString avatar);
QString toQTString();
json toJson();
};
#endif