mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 03:03:22 -03:00
qt: Factor out WalletModel::getDisplayName()
This commit is contained in:
parent
9c64278e1a
commit
d2a1adffeb
4 changed files with 11 additions and 4 deletions
|
@ -570,7 +570,7 @@ bool BitcoinGUI::addWallet(WalletModel *walletModel)
|
||||||
if(!walletFrame)
|
if(!walletFrame)
|
||||||
return false;
|
return false;
|
||||||
const QString name = walletModel->getWalletName();
|
const QString name = walletModel->getWalletName();
|
||||||
QString display_name = name.isEmpty() ? "["+tr("default wallet")+"]" : name;
|
const QString display_name = walletModel->getDisplayName();
|
||||||
setWalletActionsEnabled(true);
|
setWalletActionsEnabled(true);
|
||||||
m_wallet_selector->addItem(display_name, name);
|
m_wallet_selector->addItem(display_name, name);
|
||||||
if (m_wallet_selector->count() == 2) {
|
if (m_wallet_selector->count() == 2) {
|
||||||
|
|
|
@ -700,7 +700,7 @@ void RPCConsole::addWallet(WalletModel * const walletModel)
|
||||||
{
|
{
|
||||||
const QString name = walletModel->getWalletName();
|
const QString name = walletModel->getWalletName();
|
||||||
// use name for text and internal data object (to allow to move to a wallet id later)
|
// use name for text and internal data object (to allow to move to a wallet id later)
|
||||||
QString display_name = name.isEmpty() ? "["+tr("default wallet")+"]" : name;
|
const QString display_name = walletModel->getDisplayName();
|
||||||
ui->WalletSelector->addItem(display_name, name);
|
ui->WalletSelector->addItem(display_name, name);
|
||||||
if (ui->WalletSelector->count() == 2 && !isVisible()) {
|
if (ui->WalletSelector->count() == 2 && !isVisible()) {
|
||||||
// First wallet added, set to default so long as the window isn't presently visible (and potentially in use)
|
// First wallet added, set to default so long as the window isn't presently visible (and potentially in use)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2018 The Bitcoin Core developers
|
// Copyright (c) 2011-2019 The Bitcoin Core developers
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -578,6 +578,12 @@ QString WalletModel::getWalletName() const
|
||||||
return QString::fromStdString(m_wallet->getWalletName());
|
return QString::fromStdString(m_wallet->getWalletName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString WalletModel::getDisplayName() const
|
||||||
|
{
|
||||||
|
const QString name = getWalletName();
|
||||||
|
return name.isEmpty() ? "["+tr("default wallet")+"]" : name;
|
||||||
|
}
|
||||||
|
|
||||||
bool WalletModel::isMultiwallet()
|
bool WalletModel::isMultiwallet()
|
||||||
{
|
{
|
||||||
return m_node.getWallets().size() > 1;
|
return m_node.getWallets().size() > 1;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2011-2018 The Bitcoin Core developers
|
// Copyright (c) 2011-2019 The Bitcoin Core developers
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -219,6 +219,7 @@ public:
|
||||||
interfaces::Wallet& wallet() const { return *m_wallet; }
|
interfaces::Wallet& wallet() const { return *m_wallet; }
|
||||||
|
|
||||||
QString getWalletName() const;
|
QString getWalletName() const;
|
||||||
|
QString getDisplayName() const;
|
||||||
|
|
||||||
bool isMultiwallet();
|
bool isMultiwallet();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue