mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
Show unconfirmed balance on overview page
This commit is contained in:
parent
eee0d2391c
commit
df5ccbd2b2
@ -16,13 +16,15 @@ This has been implemented:
|
|||||||
|
|
||||||
- Tabbed interface
|
- Tabbed interface
|
||||||
|
|
||||||
|
- Overview page with current balance, unconfirmed balance, etc
|
||||||
|
|
||||||
|
- User friendly transaction list with status icons, real-time filtering and a context menu that allows editing and copying labels
|
||||||
|
|
||||||
- Asks for confirmation before sending coins
|
- Asks for confirmation before sending coins
|
||||||
|
|
||||||
- CSV export of transactions and address book
|
- CSV export of transactions and address book
|
||||||
|
|
||||||
- User friendly transaction list with status icons, real-time filtering and a context menu that allows editing and copying labels
|
- Shows alternative icon when connected to testnet
|
||||||
|
|
||||||
- Show alternative icon when on testnet
|
|
||||||
|
|
||||||
- Progress bar on initial block download
|
- Progress bar on initial block download
|
||||||
|
|
||||||
|
@ -217,19 +217,13 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel)
|
|||||||
{
|
{
|
||||||
this->walletModel = walletModel;
|
this->walletModel = walletModel;
|
||||||
|
|
||||||
// Keep up to date with wallet
|
|
||||||
setBalance(walletModel->getBalance());
|
|
||||||
connect(walletModel, SIGNAL(balanceChanged(qint64)), this, SLOT(setBalance(qint64)));
|
|
||||||
|
|
||||||
setNumTransactions(walletModel->getNumTransactions());
|
|
||||||
connect(walletModel, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int)));
|
|
||||||
|
|
||||||
// Report errors from wallet thread
|
// Report errors from wallet thread
|
||||||
connect(walletModel, SIGNAL(error(QString,QString)), this, SLOT(error(QString,QString)));
|
connect(walletModel, SIGNAL(error(QString,QString)), this, SLOT(error(QString,QString)));
|
||||||
|
|
||||||
// Put transaction list in tabs
|
// Put transaction list in tabs
|
||||||
transactionView->setModel(walletModel);
|
transactionView->setModel(walletModel);
|
||||||
|
|
||||||
|
overviewPage->setModel(walletModel);
|
||||||
addressBookPage->setModel(walletModel->getAddressTableModel());
|
addressBookPage->setModel(walletModel->getAddressTableModel());
|
||||||
receiveCoinsPage->setModel(walletModel->getAddressTableModel());
|
receiveCoinsPage->setModel(walletModel->getAddressTableModel());
|
||||||
sendCoinsPage->setModel(walletModel);
|
sendCoinsPage->setModel(walletModel);
|
||||||
@ -280,11 +274,6 @@ void BitcoinGUI::aboutClicked()
|
|||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::setBalance(qint64 balance)
|
|
||||||
{
|
|
||||||
overviewPage->setBalance(balance);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BitcoinGUI::setNumConnections(int count)
|
void BitcoinGUI::setNumConnections(int count)
|
||||||
{
|
{
|
||||||
QString icon;
|
QString icon;
|
||||||
@ -346,11 +335,6 @@ void BitcoinGUI::setNumBlocks(int count)
|
|||||||
.arg(QLocale::system().toString(lastBlockDate)));
|
.arg(QLocale::system().toString(lastBlockDate)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::setNumTransactions(int count)
|
|
||||||
{
|
|
||||||
overviewPage->setNumTransactions(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BitcoinGUI::error(const QString &title, const QString &message)
|
void BitcoinGUI::error(const QString &title, const QString &message)
|
||||||
{
|
{
|
||||||
// Report errors from network/worker thread
|
// Report errors from network/worker thread
|
||||||
|
@ -79,10 +79,8 @@ private:
|
|||||||
void createTrayIcon();
|
void createTrayIcon();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setBalance(qint64 balance);
|
|
||||||
void setNumConnections(int count);
|
void setNumConnections(int count);
|
||||||
void setNumBlocks(int count);
|
void setNumBlocks(int count);
|
||||||
void setNumTransactions(int count);
|
|
||||||
void error(const QString &title, const QString &message);
|
void error(const QString &title, const QString &message);
|
||||||
/* It is currently not possible to pass a return value to another thread through
|
/* It is currently not possible to pass a return value to another thread through
|
||||||
BlockingQueuedConnection, so use an indirected pointer.
|
BlockingQueuedConnection, so use an indirected pointer.
|
||||||
|
@ -46,20 +46,34 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Number of transactions:</string>
|
<string>Number of transactions:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLabel" name="labelNumTransactions">
|
<widget class="QLabel" name="labelNumTransactions">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>0</string>
|
<string>0</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Unconfirmed:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="labelUnconfirmed">
|
||||||
|
<property name="text">
|
||||||
|
<string>0 BTC</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "overviewpage.h"
|
#include "overviewpage.h"
|
||||||
#include "ui_overviewpage.h"
|
#include "ui_overviewpage.h"
|
||||||
|
|
||||||
|
#include "walletmodel.h"
|
||||||
#include "guiutil.h"
|
#include "guiutil.h"
|
||||||
|
|
||||||
OverviewPage::OverviewPage(QWidget *parent) :
|
OverviewPage::OverviewPage(QWidget *parent) :
|
||||||
@ -14,9 +15,14 @@ OverviewPage::OverviewPage(QWidget *parent) :
|
|||||||
ui->labelBalance->setToolTip(tr("Your current balance"));
|
ui->labelBalance->setToolTip(tr("Your current balance"));
|
||||||
ui->labelBalance->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
|
ui->labelBalance->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
|
||||||
|
|
||||||
|
// Balance: <balance>
|
||||||
|
ui->labelUnconfirmed->setFont(QFont("Monospace", -1, QFont::Bold));
|
||||||
|
ui->labelUnconfirmed->setToolTip(tr("Balance of transactions that have yet to be confirmed"));
|
||||||
|
ui->labelUnconfirmed->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
|
||||||
|
|
||||||
|
ui->labelNumTransactions->setToolTip(tr("Total number of transactions in wallet"));
|
||||||
|
|
||||||
// Overview page should show:
|
// Overview page should show:
|
||||||
// Balance
|
|
||||||
// Unconfirmed balance
|
|
||||||
// Last received transaction(s)
|
// Last received transaction(s)
|
||||||
// Last sent transaction(s)
|
// Last sent transaction(s)
|
||||||
}
|
}
|
||||||
@ -26,12 +32,26 @@ OverviewPage::~OverviewPage()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverviewPage::setBalance(qint64 balance)
|
void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance)
|
||||||
{
|
{
|
||||||
ui->labelBalance->setText(GUIUtil::formatMoney(balance) + QString(" BTC"));
|
ui->labelBalance->setText(GUIUtil::formatMoney(balance) + QString(" BTC"));
|
||||||
|
ui->labelUnconfirmed->setText(GUIUtil::formatMoney(unconfirmedBalance) + QString(" BTC"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverviewPage::setNumTransactions(int count)
|
void OverviewPage::setNumTransactions(int count)
|
||||||
{
|
{
|
||||||
ui->labelNumTransactions->setText(QLocale::system().toString(count));
|
ui->labelNumTransactions->setText(QLocale::system().toString(count));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OverviewPage::setModel(WalletModel *model)
|
||||||
|
{
|
||||||
|
this->model = model;
|
||||||
|
|
||||||
|
// Keep up to date with wallet
|
||||||
|
setBalance(model->getBalance(), model->getUnconfirmedBalance());
|
||||||
|
connect(model, SIGNAL(balanceChanged(qint64)), this, SLOT(setBalance(qint64)));
|
||||||
|
|
||||||
|
setNumTransactions(model->getNumTransactions());
|
||||||
|
connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int)));
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
namespace Ui {
|
namespace Ui {
|
||||||
class OverviewPage;
|
class OverviewPage;
|
||||||
}
|
}
|
||||||
|
class WalletModel;
|
||||||
|
|
||||||
class OverviewPage : public QWidget
|
class OverviewPage : public QWidget
|
||||||
{
|
{
|
||||||
@ -15,12 +16,15 @@ public:
|
|||||||
explicit OverviewPage(QWidget *parent = 0);
|
explicit OverviewPage(QWidget *parent = 0);
|
||||||
~OverviewPage();
|
~OverviewPage();
|
||||||
|
|
||||||
|
void setModel(WalletModel *model);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setBalance(qint64 balance);
|
void setBalance(qint64 balance, qint64 unconfirmedBalance);
|
||||||
void setNumTransactions(int count);
|
void setNumTransactions(int count);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::OverviewPage *ui;
|
Ui::OverviewPage *ui;
|
||||||
|
WalletModel *model;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,6 +28,11 @@ qint64 WalletModel::getBalance() const
|
|||||||
return wallet->GetBalance();
|
return wallet->GetBalance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qint64 WalletModel::getUnconfirmedBalance() const
|
||||||
|
{
|
||||||
|
return wallet->GetUnconfirmedBalance();
|
||||||
|
}
|
||||||
|
|
||||||
int WalletModel::getNumTransactions() const
|
int WalletModel::getNumTransactions() const
|
||||||
{
|
{
|
||||||
int numTransactions = 0;
|
int numTransactions = 0;
|
||||||
|
@ -31,6 +31,7 @@ public:
|
|||||||
TransactionTableModel *getTransactionTableModel();
|
TransactionTableModel *getTransactionTableModel();
|
||||||
|
|
||||||
qint64 getBalance() const;
|
qint64 getBalance() const;
|
||||||
|
qint64 getUnconfirmedBalance() const;
|
||||||
int getNumTransactions() const;
|
int getNumTransactions() const;
|
||||||
|
|
||||||
/* Send coins */
|
/* Send coins */
|
||||||
|
@ -570,6 +570,21 @@ int64 CWallet::GetBalance() const
|
|||||||
return nTotal;
|
return nTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64 CWallet::GetUnconfirmedBalance() const
|
||||||
|
{
|
||||||
|
int64 nTotal = 0;
|
||||||
|
CRITICAL_BLOCK(cs_mapWallet)
|
||||||
|
{
|
||||||
|
for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
|
||||||
|
{
|
||||||
|
const CWalletTx* pcoin = &(*it).second;
|
||||||
|
if (pcoin->IsFinal() && pcoin->IsConfirmed())
|
||||||
|
continue;
|
||||||
|
nTotal += pcoin->GetAvailableCredit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nTotal;
|
||||||
|
}
|
||||||
|
|
||||||
bool CWallet::SelectCoinsMinConf(int64 nTargetValue, int nConfMine, int nConfTheirs, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64& nValueRet) const
|
bool CWallet::SelectCoinsMinConf(int64 nTargetValue, int nConfMine, int nConfTheirs, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64& nValueRet) const
|
||||||
{
|
{
|
||||||
|
@ -57,6 +57,7 @@ public:
|
|||||||
void ReacceptWalletTransactions();
|
void ReacceptWalletTransactions();
|
||||||
void ResendWalletTransactions();
|
void ResendWalletTransactions();
|
||||||
int64 GetBalance() const;
|
int64 GetBalance() const;
|
||||||
|
int64 GetUnconfirmedBalance() const;
|
||||||
bool CreateTransaction(const std::vector<std::pair<CScript, int64> >& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet);
|
bool CreateTransaction(const std::vector<std::pair<CScript, int64> >& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet);
|
||||||
bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet);
|
bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet);
|
||||||
bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey);
|
bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey);
|
||||||
|
Loading…
Reference in New Issue
Block a user