From 1e83df0a56f60772f2dd4b4d123f5a9e2aa6f19e Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 14 Apr 2024 21:59:10 +0200 Subject: [PATCH 1/3] Implemented solution for issue-1678 * Help index file name encodes KLayout version and Qt version * Help index file is gzip compressed to save space as many files are expected to accumulate now --- src/lay/lay/layHelpSource.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lay/lay/layHelpSource.cc b/src/lay/lay/layHelpSource.cc index 9edce626a..aa2b783cc 100644 --- a/src/lay/lay/layHelpSource.cc +++ b/src/lay/lay/layHelpSource.cc @@ -23,6 +23,7 @@ #include "layHelpSource.h" #include "layApplication.h" +#include "layVersion.h" #include "tlLog.h" #include "tlTimer.h" @@ -273,7 +274,8 @@ HelpSource::initialize_index () bool ok = false; - const QString help_index_cache_file = QString::fromUtf8 ("help-index.xml"); + QString help_index_cache_file = QString::fromUtf8 (tl::sprintf ("help-index-%s-qt%d.xml.gz", lay::Version::version (), int (QT_VERSION_MAJOR))); + std::string per_user_cache_file; if (! lay::ApplicationBase::instance ()->appdata_path ().empty ()) { per_user_cache_file = tl::to_string (QDir (tl::to_qstring (lay::ApplicationBase::instance ()->appdata_path ())).absoluteFilePath (help_index_cache_file)); @@ -341,7 +343,7 @@ HelpSource::produce_index_file (const std::string &path) try { - tl::OutputStream os (path, tl::OutputStream::OM_Plain); + tl::OutputStream os (path, tl::OutputStream::OM_Zlib); help_index_structure.write (os, *this); } catch (tl::Exception &ex) { From daa2df159ee08d06383636773c8981783f47a94c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 14 Apr 2024 23:54:10 +0200 Subject: [PATCH 2/3] Fixed a build issue on some Qt versions --- src/lay/lay/layHelpSource.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lay/lay/layHelpSource.cc b/src/lay/lay/layHelpSource.cc index aa2b783cc..ef77ad1e6 100644 --- a/src/lay/lay/layHelpSource.cc +++ b/src/lay/lay/layHelpSource.cc @@ -274,7 +274,7 @@ HelpSource::initialize_index () bool ok = false; - QString help_index_cache_file = QString::fromUtf8 (tl::sprintf ("help-index-%s-qt%d.xml.gz", lay::Version::version (), int (QT_VERSION_MAJOR))); + QString help_index_cache_file = tl::to_qstring (tl::sprintf ("help-index-%s-qt%d.xml.gz", lay::Version::version (), int (QT_VERSION_MAJOR))); std::string per_user_cache_file; if (! lay::ApplicationBase::instance ()->appdata_path ().empty ()) { From e3dc4e7310992758b3c51a6ba64de03a4df524ad Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 16 Apr 2024 21:50:30 +0200 Subject: [PATCH 3/3] Qt4 compatibility --- src/lay/lay/layHelpSource.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lay/lay/layHelpSource.cc b/src/lay/lay/layHelpSource.cc index ef77ad1e6..7f88f7352 100644 --- a/src/lay/lay/layHelpSource.cc +++ b/src/lay/lay/layHelpSource.cc @@ -274,7 +274,8 @@ HelpSource::initialize_index () bool ok = false; - QString help_index_cache_file = tl::to_qstring (tl::sprintf ("help-index-%s-qt%d.xml.gz", lay::Version::version (), int (QT_VERSION_MAJOR))); + int qt = int (QT_VERSION >> 16); + QString help_index_cache_file = tl::to_qstring (tl::sprintf ("help-index-%s-qt%d.xml.gz", lay::Version::version (), qt)); std::string per_user_cache_file; if (! lay::ApplicationBase::instance ()->appdata_path ().empty ()) {