update// implemented dump method to each datastoretype
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user