Browse Source

merge toggleHidden() code into showNormalIfMinimized() to extend the functionality, but keep a simpler toggleHidden() for use in SLOT() macro

miguelfreitas
Philip Kaufmann 13 years ago
parent
commit
d2e6dd6c99
  1. 50
      src/qt/bitcoingui.cpp
  2. 6
      src/qt/bitcoingui.h

50
src/qt/bitcoingui.cpp

@ -439,28 +439,6 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason) @@ -439,28 +439,6 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
}
#endif
void BitcoinGUI::toggleHidden()
{
// activateWindow() (sometimes) helps with keyboard focus on Windows
if (isHidden())
{
show();
activateWindow();
}
else if (isMinimized())
{
showNormal();
activateWindow();
}
else if (GUIUtil::isObscured(this))
{
raise();
activateWindow();
}
else
hide();
}
void BitcoinGUI::optionsClicked()
{
if(!clientModel || !clientModel->getOptionsModel())
@ -782,9 +760,6 @@ void BitcoinGUI::handleURI(QString strURI) @@ -782,9 +760,6 @@ void BitcoinGUI::handleURI(QString strURI)
gotoSendCoinsPage();
sendCoinsPage->handleURI(strURI);
if(!isActiveWindow())
activateWindow();
showNormalIfMinimized();
}
@ -867,10 +842,29 @@ void BitcoinGUI::unlockWallet() @@ -867,10 +842,29 @@ void BitcoinGUI::unlockWallet()
}
}
void BitcoinGUI::showNormalIfMinimized()
void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden)
{
if(!isVisible()) // Show, if hidden
// activateWindow() (sometimes) helps with keyboard focus on Windows
if (isHidden())
{
show();
if(isMinimized()) // Unminimize, if minimized
activateWindow();
}
else if (isMinimized())
{
showNormal();
activateWindow();
}
else if (GUIUtil::isObscured(this))
{
raise();
activateWindow();
}
else if(fToggleHidden)
hide();
}
void BitcoinGUI::toggleHidden()
{
showNormalIfMinimized(true);
}

6
src/qt/bitcoingui.h

@ -169,9 +169,9 @@ private slots: @@ -169,9 +169,9 @@ private slots:
/** Ask for pass phrase to unlock wallet temporarily */
void unlockWallet();
/** Show window if hidden, unminimize when minimized */
void showNormalIfMinimized();
/** Hide window if visible, show if hidden */
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
void showNormalIfMinimized(bool fToggleHidden = false);
/** simply calls showNormalIfMinimized(true) for use in SLOT() macro */
void toggleHidden();
};

Loading…
Cancel
Save