clean
This commit is contained in:
@@ -49,6 +49,8 @@ ChatMemoEditRequest::ChatMemoEditRequest(QWidget* parent) : QTextEdit(parent) {
|
|||||||
QObject::connect(this, &QTextEdit::textChanged, this, &ChatMemoEditRequest::updateDisplayChatRequest);
|
QObject::connect(this, &QTextEdit::textChanged, this, &ChatMemoEditRequest::updateDisplayChatRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: unify this with updateDisplayChat()
|
||||||
void ChatMemoEditRequest::updateDisplayChatRequest() {
|
void ChatMemoEditRequest::updateDisplayChatRequest() {
|
||||||
QString txt = this->toPlainText();
|
QString txt = this->toPlainText();
|
||||||
if (lenDisplayLabelchatRequest)
|
if (lenDisplayLabelchatRequest)
|
||||||
@@ -98,7 +100,6 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
|
|||||||
(p.getName() == ui->contactNameMemo->text().trimmed()) &&
|
(p.getName() == ui->contactNameMemo->text().trimmed()) &&
|
||||||
(p.getPartnerAddress() == c.second.getAddress()) &&
|
(p.getPartnerAddress() == c.second.getAddress()) &&
|
||||||
(c.second.isOutgoing() == true))
|
(c.second.isOutgoing() == true))
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
QStandardItem *Items = new QStandardItem(c.second.toChatLine());
|
QStandardItem *Items = new QStandardItem(c.second.toChatLine());
|
||||||
@@ -107,10 +108,7 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
|
|||||||
chat->appendRow(Items);
|
chat->appendRow(Items);
|
||||||
ui->listChat->setModel(chat);
|
ui->listChat->setModel(chat);
|
||||||
|
|
||||||
|
} else {
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->listChat->setModel(chat);
|
ui->listChat->setModel(chat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,10 +127,7 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
|
|||||||
ui->emojiButton->setEnabled(true);
|
ui->emojiButton->setEnabled(true);
|
||||||
ui->sendChatButton->setEnabled(true);
|
ui->sendChatButton->setEnabled(true);
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
ui->listChat->setModel(chat);
|
ui->listChat->setModel(chat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,22 +163,15 @@ QString ChatItem::toChatLine()
|
|||||||
QString moneyTextRequest;
|
QString moneyTextRequest;
|
||||||
myDateTime.setTime_t(_timestamp);
|
myDateTime.setTime_t(_timestamp);
|
||||||
|
|
||||||
if (_notarize == true)
|
if (_notarize == true) {
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
lock = "<b> <img src=':/icons/res/lock_orange.png'><b>";
|
lock = "<b> <img src=':/icons/res/lock_orange.png'><b>";
|
||||||
|
} else {
|
||||||
|
lock = "<b> <img src=':/icons/res/unlocked.png'><b>";
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
if ((_confirmations > 0) && (_notarize == false)) {
|
||||||
|
|
||||||
lock = "<b> <img src=':/icons/res/unlocked.png'><b>";
|
|
||||||
}
|
|
||||||
if ((_confirmations > 0) && (_notarize == false))
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
lock = "<b> <img src=':/icons/res/lock_green.png'><b>";
|
lock = "<b> <img src=':/icons/res/lock_green.png'><b>";
|
||||||
}else{}
|
}
|
||||||
|
|
||||||
if (_memo.startsWith("Money transaction of :"))
|
if (_memo.startsWith("Money transaction of :"))
|
||||||
{
|
{
|
||||||
@@ -211,8 +204,6 @@ QString ChatItem::toChatLine()
|
|||||||
moneyTextRequest = ""; }
|
moneyTextRequest = ""; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QString line = QString("<small>") + myDateTime.toString("yyyy-MM-dd hh:mm");
|
QString line = QString("<small>") + myDateTime.toString("yyyy-MM-dd hh:mm");
|
||||||
line += QString(lock) + QString(moneyText) + QString(moneyTextRequest) + QString("</small>");
|
line += QString(lock) + QString(moneyText) + QString(moneyTextRequest) + QString("</small>");
|
||||||
line +=QString("<p>") + _memo.toHtmlEscaped() + QString("</p>");
|
line +=QString("<p>") + _memo.toHtmlEscaped() + QString("</p>");
|
||||||
@@ -223,16 +214,16 @@ QString ChatItem::toChatLine()
|
|||||||
json ChatItem::toJson()
|
json ChatItem::toJson()
|
||||||
{
|
{
|
||||||
json j;
|
json j;
|
||||||
j["_timestamp"] = _timestamp;
|
j["_timestamp"] = _timestamp;
|
||||||
j["_address"] = _address.toStdString();
|
j["_address"] = _address.toStdString();
|
||||||
j["_contact"] = _contact.toStdString();
|
j["_contact"] = _contact.toStdString();
|
||||||
j["_memo"] = _memo.toStdString();
|
j["_memo"] = _memo.toStdString();
|
||||||
j["_requestZaddr"] = _requestZaddr.toStdString();
|
j["_requestZaddr"] = _requestZaddr.toStdString();
|
||||||
j["_type"] = _type.toStdString();
|
j["_type"] = _type.toStdString();
|
||||||
j["_cid"] = _cid.toStdString();
|
j["_cid"] = _cid.toStdString();
|
||||||
j["_txid"] = _txid.toStdString();
|
j["_txid"] = _txid.toStdString();
|
||||||
j["_confirmations"] = _confirmations;
|
j["_confirmations"] = _confirmations;
|
||||||
j["_outgoing"] = _outgoing;
|
j["_outgoing"] = _outgoing;
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user