From c5035d87fcc93a2fc86ce878c3565e951d8b6b0d Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Sat, 17 Sep 2022 23:00:13 +0800 Subject: [PATCH] opt:remove scan popup options --- preferences.cc | 120 +------------------------ preferences.hh | 9 -- preferences.ui | 233 ------------------------------------------------- 3 files changed, 1 insertion(+), 361 deletions(-) diff --git a/preferences.cc b/preferences.cc index 273bdfc3..7068341a 100644 --- a/preferences.cc +++ b/preferences.cc @@ -19,32 +19,9 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ): connect( ui.enableScanPopup, SIGNAL( toggled( bool ) ), this, SLOT( enableScanPopupToggled( bool ) ) ); - connect( ui.enableScanPopupModifiers, SIGNAL( toggled( bool ) ), - this, SLOT( enableScanPopupModifiersToggled( bool ) ) ); - connect( ui.showScanFlag, SIGNAL( toggled( bool ) ), this, SLOT( showScanFlagToggled( bool ) ) ); - connect( ui.altKey, SIGNAL( clicked( bool ) ), - this, SLOT( wholeAltClicked( bool ) ) ); - connect( ui.ctrlKey, SIGNAL( clicked( bool ) ), - this, SLOT( wholeCtrlClicked( bool ) ) ); - connect( ui.shiftKey, SIGNAL( clicked( bool ) ), - this, SLOT( wholeShiftClicked( bool ) ) ); - - connect( ui.leftAlt, SIGNAL( clicked( bool ) ), - this, SLOT( sideAltClicked( bool ) ) ); - connect( ui.rightAlt, SIGNAL( clicked( bool ) ), - this, SLOT( sideAltClicked( bool ) ) ); - connect( ui.leftCtrl, SIGNAL( clicked( bool ) ), - this, SLOT( sideCtrlClicked( bool ) ) ); - connect( ui.rightCtrl, SIGNAL( clicked( bool ) ), - this, SLOT( sideCtrlClicked( bool ) ) ); - connect( ui.leftShift, SIGNAL( clicked( bool ) ), - this, SLOT( sideShiftClicked( bool ) ) ); - connect( ui.rightShift, SIGNAL( clicked( bool ) ), - this, SLOT( sideShiftClicked( bool ) ) ); - connect( ui.buttonBox, SIGNAL( helpRequested() ), this, SLOT( helpRequested() ) ); @@ -192,21 +169,7 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ): ui.enableScanPopup->setChecked( p.enableScanPopup ); ui.startWithScanPopupOn->setChecked( p.startWithScanPopupOn ); - ui.enableScanPopupModifiers->setChecked( p.enableScanPopupModifiers ); - ui.altKey->setChecked( p.scanPopupModifiers & KeyboardState::Alt ); - ui.ctrlKey->setChecked( p.scanPopupModifiers & KeyboardState::Ctrl ); - ui.shiftKey->setChecked( p.scanPopupModifiers & KeyboardState::Shift ); - ui.winKey->setChecked( p.scanPopupModifiers & KeyboardState::Win ); - ui.leftAlt->setChecked( p.scanPopupModifiers & KeyboardState::LeftAlt ); - ui.rightAlt->setChecked( p.scanPopupModifiers & KeyboardState::RightAlt ); - ui.leftCtrl->setChecked( p.scanPopupModifiers & KeyboardState::LeftCtrl ); - ui.rightCtrl->setChecked( p.scanPopupModifiers & KeyboardState::RightCtrl ); - ui.leftShift->setChecked( p.scanPopupModifiers & KeyboardState::LeftShift ); - ui.rightShift->setChecked( p.scanPopupModifiers & KeyboardState::RightShift ); - - ui.scanPopupAltMode->setChecked( p.scanPopupAltMode ); - ui.scanPopupAltModeSecs->setValue( p.scanPopupAltModeSecs ); ui.ignoreOwnClipboardChanges->setChecked( p.ignoreOwnClipboardChanges ); ui.scanToMainWindow->setChecked( p.scanToMainWindow ); ui.scanPopupUnpinnedWindowFlags->setCurrentIndex( p.scanPopupUnpinnedWindowFlags ); @@ -238,22 +201,6 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ): // Different platforms have different keys available -#ifdef Q_OS_WIN32 - ui.winKey->hide(); -#else - ui.leftAlt->hide(); - ui.rightAlt->hide(); - ui.leftCtrl->hide(); - ui.rightCtrl->hide(); - ui.leftShift->hide(); - ui.rightShift->hide(); -#ifdef Q_OS_MAC - ui.altKey->setText( "Opt" ); - ui.winKey->setText( "Ctrl" ); - ui.ctrlKey->setText( "Cmd" ); -#endif -#endif - //Platform-specific options #ifndef ENABLE_SPWF_CUSTOMIZATION @@ -415,21 +362,7 @@ Config::Preferences Preferences::getPreferences() p.enableScanPopup = ui.enableScanPopup->isChecked(); p.startWithScanPopupOn = ui.startWithScanPopupOn->isChecked(); - p.enableScanPopupModifiers = ui.enableScanPopupModifiers->isChecked(); - p.scanPopupModifiers += ui.altKey->isChecked() ? KeyboardState::Alt : 0; - p.scanPopupModifiers += ui.ctrlKey->isChecked() ? KeyboardState::Ctrl: 0; - p.scanPopupModifiers += ui.shiftKey->isChecked() ? KeyboardState::Shift: 0; - p.scanPopupModifiers += ui.winKey->isChecked() ? KeyboardState::Win: 0; - p.scanPopupModifiers += ui.leftAlt->isChecked() ? KeyboardState::LeftAlt: 0; - p.scanPopupModifiers += ui.rightAlt->isChecked() ? KeyboardState::RightAlt: 0; - p.scanPopupModifiers += ui.leftCtrl->isChecked() ? KeyboardState::LeftCtrl: 0; - p.scanPopupModifiers += ui.rightCtrl->isChecked() ? KeyboardState::RightCtrl: 0; - p.scanPopupModifiers += ui.leftShift->isChecked() ? KeyboardState::LeftShift: 0; - p.scanPopupModifiers += ui.rightShift->isChecked() ? KeyboardState::RightShift: 0; - - p.scanPopupAltMode = ui.scanPopupAltMode->isChecked(); - p.scanPopupAltModeSecs = ui.scanPopupAltModeSecs->value(); p.ignoreOwnClipboardChanges = ui.ignoreOwnClipboardChanges->isChecked(); p.scanToMainWindow = ui.scanToMainWindow->isChecked(); #ifdef HAVE_X11 @@ -582,7 +515,7 @@ Config::Preferences Preferences::getPreferences() void Preferences::enableScanPopupToggled( bool b ) { - ui.scanPopupModifiers->setEnabled( b && ui.enableScanPopupModifiers->isChecked() ); + ui.scanPopupModifiers->setEnabled( b ); } void Preferences::enableScanPopupModifiersToggled( bool b ) @@ -592,62 +525,11 @@ void Preferences::enableScanPopupModifiersToggled( bool b ) ui.showScanFlag->setChecked( false ); } -void Preferences::showScanFlagToggled( bool b ) -{ - if( b ) - ui.enableScanPopupModifiers->setChecked( false ); -} - void Preferences::on_scanPopupUnpinnedWindowFlags_currentIndexChanged( int index ) { ui.scanPopupUnpinnedBypassWMHint->setEnabled( Config::spwfFromInt( index ) != Config::SPWF_default ); } -void Preferences::wholeAltClicked( bool b ) -{ - if ( b ) - { - ui.leftAlt->setChecked( false ); - ui.rightAlt->setChecked( false ); - } -} - -void Preferences::wholeCtrlClicked( bool b ) -{ - if ( b ) - { - ui.leftCtrl->setChecked( false ); - ui.rightCtrl->setChecked( false ); - } -} - -void Preferences::wholeShiftClicked( bool b ) -{ - if ( b ) - { - ui.leftShift->setChecked( false ); - ui.rightShift->setChecked( false ); - } -} - -void Preferences::sideAltClicked( bool ) -{ - if ( ui.leftAlt->isChecked() || ui.rightAlt->isChecked() ) - ui.altKey->setChecked( false ); -} - -void Preferences::sideCtrlClicked( bool ) -{ - if ( ui.leftCtrl->isChecked() || ui.rightCtrl->isChecked() ) - ui.ctrlKey->setChecked( false ); -} - -void Preferences::sideShiftClicked( bool ) -{ - if ( ui.leftShift->isChecked() || ui.rightShift->isChecked() ) - ui.shiftKey->setChecked( false ); -} - void Preferences::on_enableMainWindowHotkey_toggled( bool checked ) { ui.mainWindowHotkey->setEnabled( checked ); diff --git a/preferences.hh b/preferences.hh index dcde4cc7..b5f5255d 100644 --- a/preferences.hh +++ b/preferences.hh @@ -35,17 +35,8 @@ private slots: void enableScanPopupToggled( bool ); void enableScanPopupModifiersToggled( bool ); - void showScanFlagToggled( bool b ); void on_scanPopupUnpinnedWindowFlags_currentIndexChanged( int index ); - void wholeAltClicked( bool ); - void wholeCtrlClicked( bool ); - void wholeShiftClicked( bool ); - - void sideAltClicked( bool ); - void sideCtrlClicked( bool ); - void sideShiftClicked( bool ); - void on_enableMainWindowHotkey_toggled( bool checked ); void on_enableClipboardHotkey_toggled( bool checked ); diff --git a/preferences.ui b/preferences.ui index f4df1e9f..ac4eb794 100644 --- a/preferences.ui +++ b/preferences.ui @@ -452,17 +452,6 @@ the program would always start with the scan popup active. - - - - With this enabled, the popup would only show up if all chosen keys are -in the pressed state when the word selection changes. - - - Only show popup when all selected keys are kept pressed: - - - @@ -487,218 +476,9 @@ in the pressed state when the word selection changes. 0 - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Left Ctrl only - - - Left Ctrl - - - - - - - Right Shift only - - - Right Shift - - - - - - - Alt key - - - Alt - - - - - - - Ctrl key - - - Ctrl - - - - - - - Left Alt only - - - Left Alt - - - - - - - Shift key - - - Shift - - - - - - - Right Alt only - - - Right Alt - - - - - - - Right Ctrl only - - - Right Ctrl - - - - - - - Left Shift only - - - Left Shift - - - - - - - Windows key or Meta key - - - Win/Meta - - - - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - 0 - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - - - Normally, in order to activate a popup you have to -maintain the chosen keys pressed while you select -a word. With this enabled, the chosen keys may also -be pressed shortly after the selection is done. - - - Keys may also be pressed afterwards, within - - - - - - - To avoid false positives, the keys are only monitored -after the selection's done for a limited amount of -seconds, which is specified here. - - - false - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - 1 - - - 99 - - - - - - - secs - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - @@ -1911,19 +1691,6 @@ from Stardict, Babylon and GLS dictionaries cbAutostart interfaceLanguage startWithScanPopupOn - enableScanPopupModifiers - leftCtrl - rightShift - altKey - ctrlKey - leftAlt - shiftKey - rightAlt - rightCtrl - leftShift - winKey - scanPopupAltMode - scanPopupAltModeSecs useProxyServer proxyType proxyHost