Browse Source
* Add upto 20 addresses to the taddr dropdown * View All Addresses dialog box * Add balances to view all addresses * Add export all keys * Add translations + copy addressimport_zecw
Arjun
5 years ago
committed by
adityapk00
7 changed files with 219 additions and 9 deletions
@ -0,0 +1,38 @@ |
|||||
|
#include "viewalladdresses.h" |
||||
|
#include "settings.h" |
||||
|
|
||||
|
ViewAllAddressesModel::ViewAllAddressesModel(QTableView *parent, QList<QString> taddrs, RPC* 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->getAllBalances()->value(address, 0.0); |
||||
|
} |
||||
|
} |
||||
|
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(); |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
#ifndef VIEWALLADDRESSES_H |
||||
|
#define VIEWALLADDRESSES_H |
||||
|
|
||||
|
#include "precompiled.h" |
||||
|
#include "rpc.h" |
||||
|
|
||||
|
class ViewAllAddressesModel : public QAbstractTableModel { |
||||
|
|
||||
|
public: |
||||
|
ViewAllAddressesModel(QTableView* parent, QList<QString> taddrs, RPC* rpc); |
||||
|
~ViewAllAddressesModel() = default; |
||||
|
|
||||
|
int rowCount(const QModelIndex &parent) const; |
||||
|
int columnCount(const QModelIndex &parent) const; |
||||
|
QVariant data(const QModelIndex &index, int role) const; |
||||
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const; |
||||
|
|
||||
|
private: |
||||
|
QList<QString> addresses; |
||||
|
QStringList headers; |
||||
|
RPC* rpc; |
||||
|
}; |
||||
|
|
||||
|
#endif |
@ -0,0 +1,81 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<ui version="4.0"> |
||||
|
<class>ViewAddressesDialog</class> |
||||
|
<widget class="QDialog" name="ViewAddressesDialog"> |
||||
|
<property name="geometry"> |
||||
|
<rect> |
||||
|
<x>0</x> |
||||
|
<y>0</y> |
||||
|
<width>400</width> |
||||
|
<height>300</height> |
||||
|
</rect> |
||||
|
</property> |
||||
|
<property name="windowTitle"> |
||||
|
<string>All Addresses</string> |
||||
|
</property> |
||||
|
<layout class="QGridLayout" name="gridLayout"> |
||||
|
<item row="1" column="1"> |
||||
|
<widget class="QDialogButtonBox" name="buttonBox"> |
||||
|
<property name="orientation"> |
||||
|
<enum>Qt::Horizontal</enum> |
||||
|
</property> |
||||
|
<property name="standardButtons"> |
||||
|
<set>QDialogButtonBox::Ok</set> |
||||
|
</property> |
||||
|
</widget> |
||||
|
</item> |
||||
|
<item row="1" column="0"> |
||||
|
<widget class="QPushButton" name="btnExportAll"> |
||||
|
<property name="text"> |
||||
|
<string>Export All Keys</string> |
||||
|
</property> |
||||
|
</widget> |
||||
|
</item> |
||||
|
<item row="0" column="0" colspan="2"> |
||||
|
<widget class="QTableView" name="tblAddresses"> |
||||
|
<property name="selectionMode"> |
||||
|
<enum>QAbstractItemView::SingleSelection</enum> |
||||
|
</property> |
||||
|
<attribute name="horizontalHeaderStretchLastSection"> |
||||
|
<bool>true</bool> |
||||
|
</attribute> |
||||
|
</widget> |
||||
|
</item> |
||||
|
</layout> |
||||
|
</widget> |
||||
|
<resources/> |
||||
|
<connections> |
||||
|
<connection> |
||||
|
<sender>buttonBox</sender> |
||||
|
<signal>accepted()</signal> |
||||
|
<receiver>ViewAddressesDialog</receiver> |
||||
|
<slot>accept()</slot> |
||||
|
<hints> |
||||
|
<hint type="sourcelabel"> |
||||
|
<x>248</x> |
||||
|
<y>254</y> |
||||
|
</hint> |
||||
|
<hint type="destinationlabel"> |
||||
|
<x>157</x> |
||||
|
<y>274</y> |
||||
|
</hint> |
||||
|
</hints> |
||||
|
</connection> |
||||
|
<connection> |
||||
|
<sender>buttonBox</sender> |
||||
|
<signal>rejected()</signal> |
||||
|
<receiver>ViewAddressesDialog</receiver> |
||||
|
<slot>reject()</slot> |
||||
|
<hints> |
||||
|
<hint type="sourcelabel"> |
||||
|
<x>316</x> |
||||
|
<y>260</y> |
||||
|
</hint> |
||||
|
<hint type="destinationlabel"> |
||||
|
<x>286</x> |
||||
|
<y>274</y> |
||||
|
</hint> |
||||
|
</hints> |
||||
|
</connection> |
||||
|
</connections> |
||||
|
</ui> |
Loading…
Reference in new issue