Merge branch 'staged' into opt/double-click-in-welcome-page

This commit is contained in:
xiaoyifang 2024-08-21 13:43:28 +08:00 committed by GitHub
commit dd48ba7d60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 75 additions and 30 deletions

View file

@ -263,8 +263,13 @@ public:
void setFTSParameters( Config::FullTextSearch const & fts ) override
{
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "AARD", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
if ( metadata_enable_fts.has_value() ) {
can_FTS = fts.enabled && metadata_enable_fts.value();
}
else {
can_FTS = fts.enabled && !fts.disabledTypes.contains( "AARD", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
}
}
protected:

View file

@ -219,8 +219,12 @@ public:
void setFTSParameters( Config::FullTextSearch const & fts ) override
{
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "BGL", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
if ( metadata_enable_fts.has_value() ) {
can_FTS = fts.enabled && metadata_enable_fts.value();
}
else
can_FTS = fts.enabled && !fts.disabledTypes.contains( "BGL", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
}
protected:

View file

@ -140,8 +140,12 @@ public:
void setFTSParameters( Config::FullTextSearch const & fts ) override
{
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "DICTD", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
if ( metadata_enable_fts.has_value() ) {
can_FTS = fts.enabled && metadata_enable_fts.value();
}
else
can_FTS = fts.enabled && !fts.disabledTypes.contains( "DICTD", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
}
};

View file

@ -315,8 +315,7 @@ protected:
QAtomicInt FTS_index_completed;
bool synonymSearchEnabled;
string dictionaryName;
//default to true;
bool enable_FTS = true;
std::optional< bool > metadata_enable_fts = std::nullopt;
// Load user icon if it exist
// By default set icon to empty
@ -376,7 +375,7 @@ public:
void setFtsEnable( bool _enable_FTS )
{
enable_FTS = _enable_FTS;
metadata_enable_fts = _enable_FTS;
}
/// Returns all the available properties, like the author's name, copyright,

View file

@ -235,9 +235,12 @@ public:
{
if ( ensureInitDone().size() )
return;
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "DSL", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
if ( metadata_enable_fts.has_value() ) {
can_FTS = fts.enabled && metadata_enable_fts.value();
}
else
can_FTS = fts.enabled && !fts.disabledTypes.contains( "DSL", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
}
uint32_t getFtsIndexVersion() override

View file

@ -154,9 +154,12 @@ public:
{
if ( ensureInitDone().size() )
return;
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "EPWING", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
if ( metadata_enable_fts.has_value() ) {
can_FTS = fts.enabled && metadata_enable_fts.value();
}
else
can_FTS = fts.enabled && !fts.disabledTypes.contains( "EPWING", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
}
static int japaneseWriting( gd::wchar ch );

View file

@ -408,8 +408,12 @@ public:
void setFTSParameters( Config::FullTextSearch const & fts ) override
{
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "GLS", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
if ( metadata_enable_fts.has_value() ) {
can_FTS = fts.enabled && metadata_enable_fts.value();
}
else
can_FTS = fts.enabled && !fts.disabledTypes.contains( "GLS", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
}
protected:

View file

@ -260,9 +260,12 @@ public:
{
if ( !ensureInitDone().empty() )
return;
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "MDICT", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
if ( metadata_enable_fts.has_value() ) {
can_FTS = fts.enabled && metadata_enable_fts.value();
}
else
can_FTS = fts.enabled && !fts.disabledTypes.contains( "MDICT", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
}
QString getCachedFileName( QString name );

View file

@ -177,8 +177,12 @@ public:
void setFTSParameters( Config::FullTextSearch const & fts ) override
{
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "SDICT", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
if ( metadata_enable_fts.has_value() ) {
can_FTS = fts.enabled && metadata_enable_fts.value();
}
else
can_FTS = fts.enabled && !fts.disabledTypes.contains( "SDICT", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
}
protected:

View file

@ -640,8 +640,12 @@ public:
void setFTSParameters( Config::FullTextSearch const & fts ) override
{
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "SLOB", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
if ( metadata_enable_fts.has_value() ) {
can_FTS = fts.enabled && metadata_enable_fts.value();
}
else
can_FTS = fts.enabled && !fts.disabledTypes.contains( "SLOB", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
}
uint32_t getFtsIndexVersion() override

View file

@ -200,8 +200,12 @@ public:
void setFTSParameters( Config::FullTextSearch const & fts ) override
{
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "STARDICT", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
if ( metadata_enable_fts.has_value() ) {
can_FTS = fts.enabled && metadata_enable_fts.value();
}
else
can_FTS = fts.enabled && !fts.disabledTypes.contains( "STARDICT", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
}
protected:

View file

@ -200,8 +200,12 @@ public:
void setFTSParameters( Config::FullTextSearch const & fts ) override
{
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "XDXF", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
if ( metadata_enable_fts.has_value() ) {
can_FTS = fts.enabled && metadata_enable_fts.value();
}
else
can_FTS = fts.enabled && !fts.disabledTypes.contains( "XDXF", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
}
uint32_t getFtsIndexVersion() override

View file

@ -221,8 +221,12 @@ public:
void setFTSParameters( Config::FullTextSearch const & fts ) override
{
can_FTS = enable_FTS && fts.enabled && !fts.disabledTypes.contains( "ZIM", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
if ( metadata_enable_fts.has_value() ) {
can_FTS = fts.enabled && metadata_enable_fts.value();
}
else
can_FTS = fts.enabled && !fts.disabledTypes.contains( "ZIM", Qt::CaseInsensitive )
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
}
protected: