Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletmodel.h
Show All 34 Lines | |||||
QT_END_NAMESPACE | QT_END_NAMESPACE | ||||
class SendCoinsRecipient { | class SendCoinsRecipient { | ||||
public: | public: | ||||
explicit SendCoinsRecipient() | explicit SendCoinsRecipient() | ||||
: amount(0), fSubtractFeeFromAmount(false), | : amount(0), fSubtractFeeFromAmount(false), | ||||
nVersion(SendCoinsRecipient::CURRENT_VERSION) {} | nVersion(SendCoinsRecipient::CURRENT_VERSION) {} | ||||
explicit SendCoinsRecipient(const QString &addr, const QString &_label, | explicit SendCoinsRecipient(const QString &addr, const QString &_label, | ||||
const CAmount &_amount, const QString &_message) | const Amount _amount, const QString &_message) | ||||
: address(addr), label(_label), amount(_amount), message(_message), | : address(addr), label(_label), amount(_amount), message(_message), | ||||
fSubtractFeeFromAmount(false), | fSubtractFeeFromAmount(false), | ||||
nVersion(SendCoinsRecipient::CURRENT_VERSION) {} | nVersion(SendCoinsRecipient::CURRENT_VERSION) {} | ||||
// If from an unauthenticated payment request, this is used for storing the | // If from an unauthenticated payment request, this is used for storing the | ||||
// addresses, e.g. address-A<br />address-B<br />address-C. | // addresses, e.g. address-A<br />address-B<br />address-C. | ||||
// Info: As we don't need to process addresses in here when using payment | // Info: As we don't need to process addresses in here when using payment | ||||
// requests, we can abuse it for displaying an address list. | // requests, we can abuse it for displaying an address list. | ||||
// TOFO: This is a hack, should be replaced with a cleaner solution! | // TOFO: This is a hack, should be replaced with a cleaner solution! | ||||
QString address; | QString address; | ||||
QString label; | QString label; | ||||
CAmount amount; | Amount amount; | ||||
// If from a payment request, this is used for storing the memo | // If from a payment request, this is used for storing the memo | ||||
QString message; | QString message; | ||||
// If from a payment request, paymentRequest.IsInitialized() will be true | // If from a payment request, paymentRequest.IsInitialized() will be true | ||||
PaymentRequestPlus paymentRequest; | PaymentRequestPlus paymentRequest; | ||||
// Empty if no authentication or invalid signature/cert/etc. | // Empty if no authentication or invalid signature/cert/etc. | ||||
QString authenticatedMerchant; | QString authenticatedMerchant; | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | enum EncryptionStatus { | ||||
Unlocked | Unlocked | ||||
}; | }; | ||||
OptionsModel *getOptionsModel(); | OptionsModel *getOptionsModel(); | ||||
AddressTableModel *getAddressTableModel(); | AddressTableModel *getAddressTableModel(); | ||||
TransactionTableModel *getTransactionTableModel(); | TransactionTableModel *getTransactionTableModel(); | ||||
RecentRequestsTableModel *getRecentRequestsTableModel(); | RecentRequestsTableModel *getRecentRequestsTableModel(); | ||||
CAmount getBalance(const CCoinControl *coinControl = nullptr) const; | Amount getBalance(const CCoinControl *coinControl = nullptr) const; | ||||
CAmount getUnconfirmedBalance() const; | Amount getUnconfirmedBalance() const; | ||||
CAmount getImmatureBalance() const; | Amount getImmatureBalance() const; | ||||
bool haveWatchOnly() const; | bool haveWatchOnly() const; | ||||
CAmount getWatchBalance() const; | Amount getWatchBalance() const; | ||||
CAmount getWatchUnconfirmedBalance() const; | Amount getWatchUnconfirmedBalance() const; | ||||
CAmount getWatchImmatureBalance() const; | Amount getWatchImmatureBalance() const; | ||||
EncryptionStatus getEncryptionStatus() const; | EncryptionStatus getEncryptionStatus() const; | ||||
// Check address for validity | // Check address for validity | ||||
bool validateAddress(const QString &address); | bool validateAddress(const QString &address); | ||||
// Return status record for SendCoins, contains error id + information | // Return status record for SendCoins, contains error id + information | ||||
struct SendCoinsReturn { | struct SendCoinsReturn { | ||||
SendCoinsReturn(StatusCode _status = OK, | SendCoinsReturn(StatusCode _status = OK, | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | private: | ||||
// for example) | // for example) | ||||
OptionsModel *optionsModel; | OptionsModel *optionsModel; | ||||
AddressTableModel *addressTableModel; | AddressTableModel *addressTableModel; | ||||
TransactionTableModel *transactionTableModel; | TransactionTableModel *transactionTableModel; | ||||
RecentRequestsTableModel *recentRequestsTableModel; | RecentRequestsTableModel *recentRequestsTableModel; | ||||
// Cache some values to be able to detect changes | // Cache some values to be able to detect changes | ||||
CAmount cachedBalance; | Amount cachedBalance; | ||||
CAmount cachedUnconfirmedBalance; | Amount cachedUnconfirmedBalance; | ||||
CAmount cachedImmatureBalance; | Amount cachedImmatureBalance; | ||||
CAmount cachedWatchOnlyBalance; | Amount cachedWatchOnlyBalance; | ||||
CAmount cachedWatchUnconfBalance; | Amount cachedWatchUnconfBalance; | ||||
CAmount cachedWatchImmatureBalance; | Amount cachedWatchImmatureBalance; | ||||
EncryptionStatus cachedEncryptionStatus; | EncryptionStatus cachedEncryptionStatus; | ||||
int cachedNumBlocks; | int cachedNumBlocks; | ||||
QTimer *pollTimer; | QTimer *pollTimer; | ||||
void subscribeToCoreSignals(); | void subscribeToCoreSignals(); | ||||
void unsubscribeFromCoreSignals(); | void unsubscribeFromCoreSignals(); | ||||
void checkBalanceChanged(); | void checkBalanceChanged(); | ||||
Q_SIGNALS: | Q_SIGNALS: | ||||
// Signal that balance in wallet changed | // Signal that balance in wallet changed | ||||
void balanceChanged(const CAmount &balance, | void balanceChanged(const Amount balance, const Amount unconfirmedBalance, | ||||
const CAmount &unconfirmedBalance, | const Amount immatureBalance, | ||||
const CAmount &immatureBalance, | const Amount watchOnlyBalance, | ||||
const CAmount &watchOnlyBalance, | const Amount watchUnconfBalance, | ||||
const CAmount &watchUnconfBalance, | const Amount watchImmatureBalance); | ||||
const CAmount &watchImmatureBalance); | |||||
// Encryption status of wallet changed | // Encryption status of wallet changed | ||||
void encryptionStatusChanged(int status); | void encryptionStatusChanged(int status); | ||||
// Signal emitted when wallet needs to be unlocked | // Signal emitted when wallet needs to be unlocked | ||||
// It is valid behaviour for listeners to keep the wallet locked after this | // It is valid behaviour for listeners to keep the wallet locked after this | ||||
// signal; this means that the unlocking failed or was cancelled. | // signal; this means that the unlocking failed or was cancelled. | ||||
void requireUnlock(); | void requireUnlock(); | ||||
Show All 31 Lines |