mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
GUI: WalletModel: Track asset type collection
This commit is contained in:
parent
7f00087b53
commit
a163be0ae1
2 changed files with 20 additions and 0 deletions
|
|
@ -56,6 +56,11 @@ WalletModel::~WalletModel()
|
|||
unsubscribeFromCoreSignals();
|
||||
}
|
||||
|
||||
std::set<CAsset> WalletModel::getAssetTypes() const
|
||||
{
|
||||
return cached_asset_types;
|
||||
}
|
||||
|
||||
void WalletModel::updateStatus()
|
||||
{
|
||||
EncryptionStatus newEncryptionStatus = getEncryptionStatus();
|
||||
|
|
@ -95,6 +100,16 @@ void WalletModel::checkBalanceChanged(const interfaces::WalletBalances& new_bala
|
|||
if(new_balances.balanceChanged(m_cached_balances)) {
|
||||
m_cached_balances = new_balances;
|
||||
Q_EMIT balanceChanged(new_balances);
|
||||
|
||||
std::set<CAsset> new_asset_types;
|
||||
for (const auto& assetamount : new_balances.balance + new_balances.unconfirmed_balance) {
|
||||
if (!assetamount.second) continue;
|
||||
new_asset_types.insert(assetamount.first);
|
||||
}
|
||||
if (new_asset_types != cached_asset_types) {
|
||||
cached_asset_types = new_asset_types;
|
||||
Q_EMIT assetTypesChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ public:
|
|||
TransactionTableModel *getTransactionTableModel();
|
||||
RecentRequestsTableModel *getRecentRequestsTableModel();
|
||||
|
||||
std::set<CAsset> getAssetTypes() const;
|
||||
EncryptionStatus getEncryptionStatus() const;
|
||||
|
||||
// Check address for validity
|
||||
|
|
@ -230,6 +231,7 @@ private:
|
|||
|
||||
// Cache some values to be able to detect changes
|
||||
interfaces::WalletBalances m_cached_balances;
|
||||
std::set<CAsset> cached_asset_types;
|
||||
EncryptionStatus cachedEncryptionStatus;
|
||||
int cachedNumBlocks;
|
||||
|
||||
|
|
@ -243,6 +245,9 @@ Q_SIGNALS:
|
|||
// Signal that balance in wallet changed
|
||||
void balanceChanged(const interfaces::WalletBalances& balances);
|
||||
|
||||
// Signal that the set of possessed asset types changed
|
||||
void assetTypesChanged();
|
||||
|
||||
// Encryption status of wallet changed
|
||||
void encryptionStatusChanged();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue