mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
clean code:remove x11 scanpopup flag setting
This commit is contained in:
parent
fba1b96b0e
commit
11b29d30a7
12
config.cc
12
config.cc
|
@ -234,8 +234,6 @@ Preferences::Preferences():
|
|||
scanPopupAltMode( false ),
|
||||
scanPopupAltModeSecs( 3 ),
|
||||
ignoreOwnClipboardChanges( false ),
|
||||
scanPopupUnpinnedWindowFlags( SPWF_default ),
|
||||
scanPopupUnpinnedBypassWMHint( false ),
|
||||
scanToMainWindow( false ),
|
||||
ignoreDiacritics( false ),
|
||||
ignorePunctuation( false ),
|
||||
|
@ -904,8 +902,6 @@ Class load()
|
|||
#ifdef HAVE_X11
|
||||
c.preferences.showScanFlag= ( preferences.namedItem( "showScanFlag" ).toElement().text() == "1" );
|
||||
#endif
|
||||
c.preferences.scanPopupUnpinnedWindowFlags = spwfFromInt( preferences.namedItem( "scanPopupUnpinnedWindowFlags" ).toElement().text().toInt() );
|
||||
c.preferences.scanPopupUnpinnedBypassWMHint = ( preferences.namedItem( "scanPopupUnpinnedBypassWMHint" ).toElement().text() == "1" );
|
||||
|
||||
c.preferences.pronounceOnLoadMain = ( preferences.namedItem( "pronounceOnLoadMain" ).toElement().text() == "1" );
|
||||
c.preferences.pronounceOnLoadPopup = ( preferences.namedItem( "pronounceOnLoadPopup" ).toElement().text() == "1" );
|
||||
|
@ -1798,14 +1794,6 @@ void save( Class const & c )
|
|||
preferences.appendChild( opt );
|
||||
#endif
|
||||
|
||||
opt = dd.createElement( "scanPopupUnpinnedWindowFlags" );
|
||||
opt.appendChild( dd.createTextNode( QString::number( c.preferences.scanPopupUnpinnedWindowFlags ) ) );
|
||||
preferences.appendChild( opt );
|
||||
|
||||
opt = dd.createElement( "scanPopupUnpinnedBypassWMHint" );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.scanPopupUnpinnedBypassWMHint ? "1":"0" ) );
|
||||
preferences.appendChild( opt );
|
||||
|
||||
opt = dd.createElement( "pronounceOnLoadMain" );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.pronounceOnLoadMain ? "1" : "0" ) );
|
||||
preferences.appendChild( opt );
|
||||
|
|
|
@ -325,8 +325,7 @@ struct Preferences
|
|||
bool scanPopupAltMode; // When you press modifier shortly after the selection
|
||||
unsigned scanPopupAltModeSecs;
|
||||
bool ignoreOwnClipboardChanges;
|
||||
ScanPopupWindowFlags scanPopupUnpinnedWindowFlags;
|
||||
bool scanPopupUnpinnedBypassWMHint;
|
||||
|
||||
bool scanToMainWindow;
|
||||
bool ignoreDiacritics;
|
||||
bool ignorePunctuation;
|
||||
|
|
|
@ -172,8 +172,6 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
|
|||
|
||||
ui.ignoreOwnClipboardChanges->setChecked( p.ignoreOwnClipboardChanges );
|
||||
ui.scanToMainWindow->setChecked( p.scanToMainWindow );
|
||||
ui.scanPopupUnpinnedWindowFlags->setCurrentIndex( p.scanPopupUnpinnedWindowFlags );
|
||||
ui.scanPopupUnpinnedBypassWMHint->setChecked( p.scanPopupUnpinnedBypassWMHint );
|
||||
|
||||
ui.storeHistory->setChecked( p.storeHistory );
|
||||
ui.historyMaxSizeField->setValue( p.maxStringsInHistory );
|
||||
|
@ -203,10 +201,6 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
|
|||
|
||||
//Platform-specific options
|
||||
|
||||
#ifndef ENABLE_SPWF_CUSTOMIZATION
|
||||
ui.groupBox_ScanPopupWindowFlags->hide();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_X11
|
||||
ui.showScanFlag->setChecked( p.showScanFlag);
|
||||
#else
|
||||
|
@ -368,8 +362,6 @@ Config::Preferences Preferences::getPreferences()
|
|||
#ifdef HAVE_X11
|
||||
p.showScanFlag= ui.showScanFlag->isChecked();
|
||||
#endif
|
||||
p.scanPopupUnpinnedWindowFlags = Config::spwfFromInt( ui.scanPopupUnpinnedWindowFlags->currentIndex() );
|
||||
p.scanPopupUnpinnedBypassWMHint = ui.scanPopupUnpinnedBypassWMHint->isChecked();
|
||||
|
||||
p.storeHistory = ui.storeHistory->isChecked();
|
||||
p.maxStringsInHistory = ui.historyMaxSizeField->text().toUInt();
|
||||
|
@ -525,11 +517,6 @@ void Preferences::enableScanPopupModifiersToggled( bool b )
|
|||
ui.showScanFlag->setChecked( false );
|
||||
}
|
||||
|
||||
void Preferences::on_scanPopupUnpinnedWindowFlags_currentIndexChanged( int index )
|
||||
{
|
||||
ui.scanPopupUnpinnedBypassWMHint->setEnabled( Config::spwfFromInt( index ) != Config::SPWF_default );
|
||||
}
|
||||
|
||||
void Preferences::on_enableMainWindowHotkey_toggled( bool checked )
|
||||
{
|
||||
ui.mainWindowHotkey->setEnabled( checked );
|
||||
|
|
|
@ -35,7 +35,6 @@ private slots:
|
|||
|
||||
void enableScanPopupToggled( bool );
|
||||
void enableScanPopupModifiersToggled( bool );
|
||||
void on_scanPopupUnpinnedWindowFlags_currentIndexChanged( int index );
|
||||
|
||||
void on_enableMainWindowHotkey_toggled( bool checked );
|
||||
void on_enableClipboardHotkey_toggled( bool checked );
|
||||
|
|
|
@ -1254,72 +1254,6 @@ download page.</string>
|
|||
<string>Ad&vanced</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_ScanPopupWindowFlags">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>83</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>ScanPopup unpinned window flags</string>
|
||||
</property>
|
||||
<widget class="QComboBox" name="scanPopupUnpinnedWindowFlags">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>25</y>
|
||||
<width>191</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Experiment with non-default flags if the unpinned scan popup window misbehaves</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string><default></string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Popup</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Tool</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="scanPopupUnpinnedBypassWMHint">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>53</y>
|
||||
<width>271</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>This hint can be combined with non-default window flags</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bypass window manager hint</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<item>
|
||||
|
|
20
scanpopup.cc
20
scanpopup.cc
|
@ -440,20 +440,8 @@ void ScanPopup::applyWordsZoomLevel()
|
|||
|
||||
Qt::WindowFlags ScanPopup::unpinnedWindowFlags() const
|
||||
{
|
||||
#ifdef ENABLE_SPWF_CUSTOMIZATION
|
||||
const Config::ScanPopupWindowFlags spwf = cfg.preferences.scanPopupUnpinnedWindowFlags;
|
||||
Qt::WindowFlags result;
|
||||
if( spwf == Config::SPWF_Popup )
|
||||
result = Qt::Popup;
|
||||
else
|
||||
if( spwf == Config::SPWF_Tool )
|
||||
result = Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint;
|
||||
else
|
||||
return defaultUnpinnedWindowFlags; // Ignore BypassWMHint option.
|
||||
|
||||
if( cfg.preferences.scanPopupUnpinnedBypassWMHint )
|
||||
result |= Qt::X11BypassWindowManagerHint;
|
||||
return result;
|
||||
#if defined( HAVE_X11 )
|
||||
return defaultUnpinnedWindowFlags | Qt::X11BypassWindowManagerHint;
|
||||
#else
|
||||
return defaultUnpinnedWindowFlags;
|
||||
#endif
|
||||
|
@ -663,7 +651,7 @@ void ScanPopup::engagePopup( bool forcePopup, bool giveFocus )
|
|||
|
||||
show();
|
||||
|
||||
#ifdef ENABLE_SPWF_CUSTOMIZATION
|
||||
#if defined( HAVE_X11 )
|
||||
// Ensure that the window always has focus on X11 with Qt::Tool flag.
|
||||
// This also often prevents the window from disappearing prematurely with Qt::Popup flag,
|
||||
// especially when combined with Qt::X11BypassWindowManagerHint flag.
|
||||
|
@ -695,7 +683,7 @@ void ScanPopup::engagePopup( bool forcePopup, bool giveFocus )
|
|||
activateWindow();
|
||||
raise();
|
||||
}
|
||||
#ifdef ENABLE_SPWF_CUSTOMIZATION
|
||||
#if defined( HAVE_X11 )
|
||||
else
|
||||
if ( ( windowFlags() & Qt::Tool ) == Qt::Tool )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue