mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
Put conditions on the ClipboardChange for X11
This commit is contained in:
parent
e6b9810cc7
commit
06a296c99f
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
/// Returns true if all Modifiers present within the given mask are pressed
|
||||
/// right now.
|
||||
bool checkModifiersPressed( int mask );
|
||||
bool static checkModifiersPressed( int mask );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
#include "ui_authentication.h"
|
||||
#include "resourceschemehandler.h"
|
||||
|
||||
#include "keyboardstate.hh"
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include "macmouseover.hh"
|
||||
#endif
|
||||
|
@ -908,16 +910,26 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
|
||||
inspector.reset( new ArticleInspector( this ));
|
||||
|
||||
connect( QApplication::clipboard(), &QClipboard::dataChanged, this, &MainWindow::clipboardChange );
|
||||
connect( QApplication::clipboard(), &QClipboard::changed, this, &MainWindow::clipboardChange );
|
||||
}
|
||||
|
||||
void MainWindow::clipboardChange( )
|
||||
void MainWindow::clipboardChange( QClipboard::Mode m)
|
||||
{
|
||||
qDebug() << "clipboard change ," << scanPopup.get();
|
||||
if( scanPopup && enableScanningAction->isChecked() )
|
||||
{
|
||||
if ( cfg.preferences.enableScanPopupModifiers && KeyboardState::checkModifiersPressed(cfg.preferences.scanPopupModifiers))
|
||||
{
|
||||
if(m == QClipboard::Clipboard){
|
||||
if(!cfg.preferences.trackClipboardScan) return;
|
||||
scanPopup->translateWordFromClipboard();
|
||||
}
|
||||
|
||||
if(m == QClipboard::Selection){
|
||||
if(!cfg.preferences.trackSelectionScan) return;
|
||||
scanPopup->translateWordFromSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::ctrlTabPressed()
|
||||
|
|
|
@ -484,7 +484,7 @@ private slots:
|
|||
void showGDHelp();
|
||||
void hideGDHelp();
|
||||
|
||||
void clipboardChange( );
|
||||
void clipboardChange(QClipboard::Mode m);
|
||||
|
||||
void inspectElement( QWebEnginePage * );
|
||||
|
||||
|
|
10
scanpopup.cc
10
scanpopup.cc
|
@ -522,11 +522,15 @@ void ScanPopup::clipboardChanged( QClipboard::Mode m )
|
|||
#ifdef HAVE_X11
|
||||
if( cfg.preferences.ignoreOwnClipboardChanges && ownsClipboardMode( m ) )
|
||||
return;
|
||||
#endif
|
||||
|
||||
GD_DPRINTF( "clipboard changed\n" );
|
||||
if(m == QClipboard::Clipboard && !cfg.preferences.trackClipboardScan){
|
||||
return;
|
||||
}
|
||||
|
||||
if(m == QClipboard::Selection && !cfg.preferences.trackSelectionScan){
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_X11
|
||||
if( m == QClipboard::Selection )
|
||||
{
|
||||
// Use delay show to prevent multiple popups while selection in progress
|
||||
|
|
Loading…
Reference in a new issue