mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
found in dictionaries list widgets
This commit is contained in:
parent
bdb9561ec9
commit
09441a8b72
|
@ -290,12 +290,10 @@ QNetworkReply * ArticleNetworkAccessManager::createRequest( Operation op,
|
|||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= 0x050300 // Qt 5.3+
|
||||
|
||||
return op == QNetworkAccessManager::GetOperation
|
||||
|| op == QNetworkAccessManager::HeadOperation ? new AllowFrameReply( reply ) : reply;
|
||||
#else
|
||||
return reply;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
sptr< Dictionary::DataRequest > ArticleNetworkAccessManager::getResource(
|
||||
|
@ -550,11 +548,11 @@ void BlockedNetworkReply::finishedSlot()
|
|||
LocalSchemeHandler::LocalSchemeHandler(ArticleNetworkAccessManager& articleNetMgr):mManager(articleNetMgr){
|
||||
|
||||
}
|
||||
|
||||
void LocalSchemeHandler::requestStarted(QWebEngineUrlRequestJob *requestJob)
|
||||
{
|
||||
QUrl url = requestJob->requestUrl();
|
||||
|
||||
|
||||
QNetworkRequest request;
|
||||
request.setUrl( url );
|
||||
|
||||
|
|
|
@ -701,7 +701,21 @@ unsigned ArticleView::getGroup( QUrl const & url )
|
|||
QStringList ArticleView::getArticlesList()
|
||||
{
|
||||
//todo dictid
|
||||
return QStringList() << getCurrentArticle();
|
||||
QStringList dictList;
|
||||
for (unsigned i = 0; i < allDictionaries.size(); i++)
|
||||
{
|
||||
dictList.append( allDictionaries[i]->getId().c_str());
|
||||
|
||||
}
|
||||
|
||||
QStringList mutedDictionaries = getMutedDictionaries(Instances::Group::AllGroupId);
|
||||
for (int i=0;i<mutedDictionaries.size();i++)
|
||||
{
|
||||
dictList.removeOne(mutedDictionaries[i]);
|
||||
}
|
||||
|
||||
return dictList;
|
||||
|
||||
// return runJavaScriptVariableSafe( ui.definition->page(), "gdArticleContents" )
|
||||
// .toString().trimmed().split( ' ', QString::SkipEmptyParts );
|
||||
}
|
||||
|
@ -760,19 +774,7 @@ void ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
|
|||
|
||||
ui.definition->page()->runJavaScript(script);
|
||||
onJsActiveArticleChanged(id);
|
||||
// if ( getArticlesList().contains( id.mid( 7 ) ) )
|
||||
// {
|
||||
|
||||
// //gdArticleContents
|
||||
|
||||
// if ( moveToIt )
|
||||
// ui.definition->page()->runJavaScript( QString( "document.getElementById('%1').scrollIntoView(true);" ).arg( id ) );
|
||||
|
||||
// //todo
|
||||
// ui.definition->setProperty("currentArticle",id);
|
||||
// ui.definition->page()->runJavaScript(
|
||||
// QString( "gdMakeArticleActive( '%1' );" ).arg( id.mid( 7 ) ) );
|
||||
// }
|
||||
ui.definition->setProperty("currentArticle",id);
|
||||
}
|
||||
|
||||
|
@ -1074,6 +1076,43 @@ QString ArticleView::getMutedForGroup( unsigned group )
|
|||
return QString();
|
||||
}
|
||||
|
||||
QStringList ArticleView::getMutedDictionaries(unsigned group)
|
||||
{
|
||||
if (dictionaryBarToggled && dictionaryBarToggled->isChecked())
|
||||
{
|
||||
// Dictionary bar is active -- mute the muted dictionaries
|
||||
Instances::Group const* groupInstance = groups.findGroup(group);
|
||||
|
||||
// Find muted dictionaries for current group
|
||||
Config::Group const* grp = cfg.getGroup(group);
|
||||
Config::MutedDictionaries const* mutedDictionaries;
|
||||
if (group == Instances::Group::AllGroupId||!grp)
|
||||
mutedDictionaries = popupView ? &cfg.popupMutedDictionaries : &cfg.mutedDictionaries;
|
||||
else
|
||||
mutedDictionaries = grp ? (popupView ? &grp->popupMutedDictionaries : &grp->mutedDictionaries) : 0;
|
||||
if (!mutedDictionaries)
|
||||
return QStringList();
|
||||
|
||||
QStringList mutedDicts;
|
||||
|
||||
if (groupInstance)
|
||||
{
|
||||
for (unsigned x = 0; x < groupInstance->dictionaries.size(); ++x)
|
||||
{
|
||||
QString id = QString::fromStdString(
|
||||
groupInstance->dictionaries[x]->getId());
|
||||
|
||||
if (mutedDictionaries->contains(id))
|
||||
mutedDicts.append(id);
|
||||
}
|
||||
}
|
||||
|
||||
return mutedDicts;
|
||||
}
|
||||
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
void ArticleView::linkHovered ( const QString & link )
|
||||
{
|
||||
QString msg;
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.;winlibs\include;qtsingleapplication\src;D:\Qt\5.15.2\msvc2019_64\include;D:\Qt\5.15.2\msvc2019_64\include\QtWebEngineWidgets;D:\Qt\5.15.2\msvc2019_64\include\QtQuick;D:\Qt\5.15.2\msvc2019_64\include\QtMultimediaWidgets;D:\Qt\5.15.2\msvc2019_64\include\QtOpenGL;D:\Qt\5.15.2\msvc2019_64\include\QtPrintSupport;D:\Qt\5.15.2\msvc2019_64\include\QtSvg;D:\Qt\5.15.2\msvc2019_64\include\QtWebEngine;D:\Qt\5.15.2\msvc2019_64\include\QtQml;D:\Qt\5.15.2\msvc2019_64\include\QtMultimedia;D:\Qt\5.15.2\msvc2019_64\include\QtWidgets;D:\Qt\5.15.2\msvc2019_64\include\QtSensors;D:\Qt\5.15.2\msvc2019_64\include\QtNetwork;D:\Qt\5.15.2\msvc2019_64\include\QtXml;D:\Qt\5.15.2\msvc2019_64\include\QtGui;D:\Qt\5.15.2\msvc2019_64\include\QtANGLE;D:\Qt\5.15.2\msvc2019_64\include\QtCore;build;..\..\Qt\Qt5.1.0-msvc2012\5.1.0\msvc2012\mkspecs\win32-msvc2012;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.;winlibs\include;qtsingleapplication\src;D:\Qt\5.15.2\msvc2019_64\include\QtWebEngineCore;D:\Qt\5.15.2\msvc2019_64\include;D:\Qt\5.15.2\msvc2019_64\include\QtWebEngineWidgets;D:\Qt\5.15.2\msvc2019_64\include\QtQuick;D:\Qt\5.15.2\msvc2019_64\include\QtMultimediaWidgets;D:\Qt\5.15.2\msvc2019_64\include\QtOpenGL;D:\Qt\5.15.2\msvc2019_64\include\QtPrintSupport;D:\Qt\5.15.2\msvc2019_64\include\QtSvg;D:\Qt\5.15.2\msvc2019_64\include\QtWebEngine;D:\Qt\5.15.2\msvc2019_64\include\QtQml;D:\Qt\5.15.2\msvc2019_64\include\QtMultimedia;D:\Qt\5.15.2\msvc2019_64\include\QtWidgets;D:\Qt\5.15.2\msvc2019_64\include\QtSensors;D:\Qt\5.15.2\msvc2019_64\include\QtNetwork;D:\Qt\5.15.2\msvc2019_64\include\QtXml;D:\Qt\5.15.2\msvc2019_64\include\QtGui;D:\Qt\5.15.2\msvc2019_64\include\QtANGLE;D:\Qt\5.15.2\msvc2019_64\include\QtCore;build;..\..\Qt\Qt5.1.0-msvc2012\5.1.0\msvc2012\mkspecs\win32-msvc2012;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>-Zm200 -w34100 -w34189 %(AdditionalOptions)</AdditionalOptions>
|
||||
<BrowseInformation>false</BrowseInformation>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
|
|
Loading…
Reference in a new issue