mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +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; }
|
||||
|
||||
@@ -239,6 +239,9 @@ namespace BlackGui
|
||||
void windowToFrontBackToggle();
|
||||
//! @}
|
||||
|
||||
//! Window minimize/normalize
|
||||
void windowMinimizeNormalToggle();
|
||||
|
||||
//! Save the main widget state?
|
||||
void setSaveMainWidgetState(bool save) { m_saveMainWidgetState = save; }
|
||||
|
||||
@@ -344,7 +347,8 @@ namespace BlackGui
|
||||
CStyleSheetUtility m_styleSheetUtility {{}, this}; //!< style sheet utility
|
||||
bool m_uiSetupCompleted = false; //!< ui setup completed
|
||||
bool m_saveMainWidgetState = true; //!< save/restore main widget's state
|
||||
bool m_frontBack = true;
|
||||
bool m_frontBack = true; //!< for front/back toggle
|
||||
bool m_normalizeMinimize = true; //!< for normalize/minimize toggle
|
||||
QScopedPointer<CSplashScreen> m_splashScreen; //!< splash screen
|
||||
Components::CUpdateInfoDialog *m_updateDialog = nullptr; //!< software installation dialog
|
||||
Components::CApplicationCloseDialog *m_closeDialog = nullptr; //!< close dialog (no QScopedPointer because I need to set parent)
|
||||
|
||||
Reference in New Issue
Block a user