Add support for GLS (Babylon source) format

This commit is contained in:
Abs62 2017-03-06 18:07:39 +03:00
parent 685cdab704
commit eba7f5578f
9 changed files with 1528 additions and 10 deletions

View file

@ -2884,3 +2884,14 @@ in bg url to hide it from iemac */
vertical-align: baseline !important; vertical-align: baseline !important;
} }
/************* GLS dictionaries **************/
.glsdict_headwords
{
font-weight: bold;
margin-top: 15px;
margin-bottom: 10px;
font-size: 110%;
}

1461
gls.cc Normal file

File diff suppressed because it is too large Load diff

20
gls.hh Normal file
View file

@ -0,0 +1,20 @@
#ifndef __GLS_HH_INCLUDED__
#define __GLS_HH_INCLUDED__
#include "dictionary.hh"
/// Support for the Dabilon source .GLS files.
namespace Gls {
using std::vector;
using std::string;
vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & )
throw( std::exception );
}
#endif // __GLS_HH_INCLUDED__

View file

@ -354,7 +354,8 @@ HEADERS += folding.hh \
dictserver.hh \ dictserver.hh \
helpwindow.hh \ helpwindow.hh \
slob.hh \ slob.hh \
ripemd.hh ripemd.hh \
gls.hh
FORMS += groups.ui \ FORMS += groups.ui \
dictgroupwidget.ui \ dictgroupwidget.ui \
@ -478,7 +479,8 @@ SOURCES += folding.cc \
dictserver.cc \ dictserver.cc \
helpwindow.cc \ helpwindow.cc \
slob.cc \ slob.cc \
ripemd.cc ripemd.cc \
gls.cc
win32 { win32 {
FORMS += texttospeechsource.ui FORMS += texttospeechsource.ui

BIN
icons/icon32_gls.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -30,6 +30,7 @@
#include "zim.hh" #include "zim.hh"
#include "dictserver.hh" #include "dictserver.hh"
#include "slob.hh" #include "slob.hh"
#include "gls.hh"
#ifndef NO_EPWING_SUPPORT #ifndef NO_EPWING_SUPPORT
#include "epwing.hh" #include "epwing.hh"
@ -61,7 +62,7 @@ LoadDictionaries::LoadDictionaries( Config::Class const & cfg ):
nameFilters << "*.bgl" << "*.ifo" << "*.lsa" << "*.dat" nameFilters << "*.bgl" << "*.ifo" << "*.lsa" << "*.dat"
<< "*.dsl" << "*.dsl.dz" << "*.index" << "*.xdxf" << "*.dsl" << "*.dsl.dz" << "*.index" << "*.xdxf"
<< "*.xdxf.dz" << "*.dct" << "*.aar" << "*.zips" << "*.xdxf.dz" << "*.dct" << "*.aar" << "*.zips"
<< "*.mdx" << "*.mdx" << "*.gls" << "*.gls.dz"
#ifdef MAKE_ZIM_SUPPORT #ifdef MAKE_ZIM_SUPPORT
<< "*.zim" << "*.zimaa" << "*.slob" << "*.zim" << "*.zimaa" << "*.slob"
#endif #endif
@ -204,6 +205,13 @@ void LoadDictionaries::handlePath( Config::Path const & path )
dictionaries.insert( dictionaries.end(), mdxDictionaries.begin(), dictionaries.insert( dictionaries.end(), mdxDictionaries.begin(),
mdxDictionaries.end() ); mdxDictionaries.end() );
} }
{
vector< sptr< Dictionary::Class > > glsDictionaries =
Gls::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
dictionaries.insert( dictionaries.end(), glsDictionaries.begin(),
glsDictionaries.end() );
}
#ifdef MAKE_ZIM_SUPPORT #ifdef MAKE_ZIM_SUPPORT
{ {
vector< sptr< Dictionary::Class > > zimDictionaries = vector< sptr< Dictionary::Class > > zimDictionaries =

View file

@ -299,6 +299,7 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
ui.allowXDXF->setChecked( !p.fts.disabledTypes.contains( "XDXF", Qt::CaseInsensitive ) ); ui.allowXDXF->setChecked( !p.fts.disabledTypes.contains( "XDXF", Qt::CaseInsensitive ) );
ui.allowZim->setChecked( !p.fts.disabledTypes.contains( "ZIM", Qt::CaseInsensitive ) ); ui.allowZim->setChecked( !p.fts.disabledTypes.contains( "ZIM", Qt::CaseInsensitive ) );
ui.allowEpwing->setChecked( !p.fts.disabledTypes.contains( "EPWING", Qt::CaseInsensitive ) ); ui.allowEpwing->setChecked( !p.fts.disabledTypes.contains( "EPWING", Qt::CaseInsensitive ) );
ui.allowGls->setChecked( !p.fts.disabledTypes.contains( "GLS", Qt::CaseInsensitive ) );
#ifndef MAKE_ZIM_SUPPORT #ifndef MAKE_ZIM_SUPPORT
ui.allowZim->hide(); ui.allowZim->hide();
ui.allowSlob->hide(); ui.allowSlob->hide();
@ -478,6 +479,13 @@ Config::Preferences Preferences::getPreferences()
p.fts.disabledTypes += "EPWING"; p.fts.disabledTypes += "EPWING";
} }
if( !ui.allowGls->isChecked() )
{
if( !p.fts.disabledTypes.isEmpty() )
p.fts.disabledTypes += ',';
p.fts.disabledTypes += "GLS";
}
return p; return p;
} }

View file

@ -1275,6 +1275,20 @@ download page.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1">
<widget class="QCheckBox" name="allowEpwing">
<property name="text">
<string notr="true">Epwing</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="allowGls">
<property name="text">
<string notr="true">Gls</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2"> <item row="6" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_14"> <layout class="QHBoxLayout" name="horizontalLayout_14">
<item> <item>
@ -1316,13 +1330,6 @@ download page.</string>
</item> </item>
</layout> </layout>
</item> </item>
<item row="4" column="1">
<widget class="QCheckBox" name="allowEpwing">
<property name="text">
<string notr="true">Epwing</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View file

@ -79,5 +79,6 @@
<file>icons/icon32_zim.png</file> <file>icons/icon32_zim.png</file>
<file>icons/icon32_epwing.png</file> <file>icons/icon32_epwing.png</file>
<file>icons/icon32_slob.png</file> <file>icons/icon32_slob.png</file>
<file>icons/icon32_gls.png</file>
</qresource> </qresource>
</RCC> </RCC>