r25061 by craig - Set minimum hunspell to 1.6, add version checking to hunspell finder,

scribus-commit scribus-commit at lists.scribus.net
Thu Mar 24 22:00:44 UTC 2022


Author: craig
Date: Thu Mar 24 22:00:44 2022
New Revision: 25061

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25061
Log:
Set minimum hunspell to 1.6, add version checking to hunspell finder,
remove incompatible code

Modified:
    trunk/Scribus/CMakeLists_Dependencies.cmake
    trunk/Scribus/cmake/modules/Findhunspell.cmake
    trunk/Scribus/config.h.cmake
    trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldict.cpp

Modified: trunk/Scribus/CMakeLists_Dependencies.cmake
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25061&path=/trunk/Scribus/CMakeLists_Dependencies.cmake
==============================================================================
--- trunk/Scribus/CMakeLists_Dependencies.cmake	(original)
+++ trunk/Scribus/CMakeLists_Dependencies.cmake	Thu Mar 24 22:00:44 2022
@@ -173,7 +173,7 @@
 #>>FontConfig
 
 #<<HUNSPELL for Spelling support
-find_package(hunspell REQUIRED)
+find_package(hunspell 1.6 QUIET REQUIRED)
 if (hunspell_FOUND)
 	message("hunspell Found OK ${hunspell_VERSION}")
 	set(HAVE_HUNSPELL ON)

Modified: trunk/Scribus/cmake/modules/Findhunspell.cmake
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25061&path=/trunk/Scribus/cmake/modules/Findhunspell.cmake
==============================================================================
--- trunk/Scribus/cmake/modules/Findhunspell.cmake	(original)
+++ trunk/Scribus/cmake/modules/Findhunspell.cmake	Thu Mar 24 22:00:44 2022
@@ -27,11 +27,20 @@
 
 string(REGEX MATCH "1\.([1-9])\.." hunspell_MATCH ${hunspell_VERSION})
 #set(hunspell_MINOR_VERSION ${CMAKE_MATCH_1})
-if(CMAKE_MATCH_1 GREATER 4)
+if(NOT hunspell_FIND_QUIETLY)
 	set(hunspell_NEWAPI ON)
 	message(STATUS "New hunspell API found. hunspell version ${hunspell_VERSION}")
 	message(STATUS "hunspell INCLUDE ${hunspell_INCLUDE_DIRS}")
 	message(STATUS "hunspell LIBRARIES ${hunspell_LIBRARIES}")
 endif()
 
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(hunspell
+	FOUND_VAR hunspell_FOUND
+	REQUIRED_VARS
+	    hunspell_LIBRARIES
+		hunspell_INCLUDE_DIRS
+	VERSION_VAR hunspell_VERSION
+)
+
 mark_as_advanced(hunspell_INCLUDE_DIR hunspell_LIBRARIES)

Modified: trunk/Scribus/config.h.cmake
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25061&path=/trunk/Scribus/config.h.cmake
==============================================================================
--- trunk/Scribus/config.h.cmake	(original)
+++ trunk/Scribus/config.h.cmake	Thu Mar 24 22:00:44 2022
@@ -34,6 +34,5 @@
 #cmakedefine HAVE_XML 1
 #cmakedefine HUNSPELL_VERSION "@HUNSPELL_VERSION@"
 #cmakedefine HAVE_HUNSPELL "@HAVE_HUNSPELL@"
-#cmakedefine HUNSPELL_NEWAPI "@HUNSPELL_NEWAPI@"
 #cmakedefine WITH_TESTS 1
 #cmakedefine WORDS_BIGENDIAN 1

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldict.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25061&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldict.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldict.cpp	(original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldict.cpp	Thu Mar 24 22:00:44 2022
@@ -36,27 +36,6 @@
 	m_hunspell = nullptr;
 }
 
-#ifndef HUNSPELL_NEWAPI
-int HunspellDict::spell(const QString& word)
-{
-	if (m_hunspell)
-		return m_hunspell->spell(m_codec->fromUnicode(word).constData());
-	return -1;
-}
-
-QStringList HunspellDict::suggest(const QString& word)
-{
-	char **sugglist = nullptr;
-	QStringList replacements;
-
-	int suggCount = m_hunspell->suggest(&sugglist, m_codec->fromUnicode(word).constData());
-	for (int j = 0; j < suggCount; ++j)
-		replacements << m_codec->toUnicode(sugglist[j]);
-	m_hunspell->free_list(&sugglist, suggCount);
-
-	return replacements;
-}
-#else
 int HunspellDict::spell(const QString& word)
 {
 	if (!m_hunspell)
@@ -77,4 +56,3 @@
 		replacements << m_codec->toUnicode(QByteArray::fromStdString(sugglist[i]));
 	return replacements;
 }
-#endif




More information about the scribus-commit mailing list