Skip to content

Commit 86731dd

Browse files
committed
[GUI] Dashboard, include owner cold stakes in the chart.
1 parent dc530c0 commit 86731dd

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/qt/pivx/dashboardwidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void DashboardWidget::loadWalletModel(){
230230
stakesFilter->setSortCaseSensitivity(Qt::CaseInsensitive);
231231
stakesFilter->setFilterCaseSensitivity(Qt::CaseInsensitive);
232232
stakesFilter->setSortRole(Qt::EditRole);
233-
stakesFilter->setOnlyStakes(true);
233+
stakesFilter->setOnlyStakes(true, true);
234234
stakesFilter->setSourceModel(txModel);
235235
stakesFilter->sort(TransactionTableModel::Date, Qt::AscendingOrder);
236236
hasStakes = stakesFilter->rowCount() > 0;

src/qt/transactionfilterproxy.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex&
6363
if (fOnlyZc && !isZcTx(type)){
6464
return false;
6565
}
66-
if (fOnlyStakes && !isStakeTx(type))
66+
if ((fOnlyStakes && !isStakeTx(type)) && (fShowOwnColdStakes && !isColdStakeMine(type)))
6767
return false;
6868

6969
if (fOnlyColdStaking && !isColdStake(type))
@@ -128,9 +128,10 @@ void TransactionFilterProxy::setShowZcTxes(bool fOnlyZc)
128128
invalidateFilter();
129129
}
130130

131-
void TransactionFilterProxy::setOnlyStakes(bool fOnlyStakes)
131+
void TransactionFilterProxy::setOnlyStakes(bool fOnlyStakes, bool fShowColdStakes)
132132
{
133133
this->fOnlyStakes = fOnlyStakes;
134+
this->fShowOwnColdStakes = fShowColdStakes;
134135
invalidateFilter();
135136
}
136137

@@ -162,11 +163,15 @@ bool TransactionFilterProxy::isZcTx(int type) const {
162163
}
163164

164165
bool TransactionFilterProxy::isStakeTx(int type) const {
165-
return (type == TransactionRecord::StakeMint || type == TransactionRecord::Generated || type == TransactionRecord::StakeZPIV);
166+
return type == TransactionRecord::StakeMint || type == TransactionRecord::Generated || type == TransactionRecord::StakeZPIV;
167+
}
168+
169+
bool TransactionFilterProxy::isColdStakeMine(int type) const {
170+
return type == TransactionRecord::StakeDelegated;
166171
}
167172

168173
bool TransactionFilterProxy::isColdStake(int type) const {
169-
return (type == TransactionRecord::P2CSDelegation || type == TransactionRecord::P2CSDelegationSent || type == TransactionRecord::P2CSDelegationSentOwner || type == TransactionRecord::StakeDelegated || type == TransactionRecord::StakeHot);
174+
return type == TransactionRecord::P2CSDelegation || type == TransactionRecord::P2CSDelegationSent || type == TransactionRecord::P2CSDelegationSentOwner || isColdStakeMine(type) || type == TransactionRecord::StakeHot;
170175
}
171176

172177
/*QVariant TransactionFilterProxy::dataFromSourcePos(int sourceRow, int role) const {

src/qt/transactionfilterproxy.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class TransactionFilterProxy : public QSortFilterProxyModel
6363
void setShowZcTxes(bool fOnlyZc);
6464

6565
/** Only stakes txes **/
66-
void setOnlyStakes(bool fOnlyStakes);
66+
void setOnlyStakes(bool fOnlyStakes, bool fShowColdStakes = false);
6767

6868
/** Shows only p2cs-p2cs && xxx-p2cs **/
6969
void setOnlyColdStakes(bool fOnlyColdStakes);
@@ -88,11 +88,13 @@ class TransactionFilterProxy : public QSortFilterProxyModel
8888
bool fHideOrphans = true;
8989
bool fOnlyZc = false;
9090
bool fOnlyStakes = false;
91+
bool fShowOwnColdStakes = false;
9192
bool fOnlyColdStaking = false;
9293

9394
bool isZcTx(int type) const;
9495
bool isStakeTx(int type) const;
9596
bool isColdStake(int type) const;
97+
bool isColdStakeMine(int type) const;
9698
};
9799

98100
#endif // BITCOIN_QT_TRANSACTIONFILTERPROXY_H

0 commit comments

Comments
 (0)