mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 12:44:07 +00:00
Merge branch 'staged' into dev
This commit is contained in:
commit
1660b0d176
|
@ -6,7 +6,6 @@ html
|
|||
body
|
||||
{
|
||||
background: white;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.gdarticle
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -87,7 +87,6 @@ a:hover
|
|||
|
||||
.gdactivearticle .gddictname
|
||||
{
|
||||
font-size: 13px;
|
||||
font-weight: normal;
|
||||
margin: -6px;
|
||||
margin-bottom: 5px;
|
||||
|
|
|
@ -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#"],
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
27
dsl.cc
27
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
4
mdx.cc
4
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 )
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue