mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
fix: move enableScanningAction code after scanPopup's initialization
This commit is contained in:
parent
afa77a8f31
commit
9079e2125d
|
@ -231,52 +231,6 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
|
||||
navToolbar->widgetForAction( enableScanningAction )->setObjectName( "scanPopupButton" );
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
macClipboard = new gd_clipboard();
|
||||
connect(macClipboard, &gd_clipboard::changed, this, &MainWindow::clipboardChange );
|
||||
#endif
|
||||
|
||||
connect( enableScanningAction, &QAction::toggled, this, [ = ]( bool on ) {
|
||||
if( on )
|
||||
{
|
||||
enableScanningAction->setIcon( QIcon( ":/icons/wizard-selected.svg" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
enableScanningAction->setIcon( QIcon( ":/icons/wizard.svg" ) );
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
if( !MacMouseOver::isAXAPIEnabled() )
|
||||
mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000, QPixmap( ":/icons/error.svg" ) );
|
||||
|
||||
if( on )
|
||||
{
|
||||
macClipboard->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
macClipboard->stop();
|
||||
}
|
||||
#else
|
||||
if( on ) {
|
||||
connect( QApplication::clipboard(), &QClipboard::changed, this, &MainWindow::clipboardChange );
|
||||
}
|
||||
else
|
||||
{
|
||||
disconnect(QApplication::clipboard(), &QClipboard::changed, this, &MainWindow::clipboardChange);
|
||||
}
|
||||
#endif
|
||||
|
||||
installHotKeys();
|
||||
updateTrayIcon();
|
||||
} );
|
||||
|
||||
if( cfg.preferences.startWithScanPopupOn )
|
||||
{
|
||||
enableScanningAction->trigger();
|
||||
}
|
||||
|
||||
navToolbar->addSeparator();
|
||||
|
||||
// sound
|
||||
|
@ -840,6 +794,52 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
connect( scanPopup, &ScanPopup::sendWordToFavorites, this, &MainWindow::addWordToFavorites );
|
||||
connect( scanPopup, &ScanPopup::isWordPresentedInFavorites, this, &MainWindow::isWordPresentedInFavorites );
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
macClipboard = new gd_clipboard();
|
||||
connect(macClipboard, &gd_clipboard::changed, this, &MainWindow::clipboardChange );
|
||||
#endif
|
||||
|
||||
connect( enableScanningAction, &QAction::toggled, this, [ = ]( bool on ) {
|
||||
if( on )
|
||||
{
|
||||
enableScanningAction->setIcon( QIcon( ":/icons/wizard-selected.svg" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
enableScanningAction->setIcon( QIcon( ":/icons/wizard.svg" ) );
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
if( !MacMouseOver::isAXAPIEnabled() )
|
||||
mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000, QPixmap( ":/icons/error.svg" ) );
|
||||
|
||||
if( on )
|
||||
{
|
||||
macClipboard->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
macClipboard->stop();
|
||||
}
|
||||
#else
|
||||
if( on ) {
|
||||
connect( QApplication::clipboard(), &QClipboard::changed, this, &MainWindow::clipboardChange );
|
||||
}
|
||||
else
|
||||
{
|
||||
disconnect(QApplication::clipboard(), &QClipboard::changed, this, &MainWindow::clipboardChange);
|
||||
}
|
||||
#endif
|
||||
|
||||
installHotKeys();
|
||||
updateTrayIcon();
|
||||
} );
|
||||
|
||||
if( cfg.preferences.startWithScanPopupOn )
|
||||
{
|
||||
enableScanningAction->trigger();
|
||||
}
|
||||
|
||||
updateSearchPaneAndBar( cfg.preferences.searchInDock );
|
||||
ui.searchPane->setVisible( cfg.preferences.searchInDock );
|
||||
|
||||
|
|
Loading…
Reference in a new issue