Hush lite wallet https://faq.hush.is/sdl
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

41 lines
1.2 KiB

// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#include "viewalladdresses.h"
#include "camount.h"
#include "settings.h"
ViewAllAddressesModel::ViewAllAddressesModel(QTableView *parent, QList<QString> taddrs, Controller* rpc)
: QAbstractTableModel(parent) {
headers << tr("Address") << tr("Balance (%1)").arg(Settings::getTokenName());
addresses = taddrs;
this->rpc = rpc;
}
int ViewAllAddressesModel::rowCount(const QModelIndex&) const {
return addresses.size();
}
int ViewAllAddressesModel::columnCount(const QModelIndex&) const {
return headers.size();
}
QVariant ViewAllAddressesModel::data(const QModelIndex &index, int role) const {
QString address = addresses.at(index.row());
if (role == Qt::DisplayRole) {
switch(index.column()) {
case 0: return address;
case 1: return rpc->getModel()->getAllBalances().value(address, CAmount::fromqint64(0)).toDecimalString();
}
}
return QVariant();
}
QVariant ViewAllAddressesModel::headerData(int section, Qt::Orientation orientation, int role) const {
if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
return headers.at(section);
}
return QVariant();
}