Merge branch 'branch-qt-5.15' into dev

This commit is contained in:
xiaoyifang 2022-01-21 22:39:28 +08:00
commit fb420d54d5
11 changed files with 16 additions and 221 deletions

View file

@ -38,7 +38,7 @@ make sure that `qmake` is from Qt 5 installation. If not, you can try
finding it at a path like `/usr/lib/x86_64-linux-gnu/qt5/bin/qmake`.
Alternatively, you might want to load `goldendict.pro` file from within Qt Creator, especially on Windows.
Note: To compile with `libhunspell` older than 1.5 pass `"CONFIG+=old_hunspell"` to `qmake`.
Note: `libhunspell` version > 1.5.
### Building with Chinese conversion support
@ -104,9 +104,8 @@ To build GoldenDict with Visual Studio take one of next library packs and unpack
[GoldenDict_libs_VS2015_x86_v4.7z](http://www.mediafire.com/file/0a7ygy9rn99oevm/GoldenDict_libs_VS2015_x86_v4.7z) - for MS Visual Studio 2015, 32 bit
[GoldenDict_libs_VS2015_x64_v4.7z](http://www.mediafire.com/file/yoy2q8af0s1467m/GoldenDict_libs_VS2015_x64_v4.7z) - for MS Visual Studio 2015, 64 bit
To create project files for Visual Studio you can pass `"-tp vc"` option to `qmake`.
Note: In Qt 5.6.0 and later the `Webkit` module was removed from official release builds. You should to build it from sources to compile GoldenDict.
To build with Visual Studio.
check this [how to build with visual studio](howto/how%20to%20build%20and%20debug%20with%20VS2019.md)
## Installation

View file

@ -70,7 +70,12 @@ pre
/* Appears between the articles */
.gdarticleseparator
{
width: 100%;
display: inline-block;
clear: both;
}
.gddictnamebodyseparator
{
display: inline-block;
clear: both;
}

View file

@ -663,12 +663,8 @@ void ArticleView::setActiveArticleId(QString const & dictId){
QString ArticleView::getCurrentArticle()
{
QVariant v=ui.definition->property("currentArticle");
if ( v.type() == QVariant::String )
return v.toString();
else
return QString();
QString dictId=getActiveArticleId();
return scrollToFromDictionaryId( dictId );
}
void ArticleView::jumpToDictionary( QString const & id, bool force )
@ -702,7 +698,7 @@ void ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
void ArticleView::selectCurrentArticle()
{
ui.definition->page()->runJavaScript(
QString( "gdSelectArticle( '%1' );" ).arg( getActiveArticleId() ) );
QString( "gdSelectArticle( '%1' );var elem=document.getElementById('%2'); if(elem!=undefined){elem.scrollIntoView(true);}" ).arg( getActiveArticleId() ,getCurrentArticle()) );
}
bool ArticleView::isFramedArticle( QString const & ca )

View file

@ -580,10 +580,6 @@ CONFIG( chinese_conversion_support ) {
}
}
CONFIG( old_hunspell ) {
DEFINES += OLD_HUNSPELL_INTERFACE
}
RESOURCES += resources.qrc \
flags.qrc
TRANSLATIONS += locale/ru_RU.ts \

View file

@ -245,13 +245,7 @@ void HunspellArticleRequest::run()
return;
}
#ifdef OLD_HUNSPELL_INTERFACE
// We'd need to free this if it gets allocated and an exception shows up
char ** suggestions = 0;
int suggestionsCount = 0;
#else
vector< string > suggestions;
#endif
try
{
@ -268,24 +262,15 @@ void HunspellArticleRequest::run()
string encodedWord = encodeToHunspell( hunspell, trimmedWord );
#ifdef OLD_HUNSPELL_INTERFACE
if ( hunspell.spell( encodedWord.c_str() ) )
#else
if ( hunspell.spell( encodedWord ) )
#endif
{
// Good word -- no spelling suggestions then.
finish();
return;
}
#ifdef OLD_HUNSPELL_INTERFACE
suggestionsCount = hunspell.suggest( &suggestions, encodedWord.c_str() );
if ( suggestionsCount )
#else
suggestions = hunspell.suggest( encodedWord );
if ( !suggestions.empty() )
#endif
{
// There were some suggestions made for us. Make an appropriate output.
@ -294,15 +279,9 @@ void HunspellArticleRequest::run()
wstring lowercasedWord = Folding::applySimpleCaseOnly( word );
#ifdef OLD_HUNSPELL_INTERFACE
for( int x = 0; x < suggestionsCount; ++x )
{
wstring suggestion = decodeFromHunspell( hunspell, suggestions[ x ] );
#else
for( vector< string >::size_type x = 0; x < suggestions.size(); ++x )
{
wstring suggestion = decodeFromHunspell( hunspell, suggestions[ x ].c_str() );
#endif
if ( Folding::applySimpleCaseOnly( suggestion ) == lowercasedWord )
{
@ -312,9 +291,6 @@ void HunspellArticleRequest::run()
finish();
#ifdef OLD_HUNSPELL_INTERFACE
hunspell.free_list( &suggestions, suggestionsCount );
#endif
return;
}
string suggestionUtf8 = Utf8::encode( suggestion );
@ -323,11 +299,7 @@ void HunspellArticleRequest::run()
result += Html::escape( suggestionUtf8 ) + "\">";
result += Html::escape( suggestionUtf8 ) + "</a>";
#ifdef OLD_HUNSPELL_INTERFACE
if ( x != suggestionsCount - 1 )
#else
if ( x != suggestions.size() - 1 )
#endif
result += ", ";
}
@ -351,15 +323,6 @@ void HunspellArticleRequest::run()
gdWarning( "Hunspell: error: %s\n", e.what() );
}
#ifdef OLD_HUNSPELL_INTERFACE
if ( suggestions )
{
Mutex::Lock _( hunspellMutex );
hunspell.free_list( &suggestions, suggestionsCount );
}
#endif
finish();
}
@ -487,13 +450,7 @@ QVector< wstring > suggest( wstring & word, Mutex & hunspellMutex, Hunspell & hu
{
QVector< wstring > result;
#ifdef OLD_HUNSPELL_INTERFACE
// We'd need to free this if it gets allocated and an exception shows up
char ** suggestions = 0;
int suggestionsCount = 0;
#else
vector< string > suggestions;
#endif
try
{
@ -501,13 +458,8 @@ QVector< wstring > suggest( wstring & word, Mutex & hunspellMutex, Hunspell & hu
string encodedWord = encodeToHunspell( hunspell, word );
#ifdef OLD_HUNSPELL_INTERFACE
suggestionsCount = hunspell.analyze( &suggestions, encodedWord.c_str() );
if ( suggestionsCount )
#else
suggestions = hunspell.analyze( encodedWord );
if ( !suggestions.empty() )
#endif
{
// There were some suggestions made for us. Make an appropriate output.
@ -515,15 +467,9 @@ QVector< wstring > suggest( wstring & word, Mutex & hunspellMutex, Hunspell & hu
static QRegExp cutStem( "^\\s*st:(((\\s+(?!\\w{2}:)(?!-)(?!\\+))|\\S+)+)" );
#ifdef OLD_HUNSPELL_INTERFACE
for( int x = 0; x < suggestionsCount; ++x )
{
QString suggestion = gd::toQString( decodeFromHunspell( hunspell, suggestions[ x ] ) );
#else
for( vector< string >::size_type x = 0; x < suggestions.size(); ++x )
{
QString suggestion = gd::toQString( decodeFromHunspell( hunspell, suggestions[ x ].c_str() ) );
#endif
// Strip comments
int n = suggestion.indexOf( '#' );
@ -552,15 +498,6 @@ QVector< wstring > suggest( wstring & word, Mutex & hunspellMutex, Hunspell & hu
gdWarning( "Hunspell: charset conversion error, no processing's done: %s\n", e.what() );
}
#ifdef OLD_HUNSPELL_INTERFACE
if ( suggestions )
{
Mutex::Lock _( hunspellMutex );
hunspell.free_list( &suggestions, suggestionsCount );
}
#endif
return result;
}
@ -662,11 +599,7 @@ void HunspellPrefixMatchRequest::run()
string encodedWord = encodeToHunspell( hunspell, trimmedWord );
#ifdef OLD_HUNSPELL_INTERFACE
if ( hunspell.spell( encodedWord.c_str() ) )
#else
if ( hunspell.spell( encodedWord ) )
#endif
{
// Known word -- add it to the result

View file

@ -1,13 +0,0 @@
TEMPLATE=lib
CONFIG += qt dll qtsingleapplication-buildlib
mac:CONFIG += absolute_library_soname
win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release build_all
include(../src/qtsingleapplication.pri)
TARGET = $$QTSINGLEAPPLICATION_LIBNAME
DESTDIR = $$QTSINGLEAPPLICATION_LIBDIR
win32 {
DLLDESTDIR = $$[QT_INSTALL_BINS]
QMAKE_DISTCLEAN += $$[QT_INSTALL_BINS]\\$${QTSINGLEAPPLICATION_LIBNAME}.dll
}
target.path = $$DESTDIR
INSTALLS += target

View file

@ -1,6 +0,0 @@
exists(config.pri):infile(config.pri, SOLUTIONS_LIBRARY, yes): CONFIG += qtsingleapplication-uselib
TEMPLATE += fakelib
QTSINGLEAPPLICATION_LIBNAME = $$qtLibraryTarget(QtSolutions_SingleApplication-head)
TEMPLATE -= fakelib
QTSINGLEAPPLICATION_LIBDIR = $$PWD/lib
unix:qtsingleapplication-uselib:!qtsingleapplication-buildlib:QMAKE_RPATHDIR += $$QTSINGLEAPPLICATION_LIBDIR

View file

@ -1 +0,0 @@
SOLUTIONS_LIBRARY = yes

View file

@ -1,25 +0,0 @@
#!/bin/sh
if [ "x$1" != "x" -a "x$1" != "x-library" ]; then
echo "Usage: $0 [-library]"
echo
echo "-library: Build the component as a dynamic library (DLL). Default is to"
echo " include the component source code directly in the application."
echo
exit 0
fi
rm -f config.pri
if [ "x$1" = "x-library" ]; then
echo "Configuring to build this component as a dynamic library."
echo "SOLUTIONS_LIBRARY = yes" > config.pri
fi
echo
echo "This component is now configured."
echo
echo "To build the component library (if requested) and example(s),"
echo "run qmake and your make command."
echo
echo "To remove or reconfigure, run make distclean."
echo

View file

@ -1,79 +0,0 @@
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
:: Contact: http://www.qt-project.org/legal
::
:: This file is part of the Qt Solutions component.
::
:: $QT_BEGIN_LICENSE:BSD$
:: You may use this file under the terms of the BSD license as follows:
::
:: "Redistribution and use in source and binary forms, with or without
:: modification, are permitted provided that the following conditions are
:: met:
:: * Redistributions of source code must retain the above copyright
:: notice, this list of conditions and the following disclaimer.
:: * Redistributions in binary form must reproduce the above copyright
:: notice, this list of conditions and the following disclaimer in
:: the documentation and/or other materials provided with the
:: distribution.
:: * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
:: of its contributors may be used to endorse or promote products derived
:: from this software without specific prior written permission.
::
::
:: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
:: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
:: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
:: A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
:: OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
:: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
:: LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
:: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
:: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
:: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
:: OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
::
:: $QT_END_LICENSE$
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
rem
rem "Main"
rem
if not "%1"=="" (
if not "%1"=="-library" (
call :PrintUsage
goto EOF
)
)
if exist config.pri. del config.pri
if "%1"=="-library" (
echo Configuring to build this component as a dynamic library.
echo SOLUTIONS_LIBRARY = yes > config.pri
)
echo .
echo This component is now configured.
echo .
echo To build the component library (if requested) and example(s),
echo run qmake and your make or nmake command.
echo .
echo To remove or reconfigure, run make (nmake) distclean.
echo .
:PrintUsage
echo Usage: configure.bat [-library]
echo .
echo -library: Build the component as a dynamic library (DLL). Default is to
echo include the component source directly in the application.
echo A DLL may be preferable for technical or licensing (LGPL) reasons.
echo .
goto EOF
:EOF

View file

@ -1,17 +1,7 @@
include(../common.pri)
QT += core network widgets
CONFIG += c++11
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
QT *= network
greaterThan(QT_MAJOR_VERSION, 4): QT *= widgets
qtsingleapplication-uselib:!qtsingleapplication-buildlib {
LIBS += -L$$QTSINGLEAPPLICATION_LIBDIR -l$$QTSINGLEAPPLICATION_LIBNAME
} else {
SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp
HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h
}
win32 {
contains(TEMPLATE, lib):contains(CONFIG, shared):DEFINES += QT_QTSINGLEAPPLICATION_EXPORT
else:qtsingleapplication-uselib:DEFINES += QT_QTSINGLEAPPLICATION_IMPORT
}
SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp
HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h