Fix macOS compatibility issues

Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
Loren Eteval
2024-10-16 19:54:49 +08:00
parent f5e5a3fbab
commit bb99498d94
4 changed files with 20 additions and 7 deletions
+4 -6
View File
@@ -106,8 +106,6 @@ class AppQDialog(QTranslatable, SupportConnectedCallback, QDialog):
if PLATFORM == 'Darwin':
if self._firstShowCall:
APP().processEvents()
self.setWidthAndHeight()
self._firstShowCall = False
@@ -289,16 +287,16 @@ class AppQMainWindow(
if PLATFORM == 'Darwin':
if self._firstShowCall:
APP().processEvents()
self.setWidthAndHeight()
APP().processEvents()
self._firstShowCall = False
moveToCenter(self)
if PLATFORM == 'Darwin':
self.activateWindow()
self.raise_()
def closeEvent(self, event):
event.ignore()
+12
View File
@@ -383,6 +383,18 @@ class Application(ApplicationFactory, SingletonApplication):
if AppSettings.isStateON_('DarkMode'):
self.switchToDarkMode()
def onApplicationStateChange(state):
if state == QtCore.Qt.ApplicationState.ApplicationActive:
if (
not self.mainWindow.isVisible()
and not self.systemTray.ConnectAction.isConnecting()
):
self.mainWindow.show()
if PLATFORM == 'Darwin':
# Ensure the main window is shown when the dock icon is clicked
self.applicationStateChanged.connect(onApplicationStateChange)
self.systemTray.show()
self.systemTray.setCustomToolTip()
self.systemTray.bootstrap()
+3
View File
@@ -32,6 +32,9 @@ class ConnectProgressBar(QTranslatable, SupportConnectedCallback, QWidget):
self.setWindowTitle(_(APPLICATION_NAME))
self.setWindowIcon(AppHue.currentWindowIcon())
self.setAttribute(QtCore.Qt.WidgetAttribute.WA_ShowWithoutActivating)
self.setWindowFlags(QtCore.Qt.WindowType.WindowStaysOnTopHint)
self.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus)
self.setFixedSize(280, 61)
@QtCore.Slot()
+1 -1
View File
@@ -158,13 +158,13 @@ class AppMainWindow(AppQMainWindow):
super().__init__(*args, **kwargs)
self.setWindowTitle(_(APPLICATION_NAME))
self.setAttribute(QtCore.Qt.WidgetAttribute.WA_ShowWithoutActivating)
self.updatesManager = UpdatesManager()
self.networkStateManager = AppNetworkStateManager(parent=self)
self.userServersQTableWidget = UserServersQTableWidget(parent=self)
self.userSubsWindow = UserSubsWindow(
parent=self,
deleteUniqueCallback=lambda unique: self.userServersQTableWidget.deleteItemByIndex(
list(
index