mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 16:04:06 +00:00
Compare commits
7 commits
a51b590f86
...
cc070a46ef
Author | SHA1 | Date | |
---|---|---|---|
cc070a46ef | |||
0680edd1e9 | |||
d3700f2926 | |||
f2ce85cda2 | |||
9c46e5c317 | |||
5b9a1611ff | |||
112874b0e3 |
|
@ -1,7 +1,6 @@
|
|||
#include "audiooutput.hh"
|
||||
|
||||
#include <QAudioFormat>
|
||||
#include <QtConcurrent/qtconcurrentrun.h>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QFuture>
|
||||
#include <QWaitCondition>
|
||||
#include <QCoreApplication>
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
#include <QStyle>
|
||||
#include <QMessageBox>
|
||||
#include <string>
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
#include <QBuffer>
|
||||
#include <QTextCodec>
|
||||
|
||||
|
@ -31,10 +28,10 @@ std::string c_string( const QString & str )
|
|||
return std::string( str.toUtf8().constData() );
|
||||
}
|
||||
|
||||
bool endsWithIgnoreCase( const string & str1, string str2 )
|
||||
bool endsWithIgnoreCase( QByteArrayView str, QByteArrayView extension )
|
||||
{
|
||||
return ( str1.size() >= (unsigned)str2.size() )
|
||||
&& ( strcasecmp( str1.c_str() + ( str1.size() - str2.size() ), str2.data() ) == 0 );
|
||||
return ( str.size() >= extension.size() )
|
||||
&& ( str.last( extension.size() ).compare( extension, Qt::CaseInsensitive ) == 0 );
|
||||
}
|
||||
|
||||
QString escapeAmps( QString const & str )
|
||||
|
|
|
@ -40,7 +40,7 @@ inline QString rstrip( const QString & str )
|
|||
}
|
||||
|
||||
std::string c_string( const QString & str );
|
||||
bool endsWithIgnoreCase( const string & str1, string str2 );
|
||||
bool endsWithIgnoreCase( QByteArrayView str, QByteArrayView extension );
|
||||
/**
|
||||
* remove punctuation , space, symbol
|
||||
*
|
||||
|
|
|
@ -16,19 +16,11 @@
|
|||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
|
||||
#include <QDir>
|
||||
#include <QString>
|
||||
#include <QSemaphore>
|
||||
#include <QThreadPool>
|
||||
#include <QAtomicInt>
|
||||
#include <QDomDocument>
|
||||
#include <QtEndian>
|
||||
#include <QRegularExpression>
|
||||
#include "ufile.hh"
|
||||
#include "wstring_qt.hh"
|
||||
#include "utils.hh"
|
||||
|
||||
namespace Aard {
|
||||
|
@ -295,11 +287,7 @@ AardDictionary::AardDictionary( string const & id, string const & indexFile, vec
|
|||
// Read dictionary name
|
||||
|
||||
idx.seek( sizeof( idxHeader ) );
|
||||
vector< char > dName( idx.read< quint32 >() );
|
||||
if ( dName.size() ) {
|
||||
idx.read( &dName.front(), dName.size() );
|
||||
dictionaryName = string( &dName.front(), dName.size() );
|
||||
}
|
||||
idx.readU32SizeAndData<>( dictionaryName );
|
||||
|
||||
// Initialize the index
|
||||
|
||||
|
|
|
@ -14,23 +14,17 @@
|
|||
#include "language.hh"
|
||||
#include "utf8.hh"
|
||||
#include "utils.hh"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
|
||||
#include <QAtomicInt>
|
||||
#include <QCryptographicHash>
|
||||
#include <QDir>
|
||||
#include <QPainter>
|
||||
#include <QRegularExpression>
|
||||
#include <QSemaphore>
|
||||
#include <QThreadPool>
|
||||
|
||||
namespace Bgl {
|
||||
|
||||
|
@ -258,15 +252,7 @@ BglDictionary::BglDictionary( string const & id, string const & indexFile, strin
|
|||
|
||||
// Read the dictionary's name
|
||||
|
||||
size_t len = idx.read< uint32_t >();
|
||||
|
||||
if ( len ) {
|
||||
vector< char > nameBuf( len );
|
||||
|
||||
idx.read( &nameBuf.front(), len );
|
||||
|
||||
dictionaryName = string( &nameBuf.front(), len );
|
||||
}
|
||||
idx.readU32SizeAndData<>( dictionaryName );
|
||||
|
||||
// Initialize the index
|
||||
|
||||
|
@ -899,8 +885,8 @@ void BglResourceRequest::run()
|
|||
break;
|
||||
}
|
||||
|
||||
vector< char > nameData( idx.read< uint32_t >() );
|
||||
idx.read( &nameData.front(), nameData.size() );
|
||||
vector< char > nameData;
|
||||
idx.readU32SizeAndData<>( nameData );
|
||||
|
||||
for ( size_t x = nameData.size(); x--; ) {
|
||||
nameData[ x ] = tolower( nameData[ x ] );
|
||||
|
@ -917,9 +903,9 @@ void BglResourceRequest::run()
|
|||
|
||||
data.resize( idx.read< uint32_t >() );
|
||||
|
||||
vector< unsigned char > compressedData( idx.read< uint32_t >() );
|
||||
vector< unsigned char > compressedData;
|
||||
|
||||
idx.read( &compressedData.front(), compressedData.size() );
|
||||
idx.readU32SizeAndData<>( compressedData );
|
||||
|
||||
unsigned long decompressedLength = data.size();
|
||||
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
#include "btreeidx.hh"
|
||||
#include "folding.hh"
|
||||
#include "utf8.hh"
|
||||
#include <QRunnable>
|
||||
#include <QThreadPool>
|
||||
#include <QSemaphore>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -18,7 +15,7 @@
|
|||
#include "wildcard.hh"
|
||||
#include "globalbroadcaster.hh"
|
||||
|
||||
#include <QtConcurrent>
|
||||
#include <QtConcurrentRun>
|
||||
#include <zlib.h>
|
||||
|
||||
namespace BtreeIndexing {
|
||||
|
|
|
@ -5,17 +5,12 @@
|
|||
|
||||
#include "dict/dictionary.hh"
|
||||
#include "dictfile.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <QFuture>
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
#include <QList>
|
||||
|
||||
|
||||
/// A base for the dictionary which creates a btree index to look up
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "utf8.hh"
|
||||
#include "dictzip.hh"
|
||||
#include "htmlescape.hh"
|
||||
|
||||
#include "langcoder.hh"
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
@ -18,15 +17,12 @@
|
|||
#include <stdlib.h>
|
||||
#include "gddebug.hh"
|
||||
#include "ftshelpers.hh"
|
||||
#include <QDir>
|
||||
#include <QUrl>
|
||||
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
|
||||
namespace DictdFiles {
|
||||
|
||||
using std::map;
|
||||
|
@ -96,11 +92,6 @@ public:
|
|||
|
||||
~DictdDictionary();
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return dictionaryName;
|
||||
}
|
||||
|
||||
map< Dictionary::Property, string > getProperties() noexcept override
|
||||
{
|
||||
return map< Dictionary::Property, string >();
|
||||
|
@ -163,11 +154,7 @@ DictdDictionary::DictdDictionary( string const & id,
|
|||
// Read the dictionary name
|
||||
idx.seek( sizeof( idxHeader ) );
|
||||
|
||||
vector< char > dName( idx.read< uint32_t >() );
|
||||
if ( dName.size() > 0 ) {
|
||||
idx.read( &dName.front(), dName.size() );
|
||||
dictionaryName = string( &dName.front(), dName.size() );
|
||||
}
|
||||
idx.readU32SizeAndData<>( dictionaryName );
|
||||
|
||||
// Open the .dict file
|
||||
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
#include <QUrl>
|
||||
#include <QTcpSocket>
|
||||
#include <QString>
|
||||
#include <list>
|
||||
#include "htmlescape.hh"
|
||||
|
||||
#include <QCryptographicHash>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QRegularExpression>
|
||||
#include <QtConcurrent>
|
||||
#include <QtConcurrentRun>
|
||||
|
||||
namespace DictServer {
|
||||
|
||||
|
@ -176,7 +177,6 @@ class DictServerDictionary: public Dictionary::Class
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
string name;
|
||||
QString url, icon;
|
||||
quint32 langId;
|
||||
QString errorString;
|
||||
|
@ -196,11 +196,13 @@ public:
|
|||
QString const & strategies_,
|
||||
QString const & icon_ ):
|
||||
Dictionary::Class( id, vector< string >() ),
|
||||
name( name_ ),
|
||||
url( url_ ),
|
||||
icon( icon_ ),
|
||||
langId( 0 )
|
||||
{
|
||||
|
||||
dictionaryName = name_;
|
||||
|
||||
int pos = url.indexOf( "://" );
|
||||
if ( pos < 0 ) {
|
||||
url = "dict://" + url;
|
||||
|
@ -301,11 +303,6 @@ public:
|
|||
disconnectFromServer( socket );
|
||||
}
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
map< Property, string > getProperties() noexcept override
|
||||
{
|
||||
return {};
|
||||
|
@ -925,4 +922,4 @@ vector< sptr< Dictionary::Class > > makeDictionaries( Config::DictServers const
|
|||
return result;
|
||||
}
|
||||
#include "dictserver.moc"
|
||||
} // namespace DictServer
|
||||
} // namespace DictServer
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "htmlescape.hh"
|
||||
#include "iconv.hh"
|
||||
#include "filetype.hh"
|
||||
|
||||
#include "audiolink.hh"
|
||||
#include "langcoder.hh"
|
||||
#include "wstring_qt.hh"
|
||||
|
@ -19,40 +18,22 @@
|
|||
#include "gddebug.hh"
|
||||
#include "tiff.hh"
|
||||
#include "ftshelpers.hh"
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <wctype.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
|
||||
#include <QSemaphore>
|
||||
#include <QThreadPool>
|
||||
#include <QAtomicInt>
|
||||
#include <QUrl>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QPainter>
|
||||
#include <QStringList>
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
// For TIFF conversion
|
||||
#include <QImage>
|
||||
#include <QByteArray>
|
||||
#include <QBuffer>
|
||||
|
||||
// For SVG handling
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
|
||||
#include <QtConcurrent>
|
||||
|
||||
#include <QSvgRenderer>
|
||||
#include <QtConcurrentRun>
|
||||
#include "utils.hh"
|
||||
|
||||
namespace Dsl {
|
||||
|
@ -158,7 +139,6 @@ class DslDictionary: public BtreeIndexing::BtreeDictionary
|
|||
QAtomicInt deferredInitDone;
|
||||
QMutex deferredInitMutex;
|
||||
bool deferredInitRunnableStarted;
|
||||
QSemaphore deferredInitRunnableExited;
|
||||
|
||||
string initError;
|
||||
|
||||
|
@ -176,10 +156,6 @@ public:
|
|||
|
||||
~DslDictionary();
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return dictionaryName;
|
||||
}
|
||||
|
||||
map< Dictionary::Property, string > getProperties() noexcept override
|
||||
{
|
||||
|
@ -303,17 +279,9 @@ DslDictionary::DslDictionary( string const & id, string const & indexFile, vecto
|
|||
|
||||
idx.seek( sizeof( idxHeader ) );
|
||||
|
||||
vector< char > dName( idx.read< uint32_t >() );
|
||||
if ( dName.size() > 0 ) {
|
||||
idx.read( &dName.front(), dName.size() );
|
||||
dictionaryName = string( &dName.front(), dName.size() );
|
||||
}
|
||||
idx.readU32SizeAndData<>( dictionaryName );
|
||||
idx.readU32SizeAndData<>( preferredSoundDictionary );
|
||||
|
||||
vector< char > sName( idx.read< uint32_t >() );
|
||||
if ( sName.size() > 0 ) {
|
||||
idx.read( &sName.front(), sName.size() );
|
||||
preferredSoundDictionary = string( &sName.front(), sName.size() );
|
||||
}
|
||||
|
||||
resourceDir1 = getDictionaryFilenames()[ 0 ] + ".files" + Utils::Fs::separator();
|
||||
QString s = QString::fromStdString( getDictionaryFilenames()[ 0 ] );
|
||||
|
@ -1421,7 +1389,6 @@ class DslArticleRequest: public Dictionary::DataRequest
|
|||
bool ignoreDiacritics;
|
||||
|
||||
QAtomicInt isCancelled;
|
||||
QSemaphore hasExited;
|
||||
QFuture< void > f;
|
||||
|
||||
public:
|
||||
|
@ -1598,7 +1565,6 @@ class DslResourceRequest: public Dictionary::DataRequest
|
|||
string resourceName;
|
||||
|
||||
QAtomicInt isCancelled;
|
||||
QSemaphore hasExited;
|
||||
QFuture< void > f;
|
||||
|
||||
public:
|
||||
|
@ -1745,11 +1711,10 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
|
|||
continue;
|
||||
}
|
||||
|
||||
// Make sure it's not an abbreviation file
|
||||
// Make sure it's not an abbreviation file. extSize of ".dsl" or ".dsl.dz"
|
||||
|
||||
int extSize = ( uncompressedDsl ? 4 : 7 );
|
||||
if ( fileName.size() - extSize >= 5
|
||||
&& strncasecmp( fileName.c_str() + fileName.size() - extSize - 5, "_abrv", 5 ) == 0 ) {
|
||||
if ( int extSize = ( uncompressedDsl ? 4 : 7 ); ( fileName.size() >= ( 5 + extSize ) )
|
||||
&& ( QByteArrayView( fileName ).chopped( extSize ).last( 5 ).compare( "_abrv", Qt::CaseInsensitive ) == 0 ) ) {
|
||||
// It is, skip it
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1,26 +1,19 @@
|
|||
/* This file is (c) 2014 Abs62
|
||||
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
||||
#include <QDir>
|
||||
#ifndef NO_EPWING_SUPPORT
|
||||
|
||||
#include "epwing_book.hh"
|
||||
#include "epwing.hh"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDir>
|
||||
#include <QRunnable>
|
||||
#include <QSemaphore>
|
||||
|
||||
#include <map>
|
||||
#include <QtConcurrent>
|
||||
#include <QtConcurrentRun>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "btreeidx.hh"
|
||||
#include "folding.hh"
|
||||
#include "gddebug.hh"
|
||||
|
||||
#include "chunkedstorage.hh"
|
||||
#include "wstring_qt.hh"
|
||||
#include "filetype.hh"
|
||||
#include "ftshelpers.hh"
|
||||
#include "globalregex.hh"
|
||||
|
@ -82,7 +75,6 @@ class EpwingDictionary: public BtreeIndexing::BtreeDictionary
|
|||
QMutex idxMutex;
|
||||
File::Index idx;
|
||||
IdxHeader idxHeader;
|
||||
string bookName;
|
||||
ChunkedStorage::Reader chunks;
|
||||
Epwing::Book::EpwingBook eBook;
|
||||
QString cacheDirectory;
|
||||
|
@ -96,15 +88,6 @@ public:
|
|||
|
||||
~EpwingDictionary();
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return bookName;
|
||||
}
|
||||
|
||||
void setName( string _name ) noexcept override
|
||||
{
|
||||
bookName = _name;
|
||||
}
|
||||
|
||||
map< Dictionary::Property, string > getProperties() noexcept override
|
||||
{
|
||||
|
@ -227,7 +210,7 @@ EpwingDictionary::EpwingDictionary( string const & id,
|
|||
idx.seek( sizeof( idxHeader ) );
|
||||
if ( data.size() > 0 ) {
|
||||
idx.read( &data.front(), idxHeader.nameSize );
|
||||
bookName = string( &data.front(), idxHeader.nameSize );
|
||||
dictionaryName = string( &data.front(), idxHeader.nameSize );
|
||||
}
|
||||
|
||||
// Initialize eBook
|
||||
|
|
|
@ -18,8 +18,12 @@
|
|||
#include <QString>
|
||||
#include <QtCore5Compat/QTextCodec>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
// POSIX symbol unavailable on Windows needed for eb headers
|
||||
#ifdef Q_OS_WIN
|
||||
#ifndef _SSIZE_T
|
||||
#define _SSIZE_T
|
||||
#define ssize_t long
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <eb/eb.h>
|
||||
|
|
|
@ -20,7 +20,6 @@ namespace {
|
|||
|
||||
class ForvoDictionary: public Dictionary::Class
|
||||
{
|
||||
string name;
|
||||
QString apiKey, languageCode;
|
||||
QNetworkAccessManager & netMgr;
|
||||
|
||||
|
@ -32,17 +31,13 @@ public:
|
|||
QString const & languageCode_,
|
||||
QNetworkAccessManager & netMgr_ ):
|
||||
Dictionary::Class( id, vector< string >() ),
|
||||
name( name_ ),
|
||||
apiKey( apiKey_ ),
|
||||
languageCode( languageCode_ ),
|
||||
netMgr( netMgr_ )
|
||||
{
|
||||
dictionaryName = name_;
|
||||
}
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
map< Property, string > getProperties() noexcept override
|
||||
{
|
||||
|
|
|
@ -16,32 +16,21 @@
|
|||
#include "dictzip.hh"
|
||||
#include "indexedzip.hh"
|
||||
#include "ftshelpers.hh"
|
||||
|
||||
#include "htmlescape.hh"
|
||||
#include "filetype.hh"
|
||||
#include "tiff.hh"
|
||||
#include "audiolink.hh"
|
||||
|
||||
#include <QString>
|
||||
#include <QSemaphore>
|
||||
#include <QThreadPool>
|
||||
#include <QAtomicInt>
|
||||
// For TIFF conversion
|
||||
#include <QImage>
|
||||
#include <QByteArray>
|
||||
#include <QBuffer>
|
||||
|
||||
#include <QDir>
|
||||
#include <QRegularExpression>
|
||||
#include <QtCore5Compat/QTextCodec>
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
|
||||
namespace Gls {
|
||||
|
||||
|
@ -361,11 +350,6 @@ public:
|
|||
|
||||
~GlsDictionary();
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return dictionaryName;
|
||||
}
|
||||
|
||||
map< Dictionary::Property, string > getProperties() noexcept override
|
||||
{
|
||||
return map< Dictionary::Property, string >();
|
||||
|
@ -461,11 +445,7 @@ GlsDictionary::GlsDictionary( string const & id, string const & indexFile, vecto
|
|||
|
||||
idx.seek( sizeof( idxHeader ) );
|
||||
|
||||
vector< char > dName( idx.read< uint32_t >() );
|
||||
if ( dName.size() > 0 ) {
|
||||
idx.read( &dName.front(), dName.size() );
|
||||
dictionaryName = string( &dName.front(), dName.size() );
|
||||
}
|
||||
idx.readU32SizeAndData<>( dictionaryName );
|
||||
|
||||
// Initialize the index
|
||||
|
||||
|
|
|
@ -6,30 +6,22 @@
|
|||
#include "htmlescape.hh"
|
||||
#include "iconv.hh"
|
||||
#include "folding.hh"
|
||||
#include "wstring_qt.hh"
|
||||
#include "language.hh"
|
||||
#include "langcoder.hh"
|
||||
|
||||
#include <QRunnable>
|
||||
#include <QThreadPool>
|
||||
#include <QSemaphore>
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <set>
|
||||
#include "gddebug.hh"
|
||||
#include "utils.hh"
|
||||
#include <QtConcurrentRun>
|
||||
|
||||
#ifndef INCLUDE_LIBRARY_PATH
|
||||
#include <hunspell.hxx>
|
||||
#else
|
||||
#include <hunspell/hunspell.hxx>
|
||||
#endif
|
||||
#include "gddebug.hh"
|
||||
|
||||
#include "utils.hh"
|
||||
#include <QtConcurrent>
|
||||
|
||||
namespace HunspellMorpho {
|
||||
|
||||
|
@ -41,7 +33,6 @@ namespace {
|
|||
|
||||
class HunspellDictionary: public Dictionary::Class
|
||||
{
|
||||
string name;
|
||||
Hunspell hunspell;
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
|
@ -56,19 +47,15 @@ public:
|
|||
/// files[ 0 ] should be .aff file, files[ 1 ] should be .dic file.
|
||||
HunspellDictionary( string const & id, string const & name_, vector< string > const & files ):
|
||||
Dictionary::Class( id, files ),
|
||||
name( name_ ),
|
||||
#ifdef Q_OS_WIN32
|
||||
hunspell( Utf8ToLocal8Bit( files[ 0 ] ).c_str(), Utf8ToLocal8Bit( files[ 1 ] ).c_str() )
|
||||
#else
|
||||
hunspell( files[ 0 ].c_str(), files[ 1 ].c_str() )
|
||||
#endif
|
||||
{
|
||||
dictionaryName = name_;
|
||||
}
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
map< Property, string > getProperties() noexcept override
|
||||
{
|
||||
|
|
|
@ -60,7 +60,6 @@ private slots:
|
|||
class LinguaDictionary: public Dictionary::Class
|
||||
{
|
||||
|
||||
string name;
|
||||
QString languageCode;
|
||||
QString langWikipediaID;
|
||||
QNetworkAccessManager & netMgr;
|
||||
|
@ -68,10 +67,10 @@ class LinguaDictionary: public Dictionary::Class
|
|||
public:
|
||||
LinguaDictionary( string const & id, string name_, QString languageCode_, QNetworkAccessManager & netMgr_ ):
|
||||
Dictionary::Class( id, vector< string >() ),
|
||||
name( std::move( name_ ) ),
|
||||
languageCode( std::move( languageCode_ ) ),
|
||||
netMgr( netMgr_ )
|
||||
{
|
||||
dictionaryName = name_;
|
||||
/* map of iso lang code to wikipedia lang id
|
||||
|
||||
Data was obtained by this query on https://commons-query.wikimedia.org/
|
||||
|
@ -166,10 +165,6 @@ WHERE {
|
|||
}
|
||||
}
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
map< Property, string > getProperties() noexcept override
|
||||
{
|
||||
|
|
|
@ -11,12 +11,6 @@
|
|||
#include "dict/sounddir.hh"
|
||||
#include "dict/hunspell.hh"
|
||||
#include "dictdfiles.hh"
|
||||
#include "dict/romaji.hh"
|
||||
#include "dict/customtransliteration.hh"
|
||||
#include "dict/russiantranslit.hh"
|
||||
#include "dict/german.hh"
|
||||
#include "dict/greektranslit.hh"
|
||||
#include "dict/belarusiantranslit.hh"
|
||||
#include "dict/website.hh"
|
||||
#include "dict/forvo.hh"
|
||||
#include "dict/programs.hh"
|
||||
|
@ -34,12 +28,19 @@
|
|||
#include "dict/lingualibre.hh"
|
||||
#include "metadata.hh"
|
||||
|
||||
#include "dict/transliteration/belarusian.hh"
|
||||
#include "dict/transliteration/custom.hh"
|
||||
#include "dict/transliteration/german.hh"
|
||||
#include "dict/transliteration/greek.hh"
|
||||
#include "dict/transliteration/romaji.hh"
|
||||
#include "dict/transliteration/russian.hh"
|
||||
|
||||
#ifndef NO_EPWING_SUPPORT
|
||||
#include "dict/epwing.hh"
|
||||
#endif
|
||||
|
||||
#ifdef MAKE_CHINESE_CONVERSION_SUPPORT
|
||||
#include "dict/chinese.hh"
|
||||
#include "dict/transliteration/chinese.hh"
|
||||
#endif
|
||||
|
||||
#include <QMessageBox>
|
||||
|
@ -243,10 +244,10 @@ void loadDictionaries( QWidget * parent,
|
|||
///// We create transliterations synchronously since they are very simple
|
||||
|
||||
#ifdef MAKE_CHINESE_CONVERSION_SUPPORT
|
||||
addDicts( Chinese::makeDictionaries( cfg.transliteration.chinese ) );
|
||||
addDicts( ChineseTranslit::makeDictionaries( cfg.transliteration.chinese ) );
|
||||
#endif
|
||||
|
||||
addDicts( Romaji::makeDictionaries( cfg.transliteration.romaji ) );
|
||||
addDicts( RomajiTranslit::makeDictionaries( cfg.transliteration.romaji ) );
|
||||
addDicts( CustomTranslit::makeDictionaries( cfg.transliteration.customTrans ) );
|
||||
|
||||
// Make Russian transliteration
|
||||
|
|
|
@ -14,10 +14,6 @@
|
|||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
|
||||
#define OV_EXCLUDE_STATIC_CALLBACKS
|
||||
#include <vorbis/vorbisfile.h>
|
||||
#include <QDir>
|
||||
|
|
|
@ -11,22 +11,16 @@
|
|||
#include "chunkedstorage.hh"
|
||||
#include "gddebug.hh"
|
||||
#include "langcoder.hh"
|
||||
|
||||
#include "audiolink.hh"
|
||||
#include "ex.hh"
|
||||
#include "mdictparser.hh"
|
||||
#include "filetype.hh"
|
||||
#include "ftshelpers.hh"
|
||||
#include "htmlescape.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <list>
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
|
||||
#include "globalregex.hh"
|
||||
#include "tiff.hh"
|
||||
#include "utils.hh"
|
||||
|
@ -35,8 +29,9 @@
|
|||
#include <QDir>
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
#include <QThreadPool>
|
||||
#include <QtConcurrent>
|
||||
#include <QtConcurrentRun>
|
||||
|
||||
namespace Mdx {
|
||||
|
||||
|
@ -218,10 +213,6 @@ public:
|
|||
|
||||
void deferredInit() override;
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return dictionaryName;
|
||||
}
|
||||
|
||||
map< Dictionary::Property, string > getProperties() noexcept override
|
||||
{
|
||||
|
@ -310,12 +301,7 @@ MdxDictionary::MdxDictionary( string const & id, string const & indexFile, vecto
|
|||
{
|
||||
// Read the dictionary's name
|
||||
idx.seek( sizeof( idxHeader ) );
|
||||
size_t len = idx.read< uint32_t >();
|
||||
vector< char > buf( len );
|
||||
if ( len > 0 ) {
|
||||
idx.read( &buf.front(), len );
|
||||
dictionaryName = string( &buf.front(), len );
|
||||
}
|
||||
idx.readU32SizeAndData<>( dictionaryName );
|
||||
|
||||
//fallback, use filename as dictionary name
|
||||
if ( dictionaryName.empty() ) {
|
||||
|
@ -324,12 +310,7 @@ MdxDictionary::MdxDictionary( string const & id, string const & indexFile, vecto
|
|||
}
|
||||
|
||||
// then read the dictionary's encoding
|
||||
len = idx.read< uint32_t >();
|
||||
if ( len > 0 ) {
|
||||
buf.resize( len );
|
||||
idx.read( &buf.front(), len );
|
||||
encoding = string( &buf.front(), len );
|
||||
}
|
||||
idx.readU32SizeAndData<>( encoding );
|
||||
|
||||
dictFile.setFileName( QString::fromUtf8( dictionaryFiles[ 0 ].c_str() ) );
|
||||
dictFile.open( QIODevice::ReadOnly );
|
||||
|
|
|
@ -13,18 +13,12 @@
|
|||
#include "utf8.hh"
|
||||
#include <map>
|
||||
#include <QAtomicInt>
|
||||
#include <QDir>
|
||||
#include <QRegularExpression>
|
||||
#include <QSemaphore>
|
||||
#include <QString>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "utils.hh"
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
|
||||
namespace Sdict {
|
||||
|
||||
|
@ -119,10 +113,6 @@ public:
|
|||
|
||||
~SdictDictionary();
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return dictionaryName;
|
||||
}
|
||||
|
||||
map< Dictionary::Property, string > getProperties() noexcept override
|
||||
{
|
||||
|
@ -196,11 +186,7 @@ SdictDictionary::SdictDictionary( string const & id,
|
|||
// Read dictionary name
|
||||
|
||||
idx.seek( sizeof( idxHeader ) );
|
||||
vector< char > dName( idx.read< uint32_t >() );
|
||||
if ( dName.size() > 0 ) {
|
||||
idx.read( &dName.front(), dName.size() );
|
||||
dictionaryName = string( &dName.front(), dName.size() );
|
||||
}
|
||||
idx.readU32SizeAndData<>( dictionaryName );
|
||||
|
||||
// Initialize the index
|
||||
|
||||
|
|
|
@ -10,29 +10,22 @@
|
|||
#include "utf8.hh"
|
||||
#include "decompress.hh"
|
||||
#include "langcoder.hh"
|
||||
#include "wstring_qt.hh"
|
||||
#include "ftshelpers.hh"
|
||||
#include "htmlescape.hh"
|
||||
#include "filetype.hh"
|
||||
#include "tiff.hh"
|
||||
#include "utils.hh"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
|
||||
#include "iconv.hh"
|
||||
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QMap>
|
||||
#include <QProcess>
|
||||
#include <QList>
|
||||
|
||||
#include <QtEndian>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
@ -618,10 +611,6 @@ public:
|
|||
|
||||
~SlobDictionary();
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return dictionaryName;
|
||||
}
|
||||
|
||||
map< Dictionary::Property, string > getProperties() noexcept override
|
||||
{
|
||||
|
|
|
@ -61,7 +61,6 @@ bool indexIsOldOrBad( string const & indexFile )
|
|||
|
||||
class SoundDirDictionary: public BtreeIndexing::BtreeDictionary
|
||||
{
|
||||
string name;
|
||||
QMutex idxMutex;
|
||||
File::Index idx;
|
||||
IdxHeader idxHeader;
|
||||
|
@ -76,10 +75,6 @@ public:
|
|||
vector< string > const & dictionaryFiles,
|
||||
QString const & iconFilename_ );
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
map< Dictionary::Property, string > getProperties() noexcept override
|
||||
{
|
||||
|
@ -113,12 +108,13 @@ SoundDirDictionary::SoundDirDictionary( string const & id,
|
|||
vector< string > const & dictionaryFiles,
|
||||
QString const & iconFilename_ ):
|
||||
BtreeDictionary( id, dictionaryFiles ),
|
||||
name( name_ ),
|
||||
idx( indexFile, QIODevice::ReadOnly ),
|
||||
idxHeader( idx.read< IdxHeader >() ),
|
||||
chunks( idx, idxHeader.chunksOffset ),
|
||||
iconFilename( iconFilename_ )
|
||||
{
|
||||
dictionaryName = name_;
|
||||
|
||||
// Initialize the index
|
||||
|
||||
openIndex( IndexInfo( idxHeader.indexBtreeMaxElements, idxHeader.indexRootOffset ), idx, idxMutex );
|
||||
|
|
|
@ -11,39 +11,30 @@
|
|||
#include "htmlescape.hh"
|
||||
#include "langcoder.hh"
|
||||
#include "gddebug.hh"
|
||||
|
||||
#include "filetype.hh"
|
||||
#include "indexedzip.hh"
|
||||
#include "tiff.hh"
|
||||
#include "ftshelpers.hh"
|
||||
#include "audiolink.hh"
|
||||
|
||||
#include <zlib.h>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <QString>
|
||||
#include <QAtomicInt>
|
||||
#include <QDomDocument>
|
||||
#include "ufile.hh"
|
||||
#include "utils.hh"
|
||||
#include <QRegularExpression>
|
||||
#include "globalregex.hh"
|
||||
#include <QDir>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
#include <arpa/inet.h>
|
||||
#else
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
|
||||
#include <QString>
|
||||
#include <QSemaphore>
|
||||
#include <QAtomicInt>
|
||||
#include <QStringList>
|
||||
#include <QDomDocument>
|
||||
#include "ufile.hh"
|
||||
#include "utils.hh"
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include "globalregex.hh"
|
||||
|
||||
namespace Stardict {
|
||||
|
||||
|
@ -131,7 +122,6 @@ class StardictDictionary: public BtreeIndexing::BtreeDictionary
|
|||
QMutex idxMutex;
|
||||
File::Index idx;
|
||||
IdxHeader idxHeader;
|
||||
string bookName;
|
||||
string sameTypeSequence;
|
||||
ChunkedStorage::Reader chunks;
|
||||
QMutex dzMutex;
|
||||
|
@ -145,17 +135,6 @@ public:
|
|||
|
||||
~StardictDictionary();
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return bookName;
|
||||
}
|
||||
|
||||
void setName( string _name ) noexcept override
|
||||
{
|
||||
bookName = _name;
|
||||
}
|
||||
|
||||
|
||||
map< Dictionary::Property, string > getProperties() noexcept override
|
||||
{
|
||||
return map< Dictionary::Property, string >();
|
||||
|
@ -239,10 +218,10 @@ StardictDictionary::StardictDictionary( string const & id,
|
|||
BtreeDictionary( id, dictionaryFiles ),
|
||||
idx( indexFile, QIODevice::ReadOnly ),
|
||||
idxHeader( idx.read< IdxHeader >() ),
|
||||
bookName( loadString( idxHeader.bookNameSize ) ),
|
||||
sameTypeSequence( loadString( idxHeader.sameTypeSequenceSize ) ),
|
||||
chunks( idx, idxHeader.chunksOffset )
|
||||
{
|
||||
dictionaryName = loadString( idxHeader.bookNameSize );
|
||||
// Open the .dict file
|
||||
|
||||
DZ_ERRORS error;
|
||||
|
|
1
src/dict/transliteration/README.md
Normal file
1
src/dict/transliteration/README.md
Normal file
|
@ -0,0 +1 @@
|
|||
Translit
|
|
@ -1,7 +1,7 @@
|
|||
/* This file is (c) 2013 Maksim Tamkovicz <quendimax@gmail.com>
|
||||
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
||||
|
||||
#include "belarusiantranslit.hh"
|
||||
#include "belarusian.hh"
|
||||
#include "transliteration.hh"
|
||||
#include <QCoreApplication>
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "dictionary.hh"
|
||||
|
||||
// Support for Belarusian transliteration
|
|
@ -4,16 +4,13 @@
|
|||
#include "chinese.hh"
|
||||
#include <stdexcept>
|
||||
#include <QCoreApplication>
|
||||
// #ifdef Q_OS_MAC
|
||||
#include <opencc/opencc.h>
|
||||
// #endif
|
||||
// #include <opencc/SimpleConverter.hpp>
|
||||
#include "folding.hh"
|
||||
#include "gddebug.hh"
|
||||
#include "transliteration.hh"
|
||||
#include "utf8.hh"
|
||||
|
||||
namespace Chinese {
|
||||
namespace ChineseTranslit {
|
||||
|
||||
class CharacterConversionDictionary: public Transliteration::BaseTransliterationDictionary
|
||||
{
|
||||
|
@ -162,4 +159,4 @@ std::vector< sptr< Dictionary::Class > > makeDictionaries( Config::Chinese const
|
|||
return result;
|
||||
}
|
||||
|
||||
} // namespace Chinese
|
||||
} // namespace ChineseTranslit
|
|
@ -3,12 +3,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include "config.hh"
|
||||
#include "dictionary.hh"
|
||||
|
||||
/// Chinese character conversion support.
|
||||
namespace Chinese {
|
||||
namespace ChineseTranslit {
|
||||
|
||||
std::vector< sptr< Dictionary::Class > > makeDictionaries( Config::Chinese const & );
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
#include "customtransliteration.hh"
|
||||
#include "custom.hh"
|
||||
#include "dictionary.hh"
|
||||
#include <QCoreApplication>
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include "transliteration.hh"
|
||||
|
||||
// Support for Belarusian transliteration
|
|
@ -1,7 +1,7 @@
|
|||
/* This file is (c) 2010 Jennie Petoumenou <epetoumenou@gmail.com>
|
||||
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
||||
|
||||
#include "greektranslit.hh"
|
||||
#include "greek.hh"
|
||||
#include "transliteration.hh"
|
||||
#include <QCoreApplication>
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
#include "romaji.hh"
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace Romaji {
|
||||
namespace RomajiTranslit {
|
||||
|
||||
using std::vector;
|
||||
|
||||
class HepburnHiragana: public Transliteration::Table
|
||||
{
|
||||
|
@ -375,4 +377,4 @@ vector< sptr< Dictionary::Class > > makeDictionaries( Config::Romaji const & r )
|
|||
return result;
|
||||
}
|
||||
|
||||
} // namespace Romaji
|
||||
} // namespace RomajiTranslit
|
|
@ -4,12 +4,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "transliteration.hh"
|
||||
#include "config.hh"
|
||||
|
||||
/// Japanese romanization (Romaji) support.
|
||||
namespace Romaji {
|
||||
namespace RomajiTranslit {
|
||||
|
||||
using std::vector;
|
||||
|
||||
vector< sptr< Dictionary::Class > > makeDictionaries( Config::Romaji const & );
|
||||
} // namespace Romaji
|
||||
std::vector< sptr< Dictionary::Class > > makeDictionaries( Config::Romaji const & );
|
||||
} // namespace RomajiTranslit
|
|
@ -1,7 +1,7 @@
|
|||
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
|
||||
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
||||
|
||||
#include "russiantranslit.hh"
|
||||
#include "russian.hh"
|
||||
#include "transliteration.hh"
|
||||
#include <QCoreApplication>
|
||||
|
|
@ -81,6 +81,18 @@ public:
|
|||
/// Like the above, but uses its own local internal buffer and strips newlines by default.
|
||||
std::string gets( bool stripNl = true );
|
||||
|
||||
/// Read 32bit as uint, then reading the subsequent data into a container
|
||||
template< typename T >
|
||||
void readU32SizeAndData( T & container )
|
||||
{
|
||||
uint32_t size = 0;
|
||||
read( &size, sizeof( uint32_t ) );
|
||||
if ( size > 0 ) {
|
||||
container.resize( size );
|
||||
read( container.data(), size );
|
||||
}
|
||||
};
|
||||
|
||||
/// export QFile::readall
|
||||
QByteArray readall();
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace {
|
|||
|
||||
class WebSiteDictionary: public Dictionary::Class
|
||||
{
|
||||
string name;
|
||||
QByteArray urlTemplate;
|
||||
bool experimentalIframe;
|
||||
QString iconFilename;
|
||||
|
@ -38,12 +37,13 @@ public:
|
|||
bool inside_iframe_,
|
||||
QNetworkAccessManager & netMgr_ ):
|
||||
Dictionary::Class( id, vector< string >() ),
|
||||
name( name_ ),
|
||||
iconFilename( iconFilename_ ),
|
||||
inside_iframe( inside_iframe_ ),
|
||||
netMgr( netMgr_ ),
|
||||
experimentalIframe( false )
|
||||
{
|
||||
dictionaryName = name_;
|
||||
|
||||
if ( urlTemplate_.startsWith( "http://" ) || urlTemplate_.startsWith( "https://" ) ) {
|
||||
experimentalIframe = true;
|
||||
}
|
||||
|
@ -53,10 +53,6 @@ public:
|
|||
dictionaryDescription = urlTemplate_;
|
||||
}
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
map< Property, string > getProperties() noexcept override
|
||||
{
|
||||
|
@ -478,7 +474,8 @@ void WebSiteDictionary::loadIcon() noexcept
|
|||
loadIconFromFile( fInfo.absoluteFilePath(), true );
|
||||
}
|
||||
}
|
||||
if ( dictionaryIcon.isNull() && !loadIconFromText( ":/icons/webdict.svg", QString::fromStdString( name ) ) ) {
|
||||
if ( dictionaryIcon.isNull()
|
||||
&& !loadIconFromText( ":/icons/webdict.svg", QString::fromStdString( dictionaryName ) ) ) {
|
||||
dictionaryIcon = QIcon( ":/icons/webdict.svg" );
|
||||
}
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "chunkedstorage.hh"
|
||||
#include "dictzip.hh"
|
||||
#include "htmlescape.hh"
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
@ -17,29 +16,19 @@
|
|||
#include <wctype.h>
|
||||
#include <stdlib.h>
|
||||
#include "gddebug.hh"
|
||||
#include "wstring_qt.hh"
|
||||
#include "xdxf2html.hh"
|
||||
#include "ufile.hh"
|
||||
#include "dictzip.hh"
|
||||
#include "langcoder.hh"
|
||||
#include "indexedzip.hh"
|
||||
#include "filetype.hh"
|
||||
#include "tiff.hh"
|
||||
#include "ftshelpers.hh"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
|
||||
#include <QIODevice>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QTextDocument>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QPainter>
|
||||
#include <QRegularExpression>
|
||||
#include <QSemaphore>
|
||||
#include <QThreadPool>
|
||||
#include <QAtomicInt>
|
||||
|
||||
#include "utils.hh"
|
||||
|
@ -152,10 +141,6 @@ public:
|
|||
|
||||
~XdxfDictionary();
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return dictionaryName;
|
||||
}
|
||||
|
||||
map< Dictionary::Property, string > getProperties() noexcept override
|
||||
{
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include "zim.hh"
|
||||
#include "btreeidx.hh"
|
||||
|
||||
#include "folding.hh"
|
||||
#include "gddebug.hh"
|
||||
#include "utf8.hh"
|
||||
|
@ -17,24 +16,18 @@
|
|||
#include "ftshelpers.hh"
|
||||
#include "htmlescape.hh"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QFile>
|
||||
#include <QString>
|
||||
#include <QAtomicInt>
|
||||
#include <QImage>
|
||||
#include <QDir>
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <QtConcurrent>
|
||||
#include <QtConcurrentRun>
|
||||
#include <utility>
|
||||
#include "globalregex.hh"
|
||||
#include <zim/zim.h>
|
||||
|
@ -168,10 +161,6 @@ public:
|
|||
|
||||
~ZimDictionary() = default;
|
||||
|
||||
string getName() noexcept override
|
||||
{
|
||||
return dictionaryName;
|
||||
}
|
||||
|
||||
map< Dictionary::Property, string > getProperties() noexcept override
|
||||
{
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
|
||||
#include "utils.hh"
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QtConcurrent>
|
||||
|
||||
#include <QtConcurrentRun>
|
||||
#include "dict/dictionary.hh"
|
||||
#include "btreeidx.hh"
|
||||
#include "fulltextsearch.hh"
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* This file is (c) 2014 Abs62
|
||||
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
||||
|
||||
#include "fulltextsearch.hh"
|
||||
#include "ftshelpers.hh"
|
||||
#include "fulltextsearch.hh"
|
||||
#include "gddebug.hh"
|
||||
#include "help.hh"
|
||||
|
||||
#include <QThreadPool>
|
||||
#include <QMessageBox>
|
||||
#include "globalregex.hh"
|
||||
#include "help.hh"
|
||||
#include <QFutureSynchronizer>
|
||||
#include <QMessageBox>
|
||||
#include <QThreadPool>
|
||||
|
||||
namespace FTS {
|
||||
|
||||
|
|
|
@ -1,19 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QAction>
|
||||
#include <QList>
|
||||
#include <QTimer>
|
||||
#include <QThread>
|
||||
#include <QRunnable>
|
||||
#include <QSemaphore>
|
||||
#include <QStringList>
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "dict/dictionary.hh"
|
||||
#include "ui_fulltextsearch.h"
|
||||
|
||||
#include "config.hh"
|
||||
#include "instances.hh"
|
||||
#include "delegate.hh"
|
||||
|
|
|
@ -9,9 +9,6 @@
|
|||
#include <QLocale>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
#endif
|
||||
// Language codes
|
||||
|
||||
QMap< QString, GDLangCode > LangCoder::LANG_CODE_MAP = {
|
||||
|
@ -231,10 +228,10 @@ QString LangCoder::intToCode2( quint32 val )
|
|||
|
||||
quint32 LangCoder::findIdForLanguage( gd::wstring const & lang )
|
||||
{
|
||||
const auto langFolded = Utf8::encode( lang );
|
||||
const auto langFolded = QByteArrayView( Utf8::encode( lang ) );
|
||||
|
||||
for ( auto const & lc : LANG_CODE_MAP ) {
|
||||
if ( strcasecmp( langFolded.c_str(), lc.lang.c_str() ) == 0 ) {
|
||||
if ( langFolded.compare( lc.lang, Qt::CaseInsensitive ) == 0 ) {
|
||||
return code2toInt( lc.code2.toStdString().c_str() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#ifdef _MSC_VER
|
||||
#if !defined(strcasecmp)
|
||||
# define strcasecmp _strcmpi
|
||||
#endif
|
||||
#if !defined(strncasecmp)
|
||||
# define strncasecmp _strnicmp
|
||||
#endif
|
||||
|
||||
#ifndef _SSIZE_T
|
||||
#define _SSIZE_T
|
||||
#define ssize_t long
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
Reference in a new issue