mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24: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 = trayIconMenu.addAction( tr( "Tracking Clipboard" ) );
|
||||||
actTrackingClipboard->setCheckable(true);
|
actTrackingClipboard->setCheckable(true);
|
||||||
actTrackingClipboard->setChecked(cfg.preferences.trackClipboardChanges);
|
actTrackingClipboard->setChecked(cfg.preferences.trackClipboardChanges);
|
||||||
actTrackingClipboard->setVisible( cfg.preferences.enableScanPopup );
|
// actTrackingClipboard->setVisible( cfg.preferences.enableScanPopup );
|
||||||
connect( actTrackingClipboard , SIGNAL( triggered(bool) ),
|
connect( actTrackingClipboard , SIGNAL( triggered(bool) ),
|
||||||
this, SLOT( trackingClipboard(bool) ) );
|
this, SLOT( trackingClipboard(bool) ) );
|
||||||
trayIconMenu.addSeparator();
|
trayIconMenu.addSeparator();
|
||||||
|
@ -918,6 +918,16 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
||||||
}
|
}
|
||||||
|
|
||||||
inspector = new ArticleInspector( this );
|
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()
|
void MainWindow::ctrlTabPressed()
|
||||||
|
|
|
@ -487,6 +487,8 @@ private slots:
|
||||||
void showGDHelp();
|
void showGDHelp();
|
||||||
void hideGDHelp();
|
void hideGDHelp();
|
||||||
|
|
||||||
|
void clipboardChange( QClipboard::Mode mode );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/// Set optional parts expand mode for all tabs
|
/// Set optional parts expand mode for all tabs
|
||||||
void setExpandOptionalParts( bool expand );
|
void setExpandOptionalParts( bool expand );
|
||||||
|
|
|
@ -514,14 +514,6 @@ void ScanPopup::delayShow()
|
||||||
|
|
||||||
void ScanPopup::clipboardChanged( QClipboard::Mode m )
|
void ScanPopup::clipboardChanged( QClipboard::Mode m )
|
||||||
{
|
{
|
||||||
if( cfg.preferences.trackClipboardChanges )
|
|
||||||
{
|
|
||||||
QString subtype = "plain";
|
|
||||||
|
|
||||||
handleInputWord( QApplication::clipboard()->text( subtype, m ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !isScanningEnabled )
|
if( !isScanningEnabled )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue