Remove enableScanPopup: Complete. Remove from config file and ui file

At here, all code working exactly same as before
The only change is that ScanPopup always enabled for all users
This commit is contained in:
shenleban tongying 2022-11-19 09:50:20 -05:00
parent eb5806503a
commit aa3778bb64
5 changed files with 260 additions and 301 deletions

View file

@ -227,7 +227,6 @@ Preferences::Preferences():
enableClipboardHotkey( true ),
clipboardHotkey( QKeySequence( "Ctrl+C,C" ) ),
enableScanPopup( true ),
startWithScanPopupOn( false ),
enableScanPopupModifiers( false ),
scanPopupModifiers( 0 ),
@ -887,7 +886,6 @@ Class load()
if ( !preferences.namedItem( "clipboardHotkey" ).isNull() )
c.preferences.clipboardHotkey = QKeySequence::fromString( preferences.namedItem( "clipboardHotkey" ).toElement().text() );
c.preferences.enableScanPopup = ( preferences.namedItem( "enableScanPopup" ).toElement().text() == "1" );
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() );
@ -1748,10 +1746,6 @@ void save( Class const & c )
opt.appendChild( dd.createTextNode( c.preferences.clipboardHotkey.toKeySequence().toString() ) );
preferences.appendChild( opt );
opt = dd.createElement( "enableScanPopup" );
opt.appendChild( dd.createTextNode( c.preferences.enableScanPopup ? "1":"0" ) );
preferences.appendChild( opt );
opt = dd.createElement( "startWithScanPopupOn" );
opt.appendChild( dd.createTextNode( c.preferences.startWithScanPopupOn ? "1":"0" ) );
preferences.appendChild( opt );

View file

@ -318,7 +318,6 @@ struct Preferences
bool enableClipboardHotkey;
HotKey clipboardHotkey;
bool enableScanPopup;
bool startWithScanPopupOn;
bool enableScanPopupModifiers;
unsigned long scanPopupModifiers; // Combination of KeyboardState::Modifier

View file

@ -16,9 +16,6 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
Config::Preferences const & p = cfg_.preferences;
ui.setupUi( this );
connect( ui.enableScanPopup, SIGNAL( toggled( bool ) ),
this, SLOT( enableScanPopupToggled( bool ) ) );
connect( ui.enableScanPopupModifiers, SIGNAL( toggled( bool ) ),
this, SLOT( enableScanPopupModifiersToggled( bool ) ) );
@ -190,7 +187,6 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
ui.enableClipboardHotkey->setChecked( p.enableClipboardHotkey );
ui.clipboardHotkey->setHotKey( p.clipboardHotkey );
ui.enableScanPopup->setChecked( p.enableScanPopup );
ui.startWithScanPopupOn->setChecked( p.startWithScanPopupOn );
ui.enableScanPopupModifiers->setChecked( p.enableScanPopupModifiers );
@ -407,7 +403,6 @@ Config::Preferences Preferences::getPreferences()
p.enableClipboardHotkey = ui.enableClipboardHotkey->isChecked();
p.clipboardHotkey = ui.clipboardHotkey->getHotKey();
p.enableScanPopup = ui.enableScanPopup->isChecked();
p.startWithScanPopupOn = ui.startWithScanPopupOn->isChecked();
p.enableScanPopupModifiers = ui.enableScanPopupModifiers->isChecked();
@ -572,14 +567,9 @@ Config::Preferences Preferences::getPreferences()
return p;
}
void Preferences::enableScanPopupToggled( bool b )
{
ui.scanPopupModifiers->setEnabled( b && ui.enableScanPopupModifiers->isChecked() );
}
void Preferences::enableScanPopupModifiersToggled( bool b )
{
ui.scanPopupModifiers->setEnabled( b && ui.enableScanPopup->isChecked() );
ui.scanPopupModifiers->setEnabled( b );
if( b )
ui.showScanFlag->setChecked( false );
}

View file

@ -33,7 +33,6 @@ private:
private slots:
void enableScanPopupToggled( bool );
void enableScanPopupModifiersToggled( bool );
void showScanFlagToggled( bool b );

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>744</width>
<height>506</height>
<width>787</width>
<height>629</height>
</rect>
</property>
<property name="windowTitle">
@ -24,7 +24,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<property name="iconSize">
<size>
@ -423,24 +423,6 @@ be the last ones.</string>
<string>&amp;Scan Popup</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QGroupBox" name="enableScanPopup">
<property name="toolTip">
<string>When enabled, a translation popup window would be shown each time
you point your mouse on any word on the screen (Windows) or select
any word with mouse (Linux). When enabled, you can switch it on and
off from main window or tray icon.</string>
</property>
<property name="title">
<string>Enable scan popup functionality</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QCheckBox" name="startWithScanPopupOn">
<property name="toolTip">
@ -719,9 +701,6 @@ seconds, which is specified here.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="scanToMainWindow">
<property name="toolTip">
@ -1844,8 +1823,6 @@ from Stardict, Babylon and GLS dictionaries</string>
<tabstop>closeToTray</tabstop>
<tabstop>cbAutostart</tabstop>
<tabstop>interfaceLanguage</tabstop>
<tabstop>startWithScanPopupOn</tabstop>
<tabstop>enableScanPopupModifiers</tabstop>
<tabstop>leftCtrl</tabstop>
<tabstop>rightShift</tabstop>
<tabstop>altKey</tabstop>