diff --git a/config.cc b/config.cc index fb4fc1b6..0dd18f01 100644 --- a/config.cc +++ b/config.cc @@ -230,8 +230,6 @@ Preferences::Preferences(): startWithScanPopupOn( false ), enableScanPopupModifiers( false ), scanPopupModifiers( 0 ), - scanPopupAltMode( false ), - scanPopupAltModeSecs( 3 ), ignoreOwnClipboardChanges( false ), scanToMainWindow( false ), ignoreDiacritics( false ), @@ -890,9 +888,6 @@ Class load() c.preferences.startWithScanPopupOn = ( preferences.namedItem( "startWithScanPopupOn" ).toElement().text() == "1" ); c.preferences.enableScanPopupModifiers = ( preferences.namedItem( "enableScanPopupModifiers" ).toElement().text() == "1" ); c.preferences.scanPopupModifiers = ( preferences.namedItem( "scanPopupModifiers" ).toElement().text().toULong() ); - c.preferences.scanPopupAltMode = ( preferences.namedItem( "scanPopupAltMode" ).toElement().text() == "1" ); - if ( !preferences.namedItem( "scanPopupAltModeSecs" ).isNull() ) - c.preferences.scanPopupAltModeSecs = preferences.namedItem( "scanPopupAltModeSecs" ).toElement().text().toUInt(); c.preferences.ignoreOwnClipboardChanges = ( preferences.namedItem( "ignoreOwnClipboardChanges" ).toElement().text() == "1" ); c.preferences.scanToMainWindow = ( preferences.namedItem( "scanToMainWindow" ).toElement().text() == "1" ); c.preferences.ignoreDiacritics = ( preferences.namedItem( "ignoreDiacritics" ).toElement().text() == "1" ); @@ -1756,14 +1751,6 @@ void save( Class const & c ) opt.appendChild( dd.createTextNode( QString::number( c.preferences.scanPopupModifiers ) ) ); preferences.appendChild( opt ); - opt = dd.createElement( "scanPopupAltMode" ); - opt.appendChild( dd.createTextNode( c.preferences.scanPopupAltMode ? "1":"0" ) ); - preferences.appendChild( opt ); - - opt = dd.createElement( "scanPopupAltModeSecs" ); - opt.appendChild( dd.createTextNode( QString::number( c.preferences.scanPopupAltModeSecs ) ) ); - preferences.appendChild( opt ); - opt = dd.createElement( "ignoreOwnClipboardChanges" ); opt.appendChild( dd.createTextNode( c.preferences.ignoreOwnClipboardChanges ? "1":"0" ) ); preferences.appendChild( opt ); diff --git a/config.hh b/config.hh index 2a1d0b3d..402723c9 100644 --- a/config.hh +++ b/config.hh @@ -321,8 +321,6 @@ struct Preferences bool startWithScanPopupOn; bool enableScanPopupModifiers; unsigned long scanPopupModifiers; // Combination of KeyboardState::Modifier - bool scanPopupAltMode; // When you press modifier shortly after the selection - unsigned scanPopupAltModeSecs; bool ignoreOwnClipboardChanges; bool scanToMainWindow; diff --git a/preferences.cc b/preferences.cc index 625785f6..96d693d7 100644 --- a/preferences.cc +++ b/preferences.cc @@ -201,8 +201,6 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ): 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 ); @@ -421,8 +419,6 @@ Config::Preferences Preferences::getPreferences() 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 diff --git a/preferences.ui b/preferences.ui index a4bd276e..7a43c656 100644 --- a/preferences.ui +++ b/preferences.ui @@ -24,7 +24,7 @@ - 1 + 0 @@ -662,67 +662,6 @@ in the pressed state when the word selection changes. - - - - - - 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 - - - - - - @@ -1858,8 +1797,6 @@ from Stardict, Babylon and GLS dictionaries rightCtrl leftShift winKey - scanPopupAltMode - scanPopupAltModeSecs useProxyServer proxyType proxyHost diff --git a/scanpopup.cc b/scanpopup.cc index adf9adec..6105fd7a 100644 --- a/scanpopup.cc +++ b/scanpopup.cc @@ -289,18 +289,6 @@ ScanPopup::ScanPopup( QWidget * parent, connect( &hideTimer, SIGNAL( timeout() ), this, SLOT( hideTimerExpired() ) ); - altModeExpirationTimer.setSingleShot( true ); - altModeExpirationTimer.setInterval( cfg.preferences.scanPopupAltModeSecs * 1000 ); - - connect( &altModeExpirationTimer, SIGNAL( timeout() ), - this, SLOT( altModeExpired() ) ); - - // This one polls constantly for modifiers while alt mode lasts - altModePollingTimer.setSingleShot( false ); - altModePollingTimer.setInterval( 50 ); - connect( &altModePollingTimer, SIGNAL( timeout() ), - this, SLOT( altModePoll() ) ); - mouseGrabPollTimer.setSingleShot( false ); mouseGrabPollTimer.setInterval( 10 ); connect( &mouseGrabPollTimer, SIGNAL( timeout() ), @@ -477,10 +465,6 @@ void ScanPopup::translateWord( QString const & word ) if ( !pendingInputPhrase.isValid() ) return; // Nothing there - // In case we had any timers engaged before, cancel them now. - altModePollingTimer.stop(); - altModeExpirationTimer.stop(); - #ifdef HAVE_X11 emit hideScanFlag(); #endif @@ -555,17 +539,6 @@ void ScanPopup::handleInputWord( QString const & str, bool forcePopup ) pendingInputPhrase = sanitizedPhrase; - if ( !pendingInputPhrase.isValid() ) - { - if ( cfg.preferences.scanPopupAltMode ) - { - // In case we had any timers engaged before, cancel them now, since - // we're not going to translate anything anymore. - altModePollingTimer.stop(); - altModeExpirationTimer.stop(); - } - return; - } #ifdef HAVE_X11 if ( cfg.preferences.showScanFlag ) { @@ -575,19 +548,6 @@ void ScanPopup::handleInputWord( QString const & str, bool forcePopup ) } #endif - // Check key modifiers - - if ( cfg.preferences.enableScanPopupModifiers && !checkModifiersPressed( cfg.preferences.scanPopupModifiers ) ) - { - if ( cfg.preferences.scanPopupAltMode ) - { - altModePollingTimer.start(); - altModeExpirationTimer.start(); - } - - return; - } - inputPhrase = pendingInputPhrase; engagePopup( forcePopup ); } @@ -1119,31 +1079,6 @@ void ScanPopup::hideTimerExpired() hideWindow(); } -void ScanPopup::altModeExpired() -{ - // The alt mode duration has expired, so there's no need to poll for modifiers - // anymore. - altModePollingTimer.stop(); -} - -void ScanPopup::altModePoll() -{ - if ( !pendingInputPhrase.isValid() ) - { - altModePollingTimer.stop(); - altModeExpirationTimer.stop(); - } - else - if ( checkModifiersPressed( cfg.preferences.scanPopupModifiers ) ) - { - altModePollingTimer.stop(); - altModeExpirationTimer.stop(); - - inputPhrase = pendingInputPhrase; - engagePopup( false ); - } -} - void ScanPopup::pageLoaded( ArticleView * ) { if( !isVisible() ) diff --git a/scanpopup.hh b/scanpopup.hh index dd4f0bc8..12f1b6fa 100644 --- a/scanpopup.hh +++ b/scanpopup.hh @@ -157,7 +157,6 @@ private: QTimer hideTimer; // When mouse leaves the window, a grace period is // given for it to return back. If it doesn't before // this timer expires, the window gets hidden. - QTimer altModeExpirationTimer, altModePollingTimer; // Timers for alt mode QTimer mouseGrabPollTimer; @@ -209,8 +208,6 @@ private slots: void on_goForwardButton_clicked(); void hideTimerExpired(); - void altModeExpired(); - void altModePoll(); /// Called repeatedly once the popup is initially engaged and we monitor the /// mouse as it may move away from the window. This simulates mouse grab, in