some changes
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
AddressBookModel::AddressBookModel(QTableView *parent) : QAbstractTableModel(parent)
|
AddressBookModel::AddressBookModel(QTableView *parent) : QAbstractTableModel(parent)
|
||||||
{
|
{
|
||||||
headers << tr("Avatar")<< tr("Label") << tr("Address") << tr("HushChatAddress") << tr("CID");
|
headers << tr("Label") << tr("Address") << tr("HushChatAddress") << tr("CID");
|
||||||
this->parent = parent;
|
this->parent = parent;
|
||||||
loadData();
|
loadData();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,13 +10,10 @@
|
|||||||
#include "ui_memodialog.h"
|
#include "ui_memodialog.h"
|
||||||
#include "ui_contactrequest.h"
|
#include "ui_contactrequest.h"
|
||||||
#include "addressbook.h"
|
#include "addressbook.h"
|
||||||
#include <QUuid>
|
|
||||||
#include <bits/stdc++.h>
|
|
||||||
#include <boost/algorithm/string.hpp>
|
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
#include <QUuid>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace boost;
|
|
||||||
|
|
||||||
ChatModel::ChatModel(std::map<QString, ChatItem> chatItems)
|
ChatModel::ChatModel(std::map<QString, ChatItem> chatItems)
|
||||||
{
|
{
|
||||||
@@ -108,52 +105,40 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view)
|
|||||||
for (auto &c : this->chatItems)
|
for (auto &c : this->chatItems)
|
||||||
for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////Render only Memos for selected contacts. Do not render empty Memos //// Render only memos where cid=cid
|
//////Render only Memos for selected contacts. Do not render empty Memos //// Render only memos where cid=cid
|
||||||
|
|
||||||
if (
|
|
||||||
(ui->contactNameMemo->text().trimmed() == c.second.getContact()) &&
|
|
||||||
(c.second.getMemo().startsWith("{") == false) &&
|
|
||||||
(c.second.getMemo().isEmpty() == false) &&
|
|
||||||
(p.getPartnerAddress() == c.second.getAddress())
|
|
||||||
|
|
||||||
)
|
if ((c.second.getContact() == ui->contactNameMemo->text().trimmed()) && (p.getPartnerAddress() == c.second.getAddress()) && (c.second.getMemo().startsWith("{") == false) && (c.second.getMemo().isEmpty() == false) && (c.second.isOutgoing() == true))
|
||||||
{
|
{
|
||||||
|
|
||||||
QStandardItem* Items = new QStandardItem(c.second.toChatLine());
|
QStandardItem* Items = new QStandardItem(c.second.toChatLine());
|
||||||
Items->setData("Outgoing", Qt::UserRole +1);
|
Items->setData("Outgoing", Qt::UserRole +1);
|
||||||
chat->appendRow(Items);
|
chat->appendRow(Items);
|
||||||
|
ui->listChat->setModel(chat);
|
||||||
|
|
||||||
ui->listChat->setModel(chat);
|
}
|
||||||
ui->listChat->setItemDelegate(new ListViewDelegate());
|
else{
|
||||||
|
ui->listChat->setModel(chat);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((c.second.getContact() == ui->contactNameMemo->text().trimmed()) && ((p.getMyAddress() == c.second.getAddress()) && c.second.getMemo().startsWith("{") == false) && (c.second.getMemo().isEmpty() == false) && (c.second.isOutgoing() == false))
|
||||||
if (
|
|
||||||
(ui->contactNameMemo->text().trimmed() == c.second.getContact()) &&
|
|
||||||
(c.second.getMemo().startsWith("{") == false) &&
|
|
||||||
(c.second.getMemo().isEmpty() == false) &&
|
|
||||||
(p.getMyAddress() == c.second.getAddress())
|
|
||||||
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
QStandardItem* Items1 = new QStandardItem(c.second.toChatLine());
|
QStandardItem* Items1 = new QStandardItem(c.second.toChatLine());
|
||||||
Items1->setData("Incoming", Qt::UserRole +1);
|
Items1->setData("Incoming", Qt::UserRole +1);
|
||||||
chat->appendRow(Items1);
|
chat->appendRow(Items1);
|
||||||
|
ui->listChat->setModel(chat);
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
ui->listChat->setModel(chat);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->listChat->setModel(chat);
|
|
||||||
ui->listChat->setItemDelegate(new ListViewDelegate());
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ChatModel::addCid(QString tx, QString cid)
|
void ChatModel::addCid(QString tx, QString cid)
|
||||||
{
|
{
|
||||||
@@ -231,8 +216,9 @@ Tx MainWindow::createTxFromChatPage() {
|
|||||||
|
|
||||||
|
|
||||||
// ui->memoSizeChat->setLenDisplayLabel();// Todo -> activate lendisplay for chat
|
// ui->memoSizeChat->setLenDisplayLabel();// Todo -> activate lendisplay for chat
|
||||||
tx.toAddrs.push_back(ToFields{addr, amt, memo});
|
|
||||||
tx.toAddrs.push_back(ToFields{addr, amt, hmemo});
|
tx.toAddrs.push_back(ToFields{addr, amt, hmemo});
|
||||||
|
tx.toAddrs.push_back(ToFields{addr, amt, memo});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ void ContactModel::renderContactList(QListView* view)
|
|||||||
view->setIconSize(QSize(60,70));
|
view->setIconSize(QSize(60,70));
|
||||||
view->setUniformItemSizes(true);
|
view->setUniformItemSizes(true);
|
||||||
view->setDragDropMode(QAbstractItemView::DropOnly);
|
view->setDragDropMode(QAbstractItemView::DropOnly);
|
||||||
|
view->show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,10 +149,6 @@ void Controller::fillTxJsonParams(json& allRecepients, Tx tx)
|
|||||||
allRecepients.push_back(rec) ;
|
allRecepients.push_back(rec) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int decider = qrand() % ((100 + 1)-1)+ 1;// random int between 1 and 100
|
|
||||||
//50% chance of adding another zdust, shuffle.
|
|
||||||
|
|
||||||
if(decider % 4 == 3)
|
|
||||||
allRecepients.insert(std::begin(allRecepients), {
|
allRecepients.insert(std::begin(allRecepients), {
|
||||||
dust.at(0),
|
dust.at(0),
|
||||||
dust.at(1),
|
dust.at(1),
|
||||||
@@ -164,21 +160,6 @@ void Controller::fillTxJsonParams(json& allRecepients, Tx tx)
|
|||||||
dust.at(7),
|
dust.at(7),
|
||||||
dust.at(8)
|
dust.at(8)
|
||||||
}) ;
|
}) ;
|
||||||
// std::shuffle(allRecepients.begin(),allRecepients.end(),std::random_device());
|
|
||||||
else
|
|
||||||
allRecepients.insert(std::begin(allRecepients), {
|
|
||||||
dust.at(0),
|
|
||||||
dust.at(1),
|
|
||||||
dust.at(2),
|
|
||||||
dust.at(3),
|
|
||||||
dust.at(4),
|
|
||||||
dust.at(5),
|
|
||||||
dust.at(6),
|
|
||||||
dust.at(7),
|
|
||||||
dust.at(8),
|
|
||||||
dust.at(9)
|
|
||||||
});
|
|
||||||
// std::shuffle(allRecepients.begin(),allRecepients.end(),std::random_device());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::noConnection()
|
void Controller::noConnection()
|
||||||
@@ -879,21 +860,16 @@ void Controller::refreshTransactions() {
|
|||||||
QString memo;
|
QString memo;
|
||||||
if (!o["memo"].is_null()) {
|
if (!o["memo"].is_null()) {
|
||||||
memo = QString::fromStdString(o["memo"]);
|
memo = QString::fromStdString(o["memo"]);
|
||||||
|
}
|
||||||
QString cid;
|
QString cid;
|
||||||
QString contact;
|
QString contact;
|
||||||
|
|
||||||
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
||||||
{
|
{
|
||||||
if (ui->contactNameMemo->text().trimmed() == c.getName()) {
|
if (address == c.getPartnerAddress()){
|
||||||
|
|
||||||
cid = c.getCid();
|
|
||||||
}else {cid = "";}
|
|
||||||
|
|
||||||
if (address == c.getPartnerAddress()){
|
|
||||||
contact = c.getName();
|
contact = c.getName();
|
||||||
}else{ contact = "";}
|
}else{ contact = "";}
|
||||||
|
}
|
||||||
|
|
||||||
ChatItem item = ChatItem(
|
ChatItem item = ChatItem(
|
||||||
datetime,
|
datetime,
|
||||||
@@ -907,9 +883,6 @@ void Controller::refreshTransactions() {
|
|||||||
chatModel->addMessage(item);
|
chatModel->addMessage(item);
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
items.push_back(TransactionItemDetail{address, amount, memo});
|
items.push_back(TransactionItemDetail{address, amount, memo});
|
||||||
total_amount = total_amount + amount;
|
total_amount = total_amount + amount;
|
||||||
@@ -922,7 +895,7 @@ void Controller::refreshTransactions() {
|
|||||||
|
|
||||||
|
|
||||||
addresses.push_back(item.address);
|
addresses.push_back(item.address);
|
||||||
|
address = addresses.join(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -914,6 +914,7 @@ void MainWindow::setupTransactionsTab() {
|
|||||||
ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
ui->listChat->setMinimumSize(200,350);
|
ui->listChat->setMinimumSize(200,350);
|
||||||
|
ui->listChat->setItemDelegate(new ListViewDelegate());
|
||||||
ui->listChat->show();
|
ui->listChat->show();
|
||||||
ui->transactionsTable->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->transactionsTable->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
// Table right click
|
// Table right click
|
||||||
|
|||||||
Reference in New Issue
Block a user