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
|
body
|
||||||
{
|
{
|
||||||
background: white;
|
background: white;
|
||||||
font-size: 13px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.gdarticle
|
.gdarticle
|
||||||
|
|
|
@ -40,7 +40,6 @@ a:hover
|
||||||
|
|
||||||
.gddictname
|
.gddictname
|
||||||
{
|
{
|
||||||
font-size: 13px;
|
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
|
||||||
float: right;
|
float: right;
|
||||||
|
@ -58,7 +57,6 @@ a:hover
|
||||||
|
|
||||||
.gdactivearticle .gddictname
|
.gdactivearticle .gddictname
|
||||||
{
|
{
|
||||||
font-size: 13px;
|
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
|
||||||
float: right;
|
float: right;
|
||||||
|
|
|
@ -87,7 +87,6 @@ a:hover
|
||||||
|
|
||||||
.gdactivearticle .gddictname
|
.gdactivearticle .gddictname
|
||||||
{
|
{
|
||||||
font-size: 13px;
|
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
margin: -6px;
|
margin: -6px;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
|
|
|
@ -5,7 +5,6 @@ body
|
||||||
{
|
{
|
||||||
background: #fefdeb;
|
background: #fefdeb;
|
||||||
font-family: Tahoma, Verdana, "Lucida Sans Unicode", sans-serif;
|
font-family: Tahoma, Verdana, "Lucida Sans Unicode", sans-serif;
|
||||||
font-size: 13px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This stylesheet is used to highligh current selection when doing a search.
|
/* This stylesheet is used to highligh current selection when doing a search.
|
||||||
|
@ -611,15 +610,15 @@ div.xdxf
|
||||||
|
|
||||||
.epwing_narrow_font
|
.epwing_narrow_font
|
||||||
{
|
{
|
||||||
width: 7px;
|
width: 0.5em;
|
||||||
height: 13px;
|
height: 1em;
|
||||||
vertical-align: -15%;
|
vertical-align: -15%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.epwing_wide_font
|
.epwing_wide_font
|
||||||
{
|
{
|
||||||
width: 13px;
|
width: 1em;
|
||||||
height: 13px;
|
height: 1em;
|
||||||
vertical-align: -15%;
|
vertical-align: -15%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1600,7 +1599,7 @@ in the bottom-right corner of the content area */
|
||||||
.mwiki #bodyContent a.external,
|
.mwiki #bodyContent a.external,
|
||||||
.mwiki #bodyContent a[href ^="gopher://"] {
|
.mwiki #bodyContent a[href ^="gopher://"] {
|
||||||
background: url(external.png) center right no-repeat;
|
background: url(external.png) center right no-repeat;
|
||||||
padding-right: 13px;
|
padding-right: 1em;
|
||||||
}
|
}
|
||||||
.mwiki #bodyContent a[href ^="https://"],
|
.mwiki #bodyContent a[href ^="https://"],
|
||||||
.mwiki .link-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 #bodyContent a.external[href $=".wma"], .mwiki #bodyContent a.external[href $=".WMA"],
|
||||||
.mwiki .link-audio {
|
.mwiki .link-audio {
|
||||||
background: url("audio.png") center right no-repeat;
|
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 $=".ogm"], .mwiki #bodyContent a.external[href $=".OGM"],
|
||||||
.mwiki #bodyContent a.external[href $=".avi"], .mwiki #bodyContent a.external[href $=".AVI"],
|
.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 #bodyContent a.external[href $=".mpg"], .mwiki #bodyContent a.external[href $=".MPG"],
|
||||||
.mwiki .link-video {
|
.mwiki .link-video {
|
||||||
background: url("video.png") center right no-repeat;
|
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"],
|
||||||
.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();
|
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
|
// Clear any current selection
|
||||||
if( ui.definition->selectedText().size() )
|
if( ui.definition->selectedText().size() )
|
||||||
{
|
{
|
||||||
|
@ -2519,6 +2491,33 @@ void ArticleView::highlightFTSResults()
|
||||||
ui.definition->page()->toPlainText(
|
ui.definition->page()->toPlainText(
|
||||||
[ & ]( const QString pageText )
|
[ & ]( 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 );
|
marksHandler->setText( pageText );
|
||||||
|
|
||||||
QRegularExpressionMatchIterator it = regexp.globalMatch( marksHandler->normalizedText() );
|
QRegularExpressionMatchIterator it = regexp.globalMatch( marksHandler->normalizedText() );
|
||||||
|
@ -2547,7 +2546,7 @@ void ArticleView::highlightFTSResults()
|
||||||
|
|
||||||
ftsSearchMatchCase = Utils::Url::hasQueryItem( url, "matchcase" );
|
ftsSearchMatchCase = Utils::Url::hasQueryItem( url, "matchcase" );
|
||||||
|
|
||||||
QWebEnginePage::FindFlags flags( 0 );
|
QWebEnginePage::FindFlags flags( QWebEnginePage::FindBackward );
|
||||||
|
|
||||||
if( ftsSearchMatchCase )
|
if( ftsSearchMatchCase )
|
||||||
flags |= QWebEnginePage::FindCaseSensitively;
|
flags |= QWebEnginePage::FindCaseSensitively;
|
||||||
|
@ -2758,21 +2757,16 @@ void ResourceToSaveHandler::downloadFinished()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArticleViewAgent::ArticleViewAgent(QObject *parent)
|
ArticleViewAgent::ArticleViewAgent( ArticleView * articleView ) : QObject( articleView ), articleView( articleView )
|
||||||
: QObject{parent}
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
ArticleViewAgent::ArticleViewAgent(ArticleView *articleView)
|
|
||||||
: articleView(articleView)
|
void ArticleViewAgent::onJsActiveArticleChanged( QString const & id )
|
||||||
{
|
{
|
||||||
|
articleView->onJsActiveArticleChanged( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArticleViewAgent::onJsActiveArticleChanged(QString const & id){
|
void ArticleViewAgent::linkClickedInHtml( QUrl const & url )
|
||||||
articleView->onJsActiveArticleChanged(id);
|
{
|
||||||
}
|
articleView->linkClickedInHtml( url );
|
||||||
|
|
||||||
void ArticleViewAgent::linkClickedInHtml(QUrl const & url){
|
|
||||||
articleView->linkClickedInHtml(url);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -433,18 +433,17 @@ private:
|
||||||
|
|
||||||
class ArticleViewAgent : public QObject
|
class ArticleViewAgent : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
ArticleView* articleView;
|
ArticleView * articleView;
|
||||||
public:
|
|
||||||
explicit ArticleViewAgent(QObject *parent = nullptr);
|
|
||||||
ArticleViewAgent(ArticleView* articleView);
|
|
||||||
|
|
||||||
signals:
|
public:
|
||||||
|
ArticleViewAgent( ArticleView * articleView );
|
||||||
|
|
||||||
public slots:
|
signals:
|
||||||
Q_INVOKABLE void onJsActiveArticleChanged(QString const & id);
|
|
||||||
Q_INVOKABLE void linkClickedInHtml( QUrl const & );
|
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
Q_INVOKABLE void onJsActiveArticleChanged( QString const & id );
|
||||||
|
Q_INVOKABLE void linkClickedInHtml( QUrl const & );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
27
dsl.cc
27
dsl.cc
|
@ -345,29 +345,6 @@ DslDictionary::~DslDictionary()
|
||||||
|
|
||||||
//////// DslDictionary::deferredInit()
|
//////// 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()
|
void DslDictionary::deferredInit()
|
||||||
{
|
{
|
||||||
if ( !Utils::AtomicInt::loadAcquire( deferredInitDone ) )
|
if ( !Utils::AtomicInt::loadAcquire( deferredInitDone ) )
|
||||||
|
@ -379,9 +356,7 @@ void DslDictionary::deferredInit()
|
||||||
|
|
||||||
if ( !deferredInitRunnableStarted )
|
if ( !deferredInitRunnableStarted )
|
||||||
{
|
{
|
||||||
QThreadPool::globalInstance()->start(
|
QThreadPool::globalInstance()->start( [ this ]() { this->doDeferredInit(); }, -1000 );
|
||||||
new DslDeferredInitRunnable( *this, deferredInitRunnableExited ),
|
|
||||||
-1000 );
|
|
||||||
deferredInitRunnableStarted = true;
|
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::Groups newGroups = groups->getGroups();
|
||||||
Config::Group newOrder = orderAndProps->getCurrentDictionaryOrder();
|
Config::Group newOrder = orderAndProps->getCurrentDictionaryOrder();
|
||||||
Config::Group newInactive = orderAndProps->getCurrentInactiveDictionaries();
|
Config::Group newInactive = orderAndProps->getCurrentInactiveDictionaries();
|
||||||
|
|
||||||
if ( isSourcesChanged() )
|
if( isSourcesChanged() )
|
||||||
acceptChangedSources( false );
|
acceptChangedSources( rebuildGroups );
|
||||||
|
|
||||||
if ( origCfg.groups != newGroups || origCfg.dictionaryOrder != newOrder ||
|
if ( origCfg.groups != newGroups || origCfg.dictionaryOrder != newOrder ||
|
||||||
origCfg.inactiveDictionaries != newInactive )
|
origCfg.inactiveDictionaries != newInactive )
|
||||||
|
@ -171,10 +171,7 @@ void EditDictionaries::rescanSources()
|
||||||
void EditDictionaries::buttonBoxClicked( QAbstractButton * button )
|
void EditDictionaries::buttonBoxClicked( QAbstractButton * button )
|
||||||
{
|
{
|
||||||
if (ui.buttons->buttonRole(button) == QDialogButtonBox::ApplyRole) {
|
if (ui.buttons->buttonRole(button) == QDialogButtonBox::ApplyRole) {
|
||||||
if ( isSourcesChanged() ) {
|
save( true );
|
||||||
acceptChangedSources( true );
|
|
||||||
}
|
|
||||||
save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,8 @@ private:
|
||||||
|
|
||||||
void acceptChangedSources( bool rebuildGroups );
|
void acceptChangedSources( bool rebuildGroups );
|
||||||
|
|
||||||
void save();
|
//the rebuildGroups was an initative,means to build the group if possible.
|
||||||
|
void save( bool rebuildGroups = false );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
4
mdx.cc
4
mdx.cc
|
@ -315,8 +315,8 @@ public:
|
||||||
|
|
||||||
virtual void setFTSParameters( Config::FullTextSearch const & fts )
|
virtual void setFTSParameters( Config::FullTextSearch const & fts )
|
||||||
{
|
{
|
||||||
// if( ensureInitDone().size() )
|
if( ensureInitDone().size() )
|
||||||
// return;
|
return;
|
||||||
|
|
||||||
can_FTS = fts.enabled
|
can_FTS = fts.enabled
|
||||||
&& !fts.disabledTypes.contains( "MDICT", Qt::CaseInsensitive )
|
&& !fts.disabledTypes.contains( "MDICT", Qt::CaseInsensitive )
|
||||||
|
|
|
@ -380,6 +380,8 @@ Config::Preferences Preferences::getPreferences()
|
||||||
//bypass the first default
|
//bypass the first default
|
||||||
if(ui.fontFamilies->currentIndex()>0)
|
if(ui.fontFamilies->currentIndex()>0)
|
||||||
p.webFontFamily = ui.fontFamilies->currentText();
|
p.webFontFamily = ui.fontFamilies->currentText();
|
||||||
|
else
|
||||||
|
p.webFontFamily = "";
|
||||||
|
|
||||||
p.helpLanguage =
|
p.helpLanguage =
|
||||||
ui.helpLanguage->itemData(
|
ui.helpLanguage->itemData(
|
||||||
|
|
Loading…
Reference in a new issue