|
|
@ -35,6 +35,7 @@ WalletModel::WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *p |
|
|
|
cachedNumBlocks(0) |
|
|
|
cachedNumBlocks(0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fProcessingQueuedTransactions = false; |
|
|
|
fProcessingQueuedTransactions = false; |
|
|
|
|
|
|
|
fHaveWatchOnly = wallet->HaveWatchOnly(); |
|
|
|
|
|
|
|
|
|
|
|
addressTableModel = new AddressTableModel(wallet, this); |
|
|
|
addressTableModel = new AddressTableModel(wallet, this); |
|
|
|
transactionTableModel = new TransactionTableModel(wallet, this); |
|
|
|
transactionTableModel = new TransactionTableModel(wallet, this); |
|
|
@ -80,6 +81,11 @@ qint64 WalletModel::getImmatureBalance() const |
|
|
|
return wallet->GetImmatureBalance(); |
|
|
|
return wallet->GetImmatureBalance(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool WalletModel::haveWatchOnly() const |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return fHaveWatchOnly; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
qint64 WalletModel::getWatchBalance() const |
|
|
|
qint64 WalletModel::getWatchBalance() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return wallet->GetWatchOnlyBalance(); |
|
|
|
return wallet->GetWatchOnlyBalance(); |
|
|
@ -131,9 +137,15 @@ void WalletModel::checkBalanceChanged() |
|
|
|
qint64 newBalance = getBalance(); |
|
|
|
qint64 newBalance = getBalance(); |
|
|
|
qint64 newUnconfirmedBalance = getUnconfirmedBalance(); |
|
|
|
qint64 newUnconfirmedBalance = getUnconfirmedBalance(); |
|
|
|
qint64 newImmatureBalance = getImmatureBalance(); |
|
|
|
qint64 newImmatureBalance = getImmatureBalance(); |
|
|
|
qint64 newWatchOnlyBalance = getWatchBalance(); |
|
|
|
qint64 newWatchOnlyBalance = 0; |
|
|
|
qint64 newWatchUnconfBalance = getWatchUnconfirmedBalance(); |
|
|
|
qint64 newWatchUnconfBalance = 0; |
|
|
|
qint64 newWatchImmatureBalance = getWatchImmatureBalance(); |
|
|
|
qint64 newWatchImmatureBalance = 0; |
|
|
|
|
|
|
|
if (haveWatchOnly()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
newWatchOnlyBalance = getWatchBalance(); |
|
|
|
|
|
|
|
newWatchUnconfBalance = getWatchUnconfirmedBalance(); |
|
|
|
|
|
|
|
newWatchImmatureBalance = getWatchImmatureBalance(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance || cachedImmatureBalance != newImmatureBalance || |
|
|
|
if(cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance || cachedImmatureBalance != newImmatureBalance || |
|
|
|
cachedWatchOnlyBalance != newWatchOnlyBalance || cachedWatchUnconfBalance != newWatchUnconfBalance || cachedWatchImmatureBalance != newWatchImmatureBalance) |
|
|
|
cachedWatchOnlyBalance != newWatchOnlyBalance || cachedWatchUnconfBalance != newWatchUnconfBalance || cachedWatchImmatureBalance != newWatchImmatureBalance) |
|
|
@ -165,6 +177,12 @@ void WalletModel::updateAddressBook(const QString &address, const QString &label |
|
|
|
addressTableModel->updateEntry(address, label, isMine, purpose, status); |
|
|
|
addressTableModel->updateEntry(address, label, isMine, purpose, status); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void WalletModel::updateWatchOnlyFlag(bool fHaveWatchonly) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
fHaveWatchOnly = fHaveWatchonly; |
|
|
|
|
|
|
|
emit notifyWatchonlyChanged(fHaveWatchonly); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool WalletModel::validateAddress(const QString &address) |
|
|
|
bool WalletModel::validateAddress(const QString &address) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CBitcoinAddress addressParsed(address.toStdString()); |
|
|
|
CBitcoinAddress addressParsed(address.toStdString()); |
|
|
@ -479,6 +497,12 @@ static void ShowProgress(WalletModel *walletmodel, const std::string &title, int |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QMetaObject::invokeMethod(walletmodel, "updateWatchOnlyFlag", Qt::QueuedConnection, |
|
|
|
|
|
|
|
Q_ARG(bool, fHaveWatchonly)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WalletModel::subscribeToCoreSignals() |
|
|
|
void WalletModel::subscribeToCoreSignals() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Connect signals to wallet
|
|
|
|
// Connect signals to wallet
|
|
|
@ -486,6 +510,7 @@ void WalletModel::subscribeToCoreSignals() |
|
|
|
wallet->NotifyAddressBookChanged.connect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6)); |
|
|
|
wallet->NotifyAddressBookChanged.connect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6)); |
|
|
|
wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); |
|
|
|
wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); |
|
|
|
wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2)); |
|
|
|
wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2)); |
|
|
|
|
|
|
|
wallet->NotifyWatchonlyChanged.connect(boost::bind(NotifyWatchonlyChanged, this, _1)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WalletModel::unsubscribeFromCoreSignals() |
|
|
|
void WalletModel::unsubscribeFromCoreSignals() |
|
|
@ -495,6 +520,7 @@ void WalletModel::unsubscribeFromCoreSignals() |
|
|
|
wallet->NotifyAddressBookChanged.disconnect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6)); |
|
|
|
wallet->NotifyAddressBookChanged.disconnect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6)); |
|
|
|
wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); |
|
|
|
wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); |
|
|
|
wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2)); |
|
|
|
wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2)); |
|
|
|
|
|
|
|
wallet->NotifyWatchonlyChanged.disconnect(boost::bind(NotifyWatchonlyChanged, this, _1)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// WalletModel::UnlockContext implementation
|
|
|
|
// WalletModel::UnlockContext implementation
|
|
|
|