Changeset View
Changeset View
Standalone View
Standalone View
src/qt/bitcoingui.cpp
Show First 20 Lines • Show All 497 Lines • ▼ Show 20 Lines | if (walletFrame) { | ||||
overviewAction->setChecked(true); | overviewAction->setChecked(true); | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
QWidget *spacer = new QWidget(); | QWidget *spacer = new QWidget(); | ||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | ||||
toolbar->addWidget(spacer); | toolbar->addWidget(spacer); | ||||
m_wallet_selector = new QComboBox(); | m_wallet_selector = new QComboBox(); | ||||
connect(m_wallet_selector, SIGNAL(currentIndexChanged(const QString &)), | connect(m_wallet_selector, SIGNAL(currentIndexChanged(int)), this, | ||||
this, SLOT(setCurrentWallet(const QString &))); | SLOT(setCurrentWalletBySelectorIndex(int))); | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
void BitcoinGUI::setClientModel(ClientModel *_clientModel) { | void BitcoinGUI::setClientModel(ClientModel *_clientModel) { | ||||
this->clientModel = _clientModel; | this->clientModel = _clientModel; | ||||
if (_clientModel) { | if (_clientModel) { | ||||
// Create system tray menu (or setup the dock menu) that late to prevent | // Create system tray menu (or setup the dock menu) that late to prevent | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | #endif // ENABLE_WALLET | ||||
unitDisplayControl->setOptionsModel(nullptr); | unitDisplayControl->setOptionsModel(nullptr); | ||||
} | } | ||||
} | } | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
bool BitcoinGUI::addWallet(WalletModel *walletModel) { | bool BitcoinGUI::addWallet(WalletModel *walletModel) { | ||||
if (!walletFrame) return false; | if (!walletFrame) return false; | ||||
const QString name = walletModel->getWalletName(); | const QString name = walletModel->getWalletName(); | ||||
QString display_name = | |||||
name.isEmpty() ? "[" + tr("default wallet") + "]" : name; | |||||
setWalletActionsEnabled(true); | setWalletActionsEnabled(true); | ||||
m_wallet_selector->addItem(name); | m_wallet_selector->addItem(display_name, name); | ||||
if (m_wallet_selector->count() == 2) { | if (m_wallet_selector->count() == 2) { | ||||
m_wallet_selector_label = new QLabel(); | m_wallet_selector_label = new QLabel(); | ||||
m_wallet_selector_label->setText(tr("Wallet:") + " "); | m_wallet_selector_label->setText(tr("Wallet:") + " "); | ||||
m_wallet_selector_label->setBuddy(m_wallet_selector); | m_wallet_selector_label->setBuddy(m_wallet_selector); | ||||
appToolBar->addWidget(m_wallet_selector_label); | appToolBar->addWidget(m_wallet_selector_label); | ||||
appToolBar->addWidget(m_wallet_selector); | appToolBar->addWidget(m_wallet_selector); | ||||
} | } | ||||
rpcConsole->addWallet(walletModel); | rpcConsole->addWallet(walletModel); | ||||
return walletFrame->addWallet(walletModel); | return walletFrame->addWallet(walletModel); | ||||
} | } | ||||
bool BitcoinGUI::setCurrentWallet(const QString &name) { | bool BitcoinGUI::setCurrentWallet(const QString &name) { | ||||
if (!walletFrame) return false; | if (!walletFrame) return false; | ||||
return walletFrame->setCurrentWallet(name); | return walletFrame->setCurrentWallet(name); | ||||
} | } | ||||
bool BitcoinGUI::setCurrentWalletBySelectorIndex(int index) { | |||||
QString internal_name = m_wallet_selector->itemData(index).toString(); | |||||
return setCurrentWallet(internal_name); | |||||
} | |||||
void BitcoinGUI::removeAllWallets() { | void BitcoinGUI::removeAllWallets() { | ||||
if (!walletFrame) return; | if (!walletFrame) return; | ||||
setWalletActionsEnabled(false); | setWalletActionsEnabled(false); | ||||
walletFrame->removeAllWallets(); | walletFrame->removeAllWallets(); | ||||
} | } | ||||
#endif // ENABLE_WALLET | #endif // ENABLE_WALLET | ||||
void BitcoinGUI::setWalletActionsEnabled(bool enabled) { | void BitcoinGUI::setWalletActionsEnabled(bool enabled) { | ||||
▲ Show 20 Lines • Show All 730 Lines • Show Last 20 Lines |