mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
opt: optimize the function in tracking clipboard in trayicon
This commit is contained in:
parent
25c9c38e96
commit
fa64d450ea
|
@ -411,7 +411,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
actTrackingClipboard = trayIconMenu.addAction( tr( "Tracking Clipboard" ) );
|
||||
actTrackingClipboard->setCheckable(true);
|
||||
actTrackingClipboard->setChecked(cfg.preferences.trackClipboardChanges);
|
||||
actTrackingClipboard->setVisible( cfg.preferences.enableScanPopup );
|
||||
// actTrackingClipboard->setVisible( cfg.preferences.enableScanPopup );
|
||||
connect( actTrackingClipboard , SIGNAL( triggered(bool) ),
|
||||
this, SLOT( trackingClipboard(bool) ) );
|
||||
trayIconMenu.addSeparator();
|
||||
|
@ -918,6 +918,16 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
}
|
||||
|
||||
inspector = new ArticleInspector( this );
|
||||
|
||||
connect( QApplication::clipboard(), &QClipboard::changed, this, &MainWindow::clipboardChange );
|
||||
}
|
||||
|
||||
void MainWindow::clipboardChange( QClipboard::Mode mode )
|
||||
{
|
||||
if( scanPopup && cfg.preferences.trackClipboardChanges )
|
||||
{
|
||||
scanPopup->translateWordFromClipboard();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::ctrlTabPressed()
|
||||
|
|
|
@ -487,6 +487,8 @@ private slots:
|
|||
void showGDHelp();
|
||||
void hideGDHelp();
|
||||
|
||||
void clipboardChange( QClipboard::Mode mode );
|
||||
|
||||
signals:
|
||||
/// Set optional parts expand mode for all tabs
|
||||
void setExpandOptionalParts( bool expand );
|
||||
|
|
|
@ -514,14 +514,6 @@ void ScanPopup::delayShow()
|
|||
|
||||
void ScanPopup::clipboardChanged( QClipboard::Mode m )
|
||||
{
|
||||
if( cfg.preferences.trackClipboardChanges )
|
||||
{
|
||||
QString subtype = "plain";
|
||||
|
||||
handleInputWord( QApplication::clipboard()->text( subtype, m ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !isScanningEnabled )
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in a new issue