mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 23:34:06 +00:00
Add config file option for track clipboard changes
This commit is contained in:
parent
2f8c0d3d80
commit
32a2cf55b9
17
config.cc
17
config.cc
|
@ -130,6 +130,9 @@ Preferences::Preferences():
|
|||
, collapseBigArticles( false )
|
||||
, articleSizeLimit( 2000 )
|
||||
, maxDictionaryRefsInContextMenu ( 20 )
|
||||
#ifndef Q_WS_X11
|
||||
, trackClipboardChanges( false )
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -755,6 +758,11 @@ Class load() throw( exError )
|
|||
|
||||
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
|
||||
}
|
||||
|
||||
c.lastMainGroupId = root.namedItem( "lastMainGroupId" ).toElement().text().toUInt();
|
||||
|
@ -1500,7 +1508,14 @@ void save( Class const & c ) throw( exError )
|
|||
|
||||
opt = dd.createElement( "maxDictionaryRefsInContextMenu" );
|
||||
opt.appendChild( dd.createTextNode( QString::number( c.preferences.maxDictionaryRefsInContextMenu ) ) );
|
||||
preferences.appendChild( opt ); }
|
||||
preferences.appendChild( opt );
|
||||
|
||||
#ifndef Q_WS_X11
|
||||
opt = dd.createElement( "trackClipboardChanges" );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.trackClipboardChanges ? "1" : "0" ) );
|
||||
preferences.appendChild( opt );
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
QDomElement opt = dd.createElement( "lastMainGroupId" );
|
||||
|
|
|
@ -211,6 +211,9 @@ struct Preferences
|
|||
int articleSizeLimit;
|
||||
|
||||
unsigned short maxDictionaryRefsInContextMenu;
|
||||
#ifndef Q_WS_X11
|
||||
bool trackClipboardChanges;
|
||||
#endif
|
||||
|
||||
QString addonStyle;
|
||||
|
||||
|
|
|
@ -1781,6 +1781,9 @@ 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
|
||||
|
||||
bool needReload = false;
|
||||
|
||||
|
|
|
@ -213,6 +213,10 @@ ScanPopup::ScanPopup( QWidget * parent,
|
|||
#ifdef Q_WS_X11
|
||||
connect( QApplication::clipboard(), SIGNAL( changed( QClipboard::Mode ) ),
|
||||
this, SLOT( clipboardChanged( QClipboard::Mode ) ) );
|
||||
#else
|
||||
if( cfg.preferences.trackClipboardChanges )
|
||||
connect( QApplication::clipboard(), SIGNAL( changed( QClipboard::Mode ) ),
|
||||
this, SLOT( clipboardChanged( QClipboard::Mode ) ) );
|
||||
#endif
|
||||
|
||||
connect( &MouseOver::instance(), SIGNAL( hovered( QString const &, bool ) ),
|
||||
|
|
Loading…
Reference in a new issue