Skip to content

Commit

Permalink
partial Merge bitcoin-core/gui#30: Disable the main window toolbar wh…
Browse files Browse the repository at this point in the history
…en the modal overlay is shown

d0cc1f6 qt: Disable toolbar when overlay is shown (Hennadii Stepanov)
e74cd20 qt, refactor: Cleanup ModalOverlay slots (Hennadii Stepanov)

Pull request description:

  Keeping the main window toolbar activated while the modal overlay is shown could create the appearance of the non-responsive GUI.

  Fixes dashpay#22.

  ---

  On master (ca05588):

  ![Screenshot from 2020-07-11 13-07-00](https://user-images.githubusercontent.com/32963518/87221791-7504e100-c377-11ea-9689-ddd4b21b98f9.png)

  With this PR:

  ![Screenshot from 2020-07-11 13-07-39](https://user-images.githubusercontent.com/32963518/87221803-8817b100-c377-11ea-92c8-3602dc4d2451.png)

ACKs for top commit:
  harding:
    Tested ACK d0cc1f6.  Tested on Linux/X11 as much as I could given it's a pretty small change; seems like a nice improvement.  I'm not experienced in Qt, but I don't see anything obviously problematic about the code.
  jonatack:
    ACK d0cc1f6 tested on Debian 5.7.6-1 (2020-06-24) x86_64 GNU/Linux
  LarryRuane:
    ACK d0cc1f6 tested on Ubuntu 18.04.4 LTS

Tree-SHA512: e371b34231c01e77118deb100e0f280ba1cdef54e317f7f7d6ac322598bda811bd1bfe3035e90d87f8267f4f5d2095d34a8136911159db63694fd1b1b11335a1
  • Loading branch information
MarcoFalke authored and knst committed Jan 14, 2024
1 parent bd8242b commit b4c1af9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle,
Q_EMIT consoleShown(rpcConsole);
}

modalOverlay = new ModalOverlay(enableWallet, this->centralWidget());

// Accept D&D of URIs
setAcceptDrops(true);

Expand Down Expand Up @@ -211,7 +213,6 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle,
openOptionsDialogWithTab(OptionsDialog::TAB_NETWORK);
});

modalOverlay = new ModalOverlay(enableWallet, this->centralWidget());
connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showModalOverlay);
connect(progressBar, &GUIUtil::ClickableProgressBar::clicked, this, &BitcoinGUI::showModalOverlay);
#ifdef ENABLE_WALLET
Expand Down Expand Up @@ -347,6 +348,9 @@ void BitcoinGUI::stopConnectingAnimation()

void BitcoinGUI::createActions()
{
// TODO: to find other approach that works with QActionGroup which doens't have `setEnabled` action
// connect(modalOverlay, &ModalOverlay::triggered, tabGroup, &QButtonGroup::setEnabled);

sendCoinsMenuAction = new QAction(tr("&Send"), this);
sendCoinsMenuAction->setStatusTip(tr("Send coins to a Dash address"));
sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip());
Expand Down
2 changes: 2 additions & 0 deletions src/qt/modaloverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ void ModalOverlay::showHide(bool hide, bool userRequested)
if (!hide && foreverHidden)
return;

Q_EMIT triggered(hide);

if (!isVisible() && !hide)
setVisible(true);

Expand Down
10 changes: 7 additions & 3 deletions src/qt/modaloverlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,21 @@ class ModalOverlay : public QWidget
explicit ModalOverlay(bool enable_wallet, QWidget *parent);
~ModalOverlay();

public Q_SLOTS:
void tipUpdate(int count, const QDateTime& blockDate, double nVerificationProgress);
void setKnownBestHeight(int count, const QDateTime& blockDate);

void toggleVisibility();
// will show or hide the modal layer
void showHide(bool hide = false, bool userRequested = false);
void closeClicked();
void hideForever();
bool isLayerVisible() const { return layerIsVisible; }

public Q_SLOTS:
void toggleVisibility();
void closeClicked();

Q_SIGNALS:
void triggered(bool hidden);

protected:
bool eventFilter(QObject * obj, QEvent * ev) override;
bool event(QEvent* ev) override;
Expand Down

0 comments on commit b4c1af9

Please sign in to comment.