mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
Unify trackClipboardChanges and enableScanPopupAction
* There is no difference between those two on Windows and MacOS which only support clipboard (Ctrl+C) scanning * Q_WS_X11 was defined on Qt4, and it causes the super weird trackClipboardChanges to occur on Windows
This commit is contained in:
parent
aa3778bb64
commit
b3b740854a
14
config.cc
14
config.cc
|
@ -263,9 +263,6 @@ Preferences::Preferences():
|
|||
, limitInputPhraseLength( false )
|
||||
, inputPhraseLengthLimit( 1000 )
|
||||
, maxDictionaryRefsInContextMenu ( 20 )
|
||||
#ifndef Q_WS_X11
|
||||
, trackClipboardChanges( false )
|
||||
#endif
|
||||
, synonymSearchEnabled( true )
|
||||
{
|
||||
}
|
||||
|
@ -1000,11 +997,6 @@ Class load()
|
|||
if ( !preferences.namedItem( "maxDictionaryRefsInContextMenu" ).isNull() )
|
||||
c.preferences.maxDictionaryRefsInContextMenu = preferences.namedItem( "maxDictionaryRefsInContextMenu" ).toElement().text().toUShort();
|
||||
|
||||
#ifndef Q_WS_X11
|
||||
if ( !preferences.namedItem( "trackClipboardChanges" ).isNull() )
|
||||
c.preferences.trackClipboardChanges = ( preferences.namedItem( "trackClipboardChanges" ).toElement().text() == "1" );
|
||||
#endif
|
||||
|
||||
if ( !preferences.namedItem( "synonymSearchEnabled" ).isNull() )
|
||||
c.preferences.synonymSearchEnabled = ( preferences.namedItem( "synonymSearchEnabled" ).toElement().text() == "1" );
|
||||
|
||||
|
@ -1955,12 +1947,6 @@ void save( Class const & c )
|
|||
opt.appendChild( dd.createTextNode( QString::number( c.preferences.maxDictionaryRefsInContextMenu ) ) );
|
||||
preferences.appendChild( opt );
|
||||
|
||||
#ifndef Q_WS_X11
|
||||
opt = dd.createElement( "trackClipboardChanges" );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.trackClipboardChanges ? "1" : "0" ) );
|
||||
preferences.appendChild( opt );
|
||||
#endif
|
||||
|
||||
opt = dd.createElement( "synonymSearchEnabled" );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.synonymSearchEnabled ? "1" : "0" ) );
|
||||
preferences.appendChild( opt );
|
||||
|
|
|
@ -369,9 +369,6 @@ struct Preferences
|
|||
InputPhrase sanitizeInputPhrase( QString const & inputPhrase ) const;
|
||||
|
||||
unsigned short maxDictionaryRefsInContextMenu;
|
||||
#ifndef Q_WS_X11
|
||||
bool trackClipboardChanges;
|
||||
#endif
|
||||
|
||||
bool synonymSearchEnabled;
|
||||
|
||||
|
|
|
@ -406,12 +406,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
connect( trayIconMenu.addAction( tr( "Show &Main Window" ) ), SIGNAL( triggered() ),
|
||||
this, SLOT( showMainWindow() ) );
|
||||
trayIconMenu.addAction( enableScanPopupAction );
|
||||
actTrackingClipboard = trayIconMenu.addAction( tr( "Tracking Clipboard" ) );
|
||||
actTrackingClipboard->setCheckable(true);
|
||||
actTrackingClipboard->setChecked(cfg.preferences.trackClipboardChanges);
|
||||
// actTrackingClipboard->setVisible( cfg.preferences.enableScanPopup );
|
||||
connect( actTrackingClipboard , SIGNAL( triggered(bool) ),
|
||||
this, SLOT( trackingClipboard(bool) ) );
|
||||
|
||||
trayIconMenu.addSeparator();
|
||||
connect( trayIconMenu.addAction( tr( "&Quit" ) ), SIGNAL( triggered() ),
|
||||
this, SLOT( quitApp() ) );
|
||||
|
@ -918,8 +913,8 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
|
||||
void MainWindow::clipboardChange( )
|
||||
{
|
||||
qDebug() << "clipboard change ," << cfg.preferences.trackClipboardChanges << scanPopup.get();
|
||||
if( scanPopup && cfg.preferences.trackClipboardChanges )
|
||||
qDebug() << "clipboard change ," << scanPopup.get();
|
||||
if( scanPopup )
|
||||
{
|
||||
scanPopup->translateWordFromClipboard();
|
||||
}
|
||||
|
@ -1485,7 +1480,7 @@ void MainWindow::makeScanPopup()
|
|||
scanPopup.reset();
|
||||
|
||||
// Later this will be remove, we want singluar way to toggling ScanPopup
|
||||
if ( !cfg.preferences.enableClipboardHotkey && !cfg.preferences.trackClipboardChanges )
|
||||
if ( !cfg.preferences.enableClipboardHotkey )
|
||||
return;
|
||||
|
||||
scanPopup = new ScanPopup( 0, cfg, articleNetMgr, audioPlayerFactory.player(),
|
||||
|
@ -2181,9 +2176,7 @@ void MainWindow::editPreferences()
|
|||
p.hideMenubar = cfg.preferences.hideMenubar;
|
||||
p.searchInDock = cfg.preferences.searchInDock;
|
||||
p.alwaysOnTop = cfg.preferences.alwaysOnTop;
|
||||
#ifndef Q_WS_X11
|
||||
p.trackClipboardChanges = cfg.preferences.trackClipboardChanges;
|
||||
#endif
|
||||
|
||||
p.proxyServer.systemProxyUser = cfg.preferences.proxyServer.systemProxyUser;
|
||||
p.proxyServer.systemProxyPassword = cfg.preferences.proxyServer.systemProxyPassword;
|
||||
|
||||
|
@ -3189,12 +3182,6 @@ void MainWindow::showMainWindow()
|
|||
toggleMainWindow( true );
|
||||
}
|
||||
|
||||
void MainWindow::trackingClipboard( bool on )
|
||||
{
|
||||
cfg.preferences.trackClipboardChanges = on;
|
||||
makeScanPopup();
|
||||
}
|
||||
|
||||
void MainWindow::visitHomepage()
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl( "http://goldendict.org/" ) );
|
||||
|
|
|
@ -117,7 +117,6 @@ private:
|
|||
QToolBar * navToolbar;
|
||||
MainStatusBar * mainStatusBar;
|
||||
QAction * navBack, * navForward, * navPronounce, * enableScanPopupAction;
|
||||
QAction * actTrackingClipboard;
|
||||
QAction * beforeOptionsSeparator;
|
||||
QAction * zoomIn, * zoomOut, * zoomBase;
|
||||
QAction * wordsZoomIn, * wordsZoomOut, * wordsZoomBase;
|
||||
|
@ -416,8 +415,6 @@ private slots:
|
|||
|
||||
void showMainWindow();
|
||||
|
||||
void trackingClipboard(bool);
|
||||
|
||||
void visitHomepage();
|
||||
void visitForum();
|
||||
void openConfigFolder();
|
||||
|
|
|
@ -515,9 +515,8 @@ void ScanPopup::delayShow()
|
|||
|
||||
void ScanPopup::clipboardChanged( QClipboard::Mode m )
|
||||
{
|
||||
// if( !cfg.preferences.trackClipboardChanges )
|
||||
// return;
|
||||
if( !isScanningEnabled && !cfg.preferences.trackClipboardChanges)
|
||||
|
||||
if( !isScanningEnabled )
|
||||
return;
|
||||
|
||||
#ifdef HAVE_X11
|
||||
|
|
Loading…
Reference in a new issue