mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
Add a "Enable web plugins" option under Edit > Preferences > Network. It allows to listen to sound pronunciations from online dictionaries that rely on flash plugin such as howjsay.com and dictionary.com. Plugin must be installed for this option to work. See http://doc.trolltech.com/4.5/qtwebkit.html#netscape-plugin-support
This commit is contained in:
parent
ba12e787d8
commit
b1965dd44c
|
@ -110,6 +110,7 @@ Preferences::Preferences():
|
|||
#endif
|
||||
checkForNewReleases( true ),
|
||||
disallowContentFromOtherSites( false ),
|
||||
enableWebPlugins( false ),
|
||||
zoomFactor( 1 ),
|
||||
wordsZoomLevel( 0 )
|
||||
{
|
||||
|
@ -585,6 +586,9 @@ Class load() throw( exError )
|
|||
|
||||
if ( !preferences.namedItem( "disallowContentFromOtherSites" ).isNull() )
|
||||
c.preferences.disallowContentFromOtherSites = ( preferences.namedItem( "disallowContentFromOtherSites" ).toElement().text() == "1" );
|
||||
|
||||
if ( !preferences.namedItem( "enableWebPlugins" ).isNull() )
|
||||
c.preferences.enableWebPlugins = ( preferences.namedItem( "enableWebPlugins" ).toElement().text() == "1" );
|
||||
}
|
||||
|
||||
c.lastMainGroupId = root.namedItem( "lastMainGroupId" ).toElement().text().toUInt();
|
||||
|
@ -1071,6 +1075,10 @@ void save( Class const & c ) throw( exError )
|
|||
opt = dd.createElement( "disallowContentFromOtherSites" );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.disallowContentFromOtherSites ? "1" : "0" ) );
|
||||
preferences.appendChild( opt );
|
||||
|
||||
opt = dd.createElement( "enableWebPlugins" );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.enableWebPlugins ? "1" : "0" ) );
|
||||
preferences.appendChild( opt );
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -168,6 +168,7 @@ struct Preferences
|
|||
|
||||
bool checkForNewReleases;
|
||||
bool disallowContentFromOtherSites;
|
||||
bool enableWebPlugins;
|
||||
|
||||
qreal zoomFactor;
|
||||
int wordsZoomLevel;
|
||||
|
|
|
@ -354,6 +354,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
restoreState( cfg.mainWindowState, 1 );
|
||||
|
||||
applyProxySettings();
|
||||
applyWebSettings();
|
||||
|
||||
makeDictionaries();
|
||||
|
||||
|
@ -594,6 +595,12 @@ void MainWindow::applyProxySettings()
|
|||
QNetworkProxy::setApplicationProxy( proxy );
|
||||
}
|
||||
|
||||
void MainWindow::applyWebSettings()
|
||||
{
|
||||
QWebSettings *defaultSettings = QWebSettings::globalSettings();
|
||||
defaultSettings->setAttribute(QWebSettings::PluginsEnabled, cfg.preferences.enableWebPlugins);
|
||||
}
|
||||
|
||||
void MainWindow::makeDictionaries()
|
||||
{
|
||||
scanPopup.reset();
|
||||
|
@ -1042,6 +1049,7 @@ void MainWindow::editPreferences()
|
|||
|
||||
updateTrayIcon();
|
||||
applyProxySettings();
|
||||
applyWebSettings();
|
||||
makeScanPopup();
|
||||
|
||||
setAutostart( cfg.preferences.autoStart );
|
||||
|
|
|
@ -109,6 +109,7 @@ private:
|
|||
void closeEvent( QCloseEvent * );
|
||||
|
||||
void applyProxySettings();
|
||||
void applyWebSettings();
|
||||
void makeDictionaries();
|
||||
void updateStatusLine();
|
||||
void updateGroupList();
|
||||
|
|
|
@ -176,6 +176,7 @@ Preferences::Preferences( QWidget * parent, Config::Preferences const & p ):
|
|||
|
||||
ui.checkForNewReleases->setChecked( p.checkForNewReleases );
|
||||
ui.disallowContentFromOtherSites->setChecked( p.disallowContentFromOtherSites );
|
||||
ui.enableWebPlugins->setChecked( p.enableWebPlugins );
|
||||
}
|
||||
|
||||
Config::Preferences Preferences::getPreferences()
|
||||
|
@ -242,6 +243,7 @@ Config::Preferences Preferences::getPreferences()
|
|||
|
||||
p.checkForNewReleases = ui.checkForNewReleases->isChecked();
|
||||
p.disallowContentFromOtherSites = ui.disallowContentFromOtherSites->isChecked();
|
||||
p.enableWebPlugins = ui.enableWebPlugins->isChecked();
|
||||
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -951,6 +951,18 @@ you are browsing. If some site breaks because of this, try disabling this.</stri
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableWebPlugins">
|
||||
<property name="toolTip">
|
||||
<string>Enabling this would allow to listen to sound pronunciations from
|
||||
online dictionaries that rely on Flash or other web plugins.
|
||||
Plugin must be installed for this option to work.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable web plugins</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_10">
|
||||
<property name="orientation">
|
||||
|
|
Loading…
Reference in a new issue