disable more staffs related to macOS trayicon -> dock icon
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run

This commit is contained in:
shenleban tongying 2024-11-11 02:53:10 -05:00 committed by GitHub
parent 1e3b22ebd0
commit 608016208b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 9 deletions

View file

@ -197,8 +197,6 @@ Preferences::Preferences():
hideSingleTab( false ),
mruTabOrder( false ),
hideMenubar( false ),
enableTrayIcon( true ),
startToTray( false ),
autoStart( false ),
doubleClickTranslates( true ),
selectWordBySingleClick( false ),
@ -902,11 +900,10 @@ Class load()
c.preferences.hideSingleTab = ( preferences.namedItem( "hideSingleTab" ).toElement().text() == "1" );
c.preferences.mruTabOrder = ( preferences.namedItem( "mruTabOrder" ).toElement().text() == "1" );
c.preferences.hideMenubar = ( preferences.namedItem( "hideMenubar" ).toElement().text() == "1" );
#ifndef Q_OS_MACOS // // macOS uses the dock menu instead of the tray icon
c.preferences.enableTrayIcon = ( preferences.namedItem( "enableTrayIcon" ).toElement().text() == "1" );
c.preferences.startToTray = ( preferences.namedItem( "startToTray" ).toElement().text() == "1" );
#ifndef Q_OS_MACOS // // macOS uses the dock menu instead of the tray icon
c.preferences.closeToTray = ( preferences.namedItem( "closeToTray" ).toElement().text() == "1" );
c.preferences.closeToTray = ( preferences.namedItem( "closeToTray" ).toElement().text() == "1" );
#endif
c.preferences.autoStart = ( preferences.namedItem( "autoStart" ).toElement().text() == "1" );
c.preferences.alwaysOnTop = ( preferences.namedItem( "alwaysOnTop" ).toElement().text() == "1" );

View file

@ -341,12 +341,15 @@ struct Preferences
bool hideSingleTab;
bool mruTabOrder;
bool hideMenubar;
bool enableTrayIcon;
bool startToTray;
#ifdef Q_OS_MACOS // macOS uses the dock menu instead of the tray icon
bool closeToTray = false;
bool closeToTray = false;
bool enableTrayIcon = false;
bool startToTray = false;
#else
bool closeToTray = true;
bool enableTrayIcon = true;
bool closeToTray = true;
bool startToTray = false;
#endif
bool autoStart;

View file

@ -1426,6 +1426,7 @@ void MainWindow::trayIconUpdateOrInit()
{
#ifdef Q_OS_MACOS
trayIconMenu.setAsDockMenu();
ui.actionCloseToTray->setVisible( false );
#else
if ( !cfg.preferences.enableTrayIcon ) {