mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
opt: remove dictionary debug mode (#1249)
* opt: remove dictionary debug mode * opt: remove dictionary debug mode
This commit is contained in:
parent
f0dcc362fa
commit
22f35dd7ee
|
@ -18,14 +18,6 @@ GlobalBroadcaster * GlobalBroadcaster::instance()
|
|||
return bdcaster;
|
||||
}
|
||||
|
||||
void GlobalBroadcaster::insertCache( const QString & key, QByteArray * object )
|
||||
{
|
||||
//do not cache the item when debug dictionary.
|
||||
if ( preference->dictionaryDebug )
|
||||
return;
|
||||
cache.insert( key, object );
|
||||
}
|
||||
|
||||
void GlobalBroadcaster::setPreference( Config::Preferences * p )
|
||||
{
|
||||
preference = p;
|
||||
|
|
|
@ -41,10 +41,6 @@ public:
|
|||
QMap< QString, QSet< QString > > folderFavoritesMap;
|
||||
QMap< unsigned, QString > groupFolderMap;
|
||||
PronounceEngine pronounce_engine;
|
||||
QCache< QString, QByteArray > cache;
|
||||
|
||||
void insertCache( const QString &, QByteArray * );
|
||||
|
||||
signals:
|
||||
void dictionaryChanges( ActiveDictIds ad );
|
||||
void dictionaryClear( ActiveDictIds ad );
|
||||
|
|
|
@ -1013,8 +1013,6 @@ Class load()
|
|||
c.preferences.removeInvalidIndexOnExit =
|
||||
( preferences.namedItem( "removeInvalidIndexOnExit" ).toElement().text() == "1" );
|
||||
|
||||
c.preferences.dictionaryDebug = fromConfig2Preference( preferences.namedItem( "dictionaryDebug" ), "1" );
|
||||
|
||||
if ( !preferences.namedItem( "maxStringsInHistory" ).isNull() )
|
||||
c.preferences.maxStringsInHistory = preferences.namedItem( "maxStringsInHistory" ).toElement().text().toUInt();
|
||||
|
||||
|
@ -2000,10 +1998,6 @@ void save( Class const & c )
|
|||
opt.appendChild( dd.createTextNode( c.preferences.removeInvalidIndexOnExit ? "1" : "0" ) );
|
||||
preferences.appendChild( opt );
|
||||
|
||||
opt = dd.createElement( "dictionaryDebug" );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.dictionaryDebug ? "1" : "0" ) );
|
||||
preferences.appendChild( opt );
|
||||
|
||||
opt = dd.createElement( "maxStringsInHistory" );
|
||||
opt.appendChild( dd.createTextNode( QString::number( c.preferences.maxStringsInHistory ) ) );
|
||||
preferences.appendChild( opt );
|
||||
|
|
|
@ -404,7 +404,6 @@ struct Preferences
|
|||
int maxNetworkCacheSize;
|
||||
bool clearNetworkCacheOnExit;
|
||||
bool removeInvalidIndexOnExit = false;
|
||||
bool dictionaryDebug = false;
|
||||
|
||||
qreal zoomFactor;
|
||||
qreal helpZoomFactor;
|
||||
|
|
|
@ -749,18 +749,6 @@ void MddResourceRequest::run()
|
|||
const QString id = QString::fromUtf8( dict.getId().c_str() );
|
||||
|
||||
const QString unique_key = id + QString::fromStdString( u8ResourceName );
|
||||
if ( GlobalBroadcaster::instance()->cache.contains( unique_key ) ) {
|
||||
//take first ,then insert again . the object() method may become null anytime.
|
||||
auto bytes = GlobalBroadcaster::instance()->cache.take( unique_key );
|
||||
if ( bytes ) {
|
||||
hasAnyData = true;
|
||||
data.resize( bytes->size() );
|
||||
memcpy( &data.front(), bytes->constData(), bytes->size() );
|
||||
GlobalBroadcaster::instance()->insertCache( unique_key, bytes );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dict.loadResourceFile( resourceName, data );
|
||||
|
||||
|
@ -789,8 +777,6 @@ void MddResourceRequest::run()
|
|||
|
||||
data.resize( bytes.size() );
|
||||
memcpy( &data.front(), bytes.constData(), bytes.size() );
|
||||
//cache the processed css result to avoid process again.
|
||||
GlobalBroadcaster::instance()->insertCache( unique_key, new QByteArray( bytes ) );
|
||||
}
|
||||
if ( Filetype::isNameOfTiff( u8ResourceName ) ) {
|
||||
// Convert it
|
||||
|
|
|
@ -354,7 +354,6 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
|
|||
|
||||
//Misc
|
||||
ui.removeInvalidIndexOnExit->setChecked( p.removeInvalidIndexOnExit );
|
||||
ui.dictionaryDebug->setChecked( p.dictionaryDebug );
|
||||
|
||||
// Add-on styles
|
||||
ui.addonStylesLabel->setVisible( ui.addonStyles->count() > 1 );
|
||||
|
@ -519,7 +518,6 @@ Config::Preferences Preferences::getPreferences()
|
|||
p.clearNetworkCacheOnExit = ui.clearNetworkCacheOnExit->isChecked();
|
||||
|
||||
p.removeInvalidIndexOnExit = ui.removeInvalidIndexOnExit->isChecked();
|
||||
p.dictionaryDebug = ui.dictionaryDebug->isChecked();
|
||||
|
||||
p.addonStyle = ui.addonStyles->getCurrentStyle();
|
||||
|
||||
|
|
|
@ -1987,16 +1987,6 @@ from Stardict, Babylon and GLS dictionaries</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="dictionaryDebug">
|
||||
<property name="toolTip">
|
||||
<string>When debugging with dictionary css/js, disable certain cache to make it easier.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dictionary debug</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in a new issue