Skip to content

Commit

Permalink
Merge #2865: [Qt] Add differentiation for Shielded Memos
Browse files Browse the repository at this point in the history
2543f6b Add RecvWithShieldedAddressMemo enum to TransactionRecord (Liquid)

Pull request description:

  This introduces a new TransactionRecord `RecvWithShieldedAddressMemo` and icon/image for the transaction.

  With the conversation in Issue #2786 , there is something we can do and that changes the icon and checking for memo to not be empty.

  ![@js](https://github.com/PIVX-Project/PIVX/assets/45834289/3adfd539-a589-4267-8037-ca9cf3953df9)

  Color for blue is not in this PR, but to make it easier to see is in the picture.

  I have also spoken with a few, where they feel more may still be warranted to make this stand out so open for options/feedback for us to update this more.

  Closes #2786

ACKs for top commit:
  Fuzzbawls:
    ACK 2543f6b
  panleone:
    tACK 2543f6b

Tree-SHA512: fd50d8d2874f1c0ee2661585db408928c11b071176c737a4c04267c520ad2bdc14abc29e9ee7f2fb82e98e815a7795dc95330904b4eab6c1127f4a8f897804d6
  • Loading branch information
Fuzzbawls committed Jul 19, 2023
2 parents 616cc48 + 2543f6b commit 559e4f1
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,9 @@ RES_ICONS = \
qt/pivx/res/img/ic-check-tor.svg \
qt/pivx/res/img/ic-label.svg \
qt/pivx/res/img/ic-transaction-received.svg \
qt/pivx/res/img/ic-transaction-received-memo.svg \
qt/pivx/res/img/dark/ic-transaction-received.svg \
qt/pivx/res/img/dark/ic-transaction-received-memo.svg \
qt/pivx/res/img/dark/ic-transaction-warning.svg \
qt/pivx/res/img/dark/ic-transaction-mint.svg \
qt/pivx/res/img/dark/ic-transaction-mint-inactive.svg \
Expand Down
2 changes: 2 additions & 0 deletions src/qt/pivx.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@
<file alias="ic-transaction-warning">pivx/res/img/ic-transaction-warning.svg</file>
<file alias="ic-transaction-mint">pivx/res/img/ic-transaction-mint.svg</file>
<file alias="ic-transaction-received">pivx/res/img/ic-transaction-received.svg</file>
<file alias="ic-transaction-received-memo">pivx/res/img/ic-transaction-received-memo.svg</file>
<file alias="ic-transaction-sent">pivx/res/img/ic-transaction-sent.svg</file>
<file alias="ic-transaction-staked">pivx/res/img/ic-transaction-staked.svg</file>
<file alias="ic-transaction-mint-dark">pivx/res/img/dark/ic-transaction-mint.svg</file>
<file alias="ic-transaction-received-dark">pivx/res/img/dark/ic-transaction-received.svg</file>
<file alias="ic-transaction-received-memo-dark">pivx/res/img/dark/ic-transaction-received-memo.svg</file>
<file alias="ic-transaction-sent-dark">pivx/res/img/dark/ic-transaction-sent.svg</file>
<file alias="ic-transaction-staked-dark">pivx/res/img/dark/ic-transaction-staked.svg</file>
<file alias="ic-transaction-mint-inactive">pivx/res/img/ic-transaction-mint-inactive.svg</file>
Expand Down
4 changes: 3 additions & 1 deletion src/qt/pivx/qtutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,16 @@ void setSortTxTypeFilter(QComboBox* filter, SortEdit* lineEditType)
filter->addItem(QObject::tr("Received"),
TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) |
TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther) |
TransactionFilterProxy::TYPE(TransactionRecord::RecvWithShieldedAddress));
TransactionFilterProxy::TYPE(TransactionRecord::RecvWithShieldedAddress) |
TransactionFilterProxy::TYPE(TransactionRecord::RecvWithShieldedAddressMemo));
filter->addItem(QObject::tr("Sent"),
TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) |
TransactionFilterProxy::TYPE(TransactionRecord::SendToOther) |
TransactionFilterProxy::TYPE(TransactionRecord::SendToShielded) |
TransactionFilterProxy::TYPE(TransactionRecord::SendToNobody));
filter->addItem(QObject::tr("Shield"),
TransactionFilterProxy::TYPE(TransactionRecord::RecvWithShieldedAddress) |
TransactionFilterProxy::TYPE(TransactionRecord::RecvWithShieldedAddressMemo) |
TransactionFilterProxy::TYPE(TransactionRecord::SendToShielded) |
TransactionFilterProxy::TYPE(TransactionRecord::SendToSelfShieldToShieldChangeAddress) |
TransactionFilterProxy::TYPE(TransactionRecord::SendToSelfShieldToTransparent) |
Expand Down
4 changes: 4 additions & 0 deletions src/qt/pivx/res/img/dark/ic-transaction-received-memo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/qt/pivx/res/img/ic-transaction-received-memo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/qt/pivx/txrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ void TxRow::setType(bool isLightTheme, int type, bool isConfirmed)
path = "://ic-transaction-received";
css = "text-list-amount-receive";
break;
case TransactionRecord::RecvWithShieldedAddressMemo:
path = "://ic-transaction-received-memo";
css = "text-list-amount-receive";
break;
case TransactionRecord::SendToAddress:
case TransactionRecord::SendToOther:
case TransactionRecord::ZerocoinSpend:
Expand Down
3 changes: 3 additions & 0 deletions src/qt/transactionrecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ bool TransactionRecord::decomposeCreditTransaction(const CWallet* wallet, const
sub.type = TransactionRecord::RecvWithShieldedAddress;
sub.credit = sspkm->GetOutPointValue(wtx, out);
sub.memo = sspkm->GetOutPointMemo(wtx, out);
if (!sub.memo->empty()) {
sub.type = TransactionRecord::RecvWithShieldedAddressMemo;
}
sub.idx = i;
parts.append(sub);
}
Expand Down
1 change: 1 addition & 0 deletions src/qt/transactionrecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class TransactionRecord
P2CSUnlockStaker, // Staker watching the owner spent the delegated utxo
SendToShielded, // Shielded send
RecvWithShieldedAddress, // Shielded receive
RecvWithShieldedAddressMemo, // Shielded recieve with memo
SendToSelfShieldedAddress, // Shielded send to self
SendToSelfShieldToTransparent, // Unshield coins to self
SendToSelfShieldToShieldChangeAddress, // Changing coins from one shielded address to another inside the wallet.
Expand Down
4 changes: 4 additions & 0 deletions src/qt/transactiontablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,8 @@ QString TransactionTableModel::formatTxType(const TransactionRecord* wtx) const
return tr("Converted z%1 to %1").arg(CURRENCY_UNIT.c_str());
case TransactionRecord::RecvWithShieldedAddress:
return tr("Received with shielded");
case TransactionRecord::RecvWithShieldedAddressMemo:
return tr("Received shielded memo");
case TransactionRecord::SendToShielded:
return tr("Shielded send to");
case TransactionRecord::SendToNobody:
Expand Down Expand Up @@ -532,6 +534,7 @@ QString TransactionTableModel::formatTxToAddress(const TransactionRecord* wtx, b
case TransactionRecord::RecvFromZerocoinSpend:
return lookupAddress(wtx->address, tooltip);
case TransactionRecord::RecvWithShieldedAddress:
case TransactionRecord::RecvWithShieldedAddressMemo:
case TransactionRecord::SendToShielded:
// todo: add addressbook support for shielded addresses.
return QString::fromStdString(wtx->address);
Expand Down Expand Up @@ -708,6 +711,7 @@ QVariant TransactionTableModel::data(const QModelIndex& index, int role) const
return COLOR_ORPHAN;
else
return COLOR_STAKE;

}
// Conflicted tx
if (rec->status.status == TransactionStatus::Conflicted || rec->status.status == TransactionStatus::NotAccepted) {
Expand Down

0 comments on commit 559e4f1

Please sign in to comment.