Hush lite wallet
https://faq.hush.is/sdl
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
2.7 KiB
156 lines
2.7 KiB
// Copyright 2019-2020 The Hush developers
|
|
// GPLv3
|
|
|
|
#include "ChatItem.h"
|
|
|
|
ChatItem::ChatItem() {}
|
|
|
|
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations)
|
|
{
|
|
_timestamp = timestamp;
|
|
_address = address;
|
|
_contact = contact;
|
|
_memo = memo;
|
|
_requestZaddr = requestZaddr;
|
|
_type = type;
|
|
_cid = cid;
|
|
_txid = txid;
|
|
_confirmations = confirmations;
|
|
_outgoing = false;
|
|
}
|
|
|
|
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing)
|
|
{
|
|
_timestamp = timestamp;
|
|
_address = address;
|
|
_contact = contact;
|
|
_memo = memo;
|
|
_requestZaddr = requestZaddr;
|
|
_type = type;
|
|
_cid = cid;
|
|
_txid = txid;
|
|
_confirmations = confirmations;
|
|
_outgoing = outgoing;
|
|
}
|
|
|
|
long ChatItem::getTimestamp()
|
|
{
|
|
return _timestamp;
|
|
}
|
|
|
|
QString ChatItem::getAddress()
|
|
{
|
|
return _address;
|
|
}
|
|
|
|
QString ChatItem::getContact()
|
|
{
|
|
return _contact;
|
|
}
|
|
|
|
QString ChatItem::getMemo()
|
|
{
|
|
return _memo;
|
|
}
|
|
|
|
QString ChatItem::getRequestZaddr()
|
|
{
|
|
return _requestZaddr;
|
|
}
|
|
QString ChatItem::getType()
|
|
{
|
|
return _type;
|
|
}
|
|
|
|
QString ChatItem::getCid()
|
|
{
|
|
return _cid;
|
|
}
|
|
|
|
QString ChatItem::getTxid()
|
|
{
|
|
return _txid;
|
|
}
|
|
int ChatItem::getConfirmations()
|
|
{
|
|
return _confirmations;
|
|
}
|
|
|
|
bool ChatItem::isOutgoing()
|
|
{
|
|
return _outgoing;
|
|
}
|
|
|
|
void ChatItem::setTimestamp(long timestamp)
|
|
{
|
|
_timestamp = timestamp;
|
|
}
|
|
|
|
void ChatItem::setAddress(QString address)
|
|
{
|
|
_address = address;
|
|
}
|
|
|
|
void ChatItem::setContact(QString contact)
|
|
{
|
|
_contact = contact;
|
|
}
|
|
|
|
void ChatItem::setMemo(QString memo)
|
|
{
|
|
_memo = memo;
|
|
}
|
|
|
|
void ChatItem::setRequestZaddr(QString requestZaddr)
|
|
{
|
|
_requestZaddr = requestZaddr;
|
|
}
|
|
|
|
void ChatItem::setType(QString type)
|
|
{
|
|
_type = type;
|
|
}
|
|
|
|
void ChatItem::setCid(QString cid)
|
|
{
|
|
_cid = cid;
|
|
}
|
|
void ChatItem::setTxid(QString txid)
|
|
{
|
|
_txid = txid;
|
|
}
|
|
void ChatItem::setConfirmations(int confirmations)
|
|
{
|
|
_confirmations = confirmations;
|
|
}
|
|
|
|
void ChatItem::toggleOutgo()
|
|
{
|
|
_outgoing = true;
|
|
}
|
|
|
|
|
|
QString ChatItem::toChatLine()
|
|
{
|
|
QDateTime myDateTime;
|
|
QString lock;
|
|
myDateTime.setTime_t(_timestamp);
|
|
|
|
if (_confirmations == 0){
|
|
lock = "<b> <img src=':/icons/res/unlocked.svg'><b>";
|
|
}else{
|
|
|
|
lock = "<b> <img src=':/icons/res/lock_green.svg'><b>";
|
|
|
|
}
|
|
|
|
QString line = QString("<small style='background: rgba(255,255,255,0.1);'>") + myDateTime.toString("dd.MM.yyyy hh:mm");
|
|
line += QString(lock) + QString("</small>");
|
|
line += QString("<p>") + _memo.toHtmlEscaped() + QString("</p>");
|
|
return line;
|
|
}
|
|
|
|
ChatItem::~ChatItem()
|
|
{
|
|
|
|
}
|