On Tue, Dec 10, 2019 at 01:55:50PM -0500, John Scott wrote:
> Control: forwarded -1 https://bugs.kde.org/show_bug.cgi?id=401306
> 
> This appears to have been fixed upstream. There are a couple patches there.

Hi all,

I have been playing with this problem and with changes in upstream bug
report and I was finally able to make digikam 5.9.0 build in sid. 

I have prepared a personal build with those changes (it is minimally
tested, so is initially intended for my personal use), and I am attaching a
debdiff with the changes as well as individual patches under debian/patches
for clarity.

That personal build is apparently working for my preliminary tests and
is intended to fix both
  
  #922574 digikam: FTBFS against opencv 4
  #918478 digikam: ImageEditor window is blank when opened a second time

as well as a problem with libkf5calendar.

Steve, feel free to use these changes at your convenience. If needed I can
prepare a NMU, but I would appreciate some additional testing first.

Summary of the patches under debian/patches follow:

 * 0010_libopencv.h_update-for-opencv4-remove-obsolete-stuff.diff:
   Update libopencv.h.cmake.in for opencv4 and remove obsolete stuff.
   Based on upstream changes in https://bugs.kde.org/show_bug.cgi?id=401306.

 * 0011_facesengine_fix-openCV4-compilation.diff:
   Update for opencv4 (and some opencv3).
   Original patch by Gilles Caulier modified to deal with buster opencv
   (seems that it also needs to use cv::IMREAD_GRAYSCALE). Version should
   be fine tuned, but seems to work with both buster and sid.

 * 0020_calsettings.cpp_Fix-for-recent-libkf5calendarcore.diff:
   Fix calsettings.cpp for libkf5calendarcore-dev_4%3a19.08.3
   KCalCore namespace has been renamed to KCalendarCore. Just set a
   namespace alias to work around this.

   This will not work for buster libkf5calendarcore-dev_4%3a18.08.3.
   Comment that alias if a backport is needed.

 * 0030_fix-blank-imageeditor.patch:
   Fix ImageEditor window is blank when opened a second time (#918478)
   Changes borrowed from http://bugs.debian.org/918478

Please find attached above patches and the debdiff for my personal build.

Hope this helps

-- 
Agustin
From: Aguatin Martin <agmar...@debian.org>
Date: 20200117
Subject: Update libopencv.h.cmake.in for opencv4 and remove obsolete stuff

Based on changes by Gilles Caulier for recent digikam.

--- a/core/app/utils/libopencv.h.cmake.in
+++ b/core/app/utils/libopencv.h.cmake.in
@@ -49,35 +49,26 @@
 #define OPENCV_VERSION                         OPENCV_MAKE_VERSION(CV_MAJOR_VERSION,CV_MINOR_VERSION,CV_SUBMINOR_VERSION)
 #define OPENCV_TEST_VERSION(major,minor,patch) ( OPENCV_VERSION < OPENCV_MAKE_VERSION(major,minor,patch) )
 
-#if OPENCV_TEST_VERSION(2,5,0)
-#   include <opencv2/opencv.hpp>
-#   include <opencv2/legacy/compat.hpp>
-#   include <opencv/cvaux.h>
-#   include <opencv2/imgproc/imgproc.hpp>
-#else
-#   include <opencv/cv.h>
-#   include <opencv/cvaux.h>
-#   include <opencv/cxcore.h>
-#   include <opencv2/imgproc.hpp>
-#endif
+// Core module headers
 
-#if OPENCV_TEST_VERSION(3,0,0)
-#   include <opencv2/core/core.hpp>
-#   include <opencv2/core/internal.hpp>
-#   include <opencv2/contrib/contrib.hpp>
-#else
-#   include <opencv2/objdetect.hpp>
 #   include <opencv2/core.hpp>
 #   include <opencv2/core/utility.hpp>
 #   include <opencv2/core/persistence.hpp>
+#include <opencv2/core/core_c.h>
+#include <opencv2/core/types_c.h>
+
+// Object detection module headers
+
+#include <opencv2/objdetect.hpp>
+
+// Image codecs module headers
+
 #   include <opencv2/imgcodecs.hpp>
-#   include <opencv2/imgcodecs/imgcodecs_c.h>
-#endif
 
-// for old-style code
-#if OPENCV_VERSION <= OPENCV_MAKE_VERSION(2,4,99)
-#   include <opencv2/legacy/compat.hpp>
-#endif
+// Image processing module headers
+
+#include <opencv2/imgproc.hpp>
+#include <opencv2/imgproc/types_c.h>
 
 // Restore warnings
 #if !defined(__APPLE__) && defined(__GNUC__)
>From 7a5af66d8fc7ab8e78f05016eaf3e94de66951b3 Mon Sep 17 00:00:00 2001
From: Gilles Caulier <caulier.gil...@gmail.com>
Date: Fri, 15 Mar 2019 17:16:06 +0100
Subject: fix broken compilation with OpenCV4 in Test::FaceEngine CCBUGS:
 401306

Modified by Agustin martin to lower version in OPENCV test to (2,99,0)
Was (3,99,0), but buster opencv version is lower and already needs
this change.

---
 core/tests/facesengine/preprocess.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/core/tests/facesengine/preprocess.cpp
+++ b/core/tests/facesengine/preprocess.cpp
@@ -63,7 +63,13 @@ QList<cv::Mat> toImages(const QStringLis
     foreach (const QString& path, paths)
     {
         QByteArray s = path.toLocal8Bit();
-        images << cv::imread(std::string(s.data()), CV_LOAD_IMAGE_GRAYSCALE);
+        images << cv::imread(std::string(s.data()),
+#if OPENCV_TEST_VERSION(2,99,0)
+            CV_LOAD_IMAGE_GRAYSCALE
+#else
+            cv::IMREAD_GRAYSCALE
+#endif
+        );
     }
 
     return images;
--- a/core/libs/facesengine/detection/opencvfacedetector.cpp
+++ b/core/libs/facesengine/detection/opencvfacedetector.cpp
@@ -366,7 +366,7 @@ void OpenCVFaceDetector::updateParameter
      * unless in we want very high sensitivity at low speed
      */
     if (d->sensitivityVsSpecificity > 0.1 || d->speedVsAccuracy < 0.9)
-        d->primaryParams.flags = CV_HAAR_DO_CANNY_PRUNING;
+        d->primaryParams.flags = cv::CASCADE_DO_CANNY_PRUNING;
     else
         d->primaryParams.flags = 0;
 
From: Agustin Martin <agmar...@debian.org>
Date: 20200117
Subject: Fix calsettings.cpp for libkf5calendarcore-dev_4%3a19.08.3

KCalCore namespace has been renamed to KCalendarCore. Just set a
namespace alias to work around this.

This will not work for buster libkf5calendarcore-dev_4%3a18.08.3.
Comment that alias if a backport is needed.

--- a/core/utilities/assistants/calendar/print/calsettings.cpp
+++ b/core/utilities/assistants/calendar/print/calsettings.cpp
@@ -42,6 +42,10 @@
     // Qt includes
 
 #   include <QTimeZone>
+
+    // New libkf5calendarcore-dev (%3a19.08.3) uses KCalendarCore instead of KCalCore
+    // Comment line below for buster backports
+    namespace KCalCore = KCalendarCore;
 #endif // HAVE_KCALENDAR
 
 namespace Digikam
--- a/core/app/main/digikamapp.cpp
+++ b/core/app/main/digikamapp.cpp
@@ -497,7 +497,6 @@
         MetadataHubMngr::instance()->requestShutDown();
 
     DXmlGuiWindow::closeEvent(e);
-    e->accept();
 }
 
 void DigikamApp::autoDetect()
--- a/core/libs/widgets/mainview/dxmlguiwindow.cpp
+++ b/core/libs/widgets/mainview/dxmlguiwindow.cpp
@@ -209,10 +209,18 @@
 
 void DXmlGuiWindow::closeEvent(QCloseEvent* e)
 {
-    if(fullScreenIsActive())
+    if (fullScreenIsActive())
         slotToggleFullScreen(false);
 
+    if (!testAttribute(Qt::WA_DeleteOnClose))
+    {
+        setVisible(false);
+        e->ignore();
+        return;
+    }
+
     KXmlGuiWindow::closeEvent(e);
+    e->accept();
 }
 
 void DXmlGuiWindow::setFullScreenOptions(int options)
--- a/core/utilities/imageeditor/main/imagewindow.cpp
+++ b/core/utilities/imageeditor/main/imagewindow.cpp
@@ -254,14 +254,13 @@
 
     KSharedConfig::Ptr config = KSharedConfig::openConfig();
     KConfigGroup group        = config->group(configGroupName());
-    saveMainWindowSettings(group);
-    saveSettings();
 
     d->rightSideBar->setConfigGroup(KConfigGroup(&group, "Right Sidebar"));
     d->rightSideBar->saveState();
 
+    saveSettings();
+
     DXmlGuiWindow::closeEvent(e);
-    e->accept();
 }
 
 void ImageWindow::showEvent(QShowEvent*)
