mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
qt: Masternode Tab should work with nowallet (#4318)
Make Masternode Tab accessible even when there is no wallet. WalletFrame now owns a MasternodeList that will be shown when there are no wallets to display.
This commit is contained in:
parent
fc8952aa19
commit
6af4a22556
@ -583,6 +583,7 @@ void BitcoinGUI::createToolBars()
|
||||
masternodeButton->setStatusTip(tr("Browse masternodes"));
|
||||
tabGroup->addButton(masternodeButton);
|
||||
connect(masternodeButton, SIGNAL(clicked()), this, SLOT(gotoMasternodePage()));
|
||||
masternodeButton->setEnabled(true);
|
||||
}
|
||||
|
||||
connect(overviewButton, SIGNAL(clicked()), this, SLOT(gotoOverviewPage()));
|
||||
@ -805,10 +806,6 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
|
||||
coinJoinCoinsButton->setEnabled(enabled && clientModel->coinJoinOptions().isEnabled());
|
||||
receiveCoinsButton->setEnabled(enabled);
|
||||
historyButton->setEnabled(enabled);
|
||||
if (masternodeButton != nullptr) {
|
||||
QSettings settings;
|
||||
masternodeButton->setEnabled(enabled && settings.value("fShowMasternodesTab").toBool());
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_WALLET
|
||||
|
||||
|
@ -91,6 +91,7 @@ MasternodeList::MasternodeList(QWidget* parent) :
|
||||
ui->tableWidgetMasternodesDIP3->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
ui->filterLineEditDIP3->setPlaceholderText(tr("Filter by any property (e.g. address or protx hash)"));
|
||||
ui->checkBoxMyMasternodesOnly->setEnabled(false);
|
||||
|
||||
QAction* copyProTxHashAction = new QAction(tr("Copy ProTx Hash"), this);
|
||||
QAction* copyCollateralOutpointAction = new QAction(tr("Copy Collateral Outpoint"), this);
|
||||
@ -126,6 +127,7 @@ void MasternodeList::setClientModel(ClientModel* model)
|
||||
void MasternodeList::setWalletModel(WalletModel* model)
|
||||
{
|
||||
this->walletModel = model;
|
||||
ui->checkBoxMyMasternodesOnly->setEnabled(model != nullptr);
|
||||
}
|
||||
|
||||
void MasternodeList::showContextMenuDIP3(const QPoint& point)
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <qt/walletmodel.h>
|
||||
|
||||
#include <qt/bitcoingui.h>
|
||||
#include <qt/masternodelist.h>
|
||||
#include <qt/walletview.h>
|
||||
|
||||
#include <cassert>
|
||||
@ -28,6 +29,9 @@ WalletFrame::WalletFrame(BitcoinGUI* _gui) :
|
||||
QLabel *noWallet = new QLabel(tr("No wallet has been loaded."));
|
||||
noWallet->setAlignment(Qt::AlignCenter);
|
||||
walletStack->addWidget(noWallet);
|
||||
|
||||
masternodeListPage = new MasternodeList();
|
||||
walletStack->addWidget(masternodeListPage);
|
||||
}
|
||||
|
||||
WalletFrame::~WalletFrame()
|
||||
@ -38,6 +42,8 @@ void WalletFrame::setClientModel(ClientModel *_clientModel)
|
||||
{
|
||||
this->clientModel = _clientModel;
|
||||
|
||||
masternodeListPage->setClientModel(_clientModel);
|
||||
|
||||
for (auto i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) {
|
||||
i.value()->setClientModel(_clientModel);
|
||||
}
|
||||
@ -144,6 +150,12 @@ void WalletFrame::gotoHistoryPage()
|
||||
void WalletFrame::gotoMasternodePage()
|
||||
{
|
||||
QMap<WalletModel*, WalletView*>::const_iterator i;
|
||||
|
||||
if (mapWalletViews.empty()) {
|
||||
walletStack->setCurrentWidget(masternodeListPage);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i)
|
||||
i.value()->gotoMasternodePage();
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ class ClientModel;
|
||||
class SendCoinsRecipient;
|
||||
class WalletModel;
|
||||
class WalletView;
|
||||
class MasternodeList;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QStackedWidget;
|
||||
@ -53,6 +54,7 @@ private:
|
||||
BitcoinGUI *gui;
|
||||
ClientModel *clientModel;
|
||||
QMap<WalletModel*, WalletView*> mapWalletViews;
|
||||
MasternodeList* masternodeListPage;
|
||||
|
||||
bool bOutOfSync;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user