mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
refs #507, improvements on frameless window base class
* handle minimized / normal in window base class * removed initial on top flag and project * executable names * version number check (for launcher)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
63e1695e3b
commit
864ca20be3
@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
const QString appName("swift pilot client GUI");
|
||||
a.setApplicationVersion(CProject::swiftVersionString());
|
||||
a.setApplicationVersion(CProject::version());
|
||||
a.setApplicationName(appName);
|
||||
|
||||
// Process the actual command line arguments given by the user
|
||||
|
||||
@@ -55,18 +55,12 @@ SwiftGuiStd::~SwiftGuiStd()
|
||||
|
||||
void SwiftGuiStd::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (!handleMouseMoveEvent(event))
|
||||
{
|
||||
QMainWindow::mouseMoveEvent(event);
|
||||
}
|
||||
if (!handleMousePressEvent(event)) { QMainWindow::mouseMoveEvent(event); }
|
||||
}
|
||||
|
||||
void SwiftGuiStd::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (!handleMousePressEvent(event))
|
||||
{
|
||||
QMainWindow::mousePressEvent(event);
|
||||
}
|
||||
if (!handleMousePressEvent(event)) { QMainWindow::mousePressEvent(event); }
|
||||
}
|
||||
|
||||
void SwiftGuiStd::performGracefulShutdown()
|
||||
@@ -121,39 +115,7 @@ void SwiftGuiStd::closeEvent(QCloseEvent *event)
|
||||
|
||||
void SwiftGuiStd::changeEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::WindowStateChange)
|
||||
{
|
||||
// make sure a tool window is changed to Normal window so it is show in taskbar
|
||||
// here we are already in transition state, so isMinimized means will be minimize right now
|
||||
// this check here is needed if minimized is called from somewhere else than ps_showMinimized
|
||||
if (!this->isFrameless())
|
||||
{
|
||||
bool toolWindow(this->isToolWindow());
|
||||
if (isMinimized())
|
||||
{
|
||||
if (toolWindow)
|
||||
{
|
||||
// still tool, force normal window
|
||||
BlackMisc::singleShot(0, QThread::currentThread(), [ = ]()
|
||||
{
|
||||
this->ps_showMinimized();
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!toolWindow)
|
||||
{
|
||||
// not tool, force tool window
|
||||
BlackMisc::singleShot(0, QThread::currentThread(), [ = ]()
|
||||
{
|
||||
this->ps_showNormal();
|
||||
});
|
||||
}
|
||||
}
|
||||
} // frameless?
|
||||
}
|
||||
QMainWindow::changeEvent(event);
|
||||
if (!CEnableForFramelessWindow::handleChangeEvent(event)) { QMainWindow::changeEvent(event); }
|
||||
}
|
||||
|
||||
QAction *SwiftGuiStd::getWindowMinimizeAction(QObject *parent)
|
||||
@@ -396,14 +358,12 @@ void SwiftGuiStd::ps_onChangedMainInfoAreaFloating(bool floating)
|
||||
|
||||
void SwiftGuiStd::ps_showMinimized()
|
||||
{
|
||||
if (m_windowMode == CEnableForFramelessWindow::WindowTool) { this->toolToNormalWindow(); }
|
||||
this->showMinimized();
|
||||
this->showMinimizedModeChecked();
|
||||
}
|
||||
|
||||
void SwiftGuiStd::ps_showNormal()
|
||||
{
|
||||
if (m_windowMode == CEnableForFramelessWindow::WindowTool) { this->normalToToolWindow(); }
|
||||
this->showNormal();
|
||||
this->showNormalModeChecked();
|
||||
}
|
||||
|
||||
void SwiftGuiStd::playNotifcationSound(CNotificationSounds::Notification notification) const
|
||||
|
||||
@@ -38,7 +38,7 @@ void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
|
||||
|
||||
// init window
|
||||
this->setWindowIcon(CIcons::swift24());
|
||||
this->setWindowTitle(CProject::swiftVersionStringDevInfo());
|
||||
this->setWindowTitle(CProject::versionStringDevBetaInfo());
|
||||
this->setObjectName("SwiftGuiStd");
|
||||
this->initStyleSheet();
|
||||
QPoint pos = CGuiUtility::introWindowPosition();
|
||||
|
||||
Reference in New Issue
Block a user