Skip to content

Commit

Permalink
[UI] Wallet sync state, pending icon and style added to the transacti…
Browse files Browse the repository at this point in the history
…onRecords with "Other" type.

[UI] pending icon size increased to 30px.
  • Loading branch information
furszy committed Sep 6, 2019
1 parent fb9b7e6 commit 62e06f2
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/Makefile.qt.include
Expand Up @@ -490,6 +490,7 @@ RES_ICONS = \
qt/pivx/res/img/ic-nav-privacy.svg \
qt/pivx/res/img/img-empty-dark-error.svg \
qt/pivx/res/img/ic-add-label.svg \
qt/pivx/res/img/ic-pending.svg \
qt/pivx/res/img/ic-check-theme-dark.svg \
qt/pivx/res/img/ic-nav-receive-active.svg \
qt/pivx/res/img/img-empty-dark-masternode.svg \
Expand Down
1 change: 1 addition & 0 deletions src/qt/pivx.qrc
Expand Up @@ -304,5 +304,6 @@
<file alias="ic-check-liliac-indeterminate">pivx/res/img/ic-check-liliac-indeterminate.svg</file>
<file alias="ani-loading-dark">pivx/res/img/ani-loading-dark.gif</file>
<file alias="ani-loading">pivx/res/img/ani-loading.gif</file>
<file alias="ic-pending">pivx/res/img/ic-pending.svg</file>
</qresource>
</RCC>
2 changes: 1 addition & 1 deletion src/qt/pivx/forms/welcomecontentwidget.ui
Expand Up @@ -823,7 +823,7 @@
</size>
</property>
<property name="text">
<string>SELECT LANGUAGE</string>
<string>Select your language</string>
</property>
</widget>
</item>
Expand Down
16 changes: 16 additions & 0 deletions src/qt/pivx/res/img/ic-pending.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions src/qt/pivx/txrow.cpp
Expand Up @@ -49,6 +49,7 @@ void TxRow::setAmount(QString str){
void TxRow::setType(bool isLightTheme, int type, bool isConfirmed){
QString path;
QString css;
bool sameIcon = false;
switch (type) {
case TransactionRecord::ZerocoinMint:
path = "://ic-transaction-mint";
Expand Down Expand Up @@ -81,11 +82,13 @@ void TxRow::setType(bool isLightTheme, int type, bool isConfirmed){
css = "text-list-amount-send";
break;
default:
path = ":/icons/tx_inout";
path = "://ic-pending";
sameIcon = true;
css = "text-list-amount-unconfirmed";
break;
}

if (!isLightTheme){
if (!isLightTheme && !sameIcon){
path += "-dark";
}

Expand Down
16 changes: 9 additions & 7 deletions src/qt/pivx/txviewholder.cpp
Expand Up @@ -4,12 +4,9 @@

#include "qt/pivx/txviewholder.h"
#include "qt/pivx/txrow.h"

#include "qt/pivx/qtutils.h"
#include "transactiontablemodel.h"
#include "transactionrecord.h"
#include <QModelIndex>
#include <iostream>

#define ADDRESS_SIZE 12

Expand All @@ -22,24 +19,29 @@ void TxViewHolder::init(QWidget* holder,const QModelIndex &index, bool isHovered
txRow->updateStatus(isLightTheme, isHovered, isSelected);

QModelIndex rIndex = (filter) ? filter->mapToSource(index) : index;
TransactionRecord *rec = static_cast<TransactionRecord*>(rIndex.internalPointer());
QDateTime date = rIndex.data(TransactionTableModel::DateRole).toDateTime();
qint64 amount = rIndex.data(TransactionTableModel::AmountRole).toLongLong();
QString amountText = BitcoinUnits::formatWithUnit(nDisplayUnit, amount, true, BitcoinUnits::separatorAlways);
QModelIndex indexType = rIndex.sibling(rIndex.row(),TransactionTableModel::Type);
QString label = indexType.data(Qt::DisplayRole).toString();
int type = rIndex.data(TransactionTableModel::TypeRole).toInt();

if(type != TransactionRecord::ZerocoinMint &&
type != TransactionRecord::ZerocoinSpend_Change_zPiv &&
type != TransactionRecord::StakeZPIV){
type != TransactionRecord::StakeZPIV &&
type != TransactionRecord::Other){
QString address = rIndex.data(Qt::DisplayRole).toString();
if(address.length() > 20) {
address = address.left(ADDRESS_SIZE) + "..." + address.right(ADDRESS_SIZE);
}
label += " " + address;
} else if (type == TransactionRecord::Other) {
label += rIndex.data(Qt::DisplayRole).toString();
}
bool isUnconfirmed = (rec->status.status == TransactionStatus::Unconfirmed) || (rec->status.status == TransactionStatus::Immature)
|| (rec->status.status == TransactionStatus::Conflicted) || (rec->status.status == TransactionStatus::NotAccepted);

int status = rIndex.data(TransactionTableModel::StatusRole).toInt();
bool isUnconfirmed = (status == TransactionStatus::Unconfirmed) || (status == TransactionStatus::Immature)
|| (status == TransactionStatus::Conflicted) || (status == TransactionStatus::NotAccepted);

txRow->setDate(date);
txRow->setLabel(label);
Expand Down
9 changes: 7 additions & 2 deletions src/qt/transactiontablemodel.cpp
Expand Up @@ -462,8 +462,13 @@ QString TransactionTableModel::formatTxToAddress(const TransactionRecord* wtx, b
QString label = walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(wtx->address));
return label.isEmpty() ? "" : label;
}
default:
return tr("(n/a)") + watchAddress;
default: {
if (watchAddress.isEmpty()) {
return tr("No information");
} else {
return tr("(n/a)") + watchAddress;
}
}
}
}

Expand Down

0 comments on commit 62e06f2

Please sign in to comment.