GSoC/2021/StatusReports/AnjaniKumar: Difference between revisions

From KDE Community Wiki
< GSoC‎ | 2021‎ | StatusReports
(Created page with "Content to be added soon...")
 
No edit summary
Line 1: Line 1:
Content to be added soon...
== digiKam: Port to Qt6 on Linux ==
 
digiKam is a professional photo management software. With the release of Qt6, digiKam needs to to adapt to many new improvements made possible with the new Qt6 framework such as code readability, better classes from Qt6 and new unit tests. Since digiKam's code-base is huge, a proper plan had to be agreed upon to achieve the goal in the GSoC timeline.
 
== Mentors ==
 
* Gilles Caulier
* Maik Qualmann
* Thanh Trung Dinh
 
== Links ==
 
* [https://summerofcode.withgoogle.com/projects/#5839448035557376 GSoC project link]
 
* [https://invent.kde.org/graphics/digikam digiKam repository]
 
* [https://invent.kde.org/graphics/digikam/-/tree/gsoc21-qt6-port My Work branch]
 
== Goals ==
 
* To build digiKam with current Qt6 stable release.
* Prepare digiKam so that it can be built with later Qt6 releases as well.
* Write new AppImage builder scripts
 
== Status Report ==
 
=== Community Bonding (May 18 - June 6) ===
 
We discussed the proposal again and made some strategies on the first task and how to test the new patches.The first task was to '''Port digiKam to Qt 5.15'''. This is a sophisticated task and involves a lot of sub-steps like:
 
* Identifying deprecated classes and class members/functions in Qt 5.15
* Identifying their uses in digiKam code and organizing them based on which class has most uses.
* Porting the identified code. Sometimes trivial, sometimes needs reviews from mentors.
* Writing new unit test if needed.
* Running tests and check the patched code at runtime with the digiKam stable release.
 
We planned a safe way to introduce patches safely in the code, otherwise regressions might be introduced. Here is a list that I made of deprecated code in digiKam and sorted it according to number of usages it had.
 
* [https://gist.github.com/anjanik012/c3285eb6e40546fbbeb5a3db5c511ace QTextStream::endl]
* [https://gist.github.com/anjanik012/a701333c390ab13f8a447f8bca8f946d QStringList]
* [https://gist.github.com/anjanik012/13d5978d4733ea2b627f414c68a1e2af qrand()]
* [https://gist.github.com/anjanik012/59513471c928a3efdf5d782ff0665b38 qsrand()]
* [https://gist.github.com/anjanik012/af2f63b403bd9c2fc581731b5b9186f0 QSet]
* [https://gist.github.com/anjanik012/8e6987c3efd5d7c11586f86d4c5e6c04 QImage]
* [https://gist.github.com/anjanik012/f033a6cdd52a9ddc379472322cce7d40 QWheelEvent]
* [https://gist.github.com/anjanik012/78be83e172ee99c92e597aa0f856e217 QMap]
* [https://gist.github.com/anjanik012/8af8c1d0f2aa392f37371ae02e1ca226 QHash]
* [https://gist.github.com/anjanik012/84352bd8d9f8ed84323d3b7ce6b75518 QDateTime]
* [https://gist.github.com/anjanik012/45060fc25cc81992826dbdcdb302a3f0 QButtonGroup]
* [https://gist.github.com/anjanik012/4304bac86a3911698ab725f707c31197 QPixmap]
* [https://gist.github.com/anjanik012/fb4149c2a51115897b4b99e8a52e4cbe QPrinter]
* [https://gist.github.com/anjanik012/3bbf02d0519f91204c6df100a9712e37 QProcess]
* [https://gist.github.com/anjanik012/e824c7eab9c30ac42fb5aa8ad96204ca QTabletEvent]
* [https://gist.github.com/anjanik012/9a00d471fdd77a664c6a3ded73060d03 QTimeLine]
* [https://gist.github.com/anjanik012/66f80b246c38d65c029cca8030cd5772 QMutex]
 
After identifying and listing the code that needed to be patched, I proposed two methods to approach the problem:
 
* We pick a source file in digiKam and make patches to it resolving all Qt deprecation warnings.
* We pick a Qt class from our list and identify it's use in all digiKam code and patch them.
 
The latter was safer as dealing with a lot of Qt classes in the same file might have led to regressions which were difficult to track down.
 
So I started early in this time only so that I don't get stuck in the coding period. I started picking Qt classes with few usages and started porting them. These were ''QMap'', ''QPrinter''. I faced some difficulty but my mentor's feedback helped me a lot and learnt quickly. More about this period in the blog post.
 
==== Related blog ====
 
https://anjani.live/posts/gsoc-community-bonding/
 
=== Coding Period (June 7 - July 12)===
 
==== Week 1 ====
 
I patched a lot of warnings mostly from Qt classes that had fewer warnings. I also wrote a new unit test for FilterAction class. This test was related to ''QHash'' warnings. The test checked if all keys are unique in a QHash in FilterAction class.
In a nutshell, there were 6693 lines of build warnings on master.With the patches on my branch these warnings reduced to 1830 lines. That’s a reduction of about 73%.
 
===== Related Patches =====
 
* [https://invent.kde.org/graphics/digikam/-/merge_requests/84 Fix QMap::unite() deprecation warning in presentation plugin ]
* [https://invent.kde.org/graphics/digikam/-/merge_requests/85 Fix QProcess deprecated warning in cameracontroller backend]
* [https://invent.kde.org/graphics/digikam/-/merge_requests/90 Fix QHash deprecated declarations in FilterAction class]
* [https://invent.kde.org/graphics/digikam/-/merge_requests/92 Fix QImage deprecated transformed() usages]
* [https://invent.kde.org/graphics/digikam/-/merge_requests/91 New Unit test: FilterAction Unique keys test for all filters]
 
===== Related Blog =====
 
https://anjani.live/posts/gsoc21-week-1/
 
==== Week 2 ====
 
Continuation of work from previous week. We also discussed about introducing STL algorithms in digiKam. Though it is huge task in its own and not related to my project so we suppressed the ''cppcheck'' warnings in report and moved on.
 
===== Related Patches =====
 
* [https://invent.kde.org/graphics/digikam/-/merge_requests/95 Fix QSet issues by using only QSet constructor to make QSet objects]
* [https://invent.kde.org/graphics/digikam/-/commit/b4d1e739efd3e50fe0a305462162431c72ebcd3f Version check for QButtonGroup]
* [https://invent.kde.org/graphics/digikam/-/commit/34ac47afbb07a5075ed79fe187cb074becd3b7d2 Version check for QWheelEvent]
* [https://invent.kde.org/graphics/digikam/-/commit/190039b8e2c45c6417d5d4a573a4c7d3ba246fef Version check for QLabel]
* [https://invent.kde.org/graphics/digikam/-/commit/8bc50e72916a34e9be8e11e3519dded203a3a9af Version check for QFlag]
* [https://invent.kde.org/graphics/digikam/-/commit/0a1fd2c60ec38707f0e2dfeabf6ebb45a01f9382 Macro for Qt::endl]
* [https://invent.kde.org/graphics/digikam/-/commit/280a47d9e7ced1d1a84adba8987cddaab9768e1f Macro for Qt::SplitBehavior]
 
===== Related Blog =====
 
https://anjani.live/posts/gsoc21-week-2/
 
==== Week 3 ====
 
During this week I patched the very old random number generators and ''qsrand()/qrand()'' in digiKam. As a result we were able to drop ''Boost::Random dependency''. I also ported ''Qt X11 Extras'' module code. A very detailed report is in the blog post.
 
===== Related patches =====
 
* [https://invent.kde.org/graphics/digikam/-/merge_requests/104 Remove qsrand]
* [https://invent.kde.org/graphics/digikam/-/merge_requests/105 Remove qrand]
* [https://invent.kde.org/graphics/digikam/-/merge_requests/106 Port class RandomNumberGenerator to drop boost::random]
* [https://invent.kde.org/graphics/digikam/-/merge_requests/107 Remove Qt X11Extras module]
* [https://invent.kde.org/graphics/digikam/-/merge_requests/108 Remove deprecated QMutex usage]
 
===== Related Blog =====
 
https://anjani.live/posts/gsoc21-week-3/
 
==== Week 4 ====
 
In this week, digiKam was fully ported to Qt 5.15. We also started discussion on now introducing Qt6 this week. I tried building it for the first time with Qt6, it failed(no surprises here). We ran into a problem that digiKam depends on Qt WebEngine which would only be stable in Qt 6.2 in September. We discussed about possible solutions. I tried building the alpha Qt 6.2 but it doesn't build.
 
===== Related Patches =====
 
* [https://invent.kde.org/graphics/digikam/-/merge_requests/110 Replace removed QDateTime constructor with new function]
* [https://invent.kde.org/graphics/digikam/-/merge_requests/111 Port dbjobsthread.cpp to not use deprecated const_iterator “+” operator]
* [https://invent.kde.org/graphics/digikam/-/merge_requests/112 Isolate rajce plugin]
 
==== Week 5 ====
 
I found the solution to problem from last week. Gilles also helped me to get started. This week I worked on porting the build system to Qt6. digiKam is huge and we have successfully branched the build process if no web module is found. A more detailed report is in the blog.
 
===== Related Patches =====
 
* [https://invent.kde.org/graphics/digikam/-/merge_requests/114 Dummy webwidget]
 
===== Related Blog =====
 
https://anjani.live/posts/gsoc21-week-5/
 
==== Current Status ====
 
I am working on completing the porting of build system. To be specific, porting build system of libO2 and trying to also integrate KF5. It should be complete in a few days.

Revision as of 14:04, 12 July 2021

digiKam: Port to Qt6 on Linux

digiKam is a professional photo management software. With the release of Qt6, digiKam needs to to adapt to many new improvements made possible with the new Qt6 framework such as code readability, better classes from Qt6 and new unit tests. Since digiKam's code-base is huge, a proper plan had to be agreed upon to achieve the goal in the GSoC timeline.

Mentors

  • Gilles Caulier
  • Maik Qualmann
  • Thanh Trung Dinh

Links

Goals

  • To build digiKam with current Qt6 stable release.
  • Prepare digiKam so that it can be built with later Qt6 releases as well.
  • Write new AppImage builder scripts

Status Report

Community Bonding (May 18 - June 6)

We discussed the proposal again and made some strategies on the first task and how to test the new patches.The first task was to Port digiKam to Qt 5.15. This is a sophisticated task and involves a lot of sub-steps like:

  • Identifying deprecated classes and class members/functions in Qt 5.15
  • Identifying their uses in digiKam code and organizing them based on which class has most uses.
  • Porting the identified code. Sometimes trivial, sometimes needs reviews from mentors.
  • Writing new unit test if needed.
  • Running tests and check the patched code at runtime with the digiKam stable release.

We planned a safe way to introduce patches safely in the code, otherwise regressions might be introduced. Here is a list that I made of deprecated code in digiKam and sorted it according to number of usages it had.

After identifying and listing the code that needed to be patched, I proposed two methods to approach the problem:

  • We pick a source file in digiKam and make patches to it resolving all Qt deprecation warnings.
  • We pick a Qt class from our list and identify it's use in all digiKam code and patch them.

The latter was safer as dealing with a lot of Qt classes in the same file might have led to regressions which were difficult to track down.

So I started early in this time only so that I don't get stuck in the coding period. I started picking Qt classes with few usages and started porting them. These were QMap, QPrinter. I faced some difficulty but my mentor's feedback helped me a lot and learnt quickly. More about this period in the blog post.

Related blog

https://anjani.live/posts/gsoc-community-bonding/

Coding Period (June 7 - July 12)

Week 1

I patched a lot of warnings mostly from Qt classes that had fewer warnings. I also wrote a new unit test for FilterAction class. This test was related to QHash warnings. The test checked if all keys are unique in a QHash in FilterAction class. In a nutshell, there were 6693 lines of build warnings on master.With the patches on my branch these warnings reduced to 1830 lines. That’s a reduction of about 73%.

Related Patches
Related Blog

https://anjani.live/posts/gsoc21-week-1/

Week 2

Continuation of work from previous week. We also discussed about introducing STL algorithms in digiKam. Though it is huge task in its own and not related to my project so we suppressed the cppcheck warnings in report and moved on.

Related Patches
Related Blog

https://anjani.live/posts/gsoc21-week-2/

Week 3

During this week I patched the very old random number generators and qsrand()/qrand() in digiKam. As a result we were able to drop Boost::Random dependency. I also ported Qt X11 Extras module code. A very detailed report is in the blog post.

Related patches
Related Blog

https://anjani.live/posts/gsoc21-week-3/

Week 4

In this week, digiKam was fully ported to Qt 5.15. We also started discussion on now introducing Qt6 this week. I tried building it for the first time with Qt6, it failed(no surprises here). We ran into a problem that digiKam depends on Qt WebEngine which would only be stable in Qt 6.2 in September. We discussed about possible solutions. I tried building the alpha Qt 6.2 but it doesn't build.

Related Patches

Week 5

I found the solution to problem from last week. Gilles also helped me to get started. This week I worked on porting the build system to Qt6. digiKam is huge and we have successfully branched the build process if no web module is found. A more detailed report is in the blog.

Related Patches
Related Blog

https://anjani.live/posts/gsoc21-week-5/

Current Status

I am working on completing the porting of build system. To be specific, porting build system of libO2 and trying to also integrate KF5. It should be complete in a few days.