mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-25 01:14:07 +00:00
Merge branch 'staged' into dev
This commit is contained in:
commit
57ae18a081
24
epwing.cc
24
epwing.cc
|
@ -173,8 +173,7 @@ private:
|
||||||
string & articleHeadword,
|
string & articleHeadword,
|
||||||
string & articleText,
|
string & articleText,
|
||||||
int & articlePage,
|
int & articlePage,
|
||||||
int & articleOffset,
|
int & articleOffset );
|
||||||
QString word = 0 );
|
|
||||||
|
|
||||||
void loadArticle( int articlePage, int articleOffset, string & articleHeadword,
|
void loadArticle( int articlePage, int articleOffset, string & articleHeadword,
|
||||||
string & articleText );
|
string & articleText );
|
||||||
|
@ -287,16 +286,8 @@ void EpwingDictionary::removeDirectory( QString const & directory )
|
||||||
dir.rmdir( directory );
|
dir.rmdir( directory );
|
||||||
}
|
}
|
||||||
|
|
||||||
void EpwingDictionary::loadArticle( quint32 address,
|
void EpwingDictionary::loadArticle(
|
||||||
|
quint32 address, string & articleHeadword, string & articleText, int & articlePage, int & articleOffset )
|
||||||
string & articleHeadword,
|
|
||||||
|
|
||||||
string & articleText,
|
|
||||||
|
|
||||||
int & articlePage,
|
|
||||||
|
|
||||||
int & articleOffset,
|
|
||||||
QString word)
|
|
||||||
{
|
{
|
||||||
vector< char > chunk;
|
vector< char > chunk;
|
||||||
|
|
||||||
|
@ -316,7 +307,7 @@ void EpwingDictionary::loadArticle( quint32 address,
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Mutex::Lock _( eBook.getLibMutex() );
|
Mutex::Lock _( eBook.getLibMutex() );
|
||||||
eBook.getArticle( headword, text, articlePage, articleOffset, false, word );
|
eBook.getArticle( headword, text, articlePage, articleOffset, false);
|
||||||
}
|
}
|
||||||
catch( std::exception & e )
|
catch( std::exception & e )
|
||||||
{
|
{
|
||||||
|
@ -531,15 +522,10 @@ void EpwingArticleRequest::run()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dict.loadArticle( chain[ x ].articleOffset,
|
dict.loadArticle( chain[ x ].articleOffset,
|
||||||
|
|
||||||
headword,
|
headword,
|
||||||
|
|
||||||
articleText,
|
articleText,
|
||||||
|
|
||||||
articlePage,
|
articlePage,
|
||||||
|
articleOffset );
|
||||||
articleOffset,
|
|
||||||
gd::toQString(word) );
|
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1032,6 +1032,9 @@ void EpwingBook::fixHeadword( QString & headword )
|
||||||
|
|
||||||
headword.remove( QChar( 0x30FB ) ); // Used in Japan transcription
|
headword.remove( QChar( 0x30FB ) ); // Used in Japan transcription
|
||||||
|
|
||||||
|
//replace any unicode Number ,Symbol ,Punctuation ,Mark character to whitespace
|
||||||
|
headword.replace( QRegularExpression( "[\\p{N}\\p{S}\\p{P}\\p{M}]" ), " " );
|
||||||
|
|
||||||
//if( isHeadwordCorrect( headword) )
|
//if( isHeadwordCorrect( headword) )
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
|
@ -1046,7 +1049,7 @@ void EpwingBook::fixHeadword( QString & headword )
|
||||||
//}
|
//}
|
||||||
|
|
||||||
gd::wstring folded = Folding::applyPunctOnly( gd::toWString( fixed ) );
|
gd::wstring folded = Folding::applyPunctOnly( gd::toWString( fixed ) );
|
||||||
fixed = gd::toQString( folded );
|
//fixed = gd::toQString( folded );
|
||||||
|
|
||||||
//if( isHeadwordCorrect( fixed ) )
|
//if( isHeadwordCorrect( fixed ) )
|
||||||
//{
|
//{
|
||||||
|
@ -1073,7 +1076,7 @@ void EpwingBook::fixHeadword( QString & headword )
|
||||||
}
|
}
|
||||||
|
|
||||||
void EpwingBook::getArticle( QString & headword, QString & articleText,
|
void EpwingBook::getArticle( QString & headword, QString & articleText,
|
||||||
int page, int offset, bool text_only, QString word)
|
int page, int offset, bool text_only)
|
||||||
{
|
{
|
||||||
error_string.clear();
|
error_string.clear();
|
||||||
char buffer[ TextBufferSize + 1 ];
|
char buffer[ TextBufferSize + 1 ];
|
||||||
|
|
|
@ -195,7 +195,7 @@ public:
|
||||||
|
|
||||||
// Retrieve article from dictionary
|
// Retrieve article from dictionary
|
||||||
void getArticle( QString & headword, QString & articleText,
|
void getArticle( QString & headword, QString & articleText,
|
||||||
int page, int offset, bool text_only, QString word=0 );
|
int page, int offset, bool text_only );
|
||||||
|
|
||||||
const char * beginDecoration( unsigned int code );
|
const char * beginDecoration( unsigned int code );
|
||||||
const char * endDecoration( unsigned int code );
|
const char * endDecoration( unsigned int code );
|
||||||
|
|
|
@ -596,7 +596,7 @@ bool isPunct( wchar ch )
|
||||||
case 0xFF64: // HALFWIDTH IDEOGRAPHIC COMMA
|
case 0xFF64: // HALFWIDTH IDEOGRAPHIC COMMA
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return QChar::isPunct(ch)||QChar::isSymbol(ch);
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue