fix for double outgoing message
This commit is contained in:
@@ -67,7 +67,8 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
|
|||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -86,6 +87,8 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
|
|||||||
Items1->setData(INCOMING, Qt::UserRole + 1);
|
Items1->setData(INCOMING, Qt::UserRole + 1);
|
||||||
chat->appendRow(Items1);
|
chat->appendRow(Items1);
|
||||||
ui->listChat->setModel(chat);
|
ui->listChat->setModel(chat);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ void ChatModel::clear()
|
|||||||
void ChatModel::addMessage(ChatItem item)
|
void ChatModel::addMessage(ChatItem item)
|
||||||
{
|
{
|
||||||
QString key = ChatIDGenerator::getInstance()->generateID(item); //this->generateChatItemID(item);
|
QString key = ChatIDGenerator::getInstance()->generateID(item); //this->generateChatItemID(item);
|
||||||
// qDebug() << "inserting chatitem with id: " << key;
|
|
||||||
this->chatItems[key] = item;
|
this->chatItems[key] = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,9 +71,7 @@ void ChatModel::showMessages()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::renderContactRequest(){
|
void MainWindow::renderContactRequest(){
|
||||||
|
|
||||||
Ui_requestDialog requestContact;
|
Ui_requestDialog requestContact;
|
||||||
@@ -336,7 +333,9 @@ void MainWindow::sendChat() {
|
|||||||
|
|
||||||
// Memos can only be used with zAddrs. So check that first
|
// Memos can only be used with zAddrs. So check that first
|
||||||
// for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
// for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
||||||
|
QString Name = ui->contactNameMemo->text();
|
||||||
|
int sizename = Name.size();
|
||||||
|
qDebug()<< sizename;
|
||||||
if (ui->contactNameMemo->text().trimmed().isEmpty() || ui->memoTxtChat->toPlainText().trimmed().isEmpty()) {
|
if (ui->contactNameMemo->text().trimmed().isEmpty() || ui->memoTxtChat->toPlainText().trimmed().isEmpty()) {
|
||||||
|
|
||||||
// auto addr = "";
|
// auto addr = "";
|
||||||
|
|||||||
@@ -237,18 +237,15 @@ void Controller::getInfoThenRefresh(bool force)
|
|||||||
zrpc->fetchInfo([=] (const json& reply) {
|
zrpc->fetchInfo([=] (const json& reply) {
|
||||||
prevCallSucceeded = true;
|
prevCallSucceeded = true;
|
||||||
int curBlock = reply["latest_block_height"].get<json::number_integer_t>();
|
int curBlock = reply["latest_block_height"].get<json::number_integer_t>();
|
||||||
int longestchain = reply["longestchain"].get<json::number_integer_t>();
|
bool doUpdate = force || (model->getLatestBlock() != curBlock);
|
||||||
int notarized = reply["notarized"].get<json::number_integer_t>();
|
|
||||||
int lag = longestchain - notarized ;
|
|
||||||
|
|
||||||
|
|
||||||
qDebug()<<"Lag :" << lag;
|
|
||||||
|
|
||||||
|
|
||||||
int difficulty = reply["difficulty"].get<json::number_integer_t>();
|
int difficulty = reply["difficulty"].get<json::number_integer_t>();
|
||||||
int blocks_until_halving= 340000 - curBlock;
|
int blocks_until_halving= 340000 - curBlock;
|
||||||
int halving_days = (blocks_until_halving * 150) / (60*60*24) ;
|
int halving_days = (blocks_until_halving * 150) / (60*60*24) ;
|
||||||
bool doUpdate = force || (model->getLatestBlock() != curBlock);
|
int longestchain = reply["longestchain"].get<json::number_integer_t>();
|
||||||
|
int notarized = reply["notarized"].get<json::number_integer_t>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
model->setLatestBlock(curBlock);
|
model->setLatestBlock(curBlock);
|
||||||
if (
|
if (
|
||||||
Settings::getInstance()->get_currency_name() == "EUR" ||
|
Settings::getInstance()->get_currency_name() == "EUR" ||
|
||||||
@@ -267,7 +264,7 @@ void Controller::getInfoThenRefresh(bool force)
|
|||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this->setLag(lag);
|
|
||||||
|
|
||||||
ui->difficulty->setText(
|
ui->difficulty->setText(
|
||||||
QLocale(QLocale::German).toString(difficulty)
|
QLocale(QLocale::German).toString(difficulty)
|
||||||
@@ -295,8 +292,6 @@ void Controller::getInfoThenRefresh(bool force)
|
|||||||
(QLocale(QLocale::English).toString(blocks_until_halving)) +
|
(QLocale(QLocale::English).toString(blocks_until_halving)) +
|
||||||
" Blocks or , " + (QLocale(QLocale::English).toString(halving_days) + " days" )
|
" Blocks or , " + (QLocale(QLocale::English).toString(halving_days) + " days" )
|
||||||
);
|
);
|
||||||
|
|
||||||
this->setLag(lag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->Version->setText(
|
ui->Version->setText(
|
||||||
@@ -305,7 +300,6 @@ void Controller::getInfoThenRefresh(bool force)
|
|||||||
ui->Vendor->setText(
|
ui->Vendor->setText(
|
||||||
QString::fromStdString(reply["vendor"].get<json::string_t>())
|
QString::fromStdString(reply["vendor"].get<json::string_t>())
|
||||||
);
|
);
|
||||||
this->setLag(lag);
|
|
||||||
main->logger->write(
|
main->logger->write(
|
||||||
QString("Refresh. curblock ") % QString::number(curBlock) % ", update=" % (doUpdate ? "true" : "false")
|
QString("Refresh. curblock ") % QString::number(curBlock) % ", update=" % (doUpdate ? "true" : "false")
|
||||||
);
|
);
|
||||||
@@ -553,8 +547,12 @@ void Controller::getInfoThenRefresh(bool force)
|
|||||||
refreshAddresses(); // This calls refreshZSentTransactions() and refreshReceivedZTrans()
|
refreshAddresses(); // This calls refreshZSentTransactions() and refreshReceivedZTrans()
|
||||||
refreshTransactions();
|
refreshTransactions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lag = longestchain - notarized ;
|
||||||
|
this->setLag(lag);
|
||||||
}, [=](QString err) {
|
}, [=](QString err) {
|
||||||
// hushd has probably disappeared.
|
// hushd has probably disappeared.
|
||||||
|
|
||||||
this->noConnection();
|
this->noConnection();
|
||||||
|
|
||||||
// Prevent multiple dialog boxes, because these are called async
|
// Prevent multiple dialog boxes, because these are called async
|
||||||
@@ -914,6 +912,12 @@ void Controller::refreshTransactions() {
|
|||||||
isNotarized = false;
|
isNotarized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (confirmations == 1) {
|
||||||
|
DataStore::getChatDataStore()->clear();
|
||||||
|
this->refresh(true);
|
||||||
|
}
|
||||||
|
qDebug()<<"Conf : " << confirmations;
|
||||||
|
|
||||||
ChatItem item = ChatItem(
|
ChatItem item = ChatItem(
|
||||||
datetime,
|
datetime,
|
||||||
address,
|
address,
|
||||||
@@ -927,12 +931,10 @@ void Controller::refreshTransactions() {
|
|||||||
true,
|
true,
|
||||||
isNotarized
|
isNotarized
|
||||||
);
|
);
|
||||||
// qDebug()<<"Memo : " <<memo;
|
|
||||||
qDebug()<< "Notarized Outgoing : " << isNotarized;
|
|
||||||
|
|
||||||
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), 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;
|
||||||
@@ -1038,7 +1040,6 @@ void Controller::refreshTransactions() {
|
|||||||
isNotarized
|
isNotarized
|
||||||
);
|
);
|
||||||
qDebug()<< "Notarized : " << isNotarized;
|
qDebug()<< "Notarized : " << isNotarized;
|
||||||
// qDebug()<<"Confirmation :" << confirmations;
|
|
||||||
|
|
||||||
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1208,6 +1208,7 @@ void MainWindow::setupTransactionsTab() {
|
|||||||
ui->listChat->setMinimumSize(200,350);
|
ui->listChat->setMinimumSize(200,350);
|
||||||
ui->listChat->setItemDelegate(new ListViewDelegate());
|
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
|
||||||
QObject::connect(ui->transactionsTable, &QTableView::customContextMenuRequested, [=] (QPoint pos) {
|
QObject::connect(ui->transactionsTable, &QTableView::customContextMenuRequested, [=] (QPoint pos) {
|
||||||
|
|||||||
@@ -1378,7 +1378,10 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="editTriggers">
|
<property name="editTriggers">
|
||||||
<set>QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
|
</property>
|
||||||
|
<property name="showDropIndicator" stdset="0">
|
||||||
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors">
|
<property name="alternatingRowColors">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@@ -1518,7 +1521,7 @@
|
|||||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="editTriggers">
|
<property name="editTriggers">
|
||||||
<set>QAbstractItemView::AllEditTriggers</set>
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="resizeMode">
|
<property name="resizeMode">
|
||||||
<enum>QListView::Adjust</enum>
|
<enum>QListView::Adjust</enum>
|
||||||
|
|||||||
Reference in New Issue
Block a user