mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
qt: Fix --disable-wallet build and --disablewallet mode (#3762)
* Fix --disable-wallet build and --disablewallet mode
Console is not showing up in --disable-wallet build and it's crashing in --disablewallet mode before this commit.
* Use nullptr
* Load a stylesheet for the RPCConsole when it's not going to be set as a central widget
This partially reverts the initial commit.
* Fix QMainWindow dark/light styles
* Avoid implicit pointer to bool conversions
* qt: Set RPCConsole's window flags based on wallet availability
* multi-line early returns
* Bring back ifdef to fix a recently introduced crash
Introduced in 2856f46424 (diff-f63c3d5094d55f88dbd1967774f85838b3aee5a40540b8c82b924574bca772a0R203)
Co-authored-by: xdustinface <xdustinfacex@gmail.com>
This commit is contained in:
parent
62985c771b
commit
9ceee5df20
@ -159,7 +159,7 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
|
||||
setUnifiedTitleAndToolBarOnMac(true);
|
||||
#endif
|
||||
|
||||
rpcConsole = new RPCConsole(this);
|
||||
rpcConsole = new RPCConsole(this, enableWallet ? Qt::Window : Qt::Widget);
|
||||
helpMessageDialog = new HelpMessageDialog(this, HelpMessageDialog::cmdline);
|
||||
#ifdef ENABLE_WALLET
|
||||
if(enableWallet)
|
||||
@ -443,6 +443,7 @@ void BitcoinGUI::createActions()
|
||||
connect(masternodeAction, SIGNAL(clicked()), this, SLOT(showNormalIfMinimized()));
|
||||
connect(masternodeAction, SIGNAL(clicked()), this, SLOT(gotoMasternodePage()));
|
||||
}
|
||||
#endif // ENABLE_WALLET
|
||||
|
||||
// These showNormalIfMinimized are needed because Send Coins and Receive Coins
|
||||
// can be triggered from the tray menu, and need to show the GUI to be useful.
|
||||
@ -465,12 +466,15 @@ void BitcoinGUI::createActions()
|
||||
|
||||
for (auto button : tabGroup->buttons()) {
|
||||
GUIUtil::setFont({button}, GUIUtil::FontWeight::Normal, 16);
|
||||
if (walletFrame == nullptr) {
|
||||
// hide buttons when there is no wallet
|
||||
button->setVisible(false);
|
||||
}
|
||||
}
|
||||
GUIUtil::updateFonts();
|
||||
|
||||
// Give the selected tab button a bolder font.
|
||||
connect(tabGroup, SIGNAL(buttonToggled(QAbstractButton *, bool)), this, SLOT(highlightTabButton(QAbstractButton *, bool)));
|
||||
#endif // ENABLE_WALLET
|
||||
|
||||
quitAction = new QAction(tr("E&xit"), this);
|
||||
quitAction->setStatusTip(tr("Quit application"));
|
||||
@ -1163,7 +1167,9 @@ void BitcoinGUI::updatePrivateSendVisibility()
|
||||
#endif
|
||||
// PrivateSend button is the third QToolButton, show/hide the underlying QAction
|
||||
// Hiding the QToolButton itself doesn't work.
|
||||
qobject_cast<QToolBar*>(centralWidget()->layout()->itemAt(0)->widget())->actions()[2]->setVisible(fEnabled);
|
||||
if (centralWidget()->layout()->itemAt(0)->widget() != nullptr) {
|
||||
qobject_cast<QToolBar*>(centralWidget()->layout()->itemAt(0)->widget())->actions()[2]->setVisible(fEnabled);
|
||||
}
|
||||
privateSendCoinsMenuAction->setVisible(fEnabled);
|
||||
showPrivateSendHelpAction->setVisible(fEnabled);
|
||||
updateToolBarShortcuts();
|
||||
@ -1172,6 +1178,9 @@ void BitcoinGUI::updatePrivateSendVisibility()
|
||||
|
||||
void BitcoinGUI::updateWidth()
|
||||
{
|
||||
if (walletFrame == nullptr) {
|
||||
return;
|
||||
}
|
||||
int nWidthWidestButton{0};
|
||||
int nButtonsVisible{0};
|
||||
for (QAbstractButton* button : tabGroup->buttons()) {
|
||||
@ -1191,6 +1200,9 @@ void BitcoinGUI::updateWidth()
|
||||
|
||||
void BitcoinGUI::updateToolBarShortcuts()
|
||||
{
|
||||
if (walletFrame == nullptr) {
|
||||
return;
|
||||
}
|
||||
#ifdef Q_OS_MAC
|
||||
auto modifier = Qt::CTRL;
|
||||
#else
|
||||
|
@ -41,12 +41,10 @@ Loaded in GUIUtil::loadStyleSheet() in guitil.cpp.
|
||||
Common stuff
|
||||
******************************************************/
|
||||
|
||||
WalletFrame,
|
||||
QDialog {
|
||||
background-color: #323233;
|
||||
}
|
||||
|
||||
QMessageBox {
|
||||
QDialog,
|
||||
QMainWindow,
|
||||
QMessageBox
|
||||
WalletFrame {
|
||||
background-color: #323233;
|
||||
}
|
||||
|
||||
|
@ -39,12 +39,10 @@ Loaded in GUIUtil::loadStyleSheet() in guitil.cpp.
|
||||
Common stuff
|
||||
******************************************************/
|
||||
|
||||
WalletFrame,
|
||||
QDialog {
|
||||
background-color: #f2f2f4;
|
||||
}
|
||||
|
||||
QMessageBox {
|
||||
QDialog,
|
||||
QMainWindow,
|
||||
QMessageBox
|
||||
WalletFrame {
|
||||
background-color: #f2f2f4;
|
||||
}
|
||||
|
||||
|
@ -442,8 +442,8 @@ void RPCExecutor::request(const QString &command)
|
||||
}
|
||||
}
|
||||
|
||||
RPCConsole::RPCConsole(QWidget* parent) :
|
||||
QWidget(parent, Qt::Window),
|
||||
RPCConsole::RPCConsole(QWidget* parent, Qt::WindowFlags flags) :
|
||||
QWidget(parent, flags),
|
||||
ui(new Ui::RPCConsole),
|
||||
clientModel(0),
|
||||
historyPtr(0),
|
||||
@ -524,6 +524,8 @@ RPCConsole::RPCConsole(QWidget* parent) :
|
||||
pageButtons.addButton(ui->btnRepair, pageButtons.buttons().size());
|
||||
connect(&pageButtons, SIGNAL(buttonClicked(int)), this, SLOT(showPage(int)));
|
||||
|
||||
showPage(TAB_INFO);
|
||||
|
||||
clear();
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class RPCConsole: public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RPCConsole(QWidget* parent);
|
||||
explicit RPCConsole(QWidget* parent, Qt::WindowFlags flags);
|
||||
~RPCConsole();
|
||||
|
||||
static bool RPCParseCommandLine(std::string &strResult, const std::string &strCommand, bool fExecute, std::string * const pstrFilteredOut = nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user