diff --git a/article-style-st-babylon.css b/article-style-st-babylon.css index 9eff7175..73fbdf65 100644 --- a/article-style-st-babylon.css +++ b/article-style-st-babylon.css @@ -6,7 +6,6 @@ html body { background: white; - font-size: 13px; } .gdarticle diff --git a/article-style-st-lingvo.css b/article-style-st-lingvo.css index b2e47958..8da59179 100644 --- a/article-style-st-lingvo.css +++ b/article-style-st-lingvo.css @@ -40,7 +40,6 @@ a:hover .gddictname { - font-size: 13px; font-weight: normal; float: right; @@ -58,7 +57,6 @@ a:hover .gdactivearticle .gddictname { - font-size: 13px; font-weight: normal; float: right; diff --git a/article-style-st-modern.css b/article-style-st-modern.css index 1a72ccd7..e37e784b 100644 --- a/article-style-st-modern.css +++ b/article-style-st-modern.css @@ -87,7 +87,6 @@ a:hover .gdactivearticle .gddictname { - font-size: 13px; font-weight: normal; margin: -6px; margin-bottom: 5px; diff --git a/article-style.css b/article-style.css index e0e54be7..16ce7887 100644 --- a/article-style.css +++ b/article-style.css @@ -5,7 +5,6 @@ body { background: #fefdeb; font-family: Tahoma, Verdana, "Lucida Sans Unicode", sans-serif; - font-size: 13px; } /* This stylesheet is used to highligh current selection when doing a search. @@ -611,15 +610,15 @@ div.xdxf .epwing_narrow_font { - width: 7px; - height: 13px; + width: 0.5em; + height: 1em; vertical-align: -15%; } .epwing_wide_font { - width: 13px; - height: 13px; + width: 1em; + height: 1em; vertical-align: -15%; } @@ -1600,7 +1599,7 @@ in the bottom-right corner of the content area */ .mwiki #bodyContent a.external, .mwiki #bodyContent a[href ^="gopher://"] { background: url(external.png) center right no-repeat; - padding-right: 13px; + padding-right: 1em; } .mwiki #bodyContent a[href ^="https://"], .mwiki .link-https { @@ -1636,7 +1635,7 @@ in the bottom-right corner of the content area */ .mwiki #bodyContent a.external[href $=".wma"], .mwiki #bodyContent a.external[href $=".WMA"], .mwiki .link-audio { background: url("audio.png") center right no-repeat; - padding-right: 13px; + padding-right: 1em; } .mwiki #bodyContent a.external[href $=".ogm"], .mwiki #bodyContent a.external[href $=".OGM"], .mwiki #bodyContent a.external[href $=".avi"], .mwiki #bodyContent a.external[href $=".AVI"], @@ -1644,7 +1643,7 @@ in the bottom-right corner of the content area */ .mwiki #bodyContent a.external[href $=".mpg"], .mwiki #bodyContent a.external[href $=".MPG"], .mwiki .link-video { background: url("video.png") center right no-repeat; - padding-right: 13px; + padding-right: 1em; } .mwiki #bodyContent a.external[href $=".pdf"], .mwiki #bodyContent a.external[href $=".PDF"], .mwiki #bodyContent a.external[href *=".pdf#"], .mwiki #bodyContent a.external[href *=".PDF#"], diff --git a/articleview.cc b/articleview.cc index 06fba01b..635e03b6 100644 --- a/articleview.cc +++ b/articleview.cc @@ -2482,34 +2482,6 @@ void ArticleView::highlightFTSResults() { closeSearch(); - const QUrl & url = ui.definition->url(); - - bool ignoreDiacritics = Utils::Url::hasQueryItem( url, "ignore_diacritics" ); - - QString regString = Utils::Url::queryItemValue( url, "regexp" ); - if( ignoreDiacritics ) - regString = gd::toQString( Folding::applyDiacriticsOnly( gd::toWString( regString ) ) ); - else - regString = regString.remove( AccentMarkHandler::accentMark() ); - - QRegularExpression regexp; - if( Utils::Url::hasQueryItem( url, "wildcards" ) ) - regexp.setPattern( wildcardsToRegexp( regString ) ); - else - regexp.setPattern( regString ); - - QRegularExpression::PatternOptions patternOptions = - QRegularExpression::DotMatchesEverythingOption | QRegularExpression::UseUnicodePropertiesOption | - QRegularExpression::MultilineOption | QRegularExpression::InvertedGreedinessOption; - if( !Utils::Url::hasQueryItem( url, "matchcase" ) ) - patternOptions |= QRegularExpression::CaseInsensitiveOption; - regexp.setPatternOptions( patternOptions ); - - if( regexp.pattern().isEmpty() || !regexp.isValid() ) - return; - - sptr< AccentMarkHandler > marksHandler = ignoreDiacritics ? new DiacriticsHandler : new AccentMarkHandler; - // Clear any current selection if( ui.definition->selectedText().size() ) { @@ -2519,6 +2491,33 @@ void ArticleView::highlightFTSResults() ui.definition->page()->toPlainText( [ & ]( const QString pageText ) { + const QUrl & url = ui.definition->url(); + + bool ignoreDiacritics = Utils::Url::hasQueryItem( url, "ignore_diacritics" ); + + QString regString = Utils::Url::queryItemValue( url, "regexp" ); + if( ignoreDiacritics ) + regString = gd::toQString( Folding::applyDiacriticsOnly( gd::toWString( regString ) ) ); + else + regString = regString.remove( AccentMarkHandler::accentMark() ); + + QRegularExpression regexp; + if( Utils::Url::hasQueryItem( url, "wildcards" ) ) + regexp.setPattern( wildcardsToRegexp( regString ) ); + else + regexp.setPattern( regString ); + + QRegularExpression::PatternOptions patternOptions = + QRegularExpression::DotMatchesEverythingOption | QRegularExpression::UseUnicodePropertiesOption | + QRegularExpression::MultilineOption | QRegularExpression::InvertedGreedinessOption; + if( !Utils::Url::hasQueryItem( url, "matchcase" ) ) + patternOptions |= QRegularExpression::CaseInsensitiveOption; + regexp.setPatternOptions( patternOptions ); + + if( regexp.pattern().isEmpty() || !regexp.isValid() ) + return; + sptr< AccentMarkHandler > marksHandler = ignoreDiacritics ? new DiacriticsHandler : new AccentMarkHandler; + marksHandler->setText( pageText ); QRegularExpressionMatchIterator it = regexp.globalMatch( marksHandler->normalizedText() ); @@ -2547,7 +2546,7 @@ void ArticleView::highlightFTSResults() ftsSearchMatchCase = Utils::Url::hasQueryItem( url, "matchcase" ); - QWebEnginePage::FindFlags flags( 0 ); + QWebEnginePage::FindFlags flags( QWebEnginePage::FindBackward ); if( ftsSearchMatchCase ) flags |= QWebEnginePage::FindCaseSensitively; @@ -2758,21 +2757,16 @@ void ResourceToSaveHandler::downloadFinished() } } -ArticleViewAgent::ArticleViewAgent(QObject *parent) - : QObject{parent} +ArticleViewAgent::ArticleViewAgent( ArticleView * articleView ) : QObject( articleView ), articleView( articleView ) { - } -ArticleViewAgent::ArticleViewAgent(ArticleView *articleView) - : articleView(articleView) + +void ArticleViewAgent::onJsActiveArticleChanged( QString const & id ) { - + articleView->onJsActiveArticleChanged( id ); } -void ArticleViewAgent::onJsActiveArticleChanged(QString const & id){ - articleView->onJsActiveArticleChanged(id); -} - -void ArticleViewAgent::linkClickedInHtml(QUrl const & url){ - articleView->linkClickedInHtml(url); +void ArticleViewAgent::linkClickedInHtml( QUrl const & url ) +{ + articleView->linkClickedInHtml( url ); } diff --git a/articleview.hh b/articleview.hh index a7c501ab..487993c9 100644 --- a/articleview.hh +++ b/articleview.hh @@ -433,18 +433,17 @@ private: class ArticleViewAgent : public QObject { - Q_OBJECT - ArticleView* articleView; - public: - explicit ArticleViewAgent(QObject *parent = nullptr); - ArticleViewAgent(ArticleView* articleView); + Q_OBJECT + ArticleView * articleView; - signals: +public: + ArticleViewAgent( ArticleView * articleView ); - public slots: - Q_INVOKABLE void onJsActiveArticleChanged(QString const & id); - Q_INVOKABLE void linkClickedInHtml( QUrl const & ); +signals: +public slots: + Q_INVOKABLE void onJsActiveArticleChanged( QString const & id ); + Q_INVOKABLE void linkClickedInHtml( QUrl const & ); }; #endif diff --git a/dsl.cc b/dsl.cc index 410b8a9d..6991e053 100644 --- a/dsl.cc +++ b/dsl.cc @@ -345,29 +345,6 @@ DslDictionary::~DslDictionary() //////// DslDictionary::deferredInit() -class DslDeferredInitRunnable: public QRunnable -{ - DslDictionary & dictionary; - QSemaphore & hasExited; - -public: - - DslDeferredInitRunnable( DslDictionary & dictionary_, - QSemaphore & hasExited_ ): - dictionary( dictionary_ ), hasExited( hasExited_ ) - {} - - ~DslDeferredInitRunnable() - { - hasExited.release(); - } - - virtual void run() - { - dictionary.doDeferredInit(); - } -}; - void DslDictionary::deferredInit() { if ( !Utils::AtomicInt::loadAcquire( deferredInitDone ) ) @@ -379,9 +356,7 @@ void DslDictionary::deferredInit() if ( !deferredInitRunnableStarted ) { - QThreadPool::globalInstance()->start( - new DslDeferredInitRunnable( *this, deferredInitRunnableExited ), - -1000 ); + QThreadPool::globalInstance()->start( [ this ]() { this->doDeferredInit(); }, -1000 ); deferredInitRunnableStarted = true; } } diff --git a/editdictionaries.cc b/editdictionaries.cc index 0cce9843..79b17a32 100644 --- a/editdictionaries.cc +++ b/editdictionaries.cc @@ -88,14 +88,14 @@ void EditDictionaries::editGroup( unsigned id ) } } -void EditDictionaries::save() +void EditDictionaries::save( bool rebuildGroups ) { Config::Groups newGroups = groups->getGroups(); Config::Group newOrder = orderAndProps->getCurrentDictionaryOrder(); Config::Group newInactive = orderAndProps->getCurrentInactiveDictionaries(); - if ( isSourcesChanged() ) - acceptChangedSources( false ); + if( isSourcesChanged() ) + acceptChangedSources( rebuildGroups ); if ( origCfg.groups != newGroups || origCfg.dictionaryOrder != newOrder || origCfg.inactiveDictionaries != newInactive ) @@ -171,10 +171,7 @@ void EditDictionaries::rescanSources() void EditDictionaries::buttonBoxClicked( QAbstractButton * button ) { if (ui.buttons->buttonRole(button) == QDialogButtonBox::ApplyRole) { - if ( isSourcesChanged() ) { - acceptChangedSources( true ); - } - save(); + save( true ); } } diff --git a/editdictionaries.hh b/editdictionaries.hh index 9fa18e88..a2488d95 100644 --- a/editdictionaries.hh +++ b/editdictionaries.hh @@ -71,8 +71,9 @@ private: void acceptChangedSources( bool rebuildGroups ); - void save(); - + //the rebuildGroups was an initative,means to build the group if possible. + void save( bool rebuildGroups = false ); + private: Config::Class & cfg; diff --git a/mdx.cc b/mdx.cc index b19558f5..757de69f 100644 --- a/mdx.cc +++ b/mdx.cc @@ -315,8 +315,8 @@ public: virtual void setFTSParameters( Config::FullTextSearch const & fts ) { -// if( ensureInitDone().size() ) -// return; + if( ensureInitDone().size() ) + return; can_FTS = fts.enabled && !fts.disabledTypes.contains( "MDICT", Qt::CaseInsensitive ) diff --git a/preferences.cc b/preferences.cc index 46705bf2..357e652a 100644 --- a/preferences.cc +++ b/preferences.cc @@ -380,6 +380,8 @@ Config::Preferences Preferences::getPreferences() //bypass the first default if(ui.fontFamilies->currentIndex()>0) p.webFontFamily = ui.fontFamilies->currentText(); + else + p.webFontFamily = ""; p.helpLanguage = ui.helpLanguage->itemData(