mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
parent
8ffa1f6643
commit
794d4b934f
|
@ -1782,7 +1782,7 @@ void save( Class const & c )
|
|||
preferences.appendChild( opt );
|
||||
|
||||
opt = dd.createElement( "mainWindowHotkey" );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.mainWindowHotkey.toKeySequence().toString() ) );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.mainWindowHotkey.toString() ) );
|
||||
preferences.appendChild( opt );
|
||||
|
||||
opt = dd.createElement( "enableClipboardHotkey" );
|
||||
|
@ -1790,7 +1790,7 @@ void save( Class const & c )
|
|||
preferences.appendChild( opt );
|
||||
|
||||
opt = dd.createElement( "clipboardHotkey" );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.clipboardHotkey.toKeySequence().toString() ) );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.clipboardHotkey.toString() ) );
|
||||
preferences.appendChild( opt );
|
||||
|
||||
opt = dd.createElement( "startWithScanPopupOn" );
|
||||
|
|
|
@ -320,9 +320,9 @@ struct Preferences
|
|||
bool searchInDock;
|
||||
|
||||
bool enableMainWindowHotkey;
|
||||
HotKey mainWindowHotkey;
|
||||
QKeySequence mainWindowHotkey;
|
||||
bool enableClipboardHotkey;
|
||||
HotKey clipboardHotkey;
|
||||
QKeySequence clipboardHotkey;
|
||||
|
||||
bool startWithScanPopupOn;
|
||||
bool enableScanPopupModifiers;
|
||||
|
|
|
@ -329,6 +329,12 @@ bool HotkeyWrapper::setGlobalKey( int key, int key2,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool HotkeyWrapper::setGlobalKey( QKeySequence & seq, int handle )
|
||||
{
|
||||
Config::HotKey hk(seq);
|
||||
return setGlobalKey(hk.key1,hk.key2,hk.modifiers,handle);
|
||||
}
|
||||
|
||||
#if( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
|
||||
bool HotkeyWrapper::winEvent ( MSG * message, long * result )
|
||||
#else
|
||||
|
|
|
@ -68,6 +68,8 @@ public:
|
|||
bool setGlobalKey( int key, int key2, Qt::KeyboardModifiers modifier,
|
||||
int handle );
|
||||
|
||||
bool setGlobalKey( QKeySequence & , int );
|
||||
|
||||
/// Unregisters everything
|
||||
void unregister();
|
||||
|
||||
|
|
|
@ -2971,17 +2971,11 @@ void MainWindow::installHotKeys()
|
|||
}
|
||||
|
||||
if ( cfg.preferences.enableMainWindowHotkey )
|
||||
hotkeyWrapper->setGlobalKey( cfg.preferences.mainWindowHotkey.key1,
|
||||
cfg.preferences.mainWindowHotkey.key2,
|
||||
cfg.preferences.mainWindowHotkey.modifiers,
|
||||
0 );
|
||||
hotkeyWrapper->setGlobalKey( cfg.preferences.mainWindowHotkey,0 );
|
||||
|
||||
if ( cfg.preferences.enableClipboardHotkey && scanPopup.get() )
|
||||
{
|
||||
hotkeyWrapper->setGlobalKey( cfg.preferences.clipboardHotkey.key1,
|
||||
cfg.preferences.clipboardHotkey.key2,
|
||||
cfg.preferences.clipboardHotkey.modifiers,
|
||||
1 );
|
||||
hotkeyWrapper->setGlobalKey( cfg.preferences.clipboardHotkey,1 );
|
||||
}
|
||||
|
||||
connect( hotkeyWrapper.get(),
|
||||
|
|
|
@ -178,9 +178,9 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
|
|||
#endif
|
||||
|
||||
ui.enableMainWindowHotkey->setChecked( p.enableMainWindowHotkey );
|
||||
ui.mainWindowHotkey->setHotKey( p.mainWindowHotkey );
|
||||
ui.mainWindowHotkey->setKeySequence( p.mainWindowHotkey );
|
||||
ui.enableClipboardHotkey->setChecked( p.enableClipboardHotkey );
|
||||
ui.clipboardHotkey->setHotKey( p.clipboardHotkey );
|
||||
ui.clipboardHotkey->setKeySequence( p.clipboardHotkey );
|
||||
|
||||
ui.startWithScanPopupOn->setChecked( p.startWithScanPopupOn );
|
||||
ui.enableScanPopupModifiers->setChecked( p.enableScanPopupModifiers );
|
||||
|
@ -398,9 +398,9 @@ Config::Preferences Preferences::getPreferences()
|
|||
p.darkMode = ui.darkMode->isChecked();
|
||||
p.darkReaderMode = ui.darkReaderMode->isChecked();
|
||||
p.enableMainWindowHotkey = ui.enableMainWindowHotkey->isChecked();
|
||||
p.mainWindowHotkey = ui.mainWindowHotkey->getHotKey();
|
||||
p.mainWindowHotkey = ui.mainWindowHotkey->keySequence();
|
||||
p.enableClipboardHotkey = ui.enableClipboardHotkey->isChecked();
|
||||
p.clipboardHotkey = ui.clipboardHotkey->getHotKey();
|
||||
p.clipboardHotkey = ui.clipboardHotkey->keySequence();
|
||||
|
||||
p.startWithScanPopupOn = ui.startWithScanPopupOn->isChecked();
|
||||
p.enableScanPopupModifiers = ui.enableScanPopupModifiers->isChecked();
|
||||
|
|
|
@ -709,11 +709,7 @@ in the pressed state when the word selection changes.</string>
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="HotKeyEdit" name="mainWindowHotkey">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QKeySequenceEdit" name="mainWindowHotkey"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
@ -740,11 +736,7 @@ in the pressed state when the word selection changes.</string>
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="HotKeyEdit" name="clipboardHotkey">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QKeySequenceEdit" name="clipboardHotkey"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
@ -1760,11 +1752,6 @@ from Stardict, Babylon and GLS dictionaries</string>
|
|||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>HotKeyEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>hotkeyedit.hh</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>StylesComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
|
|
Loading…
Reference in a new issue