From 69857c5da9f053521d273a0629dc1ff986a952e3 Mon Sep 17 00:00:00 2001 From: xdn-project Date: Wed, 1 Jun 2016 15:16:48 +0000 Subject: [PATCH] Improvements of messages GUI --- CryptoNoteWallet.cmake | 2 +- src/CryptoNoteWrapper.cpp | 8 ++++---- src/gui/SendMessageFrame.cpp | 24 +++++++++++------------- src/gui/TransactionsModel.cpp | 4 ++++ src/icons/tx_message.png | Bin 0 -> 1073 bytes src/resources.qrc | 1 + 6 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 src/icons/tx_message.png diff --git a/CryptoNoteWallet.cmake b/CryptoNoteWallet.cmake index 9a836f0f1..6b64a9998 100644 --- a/CryptoNoteWallet.cmake +++ b/CryptoNoteWallet.cmake @@ -2,4 +2,4 @@ set(CN_PROJECT_NAME "digitalnotewallet") set(CN_CURRENCY_DISPLAY_NAME "DigitalNote") set(CN_CURRENCY_TICKER "XDN") -set(CN_VERSION 1.0.8-beta) +set(CN_VERSION 1.0.9-beta) diff --git a/src/CryptoNoteWrapper.cpp b/src/CryptoNoteWrapper.cpp index 0c0d10c19..8e0633678 100644 --- a/src/CryptoNoteWrapper.cpp +++ b/src/CryptoNoteWrapper.cpp @@ -133,7 +133,7 @@ class RpcNode : CryptoNote::INodeObserver, public Node { const CryptoNote::Currency& m_currency; CryptoNote::NodeRpcProxy m_node; - void peerCountUpdated(size_t count) { + void peerCountUpdated(size_t count) override { m_callback.peerCountUpdated(*this, count); } @@ -242,15 +242,15 @@ class InprocessNode : CryptoNote::INodeObserver, public Node { CryptoNote::InProcessNode m_node; std::future m_nodeServerFuture; - void peerCountUpdated(size_t count) { + void peerCountUpdated(size_t count) override { m_callback.peerCountUpdated(*this, count); } - void localBlockchainUpdated(uint64_t height) { + void localBlockchainUpdated(uint32_t height) override { m_callback.localBlockchainUpdated(*this, height); } - void lastKnownBlockHeightUpdated(uint64_t height) { + void lastKnownBlockHeightUpdated(uint32_t height) override { m_callback.lastKnownBlockHeightUpdated(*this, height); } }; diff --git a/src/gui/SendMessageFrame.cpp b/src/gui/SendMessageFrame.cpp index 539cca53a..47d684c04 100644 --- a/src/gui/SendMessageFrame.cpp +++ b/src/gui/SendMessageFrame.cpp @@ -87,18 +87,17 @@ QString SendMessageFrame::extractAddress(const QString& _addressString) const { void SendMessageFrame::recalculateFeeValue() { QString messageText = m_ui->m_messageTextEdit->toPlainText(); - quint32 messageSize = messageText.length() ; + quint32 messageSize = messageText.length(); if (messageSize > 0) { --messageSize; } - quint64 fee = MINIMAL_MESSAGE_FEE; - if (m_ui->m_ttlCheck->checkState() == Qt::Checked) { - fee = 0; + quint64 fee = MESSAGE_AMOUNT * m_addressFrames.size(); + if (m_ui->m_ttlCheck->checkState() == Qt::Unchecked) { + fee += MINIMAL_MESSAGE_FEE + messageSize * MESSAGE_CHAR_PRICE; } - m_ui->m_feeSpin->setMinimum(CurrencyAdapter::instance().formatAmount(MESSAGE_AMOUNT * m_addressFrames.size() + - fee + messageSize * MESSAGE_CHAR_PRICE).toDouble()); + m_ui->m_feeSpin->setMinimum(CurrencyAdapter::instance().formatAmount(fee).toDouble()); m_ui->m_feeSpin->setValue(m_ui->m_feeSpin->minimum()); } @@ -160,19 +159,18 @@ void SendMessageFrame::sendClicked() { messages.append({messageString.toStdString(), address.toStdString()}); } + quint64 ttl = 0; + if (m_ui->m_ttlCheck->checkState() == Qt::Checked) { + ttl = QDateTime::currentDateTimeUtc().toTime_t() + m_ui->m_ttlSlider->value() * MIN_TTL; + } + quint64 fee = CurrencyAdapter::instance().parseAmount(m_ui->m_feeSpin->cleanText()); fee -= MESSAGE_AMOUNT * transfers.size(); - if (fee < MINIMAL_MESSAGE_FEE) { + if (ttl == 0 && fee < MINIMAL_MESSAGE_FEE) { QCoreApplication::postEvent(&MainWindow::instance(), new ShowMessageEvent(tr("Incorrect fee value"), QtCriticalMsg)); return; } - quint64 ttl = 0; - if (m_ui->m_ttlCheck->checkState() == Qt::Checked) { - ttl = QDateTime::currentDateTimeUtc().toTime_t() + m_ui->m_ttlSlider->value() * MIN_TTL; - fee = 0; - } - if (WalletAdapter::instance().isOpen()) { WalletAdapter::instance().sendMessage(transfers, fee, m_ui->m_mixinSlider->value(), messages, ttl); } diff --git a/src/gui/TransactionsModel.cpp b/src/gui/TransactionsModel.cpp index e245e71dd..cb1b0fc0c 100644 --- a/src/gui/TransactionsModel.cpp +++ b/src/gui/TransactionsModel.cpp @@ -260,6 +260,10 @@ QVariant TransactionsModel::getDisplayRole(const QModelIndex& _index) const { QVariant TransactionsModel::getDecorationRole(const QModelIndex& _index) const { if(_index.column() == COLUMN_STATE) { + if (_index.data(ROLE_FEE).toULongLong() == 0 && _index.data(ROLE_TYPE).value() != static_cast(TransactionType::MINED)) { + return QPixmap(":icons/tx-message").scaled(16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + } + quint64 numberOfConfirmations = _index.data(ROLE_NUMBER_OF_CONFIRMATIONS).value(); switch (numberOfConfirmations) { case 0: diff --git a/src/icons/tx_message.png b/src/icons/tx_message.png new file mode 100644 index 0000000000000000000000000000000000000000..c4a588283ef3d3b85ba6fe1f26b0ab783aa519e4 GIT binary patch literal 1073 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!n2Vh}LpV4%Za?&Y0OWEOctjR6 zFfi4CFk_>L#$uqLWQl7;NpOBzNqJ&XDnogBxn5>oc5!lIL8@MUQTpt6Hc|`>j4lB_ zA+G=b{|Blc1(bw9ceY(OP=9twkY6wZBQq--HxIvnpqPZDl(dY3qKc}zmVt?>nYo3f zm9>qnor8<3yN9oTNO(kSTtZ4}dRBH$VMS#_OKW>ackhHrlc&#ExMbk?Df9GeSGp;}I&-7>C?P0QFf?)m@!UborW(l(Qu2e~Ep?OrqU z>zOxu!zby^4PJ9kedZnZ`6pB7eT&k4J8_Nk0gIa+o9*}YJAQkd_y3Tln`P{Zul`r& z_ix``llFVZJtIZWi^>e?=lC`~|2BuYKxFC^<`dspY`4v`aqxS^Z1IM#?!(=7hT2(d z62_8q4I46bnOQeK)Mhw+i}Bi-2Gaz0^#h9}H*n11P)KE4!k{N}!E*P;+iKFA=gJ*e zGJkr(CFY2)%xkI`9@jM#@*nV8v*owkI+Zouw(QdzRKE6a@!YST@P4cO5!>6$Cw@pi zJ+q(1Nni1c+Q0eDUt}YUn5Q+!|6<9R#W>p`ZhfQIbkF*5){5xeic5VPOb$%R`^&V7 z`QUH%RSrMfzHlut5#Cb2jO9a6&~Y(_*Pj=Eduv?0H}&JU7k{i6cFRsG`M$j0{Ke;l z#s4c0>P~xqUF$HrUCXBGjeEliz3;!<`D|)AV@pf)kBYDTskU|hm%a-2U@G|VY~t7J z+uV}QFFSXtyC~RW+n>zmVcW^ccl&+q_N}0#>gnp|vd$@? F2>=l-OIZK_ literal 0 HcmV?d00001 diff --git a/src/resources.qrc b/src/resources.qrc index df4b6a9a3..642a49051 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -32,6 +32,7 @@ icons/mining.png icons/deposits.png icons/tx_deposit.png + icons/tx_message.png images/splash.png