aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoinamountfield.cpp28
-rw-r--r--src/qt/bitcoinamountfield.h10
-rw-r--r--src/qt/bitcoingui.cpp2
-rw-r--r--src/qt/bitcoingui.h4
-rw-r--r--src/qt/bitcoinunits.cpp13
-rw-r--r--src/qt/bitcoinunits.h12
-rw-r--r--src/qt/coincontroldialog.cpp16
-rw-r--r--src/qt/coincontroldialog.h4
-rw-r--r--src/qt/guiutil.cpp2
-rw-r--r--src/qt/guiutil.h4
-rw-r--r--src/qt/optionsmodel.cpp4
-rw-r--r--src/qt/optionsmodel.h4
-rw-r--r--src/qt/overviewpage.cpp4
-rw-r--r--src/qt/overviewpage.h18
-rw-r--r--src/qt/paymentrequestplus.cpp4
-rw-r--r--src/qt/paymentrequestplus.h2
-rw-r--r--src/qt/paymentserver.cpp4
-rw-r--r--src/qt/sendcoinsdialog.cpp10
-rw-r--r--src/qt/sendcoinsdialog.h4
-rw-r--r--src/qt/transactiondesc.cpp14
-rw-r--r--src/qt/transactionfilterproxy.cpp2
-rw-r--r--src/qt/transactionfilterproxy.h6
-rw-r--r--src/qt/transactionrecord.cpp12
-rw-r--r--src/qt/transactionrecord.h7
-rw-r--r--src/qt/transactiontablemodel.cpp4
-rw-r--r--src/qt/transactionview.cpp2
-rw-r--r--src/qt/walletmodel.cpp40
-rw-r--r--src/qt/walletmodel.h32
-rw-r--r--src/qt/walletmodeltransaction.cpp8
-rw-r--r--src/qt/walletmodeltransaction.h8
-rw-r--r--src/qt/walletview.cpp2
-rw-r--r--src/qt/walletview.h4
32 files changed, 155 insertions, 135 deletions
diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp
index 6466039013..6e35bf17b3 100644
--- a/src/qt/bitcoinamountfield.cpp
+++ b/src/qt/bitcoinamountfield.cpp
@@ -44,7 +44,7 @@ public:
void fixup(QString &input) const
{
bool valid = false;
- qint64 val = parse(input, &valid);
+ CAmount val = parse(input, &valid);
if(valid)
{
input = BitcoinUnits::format(currentUnit, val, false, BitcoinUnits::separatorAlways);
@@ -52,12 +52,12 @@ public:
}
}
- qint64 value(bool *valid_out=0) const
+ CAmount value(bool *valid_out=0) const
{
return parse(text(), valid_out);
}
- void setValue(qint64 value)
+ void setValue(const CAmount& value)
{
lineEdit()->setText(BitcoinUnits::format(currentUnit, value, false, BitcoinUnits::separatorAlways));
emit valueChanged();
@@ -66,9 +66,9 @@ public:
void stepBy(int steps)
{
bool valid = false;
- qint64 val = value(&valid);
+ CAmount val = value(&valid);
val = val + steps * singleStep;
- val = qMin(qMax(val, Q_INT64_C(0)), BitcoinUnits::maxMoney());
+ val = qMin(qMax(val, CAmount(0)), BitcoinUnits::maxMoney());
setValue(val);
}
@@ -78,7 +78,7 @@ public:
if(text().isEmpty()) // Allow step-up with empty field
return StepUpEnabled;
bool valid = false;
- qint64 val = value(&valid);
+ CAmount val = value(&valid);
if(valid)
{
if(val > 0)
@@ -92,7 +92,7 @@ public:
void setDisplayUnit(int unit)
{
bool valid = false;
- qint64 val = value(&valid);
+ CAmount val = value(&valid);
currentUnit = unit;
@@ -102,7 +102,7 @@ public:
clear();
}
- void setSingleStep(qint64 step)
+ void setSingleStep(const CAmount& step)
{
singleStep = step;
}
@@ -140,7 +140,7 @@ public:
}
private:
int currentUnit;
- qint64 singleStep;
+ CAmount singleStep;
mutable QSize cachedMinimumSizeHint;
/**
@@ -148,9 +148,9 @@ private:
* return validity.
* @note Must return 0 if !valid.
*/
- qint64 parse(const QString &text, bool *valid_out=0) const
+ CAmount parse(const QString &text, bool *valid_out=0) const
{
- qint64 val = 0;
+ CAmount val = 0;
bool valid = BitcoinUnits::parse(currentUnit, text, &val);
if(valid)
{
@@ -253,12 +253,12 @@ QWidget *BitcoinAmountField::setupTabChain(QWidget *prev)
return unit;
}
-qint64 BitcoinAmountField::value(bool *valid_out) const
+CAmount BitcoinAmountField::value(bool *valid_out) const
{
return amount->value(valid_out);
}
-void BitcoinAmountField::setValue(qint64 value)
+void BitcoinAmountField::setValue(const CAmount& value)
{
amount->setValue(value);
}
@@ -285,7 +285,7 @@ void BitcoinAmountField::setDisplayUnit(int newUnit)
unit->setValue(newUnit);
}
-void BitcoinAmountField::setSingleStep(qint64 step)
+void BitcoinAmountField::setSingleStep(const CAmount& step)
{
amount->setSingleStep(step);
}
diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h
index 84795a7e7a..e52feeb46e 100644
--- a/src/qt/bitcoinamountfield.h
+++ b/src/qt/bitcoinamountfield.h
@@ -5,6 +5,8 @@
#ifndef BITCOINAMOUNTFIELD_H
#define BITCOINAMOUNTFIELD_H
+#include "amount.h"
+
#include <QWidget>
class AmountSpinBox;
@@ -19,16 +21,16 @@ class BitcoinAmountField: public QWidget
{
Q_OBJECT
- Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY valueChanged USER true)
+ Q_PROPERTY(CAmount value READ value WRITE setValue NOTIFY valueChanged USER true)
public:
explicit BitcoinAmountField(QWidget *parent = 0);
- qint64 value(bool *valid=0) const;
- void setValue(qint64 value);
+ CAmount value(bool *value=0) const;
+ void setValue(const CAmount& value);
/** Set single step in satoshis **/
- void setSingleStep(qint64 step);
+ void setSingleStep(const CAmount& step);
/** Make read-only **/
void setReadOnly(bool fReadOnly);
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 443bed14d7..7380fbd240 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -864,7 +864,7 @@ void BitcoinGUI::closeEvent(QCloseEvent *event)
}
#ifdef ENABLE_WALLET
-void BitcoinGUI::incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address)
+void BitcoinGUI::incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address)
{
// On new transaction, make an info balloon
message((amount)<0 ? tr("Sent transaction") : tr("Incoming transaction"),
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 30b05cb7d9..8af6eda867 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -9,6 +9,8 @@
#include "config/bitcoin-config.h"
#endif
+#include "amount.h"
+
#include <QLabel>
#include <QMainWindow>
#include <QMap>
@@ -159,7 +161,7 @@ public slots:
bool handlePaymentRequest(const SendCoinsRecipient& recipient);
/** Show incoming transaction notification for new transactions. */
- void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address);
+ void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address);
#endif
private slots:
diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp
index 3215363fa0..423b559bf7 100644
--- a/src/qt/bitcoinunits.cpp
+++ b/src/qt/bitcoinunits.cpp
@@ -91,12 +91,13 @@ int BitcoinUnits::decimals(int unit)
}
}
-QString BitcoinUnits::format(int unit, qint64 n, bool fPlus, SeparatorStyle separators)
+QString BitcoinUnits::format(int unit, const CAmount& nIn, bool fPlus, SeparatorStyle separators)
{
// Note: not using straight sprintf here because we do NOT want
// localized number formatting.
if(!valid(unit))
return QString(); // Refuse to format invalid unit
+ qint64 n = (qint64)nIn;
qint64 coin = factor(unit);
int num_decimals = decimals(unit);
qint64 n_abs = (n > 0 ? n : -n);
@@ -138,12 +139,12 @@ QString BitcoinUnits::format(int unit, qint64 n, bool fPlus, SeparatorStyle sepa
// Please take care to use formatHtmlWithUnit instead, when
// appropriate.
-QString BitcoinUnits::formatWithUnit(int unit, qint64 amount, bool plussign, SeparatorStyle separators)
+QString BitcoinUnits::formatWithUnit(int unit, const CAmount& amount, bool plussign, SeparatorStyle separators)
{
return format(unit, amount, plussign, separators) + QString(" ") + name(unit);
}
-QString BitcoinUnits::formatHtmlWithUnit(int unit, qint64 amount, bool plussign, SeparatorStyle separators)
+QString BitcoinUnits::formatHtmlWithUnit(int unit, const CAmount& amount, bool plussign, SeparatorStyle separators)
{
QString str(formatWithUnit(unit, amount, plussign, separators));
str.replace(QChar(THIN_SP_CP), QString(THIN_SP_HTML));
@@ -151,7 +152,7 @@ QString BitcoinUnits::formatHtmlWithUnit(int unit, qint64 amount, bool plussign,
}
-bool BitcoinUnits::parse(int unit, const QString &value, qint64 *val_out)
+bool BitcoinUnits::parse(int unit, const QString &value, CAmount *val_out)
{
if(!valid(unit) || value.isEmpty())
return false; // Refuse to parse invalid unit or empty string
@@ -182,7 +183,7 @@ bool BitcoinUnits::parse(int unit, const QString &value, qint64 *val_out)
{
return false; // Longer numbers will exceed 63 bits
}
- qint64 retvalue = str.toLongLong(&ok);
+ CAmount retvalue(str.toLongLong(&ok));
if(val_out)
{
*val_out = retvalue;
@@ -226,7 +227,7 @@ QVariant BitcoinUnits::data(const QModelIndex &index, int role) const
return QVariant();
}
-qint64 BitcoinUnits::maxMoney()
+CAmount BitcoinUnits::maxMoney()
{
return MAX_MONEY;
}
diff --git a/src/qt/bitcoinunits.h b/src/qt/bitcoinunits.h
index be9dca6012..a392c42b9b 100644
--- a/src/qt/bitcoinunits.h
+++ b/src/qt/bitcoinunits.h
@@ -5,6 +5,8 @@
#ifndef BITCOINUNITS_H
#define BITCOINUNITS_H
+#include "amount.h"
+
#include <QAbstractListModel>
#include <QString>
@@ -85,12 +87,12 @@ public:
//! Number of decimals left
static int decimals(int unit);
//! Format as string
- static QString format(int unit, qint64 amount, bool plussign=false, SeparatorStyle separators=separatorStandard);
+ static QString format(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard);
//! Format as string (with unit)
- static QString formatWithUnit(int unit, qint64 amount, bool plussign=false, SeparatorStyle separators=separatorStandard);
- static QString formatHtmlWithUnit(int unit, qint64 amount, bool plussign=false, SeparatorStyle separators=separatorStandard);
+ static QString formatWithUnit(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard);
+ static QString formatHtmlWithUnit(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard);
//! Parse string to coin amount
- static bool parse(int unit, const QString &value, qint64 *val_out);
+ static bool parse(int unit, const QString &value, CAmount *val_out);
//! Gets title for amount column including current display unit if optionsModel reference available */
static QString getAmountColumnTitle(int unit);
///@}
@@ -117,7 +119,7 @@ public:
}
//! Return maximum number of base units (Satoshis)
- static qint64 maxMoney();
+ static CAmount maxMoney();
private:
QList<BitcoinUnits::Unit> unitlist;
diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp
index d10463fd8f..ba0febe546 100644
--- a/src/qt/coincontroldialog.cpp
+++ b/src/qt/coincontroldialog.cpp
@@ -29,7 +29,7 @@
#include <QTreeWidgetItem>
using namespace std;
-QList<qint64> CoinControlDialog::payAmounts;
+QList<CAmount> CoinControlDialog::payAmounts;
CCoinControl* CoinControlDialog::coinControl = new CCoinControl();
CoinControlDialog::CoinControlDialog(QWidget *parent) :
@@ -443,10 +443,10 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
return;
// nPayAmount
- qint64 nPayAmount = 0;
+ CAmount nPayAmount = 0;
bool fDust = false;
CMutableTransaction txDummy;
- foreach(const qint64 &amount, CoinControlDialog::payAmounts)
+ foreach(const CAmount &amount, CoinControlDialog::payAmounts)
{
nPayAmount += amount;
@@ -460,10 +460,10 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
}
QString sPriorityLabel = tr("none");
- int64_t nAmount = 0;
- int64_t nPayFee = 0;
- int64_t nAfterFee = 0;
- int64_t nChange = 0;
+ CAmount nAmount = 0;
+ CAmount nPayFee = 0;
+ CAmount nAfterFee = 0;
+ CAmount nChange = 0;
unsigned int nBytes = 0;
unsigned int nBytesInputs = 0;
double dPriority = 0;
@@ -684,7 +684,7 @@ void CoinControlDialog::updateView()
itemWalletAddress->setText(COLUMN_ADDRESS, sWalletAddress);
}
- int64_t nSum = 0;
+ CAmount nSum = 0;
double dPrioritySum = 0;
int nChildren = 0;
int nInputSum = 0;
diff --git a/src/qt/coincontroldialog.h b/src/qt/coincontroldialog.h
index a6f239a898..9eaa8eb41d 100644
--- a/src/qt/coincontroldialog.h
+++ b/src/qt/coincontroldialog.h
@@ -5,6 +5,8 @@
#ifndef COINCONTROLDIALOG_H
#define COINCONTROLDIALOG_H
+#include "amount.h"
+
#include <QAbstractButton>
#include <QAction>
#include <QDialog>
@@ -37,7 +39,7 @@ public:
static void updateLabels(WalletModel*, QDialog*);
static QString getPriorityLabel(const CTxMemPool& pool, double);
- static QList<qint64> payAmounts;
+ static QList<CAmount> payAmounts;
static CCoinControl *coinControl;
private:
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index fc22871a6b..91bb10755a 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -221,7 +221,7 @@ QString formatBitcoinURI(const SendCoinsRecipient &info)
return ret;
}
-bool isDust(const QString& address, qint64 amount)
+bool isDust(const QString& address, const CAmount& amount)
{
CTxDestination dest = CBitcoinAddress(address.toStdString()).Get();
CScript script = GetScriptForDestination(dest);
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index 67e11e59a0..0939c78f64 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -5,6 +5,8 @@
#ifndef GUIUTIL_H
#define GUIUTIL_H
+#include "amount.h"
+
#include <QHeaderView>
#include <QMessageBox>
#include <QObject>
@@ -46,7 +48,7 @@ namespace GUIUtil
QString formatBitcoinURI(const SendCoinsRecipient &info);
// Returns true if given address+amount meets "dust" definition
- bool isDust(const QString& address, qint64 amount);
+ bool isDust(const QString& address, const CAmount& amount);
// HTML escaping for rich text controls
QString HtmlEscape(const QString& str, bool fMultiLine=false);
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index bd747faeb6..cb80bd0e3d 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -275,9 +275,9 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
#ifdef ENABLE_WALLET
case Fee: { // core option - can be changed on-the-fly
// Todo: Add is valid check and warn via message, if not
- qint64 nTransactionFee = value.toLongLong();
+ CAmount nTransactionFee(value.toLongLong());
payTxFee = CFeeRate(nTransactionFee, 1000);
- settings.setValue("nTransactionFee", nTransactionFee);
+ settings.setValue("nTransactionFee", qint64(nTransactionFee));
emit transactionFeeChanged(nTransactionFee);
break;
}
diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h
index 80adab89c8..42ea3bf8e5 100644
--- a/src/qt/optionsmodel.h
+++ b/src/qt/optionsmodel.h
@@ -5,6 +5,8 @@
#ifndef OPTIONSMODEL_H
#define OPTIONSMODEL_H
+#include "amount.h"
+
#include <QAbstractListModel>
QT_BEGIN_NAMESPACE
@@ -82,7 +84,7 @@ private:
signals:
void displayUnitChanged(int unit);
- void transactionFeeChanged(qint64);
+ void transactionFeeChanged(const CAmount&);
void coinControlFeaturesChanged(bool);
};
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp
index 90762bea5d..1d6c23f8a0 100644
--- a/src/qt/overviewpage.cpp
+++ b/src/qt/overviewpage.cpp
@@ -146,7 +146,7 @@ OverviewPage::~OverviewPage()
delete ui;
}
-void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance, qint64 watchOnlyBalance, qint64 watchUnconfBalance, qint64 watchImmatureBalance)
+void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance, const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance)
{
int unit = walletModel->getOptionsModel()->getDisplayUnit();
currentBalance = balance;
@@ -220,7 +220,7 @@ void OverviewPage::setWalletModel(WalletModel *model)
// Keep up to date with wallet
setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance(),
model->getWatchBalance(), model->getWatchUnconfirmedBalance(), model->getWatchImmatureBalance());
- connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64, qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64, qint64, qint64, qint64)));
+ connect(model, SIGNAL(balanceChanged(const CAmount&, const CAmount&, const CAmount&, const CAmount&, const CAmount&, const CAmount&)), this, SLOT(setBalance(const CAmount&, const CAmount&, const CAmount&, const CAmount&, const CAmount&, const CAmount&)));
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h
index f46374efba..03f239008f 100644
--- a/src/qt/overviewpage.h
+++ b/src/qt/overviewpage.h
@@ -5,6 +5,8 @@
#ifndef OVERVIEWPAGE_H
#define OVERVIEWPAGE_H
+#include "amount.h"
+
#include <QWidget>
class ClientModel;
@@ -34,8 +36,8 @@ public:
void showOutOfSyncWarning(bool fShow);
public slots:
- void setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance,
- qint64 watchOnlyBalance, qint64 watchUnconfBalance, qint64 watchImmatureBalance);
+ void setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance,
+ const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance);
signals:
void transactionClicked(const QModelIndex &index);
@@ -44,12 +46,12 @@ private:
Ui::OverviewPage *ui;
ClientModel *clientModel;
WalletModel *walletModel;
- qint64 currentBalance;
- qint64 currentUnconfirmedBalance;
- qint64 currentImmatureBalance;
- qint64 currentWatchOnlyBalance;
- qint64 currentWatchUnconfBalance;
- qint64 currentWatchImmatureBalance;
+ CAmount currentBalance;
+ CAmount currentUnconfirmedBalance;
+ CAmount currentImmatureBalance;
+ CAmount currentWatchOnlyBalance;
+ CAmount currentWatchUnconfBalance;
+ CAmount currentWatchImmatureBalance;
TxViewDelegate *txdelegate;
TransactionFilterProxy *filter;
diff --git a/src/qt/paymentrequestplus.cpp b/src/qt/paymentrequestplus.cpp
index 7b7de49831..7aefffe24a 100644
--- a/src/qt/paymentrequestplus.cpp
+++ b/src/qt/paymentrequestplus.cpp
@@ -196,9 +196,9 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
return fResult;
}
-QList<std::pair<CScript,qint64> > PaymentRequestPlus::getPayTo() const
+QList<std::pair<CScript,CAmount> > PaymentRequestPlus::getPayTo() const
{
- QList<std::pair<CScript,qint64> > result;
+ QList<std::pair<CScript,CAmount> > result;
for (int i = 0; i < details.outputs_size(); i++)
{
const unsigned char* scriptStr = (const unsigned char*)details.outputs(i).script().data();
diff --git a/src/qt/paymentrequestplus.h b/src/qt/paymentrequestplus.h
index 3c4861a4d4..3d94d93269 100644
--- a/src/qt/paymentrequestplus.h
+++ b/src/qt/paymentrequestplus.h
@@ -33,7 +33,7 @@ public:
bool getMerchant(X509_STORE* certStore, QString& merchant) const;
// Returns list of outputs, amount
- QList<std::pair<CScript,qint64> > getPayTo() const;
+ QList<std::pair<CScript,CAmount> > getPayTo() const;
const payments::PaymentDetails& getDetails() const { return details; }
diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp
index cc4478f39f..707de55290 100644
--- a/src/qt/paymentserver.cpp
+++ b/src/qt/paymentserver.cpp
@@ -532,10 +532,10 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, SendCoins
request.getMerchant(PaymentServer::certStore, recipient.authenticatedMerchant);
- QList<std::pair<CScript, qint64> > sendingTos = request.getPayTo();
+ QList<std::pair<CScript, CAmount> > sendingTos = request.getPayTo();
QStringList addresses;
- foreach(const PAIRTYPE(CScript, qint64)& sendingTo, sendingTos) {
+ foreach(const PAIRTYPE(CScript, CAmount)& sendingTo, sendingTos) {
// Extract and check destination addresses
CTxDestination dest;
if (ExtractDestination(sendingTo.first, dest)) {
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
index 25e3d2a0dc..d67cac57b4 100644
--- a/src/qt/sendcoinsdialog.cpp
+++ b/src/qt/sendcoinsdialog.cpp
@@ -92,7 +92,7 @@ void SendCoinsDialog::setModel(WalletModel *model)
setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance(),
model->getWatchBalance(), model->getWatchUnconfirmedBalance(), model->getWatchImmatureBalance());
- connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64, qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64, qint64, qint64, qint64)));
+ connect(model, SIGNAL(balanceChanged(const CAmount&, const CAmount&, const CAmount&, const CAmount&, const CAmount&, const CAmount&)), this, SLOT(setBalance(const CAmount&, const CAmount&, const CAmount&, const CAmount&, const CAmount&, const CAmount&)));
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
// Coin Control
@@ -203,7 +203,7 @@ void SendCoinsDialog::on_sendButton_clicked()
return;
}
- qint64 txFee = currentTransaction.getTransactionFee();
+ CAmount txFee = currentTransaction.getTransactionFee();
QString questionString = tr("Are you sure you want to send?");
questionString.append("<br /><br />%1");
@@ -218,7 +218,7 @@ void SendCoinsDialog::on_sendButton_clicked()
// add total amount in all subdivision units
questionString.append("<hr />");
- qint64 totalAmount = currentTransaction.getTotalTransactionAmount() + txFee;
+ CAmount totalAmount = currentTransaction.getTotalTransactionAmount() + txFee;
QStringList alternativeUnits;
foreach(BitcoinUnits::Unit u, BitcoinUnits::availableUnits())
{
@@ -384,8 +384,8 @@ bool SendCoinsDialog::handlePaymentRequest(const SendCoinsRecipient &rv)
return true;
}
-void SendCoinsDialog::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance,
- qint64 watchBalance, qint64 watchUnconfirmedBalance, qint64 watchImmatureBalance)
+void SendCoinsDialog::setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance,
+ const CAmount& watchBalance, const CAmount& watchUnconfirmedBalance, const CAmount& watchImmatureBalance)
{
Q_UNUSED(unconfirmedBalance);
Q_UNUSED(immatureBalance);
diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h
index a090fa42d5..74cc4bde56 100644
--- a/src/qt/sendcoinsdialog.h
+++ b/src/qt/sendcoinsdialog.h
@@ -47,8 +47,8 @@ public slots:
void accept();
SendCoinsEntry *addEntry();
void updateTabsAndLabels();
- void setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance,
- qint64 watchOnlyBalance, qint64 watchUnconfBalance, qint64 watchImmatureBalance);
+ void setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance,
+ const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance);
private:
Ui::SendCoinsDialog *ui;
diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp
index 4923718341..1efad8259b 100644
--- a/src/qt/transactiondesc.cpp
+++ b/src/qt/transactiondesc.cpp
@@ -56,9 +56,9 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
strHTML += "<html><font face='verdana, arial, helvetica, sans-serif'>";
int64_t nTime = wtx.GetTxTime();
- int64_t nCredit = wtx.GetCredit(ISMINE_ALL);
- int64_t nDebit = wtx.GetDebit(ISMINE_ALL);
- int64_t nNet = nCredit - nDebit;
+ CAmount nCredit = wtx.GetCredit(ISMINE_ALL);
+ CAmount nDebit = wtx.GetDebit(ISMINE_ALL);
+ CAmount nNet = nCredit - nDebit;
strHTML += "<b>" + tr("Status") + ":</b> " + FormatTxStatus(wtx);
int nRequests = wtx.GetRequestCount();
@@ -132,7 +132,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
//
// Coinbase
//
- int64_t nUnmatured = 0;
+ CAmount nUnmatured = 0;
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
nUnmatured += wallet->GetCredit(txout, ISMINE_ALL);
strHTML += "<b>" + tr("Credit") + ":</b> ";
@@ -206,13 +206,13 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
if (fAllToMe)
{
// Payment to self
- int64_t nChange = wtx.GetChange();
- int64_t nValue = nCredit - nChange;
+ CAmount nChange = wtx.GetChange();
+ CAmount nValue = nCredit - nChange;
strHTML += "<b>" + tr("Total debit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, -nValue) + "<br>";
strHTML += "<b>" + tr("Total credit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, nValue) + "<br>";
}
- int64_t nTxFee = nDebit - wtx.GetValueOut();
+ CAmount nTxFee = nDebit - wtx.GetValueOut();
if (nTxFee > 0)
strHTML += "<b>" + tr("Transaction fee") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, -nTxFee) + "<br>";
}
diff --git a/src/qt/transactionfilterproxy.cpp b/src/qt/transactionfilterproxy.cpp
index 6ab029173b..2a0f621d1e 100644
--- a/src/qt/transactionfilterproxy.cpp
+++ b/src/qt/transactionfilterproxy.cpp
@@ -78,7 +78,7 @@ void TransactionFilterProxy::setTypeFilter(quint32 modes)
invalidateFilter();
}
-void TransactionFilterProxy::setMinAmount(qint64 minimum)
+void TransactionFilterProxy::setMinAmount(const CAmount& minimum)
{
this->minAmount = minimum;
invalidateFilter();
diff --git a/src/qt/transactionfilterproxy.h b/src/qt/transactionfilterproxy.h
index f408317b53..ca31ee8f87 100644
--- a/src/qt/transactionfilterproxy.h
+++ b/src/qt/transactionfilterproxy.h
@@ -5,6 +5,8 @@
#ifndef TRANSACTIONFILTERPROXY_H
#define TRANSACTIONFILTERPROXY_H
+#include "amount.h"
+
#include <QDateTime>
#include <QSortFilterProxyModel>
@@ -38,7 +40,7 @@ public:
@note Type filter takes a bit field created with TYPE() or ALL_TYPES
*/
void setTypeFilter(quint32 modes);
- void setMinAmount(qint64 minimum);
+ void setMinAmount(const CAmount& minimum);
void setWatchOnlyFilter(WatchOnlyFilter filter);
/** Set maximum number of rows returned, -1 if unlimited. */
@@ -58,7 +60,7 @@ private:
QString addrPrefix;
quint32 typeFilter;
WatchOnlyFilter watchOnlyFilter;
- qint64 minAmount;
+ CAmount minAmount;
int limitRows;
bool showInactive;
};
diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp
index 20c1449c92..afb343f349 100644
--- a/src/qt/transactionrecord.cpp
+++ b/src/qt/transactionrecord.cpp
@@ -32,9 +32,9 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
{
QList<TransactionRecord> parts;
int64_t nTime = wtx.GetTxTime();
- int64_t nCredit = wtx.GetCredit(true);
- int64_t nDebit = wtx.GetDebit(ISMINE_ALL);
- int64_t nNet = nCredit - nDebit;
+ CAmount nCredit = wtx.GetCredit(true);
+ CAmount nDebit = wtx.GetDebit(ISMINE_ALL);
+ CAmount nNet = nCredit - nDebit;
uint256 hash = wtx.GetHash();
std::map<std::string, std::string> mapValue = wtx.mapValue;
@@ -97,7 +97,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
if (fAllFromMe && fAllToMe)
{
// Payment to self
- int64_t nChange = wtx.GetChange();
+ CAmount nChange = wtx.GetChange();
parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "",
-(nDebit - nChange), nCredit - nChange));
@@ -108,7 +108,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
//
// Debit
//
- int64_t nTxFee = nDebit - wtx.GetValueOut();
+ CAmount nTxFee = nDebit - wtx.GetValueOut();
for (unsigned int nOut = 0; nOut < wtx.vout.size(); nOut++)
{
@@ -138,7 +138,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
sub.address = mapValue["to"];
}
- int64_t nValue = txout.nValue;
+ CAmount nValue = txout.nValue;
/* Add fee to first output */
if (nTxFee > 0)
{
diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h
index 626b7654c6..9276c9f0af 100644
--- a/src/qt/transactionrecord.h
+++ b/src/qt/transactionrecord.h
@@ -5,6 +5,7 @@
#ifndef TRANSACTIONRECORD_H
#define TRANSACTIONRECORD_H
+#include "amount.h"
#include "uint256.h"
#include <QList>
@@ -94,7 +95,7 @@ public:
TransactionRecord(uint256 hash, qint64 time,
Type type, const std::string &address,
- qint64 debit, qint64 credit):
+ const CAmount& debit, const CAmount& credit):
hash(hash), time(time), type(type), address(address), debit(debit), credit(credit),
idx(0)
{
@@ -111,8 +112,8 @@ public:
qint64 time;
Type type;
std::string address;
- qint64 debit;
- qint64 credit;
+ CAmount debit;
+ CAmount credit;
/**@}*/
/** Subtransaction index, for sort key */
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
index 2b869b4ea5..e34d776818 100644
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -546,7 +546,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
case ToAddress:
return formatTxToAddress(rec, true);
case Amount:
- return rec->credit + rec->debit;
+ return qint64(rec->credit + rec->debit);
}
break;
case Qt::ToolTipRole:
@@ -583,7 +583,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
case LabelRole:
return walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(rec->address));
case AmountRole:
- return rec->credit + rec->debit;
+ return qint64(rec->credit + rec->debit);
case TxIDRole:
return rec->getTxID();
case TxHashRole:
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp
index a7ba100cd2..d153973872 100644
--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -304,7 +304,7 @@ void TransactionView::changedAmount(const QString &amount)
{
if(!transactionProxyModel)
return;
- qint64 amount_parsed = 0;
+ CAmount amount_parsed = 0;
if(BitcoinUnits::parse(model->getOptionsModel()->getDisplayUnit(), amount, &amount_parsed))
{
transactionProxyModel->setMinAmount(amount_parsed);
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp
index ed90914ba7..b8701a23a6 100644
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -55,11 +55,11 @@ WalletModel::~WalletModel()
unsubscribeFromCoreSignals();
}
-qint64 WalletModel::getBalance(const CCoinControl *coinControl) const
+CAmount WalletModel::getBalance(const CCoinControl *coinControl) const
{
if (coinControl)
{
- qint64 nBalance = 0;
+ CAmount nBalance = 0;
std::vector<COutput> vCoins;
wallet->AvailableCoins(vCoins, true, coinControl);
BOOST_FOREACH(const COutput& out, vCoins)
@@ -72,12 +72,12 @@ qint64 WalletModel::getBalance(const CCoinControl *coinControl) const
return wallet->GetBalance();
}
-qint64 WalletModel::getUnconfirmedBalance() const
+CAmount WalletModel::getUnconfirmedBalance() const
{
return wallet->GetUnconfirmedBalance();
}
-qint64 WalletModel::getImmatureBalance() const
+CAmount WalletModel::getImmatureBalance() const
{
return wallet->GetImmatureBalance();
}
@@ -87,17 +87,17 @@ bool WalletModel::haveWatchOnly() const
return fHaveWatchOnly;
}
-qint64 WalletModel::getWatchBalance() const
+CAmount WalletModel::getWatchBalance() const
{
return wallet->GetWatchOnlyBalance();
}
-qint64 WalletModel::getWatchUnconfirmedBalance() const
+CAmount WalletModel::getWatchUnconfirmedBalance() const
{
return wallet->GetUnconfirmedWatchOnlyBalance();
}
-qint64 WalletModel::getWatchImmatureBalance() const
+CAmount WalletModel::getWatchImmatureBalance() const
{
return wallet->GetImmatureWatchOnlyBalance();
}
@@ -137,12 +137,12 @@ void WalletModel::pollBalanceChanged()
void WalletModel::checkBalanceChanged()
{
- qint64 newBalance = getBalance();
- qint64 newUnconfirmedBalance = getUnconfirmedBalance();
- qint64 newImmatureBalance = getImmatureBalance();
- qint64 newWatchOnlyBalance = 0;
- qint64 newWatchUnconfBalance = 0;
- qint64 newWatchImmatureBalance = 0;
+ CAmount newBalance = getBalance();
+ CAmount newUnconfirmedBalance = getUnconfirmedBalance();
+ CAmount newImmatureBalance = getImmatureBalance();
+ CAmount newWatchOnlyBalance = 0;
+ CAmount newWatchUnconfBalance = 0;
+ CAmount newWatchImmatureBalance = 0;
if (haveWatchOnly())
{
newWatchOnlyBalance = getWatchBalance();
@@ -194,9 +194,9 @@ bool WalletModel::validateAddress(const QString &address)
WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransaction &transaction, const CCoinControl *coinControl)
{
- qint64 total = 0;
+ CAmount total = 0;
QList<SendCoinsRecipient> recipients = transaction.getRecipients();
- std::vector<std::pair<CScript, int64_t> > vecSend;
+ std::vector<std::pair<CScript, CAmount> > vecSend;
if(recipients.empty())
{
@@ -211,7 +211,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
{
if (rcp.paymentRequest.IsInitialized())
{ // PaymentRequest...
- int64_t subtotal = 0;
+ CAmount subtotal = 0;
const payments::PaymentDetails& details = rcp.paymentRequest.getDetails();
for (int i = 0; i < details.outputs_size(); i++)
{
@@ -220,7 +220,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
subtotal += out.amount();
const unsigned char* scriptStr = (const unsigned char*)out.script().data();
CScript scriptPubKey(scriptStr, scriptStr+out.script().size());
- vecSend.push_back(std::pair<CScript, int64_t>(scriptPubKey, out.amount()));
+ vecSend.push_back(std::pair<CScript, CAmount>(scriptPubKey, out.amount()));
}
if (subtotal <= 0)
{
@@ -242,7 +242,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
++nAddresses;
CScript scriptPubKey = GetScriptForDestination(CBitcoinAddress(rcp.address.toStdString()).Get());
- vecSend.push_back(std::pair<CScript, int64_t>(scriptPubKey, rcp.amount));
+ vecSend.push_back(std::pair<CScript, CAmount>(scriptPubKey, rcp.amount));
total += rcp.amount;
}
@@ -252,7 +252,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
return DuplicateAddress;
}
- qint64 nBalance = getBalance(coinControl);
+ CAmount nBalance = getBalance(coinControl);
if(total > nBalance)
{
@@ -263,7 +263,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
LOCK2(cs_main, wallet->cs_wallet);
transaction.newPossibleKeyChange(wallet);
- int64_t nFeeRequired = 0;
+ CAmount nFeeRequired = 0;
std::string strFailReason;
CWalletTx *newTx = transaction.getTransaction();
diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h
index 111ae2178c..b1d0f28f12 100644
--- a/src/qt/walletmodel.h
+++ b/src/qt/walletmodel.h
@@ -37,7 +37,7 @@ class SendCoinsRecipient
{
public:
explicit SendCoinsRecipient() : amount(0), nVersion(SendCoinsRecipient::CURRENT_VERSION) { }
- explicit SendCoinsRecipient(const QString &addr, const QString &label, quint64 amount, const QString &message):
+ explicit SendCoinsRecipient(const QString &addr, const QString &label, const CAmount& amount, const QString &message):
address(addr), label(label), amount(amount), message(message), nVersion(SendCoinsRecipient::CURRENT_VERSION) {}
// If from an insecure payment request, this is used for storing
@@ -47,7 +47,7 @@ public:
// Todo: This is a hack, should be replaced with a cleaner solution!
QString address;
QString label;
- qint64 amount;
+ CAmount amount;
// If from a payment request, this is used for storing the memo
QString message;
@@ -125,13 +125,13 @@ public:
TransactionTableModel *getTransactionTableModel();
RecentRequestsTableModel *getRecentRequestsTableModel();
- qint64 getBalance(const CCoinControl *coinControl = NULL) const;
- qint64 getUnconfirmedBalance() const;
- qint64 getImmatureBalance() const;
+ CAmount getBalance(const CCoinControl *coinControl = NULL) const;
+ CAmount getUnconfirmedBalance() const;
+ CAmount getImmatureBalance() const;
bool haveWatchOnly() const;
- qint64 getWatchBalance() const;
- qint64 getWatchUnconfirmedBalance() const;
- qint64 getWatchImmatureBalance() const;
+ CAmount getWatchBalance() const;
+ CAmount getWatchUnconfirmedBalance() const;
+ CAmount getWatchImmatureBalance() const;
EncryptionStatus getEncryptionStatus() const;
bool processingQueuedTransactions() { return fProcessingQueuedTransactions; }
@@ -210,12 +210,12 @@ private:
RecentRequestsTableModel *recentRequestsTableModel;
// Cache some values to be able to detect changes
- qint64 cachedBalance;
- qint64 cachedUnconfirmedBalance;
- qint64 cachedImmatureBalance;
- qint64 cachedWatchOnlyBalance;
- qint64 cachedWatchUnconfBalance;
- qint64 cachedWatchImmatureBalance;
+ CAmount cachedBalance;
+ CAmount cachedUnconfirmedBalance;
+ CAmount cachedImmatureBalance;
+ CAmount cachedWatchOnlyBalance;
+ CAmount cachedWatchUnconfBalance;
+ CAmount cachedWatchImmatureBalance;
EncryptionStatus cachedEncryptionStatus;
int cachedNumBlocks;
@@ -227,8 +227,8 @@ private:
signals:
// Signal that balance in wallet changed
- void balanceChanged(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance,
- qint64 watchOnlyBalance, qint64 watchUnconfBalance, qint64 watchImmatureBalance);
+ void balanceChanged(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance,
+ const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance);
// Encryption status of wallet changed
void encryptionStatusChanged(int status);
diff --git a/src/qt/walletmodeltransaction.cpp b/src/qt/walletmodeltransaction.cpp
index 943f13e208..ddd2d09bb5 100644
--- a/src/qt/walletmodeltransaction.cpp
+++ b/src/qt/walletmodeltransaction.cpp
@@ -31,19 +31,19 @@ CWalletTx *WalletModelTransaction::getTransaction()
return walletTransaction;
}
-qint64 WalletModelTransaction::getTransactionFee()
+CAmount WalletModelTransaction::getTransactionFee()
{
return fee;
}
-void WalletModelTransaction::setTransactionFee(qint64 newFee)
+void WalletModelTransaction::setTransactionFee(const CAmount& newFee)
{
fee = newFee;
}
-qint64 WalletModelTransaction::getTotalTransactionAmount()
+CAmount WalletModelTransaction::getTotalTransactionAmount()
{
- qint64 totalTransactionAmount = 0;
+ CAmount totalTransactionAmount = 0;
foreach(const SendCoinsRecipient &rcp, recipients)
{
totalTransactionAmount += rcp.amount;
diff --git a/src/qt/walletmodeltransaction.h b/src/qt/walletmodeltransaction.h
index b7e85bcd11..4eadfbe4d1 100644
--- a/src/qt/walletmodeltransaction.h
+++ b/src/qt/walletmodeltransaction.h
@@ -26,10 +26,10 @@ public:
CWalletTx *getTransaction();
- void setTransactionFee(qint64 newFee);
- qint64 getTransactionFee();
+ void setTransactionFee(const CAmount& newFee);
+ CAmount getTransactionFee();
- qint64 getTotalTransactionAmount();
+ CAmount getTotalTransactionAmount();
void newPossibleKeyChange(CWallet *wallet);
CReserveKey *getPossibleKeyChange();
@@ -38,7 +38,7 @@ private:
const QList<SendCoinsRecipient> recipients;
CWalletTx *walletTransaction;
CReserveKey *keyChange;
- qint64 fee;
+ CAmount fee;
};
#endif // WALLETMODELTRANSACTION_H
diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp
index b40ddc0a2f..322d0a6ee6 100644
--- a/src/qt/walletview.cpp
+++ b/src/qt/walletview.cpp
@@ -92,7 +92,7 @@ void WalletView::setBitcoinGUI(BitcoinGUI *gui)
connect(this, SIGNAL(encryptionStatusChanged(int)), gui, SLOT(setEncryptionStatus(int)));
// Pass through transaction notifications
- connect(this, SIGNAL(incomingTransaction(QString,int,qint64,QString,QString)), gui, SLOT(incomingTransaction(QString,int,qint64,QString,QString)));
+ connect(this, SIGNAL(incomingTransaction(QString,int,const CAmount&,QString,QString)), gui, SLOT(incomingTransaction(QString,int,const CAmount&,QString,QString)));
}
}
diff --git a/src/qt/walletview.h b/src/qt/walletview.h
index 9cfa8d6760..cafba517fd 100644
--- a/src/qt/walletview.h
+++ b/src/qt/walletview.h
@@ -5,6 +5,8 @@
#ifndef WALLETVIEW_H
#define WALLETVIEW_H
+#include "amount.h"
+
#include <QStackedWidget>
class BitcoinGUI;
@@ -111,7 +113,7 @@ signals:
/** Encryption status of wallet changed */
void encryptionStatusChanged(int status);
/** Notify that a new transaction appeared */
- void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address);
+ void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address);
};
#endif // WALLETVIEW_H