--- a/core/utilities/importui/main/importui.cpp
+++ b/core/utilities/importui/main/importui.cpp
@@ -964,11 +964,9 @@
 
 void ImportUI::closeEvent(QCloseEvent* e)
 {
-    DXmlGuiWindow::closeEvent(e);
-
     if (dialogClosed())
     {
-        e->accept();
+        DXmlGuiWindow::closeEvent(e);
     }
     else
     {
--- a/core/utilities/lighttable/lighttablewindow.cpp
+++ b/core/utilities/lighttable/lighttablewindow.cpp
@@ -249,7 +249,6 @@
     writeSettings();
 
     DXmlGuiWindow::closeEvent(e);
-    e->accept();
 }
 
 void LightTableWindow::showEvent(QShowEvent*)
--- a/core/utilities/queuemanager/main/queuemgrwindow.cpp
+++ b/core/utilities/queuemanager/main/queuemgrwindow.cpp
@@ -164,8 +164,8 @@
     }
 
     writeSettings();
+
     DXmlGuiWindow::closeEvent(e);
-    e->accept();
 }
 
 void QueueMgrWindow::setupUserArea()
diff -Nru digikam-5.9.0/debian/changelog digikam-5.9.0/debian/changelog
--- digikam-5.9.0/debian/changelog	2018-04-16 03:46:17.000000000 +0200
+++ digikam-5.9.0/debian/changelog	2020-01-17 15:13:13.000000000 +0100
@@ -1,3 +1,18 @@
+digikam (4:5.9.0-1.0~amd1) unstable; urgency=medium
+
+  * Personal build.
+  * Make digikam build with 20200117 sid (Closes: #922574).
+    - Update for openCV4.
+      + 0010_libopencv.h_update-for-opencv4-remove-obsolete-stuff.diff.
+      + 0011_facesengine_fix-openCV4-compilation.diff
+    - Update for libkf5calendarcore-dev_4%3a19.08.3
+      + 0020_calsettings.cpp_Fix-for-recent-libkf5calendarcore.diff
+  * Fix ImageEditor window is blank when opened a second time
+    (Closes: #918478).
+    - 0030_fix-blank-imageeditor.patch
+
+ -- Agustin Martin Domingo <agmar...@debian.org>  Fri, 17 Jan 2020 15:13:13 +0100
+
 digikam (4:5.9.0-1) unstable; urgency=medium
 
   * New upstream.
@@ -2127,4 +2142,3 @@
   * Initial Release.
 
  -- Renchi Raju <ren...@green.tam.uiuc.edu>  Fri, 15 Jul 2002 12:03:04 -0500
-
diff -Nru digikam-5.9.0/debian/patches/0010_libopencv.h_update-for-opencv4-remove-obsolete-stuff.diff digikam-5.9.0/debian/patches/0010_libopencv.h_update-for-opencv4-remove-obsolete-stuff.diff
--- digikam-5.9.0/debian/patches/0010_libopencv.h_update-for-opencv4-remove-obsolete-stuff.diff	1970-01-01 01:00:00.000000000 +0100
+++ digikam-5.9.0/debian/patches/0010_libopencv.h_update-for-opencv4-remove-obsolete-stuff.diff	2020-01-17 14:46:01.000000000 +0100
@@ -0,0 +1,58 @@
+From: Aguatin Martin <agmar...@debian.org>
+Date: 20200117
+Subject: Update libopencv.h.cmake.in for opencv4 and remove obsolete stuff
+
+Based on changes by Gilles Caulier for recent digikam.
+
+--- a/core/app/utils/libopencv.h.cmake.in
++++ b/core/app/utils/libopencv.h.cmake.in
+@@ -49,35 +49,26 @@
+ #define OPENCV_VERSION                         OPENCV_MAKE_VERSION(CV_MAJOR_VERSION,CV_MINOR_VERSION,CV_SUBMINOR_VERSION)
+ #define OPENCV_TEST_VERSION(major,minor,patch) ( OPENCV_VERSION < OPENCV_MAKE_VERSION(major,minor,patch) )
+ 
+-#if OPENCV_TEST_VERSION(2,5,0)
+-#   include <opencv2/opencv.hpp>
+-#   include <opencv2/legacy/compat.hpp>
+-#   include <opencv/cvaux.h>
+-#   include <opencv2/imgproc/imgproc.hpp>
+-#else
+-#   include <opencv/cv.h>
+-#   include <opencv/cvaux.h>
+-#   include <opencv/cxcore.h>
+-#   include <opencv2/imgproc.hpp>
+-#endif
++// Core module headers
+ 
+-#if OPENCV_TEST_VERSION(3,0,0)
+-#   include <opencv2/core/core.hpp>
+-#   include <opencv2/core/internal.hpp>
+-#   include <opencv2/contrib/contrib.hpp>
+-#else
+-#   include <opencv2/objdetect.hpp>
+ #   include <opencv2/core.hpp>
+ #   include <opencv2/core/utility.hpp>
+ #   include <opencv2/core/persistence.hpp>
++#include <opencv2/core/core_c.h>
++#include <opencv2/core/types_c.h>
++
++// Object detection module headers
++
++#include <opencv2/objdetect.hpp>
++
++// Image codecs module headers
++
+ #   include <opencv2/imgcodecs.hpp>
+-#   include <opencv2/imgcodecs/imgcodecs_c.h>
+-#endif
+ 
+-// for old-style code
+-#if OPENCV_VERSION <= OPENCV_MAKE_VERSION(2,4,99)
+-#   include <opencv2/legacy/compat.hpp>
+-#endif
++// Image processing module headers
++
++#include <opencv2/imgproc.hpp>
++#include <opencv2/imgproc/types_c.h>
+ 
+ // Restore warnings
+ #if !defined(__APPLE__) && defined(__GNUC__)
diff -Nru digikam-5.9.0/debian/patches/0011_facesengine_fix-openCV4-compilation.diff digikam-5.9.0/debian/patches/0011_facesengine_fix-openCV4-compilation.diff
--- digikam-5.9.0/debian/patches/0011_facesengine_fix-openCV4-compilation.diff	1970-01-01 01:00:00.000000000 +0100
+++ digikam-5.9.0/debian/patches/0011_facesengine_fix-openCV4-compilation.diff	2020-01-17 14:51:25.000000000 +0100
@@ -0,0 +1,42 @@
+From 7a5af66d8fc7ab8e78f05016eaf3e94de66951b3 Mon Sep 17 00:00:00 2001
+From: Gilles Caulier <caulier.gil...@gmail.com>
+Date: Fri, 15 Mar 2019 17:16:06 +0100
+Subject: fix broken compilation with OpenCV4 in Test::FaceEngine CCBUGS:
+ 401306
+
+Modified by Agustin martin to lower version in OPENCV test to (2,99,0)
+Was (3,99,0), but buster opencv version is lower and already needs
+this change.
+
+---
+ core/tests/facesengine/preprocess.cpp | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/core/tests/facesengine/preprocess.cpp
++++ b/core/tests/facesengine/preprocess.cpp
+@@ -63,7 +63,13 @@ QList<cv::Mat> toImages(const QStringLis
+     foreach (const QString& path, paths)
+     {
+         QByteArray s = path.toLocal8Bit();
+-        images << cv::imread(std::string(s.data()), CV_LOAD_IMAGE_GRAYSCALE);
++        images << cv::imread(std::string(s.data()),
++#if OPENCV_TEST_VERSION(2,99,0)
++            CV_LOAD_IMAGE_GRAYSCALE
++#else
++            cv::IMREAD_GRAYSCALE
++#endif
++        );
+     }
+ 
+     return images;
+--- a/core/libs/facesengine/detection/opencvfacedetector.cpp
++++ b/core/libs/facesengine/detection/opencvfacedetector.cpp
+@@ -366,7 +366,7 @@ void OpenCVFaceDetector::updateParameter
+      * unless in we want very high sensitivity at low speed
+      */
+     if (d->sensitivityVsSpecificity > 0.1 || d->speedVsAccuracy < 0.9)
+-        d->primaryParams.flags = CV_HAAR_DO_CANNY_PRUNING;
++        d->primaryParams.flags = cv::CASCADE_DO_CANNY_PRUNING;
+     else
+         d->primaryParams.flags = 0;
+ 
diff -Nru digikam-5.9.0/debian/patches/0020_calsettings.cpp_Fix-for-recent-libkf5calendarcore.diff digikam-5.9.0/debian/patches/0020_calsettings.cpp_Fix-for-recent-libkf5calendarcore.diff
--- digikam-5.9.0/debian/patches/0020_calsettings.cpp_Fix-for-recent-libkf5calendarcore.diff	1970-01-01 01:00:00.000000000 +0100
+++ digikam-5.9.0/debian/patches/0020_calsettings.cpp_Fix-for-recent-libkf5calendarcore.diff	2020-01-17 15:00:30.000000000 +0100
@@ -0,0 +1,23 @@
+From: Agustin Martin <agmar...@debian.org>
+Date: 20200117
+Subject: Fix calsettings.cpp for libkf5calendarcore-dev_4%3a19.08.3
+
+KCalCore namespace has been renamed to KCalendarCore. Just set a
+namespace alias to work around this.
+
+This will not work for buster libkf5calendarcore-dev_4%3a18.08.3.
+Comment that alias if a backport is needed.
+
+--- a/core/utilities/assistants/calendar/print/calsettings.cpp
++++ b/core/utilities/assistants/calendar/print/calsettings.cpp
+@@ -42,6 +42,10 @@
+     // Qt includes
+ 
+ #   include <QTimeZone>
++
++    // New libkf5calendarcore-dev (%3a19.08.3) uses KCalendarCore instead of KCalCore
++    // Comment line below for buster backports
++    namespace KCalCore = KCalendarCore;
+ #endif // HAVE_KCALENDAR
+ 
+ namespace Digikam
diff -Nru digikam-5.9.0/debian/patches/0030_fix-blank-imageeditor.patch digikam-5.9.0/debian/patches/0030_fix-blank-imageeditor.patch
--- digikam-5.9.0/debian/patches/0030_fix-blank-imageeditor.patch	1970-01-01 01:00:00.000000000 +0100
+++ digikam-5.9.0/debian/patches/0030_fix-blank-imageeditor.patch	2020-01-13 12:31:54.000000000 +0100
@@ -0,0 +1,88 @@
+--- a/core/app/main/digikamapp.cpp
++++ b/core/app/main/digikamapp.cpp
+@@ -497,7 +497,6 @@
+         MetadataHubMngr::instance()->requestShutDown();
+ 
+     DXmlGuiWindow::closeEvent(e);
+-    e->accept();
+ }
+ 
+ void DigikamApp::autoDetect()
+--- a/core/libs/widgets/mainview/dxmlguiwindow.cpp
++++ b/core/libs/widgets/mainview/dxmlguiwindow.cpp
+@@ -209,10 +209,18 @@
+ 
+ void DXmlGuiWindow::closeEvent(QCloseEvent* e)
+ {
+-    if(fullScreenIsActive())
++    if (fullScreenIsActive())
+         slotToggleFullScreen(false);
+ 
++    if (!testAttribute(Qt::WA_DeleteOnClose))
++    {
++        setVisible(false);
++        e->ignore();
++        return;
++    }
++
+     KXmlGuiWindow::closeEvent(e);
++    e->accept();
+ }
+ 
+ void DXmlGuiWindow::setFullScreenOptions(int options)
+--- a/core/utilities/imageeditor/main/imagewindow.cpp
++++ b/core/utilities/imageeditor/main/imagewindow.cpp
+@@ -254,14 +254,13 @@
+ 
+     KSharedConfig::Ptr config = KSharedConfig::openConfig();
+     KConfigGroup group        = config->group(configGroupName());
+-    saveMainWindowSettings(group);
+-    saveSettings();
+ 
+     d->rightSideBar->setConfigGroup(KConfigGroup(&group, "Right Sidebar"));
+     d->rightSideBar->saveState();
+ 
++    saveSettings();
++
+     DXmlGuiWindow::closeEvent(e);
+-    e->accept();
+ }
+ 
+ void ImageWindow::showEvent(QShowEvent*)
+--- a/core/utilities/importui/main/importui.cpp
++++ b/core/utilities/importui/main/importui.cpp
+@@ -964,11 +964,9 @@
+ 
+ void ImportUI::closeEvent(QCloseEvent* e)
+ {
+-    DXmlGuiWindow::closeEvent(e);
+-
+     if (dialogClosed())
+     {
+-        e->accept();
++        DXmlGuiWindow::closeEvent(e);
+     }
+     else
+     {
+--- a/core/utilities/lighttable/lighttablewindow.cpp
++++ b/core/utilities/lighttable/lighttablewindow.cpp
+@@ -249,7 +249,6 @@
+     writeSettings();
+ 
+     DXmlGuiWindow::closeEvent(e);
+-    e->accept();
+ }
+ 
+ void LightTableWindow::showEvent(QShowEvent*)
+--- a/core/utilities/queuemanager/main/queuemgrwindow.cpp
++++ b/core/utilities/queuemanager/main/queuemgrwindow.cpp
+@@ -164,8 +164,8 @@
+     }
+ 
+     writeSettings();
++
+     DXmlGuiWindow::closeEvent(e);
+-    e->accept();
+ }
+ 
+ void QueueMgrWindow::setupUserArea()
diff -Nru digikam-5.9.0/debian/patches/series digikam-5.9.0/debian/patches/series
--- digikam-5.9.0/debian/patches/series	2018-04-16 03:46:17.000000000 +0200
+++ digikam-5.9.0/debian/patches/series	2020-01-17 15:05:28.000000000 +0100
@@ -2,3 +2,7 @@
 cmake-add-quotes
 flickruploadlimits.patch
 0004-Downgrade-Exiv2-minimum-version-to-0.25.patch
+0010_libopencv.h_update-for-opencv4-remove-obsolete-stuff.diff
+0011_facesengine_fix-openCV4-compilation.diff
+0020_calsettings.cpp_Fix-for-recent-libkf5calendarcore.diff
+0030_fix-blank-imageeditor.patch

Reply via email to