Remove redundant WalletController::addWallet slot
This commit is contained in:
parent
8046a3e0be
commit
6285a318d7
2 changed files with 4 additions and 18 deletions
|
@ -99,6 +99,9 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
|
|||
|
||||
// Instantiate model and register it.
|
||||
WalletModel* wallet_model = new WalletModel(std::move(wallet), m_node, m_platform_style, m_options_model, nullptr);
|
||||
// Handler callback runs in a different thread so fix wallet model thread affinity.
|
||||
wallet_model->moveToThread(thread());
|
||||
wallet_model->setParent(this);
|
||||
m_wallets.push_back(wallet_model);
|
||||
|
||||
connect(wallet_model, &WalletModel::unload, [this, wallet_model] {
|
||||
|
@ -119,25 +122,11 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
|
|||
connect(wallet_model, &WalletModel::coinsSent, this, &WalletController::coinsSent);
|
||||
|
||||
// Notify walletAdded signal on the GUI thread.
|
||||
if (QThread::currentThread() == thread()) {
|
||||
addWallet(wallet_model);
|
||||
} else {
|
||||
// Handler callback runs in a different thread so fix wallet model thread affinity.
|
||||
wallet_model->moveToThread(thread());
|
||||
bool invoked = QMetaObject::invokeMethod(this, "addWallet", Qt::QueuedConnection, Q_ARG(WalletModel*, wallet_model));
|
||||
assert(invoked);
|
||||
}
|
||||
Q_EMIT walletAdded(wallet_model);
|
||||
|
||||
return wallet_model;
|
||||
}
|
||||
|
||||
void WalletController::addWallet(WalletModel* wallet_model)
|
||||
{
|
||||
// Take ownership of the wallet model and register it.
|
||||
wallet_model->setParent(this);
|
||||
Q_EMIT walletAdded(wallet_model);
|
||||
}
|
||||
|
||||
void WalletController::removeAndDeleteWallet(WalletModel* wallet_model)
|
||||
{
|
||||
// Unregister wallet model.
|
||||
|
|
|
@ -50,9 +50,6 @@ public:
|
|||
OpenWalletActivity* openWallet(const std::string& name, QWidget* parent = nullptr);
|
||||
void closeWallet(WalletModel* wallet_model, QWidget* parent = nullptr);
|
||||
|
||||
private Q_SLOTS:
|
||||
void addWallet(WalletModel* wallet_model);
|
||||
|
||||
Q_SIGNALS:
|
||||
void walletAdded(WalletModel* wallet_model);
|
||||
void walletRemoved(WalletModel* wallet_model);
|
||||
|
|
Loading…
Reference in a new issue