mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
Ref T747, added toggle normal/minimal
* also provide action for toggle normal/minimal * reverted "on top" for front/back toggle based on discussion https://discordapp.com/channels/539048679160676382/539846348275449887/641003058867994634
This commit is contained in:
committed by
Mat Sutcliffe
parent
37c21b3dae
commit
de7174ad49
@@ -883,6 +883,13 @@ namespace BlackGui
|
||||
c = connect(a, &QAction::triggered, this, &CGuiApplication::windowToBack);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "connect failed");
|
||||
|
||||
a = menu.addAction("Toggle normal or minimized");
|
||||
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||
{
|
||||
if (!w) { return; }
|
||||
this->windowMinimizeNormalToggle();
|
||||
});
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||
Q_UNUSED(c)
|
||||
}
|
||||
|
||||
@@ -1182,14 +1189,8 @@ namespace BlackGui
|
||||
w->showNormal(); // bring window to top on OSX
|
||||
w->raise(); // bring window from minimized state on OSX
|
||||
|
||||
// In order to show also on top if another window is (permanent) on top
|
||||
if (!CGuiUtility::staysOnTop(w))
|
||||
{
|
||||
CGuiUtility::stayOnTop(true, w);
|
||||
emit this->alwaysOnTop(true);
|
||||
}
|
||||
|
||||
// w->activateWindow(); // bring window to front/unminimize on windows
|
||||
// if (!CGuiUtility::staysOnTop(w)) { CGuiUtility::stayOnTop(true, w); emit this->alwaysOnTop(true); }
|
||||
w->activateWindow(); // bring window to front/unminimize on windows
|
||||
}
|
||||
|
||||
void CGuiApplication::windowToBack()
|
||||
@@ -1226,6 +1227,24 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CGuiApplication::windowMinimizeNormalToggle()
|
||||
{
|
||||
if (this->isShuttingDown()) { return; }
|
||||
QMainWindow *w = sGui->mainApplicationWindow();
|
||||
if (!w) { return; }
|
||||
if (m_normalizeMinimize)
|
||||
{
|
||||
w->showMinimized();
|
||||
}
|
||||
else
|
||||
{
|
||||
// trick here is to minimize first and the normalize from minimized state
|
||||
w->showMinimized();
|
||||
w->showNormal();
|
||||
}
|
||||
m_normalizeMinimize = !m_normalizeMinimize;
|
||||
}
|
||||
|
||||
void CGuiApplication::triggerNewVersionCheck(int delayedMs)
|
||||
{
|
||||
if (!m_updateSetting.get()) { return; }
|
||||
|
||||
Reference in New Issue
Block a user