- Update to 3.1.0

* Use Qt 6
- Add fix_compilation_against_sword_1_8_1.patch and
  fixed_grouping_serialization_qt5_compatibility.patch

OBS-URL: https://build.opensuse.org/package/show/Education/bibletime?expand=0&rev=71
This commit is contained in:
Cor Blom 2025-03-09 15:07:24 +00:00 committed by Git OBS Bridge
commit 5c0ef27dce
9 changed files with 794 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

3
bibletime-3.0.3.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:80e5e4ccb69a95201036442dd3f13dffcfcb0f001be1222ce7eefcb30fcc2692
size 1620012

3
bibletime-3.1.0.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cfd85a416cfbae467ad2687df98cd553af952aa02869954d33250bdcb4840280
size 1570636

2
bibletime-rpmlintrc Normal file
View File

@ -0,0 +1,2 @@
# Education Teaching is valid category
addFilter("invalid-desktopfile.*/usr/share/applications/bibletime.desktop")

432
bibletime.changes Normal file
View File

@ -0,0 +1,432 @@
-------------------------------------------------------------------
Sat Mar 8 19:21:08 UTC 2025 - Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
- Update to 3.1.0
* Use Qt 6
- Add fix_compilation_against_sword_1_8_1.patch and
fixed_grouping_serialization_qt5_compatibility.patch
-------------------------------------------------------------------
Fri Feb 23 11:05:12 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
- Align path for document installation between openSUSE versions.
-------------------------------------------------------------------
Sun May 15 19:45:28 UTC 2022 - Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
- Update to 3.0.3:
* Fixed license.html being installed twice
* Partially worked around a libsword bug which limited download durations to
10 seconds
* Fixed bug which made it impossible to active toolbar buttons using keyboard
* Fixed some out-of-bounds memory read
* Fixed a number of input parsing and output generation errors, including
invalid memory reads
* Fixed search scopes not being properly translated
* Fixed version information in installed metadata files
* Updated translations
-------------------------------------------------------------------
Mon Aug 30 20:16:11 UTC 2021 - Cor Blom <cornelis@solcon.nl>
- Update to 3.0.2:
* Fixed a build-error caused by an C++11 incompatibility (bug #332)
* Fixed copying of text disabled with Qt versions earlier than than
5.13 (bug #334)
* Fixed some undefined behavior and out-of-bounds memory errors
* Fixed missing documentation in Windows
* Updated translations
* Added ability to copy docs into build during install and packaging
-------------------------------------------------------------------
Sun Aug 8 19:12:41 UTC 2021 - Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fastmail.net>
- Update to 3.0.1:
* Improved tuning of scrolling speed.
* Improved handling of fonts to fix many bugs, including a switch to Qt's
native font chooser widget in settings dialog, because of many serious bugs
in our legacy implementation.
* Improved sample text in settings dialog.
* Improved behavior of the mag view to be more similar to pre-3.0 behavior.
* Increased maximum column count from 4 to 10.
* Removed the orphaned and broken tests for BibleTime.
* Updated translations, including a new user interface translations to
Japanese and Ukrainian, a new Handbook translation to Russian, and a new
Howto translation to Ukrainian.
* Fixed DisplayView.qml getting incorrectly installed under /usr/bin/ on some
platforms.
* Fixed some compatibility issues with different Qt versions.
* Fixed a crash when editing personal commentary.
* Fixed highlighting of selected text.
* Fixed dragging of links.
* Fixed modules rearranging themselves.
* Fixed logic related to clicking on verse numbers.
* Fixed custom font of first column being incorrectly applied to all columns.
* Fixed preview in settings dialog displaying text in red.
* Fixed lexicons not being displayed.
* Fixed drag and drop in mag view and search dialog.
* Fixed no text being displayed for some ThML modules.
* Fixed undefined behavior and crashes from opening menus to select works by
working around a broken QMenu interface (QTBUG-77273).
* Fixes to handling of languages, including a caching discrepancy which
caused some settings not being properly applied before restarting
BibleTime.
* Fixed saving of chapters not working properly.
* Fixed handling of nested tags for OSIS works.
* Fixes to handling of PageUp/PageDown keys when scrolling out of bounds.
Note that when BibleTime is compiled against Qt 5.9, one might still
experience a trivial glitch where only part of the module is displayed.
Pressing PageUp/PageDown again may help to work around this.
- Remove displayview.patch
-------------------------------------------------------------------
Sun Jun 27 16:03:12 UTC 2021 - Christophe Giboudeaux <christophe@krop.fr>
- Remove the unneeded QtWebKit build dependency.
-------------------------------------------------------------------
Fri Jan 15 17:21:57 UTC 2021 - Fabian Vogt <fabian@ritter-vogt.de>
- Add compatibility with qml-autoreqprov
-------------------------------------------------------------------
Sun Aug 30 19:45:45 UTC 2020 - Cor Blom <cornelis@solcon.nl>
- Update to 3.0:
Enhancements:
* Text windows now have continuous scrolling from the beginning
to end of a module. At the end of a chapter just keep scrolling
to see the next chapter.
* You don't have to open the Personal Commentary for writing. Edit
it in a normal text window or even when it is a parallel column in a text window.
* Automatic text scrolling up or down with variable speed and pause.
* Copy to clipboard by choosing the beginning and ending reference.
* A search filter was added in the "Install Works" page of the
Bookshelf Manager.
* You can select text from a single column when using parallel
texts in a window.
* Added a user interface to delete or create search indices.
* The first time the Bookshelf Manager is used in a session, the
remote libraries are updated.
* Improved popup menus and icons for module chooser buttons and
text window headers.
* Show module unlock information in about text when available.
* Improved unlocking of modules.
Bugs fixed:
* Locked Bible not unlocking properly.
* Place not being saved in Daily Devotional.
* Problems with MAG window references using hebrew modules OSHB
and OSMHB.
* Unable to create a search scope for deuterocanonical books.
* Searching with quotes not working.
* MAG windows Strongs references not working unless config
settings were saved.
- Add displayview.patch
-------------------------------------------------------------------
Mon Nov 18 23:15:31 UTC 2019 - Simon Lees <sflees@suse.de>
- %make_jobs is depricated replaced by %cmake_build
-------------------------------------------------------------------
Sun Sep 15 13:23:25 UTC 2019 - Cor Blom <cornelis@solcon.nl>
- Update desktop file categories
-------------------------------------------------------------------
Wed Sep 19 14:30:11 UTC 2018 - Jan Engelhardt <jengelh@inai.de>
- Trim bias from description.
-------------------------------------------------------------------
Mon Sep 17 20:48:13 UTC 2018 - Cor Blom <cornelis@solcon.nl>
- Update to 2.11.2:
* Updated translations.
* Improved compatibility with Qt 5.11 (including bug #140)
* Fixed crash when clicking on "full syntax" (bug #134)
* Fixed Mag not always working with Hebrew / Strongs (bug #132)
* Fixed BibleTime startup on some versions of Windows (bug #119)
* Fixed Bookshelf Wizard buttons not being translated (bug #131)
* Fixed application icon directory to match the FreeDesktop standard
* Fixed bug which prevented installing of works (bug #124)
-------------------------------------------------------------------
Thu Dec 7 08:13:10 UTC 2017 - mpluskal@suse.com
- Drop useless provides/obsoletes
- Use cmake macros
- Use source for url
-------------------------------------------------------------------
Tue Dec 5 21:30:36 UTC 2017 - cornelis@solcon.nl
- Update to 2.11.1:
* Details: https://github.com/bibletime/bibletime/releases
- Swith to Qt5
- Cleanup spec file: remove line for other distros.
-------------------------------------------------------------------
Wed Feb 1 09:59:34 UTC 2017 - adam.majer@suse.de
- use individual libboost-*-devel packages instead of boost-devel
-------------------------------------------------------------------
Wed Apr 8 12:09:48 UTC 2015 - dimstar@opensuse.org
- No longer package bibletime.xpm: there are perfectly good icons
inside the tarball (even in scalable svg format).
- Fix the installation location of the icon: ensure the real file
is located in /usr/share/icons/[..].
-------------------------------------------------------------------
Mon Jul 7 14:14:06 UTC 2014 - lars@linux-schulserver.de
- udpate to 2.10.1:
* Implemented support for localized module config entries.
* Fixed an OSIS rendering bug.
* Fixed some HTML rendering issues.
* Fixed key chooser bug in book windows.
* Fixed double loading of some settings.
* Fixed Text Filter settings not being saved.
* Various install manager bug fixes.
* Various other minor fixes and optimizations.
-------------------------------------------------------------------
Tue Dec 31 14:59:44 UTC 2013 - lars@linux-schulserver.de
- update to 2.10.0:
+ Enhancements:
++ Uses Sword library version 1.7.
++ Added Find context menu for search within each window. Matching
words are highlighted and navigated using next or previous buttons.
++ Added support for HTTP, HTTPS, SFTP transports in BibleTime.
++ Implemented saving of font family and size in HTML commentary editor.
+ Bugs fixed:
++ Fixed problem where certain alternate versification bibles did not
display old testament.
++ Fixed Windows Control Panel version was to be correct.
++ Fixed search analysis save dialog filters.
++ Fixed search analysis save asking for overwrite confirmation twice.
++ Optimized and enhanced search analysis to output proper XHTML.
++ Fixed widget ending up disabled after removing install source.
++ Mag Window uses current module if no default cross reference is set.
++ Fixed a bug in the HTML commentary editor which resulted in text
formatting from the cursor to be applied to the whole selection.
++ Allow comboxboxes on config dialog desk page to resize.
++ Fixed some lexicons never working.
++ Fixed high stack memory usage on indexing.
++ Fixed unexpected exception with encrypted modules.
++ Fixed application freeze during installation of works.
-------------------------------------------------------------------
Tue Jun 4 15:55:48 UTC 2013 - lars@linux-schulserver.de
- update to 2.9.2:
+ Fixed settings dialog tab contents not being translated
+ Fix crash when closing window with tab
+ Fix bug 14 - Headers displayed as plain text in some modules
+ Fix problem with text not displaying when using QtWebKit 2.3
+ added changes needed for Qt5
+ Fix multi-arch path issue in FindCLucene.cmake
- removed fix-movetoanchor-for-qt5.patch (upstream)
-------------------------------------------------------------------
Fri May 3 23:34:36 UTC 2013 - hrvoje.senjan@gmail.com
- Added fix-movetoanchor-for-qt5.patch, fixes non visible text when
used with libQtWebkit 2.3
-------------------------------------------------------------------
Sat Dec 15 23:59:15 UTC 2012 - lars@linux-schulserver.de
- specfile cleanup
- fix license to be in SPDX format
- fix build on Fedora and Mandriva
-------------------------------------------------------------------
Fri Dec 30 08:34:18 UTC 2011 - lars@linux-schulserver.de
- update to 2.9.1:
+ Fixed Portuguese translation not being included.
+ Updated British translation.
+ Updated handbooks.
- Notable changes since the 2.8 series:
+ Add close buttons to tabbed works windows.
+ Hovering over works in the bookshelf views shows tooltips.
+ Hovering over works in the bookshelf dock shows info in the mag view.
+ Add toolbar icons to toggle visibility of docking windows.
+ Switch off footnotes in display options.
+ Bible windows can have parallel commentaries.
-------------------------------------------------------------------
Sat Sep 10 18:14:47 UTC 2011 - lars@linux-schulserver.de
- update to 2.8.2:
+ Fixed bookshelf manager install page taking long to open.
+ Fix restoring from fullscreen to a maximized window.
+ Fixed Personal Commentary texts being saved to wrong
references.
+ Fixed an assert-crash caused by not catching indexing failures
properly.
-------------------------------------------------------------------
Sat Jan 29 19:29:24 UTC 2011 - lars@linux-schulserver.de
- update to 2.8.1:
+ Fixed a bug which caused many works to be incorrectly categorized
+ Fixed a Bookshelf Manager crash caused by installation sources
which provide invalid data
-------------------------------------------------------------------
Sat Dec 18 18:49:32 UTC 2010 - lars@linux-schulserver.de
- update to 2.8.0:
+ Redesigned and refactored the bookshelf manager
+ Implemented the Tip Of The Day dialog
+ Made BibleTime handle missing default template gracefully
+ Made the "Remove modules" confirmation dialog a bit prettier
+ Fixed a crash triggered by an assertion in legacy code
+ Fix main window toolbar key changer to save a modified entry
in Personal Commentary
-------------------------------------------------------------------
Thu Oct 21 07:29:39 UTC 2010 - lars@linux-schulserver.de
- update to 2.7.3:
+ Backported "Fixed invalid bibletimerc creation; removed unused
CResMgr::init_tr()." by Jaak Ristioja
+ Backported "Fix crash opening first window in manual arrangement
mode." by Gary Holmlund.
+ Backported "Fixed a bug that caused some users home directories
to be deleted" by Jaak Ristioja.
+ Backported "Save the "grouping" setting of the Bookshelf"
by Gary Holmlund.
-------------------------------------------------------------------
Fri Jul 9 21:49:08 UTC 2010 - lars@linux-schulserver.de
- update to 2.7:
+ Fix bug #2969498 : Resize bug in magnification area
+ Fix main window view menu so that shortcuts can be assigned
to them.
+ Modified retranslateUi to work correctly with the shortcut
editor
+ Add option to show toolbar on main window instead of
text windows
-------------------------------------------------------------------
Sun Mar 28 21:25:12 UTC 2010 - lars@linux-schulserver.de
- update to 2.6:
+ Fixed an issue causing data loss when closing the main window,
because open sub-windows were not properly queried for unsaved
changes.
+ Refactored the module unlocking GUI to provide more info on
failures and made opening a locked module also initiate the
unlocking procedure.
+ Fixed a bug that some display/filter settings were not applied
on startup
+ Add tabbed window arrangement mode
+ Fix problems with manual arrangement mode
+ Implemented a menu item and tool button for opening installed works
+ Refactored a couple of other dialogs to use the new bookshelf model.
This means they now also have search and grouping fields.
+ Refactored search dialog module chooser dialog
- removed all patches
-------------------------------------------------------------------
Sun Dec 20 19:08:44 UTC 2009 - lars@linux-schulserver.de
- update to 2.5:
+ improvements to the subwindow arrangement algorithms
++ many bugfixes
++ new window arrangement modes "Tile" and "Auto Tile"
+ new module selection header in the text windows
+ tons of bugfixes
+ many improvements to the windows port
+ improved debug mode of the application
+ improvements to build system
+ translation updates
+ Christmas splash screen and display template
-------------------------------------------------------------------
Sun Dec 13 15:47:03 UTC 2009 - lars@linux-schulserver.de
- update to 2.4:
+ many, many bugfixes
+ Improved search dialog
+ Added "get list of install sources from server" functionality
+ BibleTime can now open TEI modules
+ Added new feature called "Change location". It is a shortcut
(Ctrl-L) that changes the focus to the toolbar field for the
bible reference or book location.
This is like the Ctrl-L feature of FireFox.
+ Add shortcut page to config settings dialog
- fix build for fedora
-------------------------------------------------------------------
Thu Jul 23 15:01:08 CEST 2009 - lars@linux-schulserver.de
- update to 2.0.1:
+ Completed the port to QT. KDE is no longer required.
+ Use default browser instead of just konqueror or firefox.
+ Use docking windows instead of splitters for the left
side windows.
+ Add Czech translation
+ Add Hungarian Handbook translation
+ Fix drag/drop onto the display window
+ Fix clicking of links in the Mag Window
+ Fix problem causing Mag window to update when it should not
- obsolete bibletime-i18n and bibletime-devel
-------------------------------------------------------------------
Thu Jul 23 12:13:43 CEST 2009 - lars@linux-schulserver.de
- update to 1.7:
+ tons of bugfixes
+ Port to KDE4/QT4, reduced KDE dependency to a minimum
+ Command line options have changed (--help is out of date)
+ Configuration files have been moved to ~/.bibletime/
+ i18n of UI strings is now handled by QT
+ Massive code cleanups and internal refactoring
+ New bookshelf manager
+ New external communications interface DBUS (instead of DCOP)
+ many Bookshelf improvements
+ Corrections and enhancements to session management
+ Search dialog now has a history for the modules to search in
-------------------------------------------------------------------
Thu Jul 23 10:36:01 CEST 2009 - lars@linux-schulserver.de
- added virtual provides: sword-frontend
-------------------------------------------------------------------
Mon Dec 15 15:58:59 CET 2008 - lars@linux-schulserver.de
- fix gcc 4.3.2 issues
(bibletime-1.6.5.1-stringcompare.patch)
-------------------------------------------------------------------
Thu Jun 12 17:33:12 CEST 2008 - lars@linux-schulserver.de
- added
Recommends: sword-bible
Recommends: sword-commentary
-------------------------------------------------------------------
Mon Jun 9 20:23:56 CEST 2008 - lars@linux-schulserver.de
- update to 1.6.5.1:
+ bugfix release to build with current gcc
-------------------------------------------------------------------
Mon May 19 18:28:29 CEST 2008 - lars@linux-schulserver.de
- fix rpm groups
-------------------------------------------------------------------
Sun Dec 23 21:22:08 CET 2007 - lars@linux-schulserver.de
- initial version 1.6.5

107
bibletime.spec Normal file
View File

@ -0,0 +1,107 @@
#
# spec file for package bibletime
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2012-2014 Lars Vogdt
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# Internal QML import
%global __requires_exclude qmlimport\\(BibleTime.*
Name: bibletime
Version: 3.1.0
Release: 0
Summary: A Bible study tool
License: GPL-2.0-or-later
Group: Productivity/Scientific/Other
URL: http://www.bibletime.info/
Source0: https://github.com/bibletime/bibletime/releases/download/v%{version}/bibletime-%{version}.tar.xz
Source1: bibletime-rpmlintrc
# PATCH-FIX-UPSTREAM https://github.com/bibletime/bibletime/issues/498
Patch0: fix_compilation_against_sword_1_8_1.patch
# PATCH-FIX-UPSTREAM https://github.com/bibletime/bibletime/issues/497
Patch1: fixed_grouping_serialization_qt5_compatibility.patch
BuildRequires: cmake >= 3.12
BuildRequires: curl-devel
BuildRequires: fdupes
BuildRequires: pkgconfig
BuildRequires: update-desktop-files
BuildRequires: cmake(Qt6Core)
BuildRequires: cmake(Qt6Gui)
BuildRequires: cmake(Qt6LinguistTools)
BuildRequires: cmake(Qt6PrintSupport)
BuildRequires: cmake(Qt6Qml)
BuildRequires: cmake(Qt6Quick)
BuildRequires: cmake(Qt6QuickWidgets)
BuildRequires: cmake(Qt6Svg)
BuildRequires: cmake(Qt6Test)
BuildRequires: cmake(Qt6Widgets)
BuildRequires: cmake(Qt6Xml)
BuildRequires: pkgconfig(libclucene-core) >= 2.0
BuildRequires: pkgconfig(sword) >= 1.8.1
# Dependencies for building documentation
BuildRequires: docbook-xsl-stylesheets
BuildRequires: fop
BuildRequires: libxslt-tools
BuildRequires: po4a
Recommends: sword-bible
Recommends: sword-commentary
%if 0%{?suse_version} > 1325
BuildRequires: libboost_headers-devel
%else
BuildRequires: boost-devel
%endif
%description
BibleTime is a Bible study program.
The software uses the SWORD programming library to work with over 200 free
Bible texts, commentaries, dictionaries and books provided by the Crosswire
Bible Society.
BibleTime provides easy handling of digitalized texts (Bibles, commentaries and
lexicons) and powerful features to work with these texts (search in texts,
write own notes, save, print etc.).
%prep
%autosetup -p1
%build
%cmake_qt6 \
-DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name} \
-DBT_DOCBOOK_XSL_HTML_CHUNK_XSL=%{_datadir}/xml/docbook/stylesheet/nwalsh/current/html/chunk.xsl \
-DBT_DOCBOOK_XSL_PDF_DOCBOOK_XSL=%{_datadir}/xml/docbook/stylesheet/nwalsh/current/fo/docbook.xsl
%qt6_build
%install
%qt6_install
%fdupes -s %{buildroot}
%suse_update_desktop_file -r %{buildroot}%{_datadir}/applications/info.%{name}.BibleTime.desktop Education Humanities
%files
%doc README.md
%license LICENSE
%{_bindir}/bibletime
%{_datadir}/icons/*
%{_datadir}/applications/info.%{name}.BibleTime.desktop
%dir %{_datadir}/bibletime
%{_datadir}/bibletime/*
%dir %{_docdir}/bibletime
%{_docdir}/bibletime/*
%{_datadir}/metainfo/info.bibletime.BibleTime.metainfo.xml
%changelog

View File

@ -0,0 +1,48 @@
From 0be2c8854eba81b94dbf81289d57ec50ab2b6ca4 Mon Sep 17 00:00:00 2001
From: Jaak Ristioja <jaak@ristioja.ee>
Date: Sat, 8 Mar 2025 19:11:41 +0200
Subject: [PATCH] backend, BtInstallMgr: Fix compilation against Sword 1.8.1
The if constexpr body is type-checked regardless of whether the condition holds.
---
src/backend/btinstallmgr.cpp | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/backend/btinstallmgr.cpp b/src/backend/btinstallmgr.cpp
index 063ea2ff4..f6473ec04 100644
--- a/src/backend/btinstallmgr.cpp
+++ b/src/backend/btinstallmgr.cpp
@@ -51,13 +51,19 @@ inline int calculateIntPercentage(T done, T total) {
}
template <typename T, class = void>
-struct HasSetTimeoutMillis : std::false_type {};
+struct TrySetTimeoutMillis {
+ template <typename ... Args>
+ static void setTimeoutMillis(Args && ...) noexcept {}
+};
template <typename T>
-struct HasSetTimeoutMillis<T,
+struct TrySetTimeoutMillis<T,
std::void_t<decltype(std::declval<T &>().setTimeoutMillis(0))>>
- : std::true_type
-{};
+{
+ template <typename ... Args>
+ static void setTimeoutMillis(T & c, Args && ... args)
+ { c.setTimeoutMillis(std::forward<Args>(args)...); }
+};
} // anonymous namespace
@@ -71,8 +77,7 @@ BtInstallMgr::BtInstallMgr(QObject * parent)
, m_firstCallOfPreStatus(true)
{
setFTPPassive(true);
- if constexpr (HasSetTimeoutMillis<BtInstallMgr>::value)
- setTimeoutMillis(0);
+ TrySetTimeoutMillis<BtInstallMgr>::setTimeoutMillis(*this, 0);
}
BtInstallMgr::~BtInstallMgr() {

View File

@ -0,0 +1,175 @@
From 52fca59a99bf1bfec88945a1654b9760a5ea8eda Mon Sep 17 00:00:00 2001
From: Jaak Ristioja <jaak@ristioja.ee>
Date: Sat, 8 Mar 2025 00:05:20 +0200
Subject: [PATCH] backend, BtBookshelfTreeModel: Fixed Grouping serialization
Qt5 compatibility
The Qt6 API change the of the QList<T>::size() return type from int to qsizetype
broke our the serialization and deserialization logic. This was an oversight
during porting to Qt6, and a rather unpleasantly difficult one to fix, but
thanks God for His mercy! :)
---
.../bookshelfmodel/btbookshelftreemodel.cpp | 142 +++++++++++++++++-
1 file changed, 134 insertions(+), 8 deletions(-)
diff --git a/src/backend/bookshelfmodel/btbookshelftreemodel.cpp b/src/backend/bookshelfmodel/btbookshelftreemodel.cpp
index 6a62e646a..d310d1458 100644
--- a/src/backend/bookshelfmodel/btbookshelftreemodel.cpp
+++ b/src/backend/bookshelfmodel/btbookshelftreemodel.cpp
@@ -12,7 +12,9 @@
#include "btbookshelftreemodel.h"
+#include <QByteArray>
#include <QDataStream>
+#include <QDebug>
#include <QModelIndexList>
#include <QPair>
#include <QtGlobal>
@@ -627,14 +629,138 @@ QDataStream & operator <<(QDataStream & os,
QDataStream & operator >>(QDataStream & is,
BtBookshelfTreeModel::Grouping & o)
{
- decltype(o.list().size()) s;
- is >> s;
- decltype(o.m_list) newList;
- for (decltype(s) i = 0; i < s; i++) {
- std::underlying_type_t<BtBookshelfTreeModel::Group> g;
- is >> g;
- newList.append(static_cast<BtBookshelfTreeModel::Group>(g));
+ using Size = decltype(o.list().size());
+ Size size = -1; // -1 stands for invalid
+
+ // Due to a serialization bug in BibleTime the grouping size may have been
+ // serialized as an int on Qt5 or as qsizetype on Qt6. The complex logic
+ // which follows works around this issue by attempting to parse both cases.
+ // This is not entirely future proof, but good enough for the foreseeable
+ // future, assuming that Qt does not change too much and users upgrade
+ // relatively often enough.
+ using U = std::underlying_type_t<BtBookshelfTreeModel::Group>;
+ if constexpr (std::is_same_v<int, Size>) {
+ is >> size;
+ } else {
+ // If other strange platforms need to be supported, please let us know:
+ static_assert(sizeof(int) == 4, "Platform not supported");
+ static_assert(sizeof(Size) == 8, "Platform not supported");
+
+ // The following relies on Qt providing us a datastream which only
+ // contains the serialized value and an optional ')' at the end. See
+ // QSettingsPrivate::stringToVariant() in Qt 6.8.2 for details. Assuming
+ // this, and the facts that the size can only be 0, 1 or 2, and that the
+ // values can only be 0 or 1, makes it possible for us to deduce the
+ // width of the serialized size field.
+ static constexpr Size const maxReadSize =
+ sizeof(Size) + sizeof(U) * 2 + 2;
+ char buf[maxReadSize];
+ auto readSize = is.device()->peek(buf, maxReadSize);
+ if (readSize < maxReadSize) { // Assumptions about Qt must hold
+ if (buf[readSize - 1] == ')')
+ --readSize;
+ if (readSize == 4) { // 4 bytes can only fit an (int) size:
+ int s;
+ is >> s; // Consume (int)
+ if (s == 0) // The (int) size can only be 0.
+ size = 0;
+ } else if (readSize == 8) {
+ // 8 bytes can be either hold a (Size) size of value 0, or a
+ // (int) size of value 1 followed by an (int) value.
+ int s;
+ is >> s; // Consume (int)
+ if (s == 1) { // (int) size of value 1
+ size = s;
+ } else if (s == 0) { // (Size) size
+ is >> s; // Consume other (int) half of (Size) size
+ if (s == 0) // Both (int) halves must be 0 for (Size) 0
+ size = 0;
+ }
+ } else if (readSize == 12) {
+ // 12 bytes either holds a (Size) size of value 1 and a value,
+ // or an (int) size of value 2, and two values:
+ int s;
+ is >> s; // Consume (int)
+ if (s == 2) { // (int) size of value 2
+ size = 2;
+ } else if (s >= 0 && s <= 1) { // First half is either 0 or 1
+ int s2;
+ is >> s2; // Consume other (int) half of (Size) size
+ if ((s2 ^ 0x1) == s) // Other half is the other way around
+ size = 1;
+ }
+ } else if (readSize == 16) { // must be (Size) 2 + (int) values
+ is >> size; // Consume (Size) size
+ if (size != 2) // The (Size) size can only by 2
+ size = -1;
+ } // else keep size as -1 (invalid)
+ }
}
- o.m_list = std::move(newList);
+
+ if (size >= 0 && size <= 2) {
+ decltype(o.m_list) newList;
+ for (; size; --size) {
+ U v;
+ is >> v;
+ if (v < 0 || v > 1)
+ break;
+ newList.append(static_cast<BtBookshelfTreeModel::Group>(v));
+ }
+ if (!size) {
+ o.m_list = std::move(newList);
+ return is;
+ }
+ }
+
+ qWarning() << "Failed to deserialize BtBookshelfTreeModel::Grouping";
+ is.setStatus(QDataStream::ReadCorruptData);
+ o.m_list.clear();
return is;
}
+
+#if 0
+namespace {
+
+template <typename SizeType>
+void testGroupingSerialization_(BtBookshelfTreeModel::Grouping const & expected)
+{
+ using U = std::underlying_type_t<BtBookshelfTreeModel::Group>;
+ auto const & list = expected.list();
+ QByteArray byteArray;
+ {
+ QBuffer buffer(&byteArray);
+ buffer.open(QIODevice::WriteOnly);
+ QDataStream os(&buffer);
+ SizeType s = list.size();
+ os << s;
+ for (auto const g : list)
+ os << static_cast<U>(g);
+ }
+ QBuffer buffer(&byteArray);
+ buffer.open(QIODevice::ReadOnly);
+ QDataStream is(&buffer);
+ BtBookshelfTreeModel::Grouping value;
+ is >> value;
+ if (value == expected) {
+ qInfo() << "SUCCESS" << Q_FUNC_INFO << byteArray << list;
+ } else {
+ qFatal() << "FAILURE" << Q_FUNC_INFO << byteArray << list;
+ }
+}
+
+void testGroupingSerialization(BtBookshelfTreeModel::Grouping const & expected){
+ testGroupingSerialization_<int>(expected);
+ testGroupingSerialization_<decltype(expected.list().size())>(expected);
+}
+
+} // anonymous namespace
+
+void testGroupingSerializations() {
+ using G = BtBookshelfTreeModel::Grouping;
+ testGroupingSerialization(G::NONE);
+ testGroupingSerialization(G::CAT);
+ testGroupingSerialization(G::CAT_LANG);
+ testGroupingSerialization(G::LANG);
+ testGroupingSerialization(G::LANG_CAT);
+}
+#endif