Skip to content

Commit

Permalink
tx row, use tx model flow instead of direct access.
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Aug 28, 2019
1 parent c3455f9 commit 1304c66
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/qt/pivx/txrow.cpp
Expand Up @@ -43,7 +43,7 @@ void TxRow::setAmount(QString str){
}

// TODO: Agregar send to zPIV and receive zPIV icons..
void TxRow::setType(bool isLightTheme, TransactionRecord::Type type, bool isConfirmed){
void TxRow::setType(bool isLightTheme, int type, bool isConfirmed){
QString path;
QString css;
switch (type) {
Expand Down
2 changes: 1 addition & 1 deletion src/qt/pivx/txrow.h
Expand Up @@ -28,7 +28,7 @@ class TxRow : public QWidget
void setDate(QDateTime);
void setLabel(QString);
void setAmount(QString);
void setType(bool isLightTheme, TransactionRecord::Type type, bool isConfirmed);
void setType(bool isLightTheme, int type, bool isConfirmed);
void setConfirmStatus(bool isConfirmed);

private:
Expand Down
11 changes: 6 additions & 5 deletions src/qt/pivx/txviewholder.cpp
Expand Up @@ -21,14 +21,15 @@ void TxViewHolder::init(QWidget* holder,const QModelIndex &index, bool isHovered
TransactionRecord *rec = static_cast<TransactionRecord*>(rIndex.internalPointer());
QDateTime date = rIndex.data(TransactionTableModel::DateRole).toDateTime();
qint64 amount = rIndex.data(TransactionTableModel::AmountRole).toLongLong();
//bool isConfirmed = rIndex.data(TransactionTableModel::ConfirmedRole).toBool();
QString amountText = BitcoinUnits::formatWithUnit(nDisplayUnit, amount, true, BitcoinUnits::separatorAlways);
QModelIndex indexType = rIndex.sibling(rIndex.row(),TransactionTableModel::Type);
bool isUnconfirmed = (rec->status.status == TransactionStatus::Unconfirmed) || (rec->status.status == TransactionStatus::Immature);
QString label = indexType.data(Qt::DisplayRole).toString();
if(rec->type != TransactionRecord::ZerocoinMint &&
rec->type != TransactionRecord::ZerocoinSpend_Change_zPiv &&
rec->type != TransactionRecord::StakeZPIV){
int type = rIndex.data(TransactionTableModel::TypeRole).toInt();

if(type != TransactionRecord::ZerocoinMint &&
type != TransactionRecord::ZerocoinSpend_Change_zPiv &&
type != TransactionRecord::StakeZPIV){
QString address = rIndex.data(Qt::DisplayRole).toString();
if(address.length() > 20) {
address = address.left(ADDRESS_SIZE) + "..." + address.right(ADDRESS_SIZE);
Expand All @@ -39,7 +40,7 @@ void TxViewHolder::init(QWidget* holder,const QModelIndex &index, bool isHovered
txRow->setDate(date);
txRow->setLabel(label);
txRow->setAmount(amountText);
txRow->setType(isLightTheme, rec->type, !isUnconfirmed);
txRow->setType(isLightTheme, type, !isUnconfirmed);
}

QColor TxViewHolder::rectColor(bool isHovered, bool isSelected) {
Expand Down

0 comments on commit 1304c66

Please sign in to comment.