Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Declare WalletModel member functions with const #590

Merged
merged 1 commit into from May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/qt/walletmodel.cpp
Expand Up @@ -145,7 +145,7 @@ void WalletModel::updateWatchOnlyFlag(bool fHaveWatchonly)
Q_EMIT notifyWatchonlyChanged(fHaveWatchonly);
}

bool WalletModel::validateAddress(const QString &address)
bool WalletModel::validateAddress(const QString& address) const
{
return IsValidDestinationString(address.toStdString());
}
Expand Down Expand Up @@ -284,22 +284,22 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
return SendCoinsReturn(OK);
}

OptionsModel *WalletModel::getOptionsModel()
OptionsModel* WalletModel::getOptionsModel() const
{
return optionsModel;
}

AddressTableModel *WalletModel::getAddressTableModel()
AddressTableModel* WalletModel::getAddressTableModel() const
{
return addressTableModel;
}

TransactionTableModel *WalletModel::getTransactionTableModel()
TransactionTableModel* WalletModel::getTransactionTableModel() const
{
return transactionTableModel;
}

RecentRequestsTableModel *WalletModel::getRecentRequestsTableModel()
RecentRequestsTableModel* WalletModel::getRecentRequestsTableModel() const
{
return recentRequestsTableModel;
}
Expand Down Expand Up @@ -557,7 +557,7 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
return true;
}

bool WalletModel::displayAddress(std::string sAddress)
bool WalletModel::displayAddress(std::string sAddress) const
{
CTxDestination dest = DecodeDestination(sAddress);
bool res = false;
Expand Down Expand Up @@ -585,7 +585,7 @@ QString WalletModel::getDisplayName() const
return name.isEmpty() ? "["+tr("default wallet")+"]" : name;
}

bool WalletModel::isMultiwallet()
bool WalletModel::isMultiwallet() const
{
return m_node.walletLoader().getWallets().size() > 1;
}
Expand Down
16 changes: 7 additions & 9 deletions src/qt/walletmodel.h
Expand Up @@ -77,15 +77,15 @@ class WalletModel : public QObject
Unlocked // wallet->IsCrypted() && !wallet->IsLocked()
};

OptionsModel *getOptionsModel();
AddressTableModel *getAddressTableModel();
TransactionTableModel *getTransactionTableModel();
RecentRequestsTableModel *getRecentRequestsTableModel();
OptionsModel* getOptionsModel() const;
AddressTableModel* getAddressTableModel() const;
TransactionTableModel* getTransactionTableModel() const;
RecentRequestsTableModel* getRecentRequestsTableModel() const;

EncryptionStatus getEncryptionStatus() const;

// Check address for validity
bool validateAddress(const QString &address);
bool validateAddress(const QString& address) const;

// Return status record for SendCoins, contains error id + information
struct SendCoinsReturn
Expand Down Expand Up @@ -137,7 +137,7 @@ class WalletModel : public QObject
UnlockContext requestUnlock();

bool bumpFee(uint256 hash, uint256& new_hash);
bool displayAddress(std::string sAddress);
bool displayAddress(std::string sAddress) const;

static bool isWalletEnabled();

Expand All @@ -149,9 +149,7 @@ class WalletModel : public QObject
QString getWalletName() const;
QString getDisplayName() const;

bool isMultiwallet();

AddressTableModel* getAddressTableModel() const { return addressTableModel; }
bool isMultiwallet() const;

void refresh(bool pk_hash_only = false);

Expand Down