bibletime/fix_compilation_against_sword_1_8_1.patch
Cor Blom 5c0ef27dce - 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
2025-03-09 15:07:24 +00:00

49 lines
1.5 KiB
Diff

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() {