mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Compare commits
2 commits
720f66c781
...
608016208b
Author | SHA1 | Date | |
---|---|---|---|
608016208b | |||
1e3b22ebd0 |
|
@ -197,9 +197,6 @@ Preferences::Preferences():
|
||||||
hideSingleTab( false ),
|
hideSingleTab( false ),
|
||||||
mruTabOrder( false ),
|
mruTabOrder( false ),
|
||||||
hideMenubar( false ),
|
hideMenubar( false ),
|
||||||
enableTrayIcon( true ),
|
|
||||||
startToTray( false ),
|
|
||||||
closeToTray( true ),
|
|
||||||
autoStart( false ),
|
autoStart( false ),
|
||||||
doubleClickTranslates( true ),
|
doubleClickTranslates( true ),
|
||||||
selectWordBySingleClick( false ),
|
selectWordBySingleClick( false ),
|
||||||
|
@ -903,10 +900,11 @@ Class load()
|
||||||
c.preferences.hideSingleTab = ( preferences.namedItem( "hideSingleTab" ).toElement().text() == "1" );
|
c.preferences.hideSingleTab = ( preferences.namedItem( "hideSingleTab" ).toElement().text() == "1" );
|
||||||
c.preferences.mruTabOrder = ( preferences.namedItem( "mruTabOrder" ).toElement().text() == "1" );
|
c.preferences.mruTabOrder = ( preferences.namedItem( "mruTabOrder" ).toElement().text() == "1" );
|
||||||
c.preferences.hideMenubar = ( preferences.namedItem( "hideMenubar" ).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.enableTrayIcon = ( preferences.namedItem( "enableTrayIcon" ).toElement().text() == "1" );
|
||||||
c.preferences.startToTray = ( preferences.namedItem( "startToTray" ).toElement().text() == "1" );
|
c.preferences.startToTray = ( preferences.namedItem( "startToTray" ).toElement().text() == "1" );
|
||||||
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.autoStart = ( preferences.namedItem( "autoStart" ).toElement().text() == "1" );
|
||||||
c.preferences.alwaysOnTop = ( preferences.namedItem( "alwaysOnTop" ).toElement().text() == "1" );
|
c.preferences.alwaysOnTop = ( preferences.namedItem( "alwaysOnTop" ).toElement().text() == "1" );
|
||||||
c.preferences.searchInDock = ( preferences.namedItem( "searchInDock" ).toElement().text() == "1" );
|
c.preferences.searchInDock = ( preferences.namedItem( "searchInDock" ).toElement().text() == "1" );
|
||||||
|
|
|
@ -341,9 +341,17 @@ struct Preferences
|
||||||
bool hideSingleTab;
|
bool hideSingleTab;
|
||||||
bool mruTabOrder;
|
bool mruTabOrder;
|
||||||
bool hideMenubar;
|
bool hideMenubar;
|
||||||
bool enableTrayIcon;
|
|
||||||
bool startToTray;
|
#ifdef Q_OS_MACOS // macOS uses the dock menu instead of the tray icon
|
||||||
bool closeToTray;
|
bool closeToTray = false;
|
||||||
|
bool enableTrayIcon = false;
|
||||||
|
bool startToTray = false;
|
||||||
|
#else
|
||||||
|
bool enableTrayIcon = true;
|
||||||
|
bool closeToTray = true;
|
||||||
|
bool startToTray = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool autoStart;
|
bool autoStart;
|
||||||
bool doubleClickTranslates;
|
bool doubleClickTranslates;
|
||||||
bool selectWordBySingleClick;
|
bool selectWordBySingleClick;
|
||||||
|
|
|
@ -402,13 +402,17 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
||||||
connect( wordsZoomBase, &QAction::triggered, this, &MainWindow::doWordsZoomBase );
|
connect( wordsZoomBase, &QAction::triggered, this, &MainWindow::doWordsZoomBase );
|
||||||
|
|
||||||
// tray icon
|
// tray icon
|
||||||
|
#ifndef Q_OS_MACOS // macOS uses the dock menu instead of the tray icon
|
||||||
connect( trayIconMenu.addAction( tr( "Show &Main Window" ) ), &QAction::triggered, this, [ this ] {
|
connect( trayIconMenu.addAction( tr( "Show &Main Window" ) ), &QAction::triggered, this, [ this ] {
|
||||||
this->toggleMainWindow( true );
|
this->toggleMainWindow( true );
|
||||||
} );
|
} );
|
||||||
|
#endif
|
||||||
trayIconMenu.addAction( enableScanningAction );
|
trayIconMenu.addAction( enableScanningAction );
|
||||||
|
|
||||||
|
#ifndef Q_OS_MACOS // macOS uses the dock menu instead of the tray icon
|
||||||
trayIconMenu.addSeparator();
|
trayIconMenu.addSeparator();
|
||||||
connect( trayIconMenu.addAction( tr( "&Quit" ) ), &QAction::triggered, this, &MainWindow::quitApp );
|
connect( trayIconMenu.addAction( tr( "&Quit" ) ), &QAction::triggered, this, &MainWindow::quitApp );
|
||||||
|
#endif
|
||||||
|
|
||||||
addGlobalAction( &escAction, [ this ]() {
|
addGlobalAction( &escAction, [ this ]() {
|
||||||
handleEsc();
|
handleEsc();
|
||||||
|
@ -1420,6 +1424,11 @@ void MainWindow::updateAppearances( QString const & addonStyle,
|
||||||
|
|
||||||
void MainWindow::trayIconUpdateOrInit()
|
void MainWindow::trayIconUpdateOrInit()
|
||||||
{
|
{
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
trayIconMenu.setAsDockMenu();
|
||||||
|
ui.actionCloseToTray->setVisible( false );
|
||||||
|
#else
|
||||||
|
|
||||||
if ( !cfg.preferences.enableTrayIcon ) {
|
if ( !cfg.preferences.enableTrayIcon ) {
|
||||||
if ( trayIcon ) {
|
if ( trayIcon ) {
|
||||||
delete trayIcon;
|
delete trayIcon;
|
||||||
|
@ -1443,6 +1452,7 @@ void MainWindow::trayIconUpdateOrInit()
|
||||||
// The 'Close to tray' action is associated with the tray icon, so we hide
|
// The 'Close to tray' action is associated with the tray icon, so we hide
|
||||||
// or show it here.
|
// or show it here.
|
||||||
ui.actionCloseToTray->setVisible( cfg.preferences.enableTrayIcon );
|
ui.actionCloseToTray->setVisible( cfg.preferences.enableTrayIcon );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::wheelEvent( QWheelEvent * ev )
|
void MainWindow::wheelEvent( QWheelEvent * ev )
|
||||||
|
|
|
@ -174,6 +174,11 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
|
||||||
ui.hideSingleTab->setChecked( p.hideSingleTab );
|
ui.hideSingleTab->setChecked( p.hideSingleTab );
|
||||||
ui.mruTabOrder->setChecked( p.mruTabOrder );
|
ui.mruTabOrder->setChecked( p.mruTabOrder );
|
||||||
ui.enableTrayIcon->setChecked( p.enableTrayIcon );
|
ui.enableTrayIcon->setChecked( p.enableTrayIcon );
|
||||||
|
|
||||||
|
#ifdef Q_OS_MACOS // macOS uses the dock menu instead of the tray icon
|
||||||
|
ui.enableTrayIcon->hide();
|
||||||
|
#endif
|
||||||
|
|
||||||
ui.startToTray->setChecked( p.startToTray );
|
ui.startToTray->setChecked( p.startToTray );
|
||||||
ui.closeToTray->setChecked( p.closeToTray );
|
ui.closeToTray->setChecked( p.closeToTray );
|
||||||
ui.cbAutostart->setChecked( p.autoStart );
|
ui.cbAutostart->setChecked( p.autoStart );
|
||||||
|
|
Loading…
Reference in a new issue