Digikam/CodingSprint2014: Difference between revisions

From KDE Community Wiki
m (395 revisions imported)
 
(10 intermediate revisions by one other user not shown)
Line 265: Line 265:
** KF5::I18n (translations).
** KF5::I18n (translations).
** KF5::Config (KConfigGroup used in widgets).
** KF5::Config (KConfigGroup used in widgets).
** KF5::KHtml (HTMLWidget is based on KHTMLPart).
* Needs Marble code from [https://projects.kde.org/projects/kde/kdeedu/marble/repository/show?rev=master master git branch] compiled with cmake option '''-DQT5BUILD=ON'''.
* Needs Marble code from [https://projects.kde.org/projects/kde/kdeedu/marble/repository/show?rev=kde-frameworks-5 kde-frameworks-5 git branch] to compile.
* <span style="background:salmon">TODO</span> We need to detect the Marble version somehow, to avoid linking KF5 build against Qt4 version of Marble. We still use FindMarble cmake script from KDE4. Marble need to be ported as pure KF5 frameworks component.
* <span style="background:salmon">TODO</span> We need to detect the Marble version somehow, to avoid linking KF5 build against Qt4 version of Marble. We still use FindMarble cmake script from KDE4. Marble need to be ported as pure KF5 frameworks component.
* <span style="background:salmon">TODO</span> KHTML based class HTMLWidget must be ported to Qt5::Webkit.
* <span style="background:lightgreen">DONE</span> KHTML based class HTMLWidget must be ported to Qt5::Webkit.
|-
|-
| '''libkgeomap/tests'''
| '''libkgeomap/tests'''
Line 455: Line 454:
| '''digiKam/libs'''
| '''digiKam/libs'''
| done
| done
| under progress
| done
| under progress
| done
| yes
| yes
| yes
| no
| Gilles, Laurent, Teemu, Alin
| Gilles, Laurent, Teemu, Alin, Veaceslav
|
|
* <span style="background:salmon">TODO</span> ProxyLineEdit is based on KLineEdit and must be ported to QLineEdit, but it use KLineEdit::clearButtonUsedSize() which do not exist with QLineEdit.
* <span style="background:salmon">TODO</span> ProxyLineEdit is based on KLineEdit and must be ported to QLineEdit, but it use KLineEdit::clearButtonUsedSize() which do not exist with QLineEdit.
* <span style="background:salmon">TODO</span> SearchTextBar is based on KLineEdit and must be ported to QLineEdit, but it use completion model class ModelCompletion  based on KCompletion Which must be ported to QCompleter.
* <span style="background:orange">UNCOMPLETE</span> SearchTextBar is based on KLineEdit and must be ported to QLineEdit, but it use completion model class ModelCompletion  based on KCompletion Which must be ported to QCompleter.
* <span style="background:lightgreen">DONE</span> ICCSettings : Q_WS__X11 have been removed with Qt5. X11 detection is performed by CMake and rules are set as definition into digikam_config.h
* <span style="background:lightgreen">DONE</span> ICCSettings : Q_WS__X11 have been removed with Qt5. X11 detection is performed by CMake and rules are set as definition into digikam_config.h
* <span style="background:salmon">TODO</span> Port LoadingCache from KDirWatch to QFileSystemWatcher.
* <span style="background:salmon">TODO</span> Port LoadingCache from KDirWatch to QFileSystemWatcher.
Line 469: Line 468:
| '''digiKam/app'''
| '''digiKam/app'''
| done
| done
| under progress
| done
| under progress
| done
| yes
| yes
| yes
| no
| Gilles, Laurent, Teemu, Alin
| Gilles, Laurent, Teemu, Alin
|
|
* <span style="background:salmon">TODO</span> AddTagsLineEdit is based on KLineEdit and must be ported to QLineEdit, but it use completion model class ModelCompletion based on KCompletion Which must be ported to QCompleter.
* <span style="background:orange">UNCOMPLETE</span> AddTagsLineEdit is based on KLineEdit and must be ported to QLineEdit, but it use completion model class ModelCompletion based on KCompletion Which must be ported to QCompleter.
* <span style="background:lightgreen">DONE</span> WelcomePageView ported from KHTMLPart to QWebView. KParts and KHtml dependencies removed from digiKam.
* <span style="background:lightgreen">DONE</span> WelcomePageView ported from KHTMLPart to QWebView. KParts and KHtml dependencies removed from digiKam.
* <span style="background:salmon">TODO</span> WelcomePageView HTML rendering is completly broken. Check if CSS and HTML code are conform. Note : this is not due to Qt5 port as KHTML done the same result.
* <span style="background:lightgreen">DONE</span> WelcomePageView HTML rendering is completly broken. Check if CSS and HTML code are conform. Note : this is not due to Qt5 port as KHTML done the same result. New layout introduced to host best users photo as background image. [https://www.flickr.com/photos/digikam/16628134940/ See example here for details].
* <span style="background:lightgreen">DONE</span> MediaPlayerView ported from Phonon to QMediaPlayer. Phonon dependency removed from digiKam. New CMake option add to enable/disable QMediaPlayer support.
* <span style="background:lightgreen">DONE</span> MediaPlayerView ported from Phonon to QMediaPlayer. Phonon dependency removed from digiKam. New CMake option add to enable/disable QMediaPlayer support.
* <span style="background:salmon">TODO</span> Port AlbumWatch from KDirWatch to QFileSystemWatcher
* <span style="background:salmon">TODO</span> Port AlbumWatch from KDirWatch to QFileSystemWatcher
Line 483: Line 482:
| '''digiKam/utilities'''
| '''digiKam/utilities'''
| done
| done
| under progress
| done
| under progress
| done
| yes
| yes
| yes
| no
| Gilles, Laurent, Teemu, Alin
| Gilles, Laurent, Teemu, Alin, Mohamed
|
|
* <span style="background:salmon">TODO</span> CameraController use KProcess and KMacroExpander and need to be ported to QProcess.
* <span style="background:salmon">TODO</span> CameraController use KProcess and KMacroExpander and need to be ported to QProcess.
Line 493: Line 492:
| '''digiKam/imageplugins'''
| '''digiKam/imageplugins'''
| done
| done
| under progress
| done
| under progress
| done
| yes
| yes
| yes
| no
| Gilles, Laurent, Teemu
| Gilles, Laurent, Teemu
|
|
Line 503: Line 502:
| '''digiKam/kioslave'''
| '''digiKam/kioslave'''
| done
| done
| under progress
| done
| under progress
| done
| yes
| yes
| yes
| no
| Gilles, Laurent, Teemu
| Gilles, Laurent, Teemu
|
|
Line 513: Line 512:
| '''digiKam/showfoto'''
| '''digiKam/showfoto'''
| done
| done
| under progress
| done
| under progress
| done
| yes
| yes
| yes
| no
| Gilles, Laurent, Teemu
| Gilles, Laurent, Teemu
|
|
Line 522: Line 521:
| '''digiKam/databaseserver'''
| '''digiKam/databaseserver'''
| done
| done
| under progress
| done
| under progress
| done
| yes
| yes
| yes
| no
| Gilles, Laurent, Teemu
| Gilles, Laurent, Teemu
|
|
Line 531: Line 530:
| '''digiKam/tests'''
| '''digiKam/tests'''
| done
| done
| under progress
| done
| under progress
| done
| yes
| no
| no
|
| Gilles, Laurent, Teemu
| Gilles, Laurent, Teemu
|
|
* <span style="background:salmon">TODO</span> 2 test tools do not link yet and are disable from compilation rules
|}
|}


Line 1,137: Line 1,137:
** clean-includes.sh (try to remove not used includes, not safe to 100%)
** clean-includes.sh (try to remove not used includes, not safe to 100%)
** port_to_autogenerate_export_header.sh (convert to new signal/slot API, not safe to 100%)
** port_to_autogenerate_export_header.sh (convert to new signal/slot API, not safe to 100%)
== digiKam Coding Sprint 2014  ==
digiKam is a mature open-source project (more than 14 years old now), which provide a digital asset management application oriented to photography post-production.
https://farm6.staticflickr.com/5055/5508779067_11c67b8a40.jpg
=== The event ===
It had been almost three years since the last time the [http://www.digikam.org digiKam] team had an opportunity to meet, talk, code and spend some time together. Gilles Caulier, the lead coordinator, was a victim of a serious car crash two years ago and was thus unable to organize or attend such an event. Now, we finally had an opportunity to meet again. After a lot of effort finding a suitable place and a date suitable for all developers to work together under optimal conditions, the digiKam coding sprint 2014 finally took place in [https://sprints.kde.org/sprint/248 Berlin, Germany], between November 14th and 16th 2014.
Before going through what happened during these days, we would like to sincerely thank [http://www.digia.com/en/Contact Digia], the company in charge of Qt development, for hosting the event, and also in particular Tobias Hunger, who welcomed us at Digia's offices located in the South of Berlin.
People participating the sprint (from the left to right) :
* [https://plus.google.com/+GillesCaulier Gilles Caulier] from France
* [https://www.facebook.com/marcel.wiesweg Marcel Wiesweg] from Germany
* [https://plus.google.com/u/0/105136119348505864693 Teemu Rytilahti] from Finland
* [https://plus.google.com/114906808699351374523 Veaceslav Munteanu] from Republic of Moldova
* [https://plus.google.com/u/0/100157321534338890446 Shourya Singh Gupta] from India
* [https://plus.google.com/u/0/+DmitriPopov Dmitri Popov] from Denmark
https://farm6.staticflickr.com/5615/15772576686_e5ea277655_c.jpg
=== What happened during the sprint ===
The next major task is to port digiKam to Qt5. Originally approximately 10% was already ported by Gilles before the sprint, and the objectives for this coding sprint were as follows:
* Specify timeline for porting digiKam.
* Identify priorities (what should be ported first).
* Delegate porting tasks to developers (who does what).
Long discussions evolved around these topics. Gilles explained the experience he already gained with this sort of work, which tools are available to facilitate the porting, and where manual work is required. The libraries which are part of the digikam project were prioritized for the port, and tasks were assigned.<br/>
There were also discussions about the KIPI framework and its plugins. After many years of development, some plugins are essentially unmaintained and no longer needed by the digiKam as there functionality was superseded or moved, leaving them out from porting. We also talked about APIs to provide better integration between KIPI and digiKam for a task-based framework such as digiKam's batch queue manager. The KF5 port seems like the right time to integrate binary incompatible as well as architectural changes where needed.
Shourya Singh Gupta consequentially worked on implementing the KIPI tools functionality in the Batch Queue Manager (Tools Settings). To do this, discussions were done regarding what API changes must be done to the stack to facilitate a generic way to plug kipi-plugins into BQM. By the end of Coding Sprint, there were changes made to APIs to allow a generic way to plug kipi-plugins' settings widgets to the user-interface, tested by converting two plugins (DNG converter and KIO export tool) to take advantage of this feature. Later on, also the background processing part of DNG converter, responsible for doing the real work, was ported over. This work is currently still in its separate feature branch, waiting to be merged after the frameworks porting branch becomes more stable.
Marcel worked on memory consumption problems with the database functionalities as well as several reported memory leaks. As soon as he could reproduce the problems under valgrind, many cleanups and fixes were committed. Among other fixes a long-standing bug https://bugs.kde.org/show_bug.cgi?id=205776 was fixed.<br/>
He also worked to complete the Removable Collection support. The goal is to show thumbnails from disconnected media, without actually having access to the full file, as this information is stored by the digiKam in its internal metadata database. In practise this means that the users can continue to search and preview collections with thumbnails and other metadata. A feedback to the user is provided to indicate that items and collection are not available for editing. See bugs https://bugs.kde.org/show_bug.cgi?id=191494 and https://bugs.kde.org/show_bug.cgi?id=114539. This feature was completed during the train ride back from Berlin, and committed Sunday evening.
Gilles polished the whole libkgeomap public API to be ready for the KF5 port. A lot of changes have been applied to reduce binary compatibility issues. This is especially needed if a library is to be moved to be a KF5 library to be more easily reused by other projects. A similar move has recently been made to libkface to make it available for KPhotoAlbum.
Veaceslav worked on porting libkdcraw from the old KDE4 Threadweaver API to the new KF5 Threadweaver implementation. Unfortunately, the new API was not quite stable nor documented, and Gilles decided to port it one more time to use a pure Qt thread pool implementation.
Teemu fixed some crashes as well as some small annoyances and introduced his plans to work on cleaning up the codebase, which is still on-going process started with cleaning up the CMakeLists and moving misplaced source files to their corresponding places.
Dmitry, who is a long time digiKam user and who has written the famous [https://www.digikam.org/node/543 Recipes Book] has reported the needs to have a digiKam less dependent of the KDE desktop to be more suitable everywhere. This do not want to mean to lost KDE support, but to wrap properly all specific KDE features used by digiKam as optional when it's possible. Dmitry has take also a lots of photo of the event and share user experience with developers, which has introduced some long and instructive discussions about photographer methodologies and workflow...
After long days of coding, the tired developers went out in search for food in the quarter around the hotel at Rosenthaler Straße. Sushi on Friday and Vietnamese food on Saturday managed to support the developers for another day of coding.
https://farm8.staticflickr.com/7506/15175371273_c774455db9_n.jpg
https://farm6.staticflickr.com/5616/15766506676_7b6e6cc846_n.jpg
=== Aftermath ===
The [https://www.digikam.org/about/releaseplan release plan] have been talk and published. As a lots of kipi-plugins still not yet ported to Qt5, we must delay digiKam 5.0  for the end of the year. Christmas sound like the right moment to offer code to the users community.
MySQL support is now disabled by default for the time being because it's not fully functional and still experimental. MySQL support is still fully available of course, but as an optional feature. The plan is to found a student to work on it in the goal to stabilize code and add PostgreSQL support through Qt SQL plugins.
digiKam core (and the libraries we are depending on) is now pretty much ported to Qt5/KF5, is compilable and running, although there is still ongoing effort to port away from KDE4 support libraries which are currently employed. The port is not yet ready for the prime-time and one can encounter bugs caused by porting, but in the near future we will start to roll beta releases in hope to get reports from end-users about regressions.
However, there is still a lot of work required especially into kipi-plugins, of which only a small part (20%) is currently ported. For those wanting to try out and help in the development the code is available in frameworks branch of corresponding projects. See more information from [https://www.digikam.org/contrib our contribution page].
The build-system (CMake) structure is currently being cleaned up to make the codebase more maintainable for the future as well as making writing unit tests a breeze. In the same time the dependencies of different parts is being investigated and cleaned up, hopefully to allow easier compilation on Windows and OSX.
=== Final Words ===
digiKam is hoping to participate once again in the GSoC this year, and there are some selected new ideas for next [https://community.kde.org/GSoC/2015/Ideas#digiKam available in the wiki] to find new contributors. We hope that anyone interested in working on digiKam in this summer to start getting familiar with the project already.
We would like to thank the folks at Digia once more for their hospitality and KDE e.V. for sponsoring the event!
https://farm8.staticflickr.com/7571/15916071079_05bb30163a_c.jpg
https://farm8.staticflickr.com/7515/15509459184_5b1a8a9a26_c.jpg
More photos from the event are available on [https://www.flickr.com/photos/digikam/sets/72157648876788027 Flickr].

Latest revision as of 17:45, 18 March 2016

KDE Framework Port

Branches Creation

All port code must be stored in dedicated "frameworks" git branch for each project. Branch must be created from master.

$>git checkout master
$>git pull --rebase
$>git checkout -b frameworks
$>git push origin frameworks:frameworks
$>git branch -a
* frameworks
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/frameworks
  remotes/origin/master


KF5 Repositories list is given below :

Kipi-plugins Refactoring

A lots of tools are not maintained since a while, other one have been never finalized. See the list of plugins which will be ported or not :

  • Tools which can be ported as well :
    • panorama
    • expoblending
    • gpssync
    • sendimages
    • timeadjust
    • metadataedit
    • videoslideshow
    • advancedslideshow
    • flashexport
    • kmlexport
    • acquireimages
    • calendar
    • dngconverter
    • printimages
    • imageviewer
  • Tools in pending stage :
    • dlnaexport <=== Needs HUpnp lib Qt5 port
    • htmlexport <=== Nobody maintain this code since a while, but tool still used.
    • photolayoutseditor <=== A complex but powerful tool. Will be complex to port.
    • removeredeyes <=== We can share red eyes removal core implementation in libkface in way to share with other KDE applications and replace digiKam Image Editor tool by this code. A new digiKam BQM tool must be created. A GSoC 2015 project can be planned about this topic.
  • Web export tools which must be factored (same settings widgets, common dialog, common high level interface to process import/export). Another GSoC 2015 project can be planned about this topic.
    • facebook
    • picasawebexport
    • rajceexport
    • shwup
    • debianscreenshots
    • dropbox
    • googledrive
    • imageshackexport
    • kioexportimport
    • piwigoexport
    • smug
    • flickrexport
    • yandexfotki
    • mediawiki <=== need to port libmediawiki from extragear/libs/.
    • vkontakte <=== require libkvkontakte from extragear/libs/.
  • Tools never finalized (can be moved to attic for the moment) :
    • imgurexport <=== require libqtkoauth from SF.net
    • photivointegration
    • jalbumexport
    • wallpaper
  • Tools obsolete (can be moved to attic for the moment) :
    • batchprocessimages <=== replaced by digiKam BQM
    • rawconverter <=== replaced by digiKam BQM
    • jpeglossless <=== replaced by new digiKam core tool
    • kopete <=== KF5 will use new API
    • ipodexport <=== work only with very old Apple devices.
    • galleryexport <=== Gallery web service is not maintained since a while. Gallery project is dead.

KF5/Qt5 Port Status

Libkexiv2

Component Cmake port pure Qt5 port pure KF5 port compile warnings Who Remarks
libkexiv2/src done done done yes no Gilles, Laurent
  • C++ auto_ptr warnings from Exiv2 API disabled.
  • Library depend of :
    • KF5::I18n (translations)
    • KF5::TextWidgets (MsgTextEdit is based on KTextEdit)
libkexiv2/tests done done done yes no Gilles, Laurent Code do not depend of KF5

Libkdcraw

Component Cmake port pure Qt5 port pure KF5 port compile warnings Who Remarks
libkdcraw/src done done done yes no Gilles, Laurent, Veaceslav
  • C++ auto_ptr warnings from Libraw API disabled.
  • ThreadWeaver and Solid dependencies removed.
  • RActionThreadBase is ported to QThreadPool + QRunnable API instead ThreadWeaver.
  • KIntNumInput and KDoubleNumInput are deprecated and removed as dependencies. We use Krita Int and Double input widgets instead. See bug #284216 for details.
  • Library depend of:
    • KF5::I18n (translations).
    • KF5::ConfigCore (KConfigGroup used in widgets).
libkdcraw/tests done done done yes no Gilles, Laurent, Veaceslav
  • Code do not depend of KF5
  • Multithreaded RAW to PNG GUI test program now use DCrawSettingsWidget to tune Raw decoding settings, and is ported to RActionThreadBase to process conversions on all core CPU.

Libkipi

Component Cmake port pure Qt5 port pure KF5 port compile warnings Who Remarks
libkipi/src done done done yes no Gilles, Laurent, Mohamed
  • libkipi/version.h file renamed as libkipi_config.h to host only SO version ID shared with kipi plugins.
  • API changes a little bit : path() => url().
  • Library depend of :
    • KF5::I18n (translations)
    • KF5::Config (KConfigGroup and KSharedConfig)
    • KF5::XmlGui (plugins based on KXMLGuiCLient)
    • KF5::Service (plugins use KService)
libkipi/test done done done yes no Gilles, Laurent, Mohamed
  • moc header must be placed at end of plugin implementation. See all plugin_helloworld.cpp comments for details.
  • K_PLUGIN_EXPORT macro at start of plugin implementation can be dropped.
  • kbuildsycoca5 --noincremental must be run to found new plugin installed on the system if KF5 is not the current active desktop.

Libkface

Component Cmake port pure Qt5 port pure KF5 port compile warnings Who Remarks
libkface/src done done done yes no Gilles, Laurent, Teemu Library only depend of KF5::I18n
libkface/tests done done done yes no Gilles, Laurent, Teemu Code do not depend of KF5

Libkgeomap

Component Cmake port pure Qt5 port pure KF5 port compile warnings Who Remarks
libkgeomap/src done done done yes no Gilles, Laurent, Teemu, Mohamed
  • Library depend of:
    • KF5::I18n (translations).
    • KF5::Config (KConfigGroup used in widgets).
  • Needs Marble code from master git branch compiled with cmake option -DQT5BUILD=ON.
  • TODO We need to detect the Marble version somehow, to avoid linking KF5 build against Qt4 version of Marble. We still use FindMarble cmake script from KDE4. Marble need to be ported as pure KF5 frameworks component.
  • DONE KHTML based class HTMLWidget must be ported to Qt5::Webkit.
libkgeomap/tests done done done yes no Gilles, Laurent, Teemu
libkgeomap/calibrator done done done yes no Gilles, Laurent, Teemu
libkgeomap/demo done done done yes no Gilles, Laurent, Teemu
  • Needs libkexiv2 from KF5 to compile (optional).

Kipi-plugins

Component Cmake port pure Qt5 port pure KF5 port compile warnings Who Remarks
Kipi-plugins/common done uncomplete uncomplete yes yes Gilles, Laurent
  • New MacroLocalLibs.cmake wrapper added to handle local or system wide shared libraries.
  • Plugins must be linked at least with:
    • KF5::Parts
    • KF5::KDELibs4Support
    • ${KF5Kipi_LIBRARIES}
    • ${KF5KExiv2_LIBRARIES}
    • ${KF5KDcraw_LIBRARIES}
    • KF5kipiplugins
  • Use kipiplugins_debug.h header in plugins to handle debug space.
  • ${KF5*_LIBRARIES} are populated by MacroLocalLibs.cmake
  • Add a new common class to process images resizement based SendImage::ImageResize
Kipi-plugins/tests done uncomplete uncomplete yes no Gilles, Laurent
Kipi-plugins Documentation done not applicable not applicable yes no Gilles
Kipi-plugins/timeadjust done uncomplete uncomplete yes no Gilles, Laurent
Kipi-plugins/sendimages done uncomplete uncomplete yes no Gilles, Laurent
Kipi-plugins/kmlexport done uncomplete uncomplete yes no Gilles, Laurent
Kipi-plugins/printimages done uncomplete uncomplete yes no Gilles, Laurent Postscript support have been removed from QPrinter. Option is now removed from assistant.
Kipi-plugins/flashexport done uncomplete uncomplete yes no Gilles, Laurent

digiKam Software Compilation

Component Cmake port pure Qt5 port pure KF5 port compile warnings Who Remarks
digiKam Software Compilation done not applicable not applicable not applicable not applicable Gilles
  • 2 new Cmake options have been add to enable/disable digiKam core and Kipi-plugins compilation (digiKam still disabled by default for the moment).
  • List of checkout repositories managed by "download-repos" scripts is reduced to current sub projects already ready to support KF5. "frameworks" branches are automatically switched. See ".gitslaves" for details.
  • New MacroLocalLibs.cmake must be used in Kipi-plugins and digiKam Core to wrap local or system libraries (libkipi, likdcraw, libkexiv2, etc) when compilation is done under SC or not.
digiKam Documentation done not applicable not applicable yes no Gilles

digiKam Core

Component Cmake port pure Qt5 port pure KF5 port compile warnings Who Remarks
digiKam/data done not applicable not applicable yes no Gilles, Laurent
digiKam/libs done done done yes no Gilles, Laurent, Teemu, Alin, Veaceslav
  • TODO ProxyLineEdit is based on KLineEdit and must be ported to QLineEdit, but it use KLineEdit::clearButtonUsedSize() which do not exist with QLineEdit.
  • UNCOMPLETE SearchTextBar is based on KLineEdit and must be ported to QLineEdit, but it use completion model class ModelCompletion based on KCompletion Which must be ported to QCompleter.
  • DONE ICCSettings : Q_WS__X11 have been removed with Qt5. X11 detection is performed by CMake and rules are set as definition into digikam_config.h
  • TODO Port LoadingCache from KDirWatch to QFileSystemWatcher.
  • TODO When QFileSystemWtyacher port is complete, check if KInotify still mandatory.
digiKam/app done done done yes no Gilles, Laurent, Teemu, Alin
  • UNCOMPLETE AddTagsLineEdit is based on KLineEdit and must be ported to QLineEdit, but it use completion model class ModelCompletion based on KCompletion Which must be ported to QCompleter.
  • DONE WelcomePageView ported from KHTMLPart to QWebView. KParts and KHtml dependencies removed from digiKam.
  • DONE WelcomePageView HTML rendering is completly broken. Check if CSS and HTML code are conform. Note : this is not due to Qt5 port as KHTML done the same result. New layout introduced to host best users photo as background image. See example here for details.
  • DONE MediaPlayerView ported from Phonon to QMediaPlayer. Phonon dependency removed from digiKam. New CMake option add to enable/disable QMediaPlayer support.
  • TODO Port AlbumWatch from KDirWatch to QFileSystemWatcher
digiKam/utilities done done done yes no Gilles, Laurent, Teemu, Alin, Mohamed
  • TODO CameraController use KProcess and KMacroExpander and need to be ported to QProcess.
digiKam/imageplugins done done done yes no Gilles, Laurent, Teemu
  • TODO Remove editor plugins interface and move tools directly to editor implementation.
digiKam/kioslave done done done yes no Gilles, Laurent, Teemu
digiKam/showfoto done done done yes no Gilles, Laurent, Teemu
digiKam/databaseserver done done done yes no Gilles, Laurent, Teemu
digiKam/tests done done done yes no Gilles, Laurent, Teemu
  • TODO 2 test tools do not link yet and are disable from compilation rules

Recommendations

Porting to KF5 is divided in 4 stages:

1/ Change CMake files. Some Laurent scripts do this stuff. We use now ECM scripts collection from KDE core to manage dependencies and report on the console. Some macros disappear, and are replaced by new ones. For this job, it's recommended to look well all done in CMake files from libkexiv2 and libkdcraw already ported and polished.

2/ Port C++ code using KDE4Support. This include older classes from Qt4 and KDE4 to make transition faster. This will help to have quickly a code compilable, but this will generate a lots of deprecated warnings. First regression tests must be done at this stage to see if nothing is broken.

3/ Port C++ code to pure KF5. The goal of KF5 is to reduce KDELibs fingerprint everywhere, when it's possible. Qt API will be used in priority against KF5 API. But sometime, this will be not possible as well, without big changes. A lot of KDE API have migrated to Qt5 (as for ex : KUrl -> QUrl and kDebug ->qDebug). It's sound like KDELibs will become an incubator for new implementations which will move later to Qt. Also, to have the most of code using pure Qt5 will simplify future transitions more easy to do. Removing KDE4Support dependency will force to use non-deprecated KF5 API.

4/ Port C++ code to pure Qt5. Porting most of KF5 Api to use Qt5 instead is prefered, when it's possible. Another important change in Qt5 is the non-support of char pointer with QString.

In first stage we must use remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII) in CMake script to compile code. These definitions force to not use deprecated QString methods.

Another definition to add while Qt5 porting is add_definitions(-DQT_NO_URL_CAST_FROM_STRING) about cast between QString and QUrl.

In last stage we must use remove_definition(-DQT_DEPRECATED_SINCE(5,0)) in CMake script to compile code. These definitions force to disable deprecated methods in Qt API.

Common changes to port code

Original Code Ported Code Remarks
...section of code not yet ported...
#pragma message("PORT QT5")
/*
...section of code not yet ported...
*/
Not yet ported code sections must be commented with compiler warnings printed on the console
KDE4_BUILD_TESTS=ON BUILD_TESTING=ON CMake flag to build tests sub-dir.
CMAKE_BUILD_TYPE=debugfull CMAKE_BUILD_TYPE=debug CMake flag to build code with debug symbols.
kDebug() / kWarning() / kError() qCDebug(FOO_LOG) / qCWarning(FOO_LOG) / qCCritical(FOO_LOG)
  • New "foo_debug.h" and "foo_debug.cpp" files must be created to declare debug space.
  • "foo_debug.h" is not shared. For shared a library, this header must be placed as private in implementation files, not header files.
#include "foo.moc"
#include "foo.h"
  • To prevent compilation errors with Qt5. Qt will generate moc_foo.h files instead. Header file of a class declaration must be placed on top of included header files list from implementation file.
  • Special case : KF5 plugin factory needs moc header file included at end of plugin implementation to prevent broken linking.
KUrl::directory()
QUrl::adjusted(QUrl::RemoveFilename).path()
KDiskFreeSpaceInfo
QStorageInfo
KUrl::setFileName(newFileName)
QUrl::setPath(QUrl::path() + newFileName)
KUrl url;
url.adjustPath(KUrl::AddTrailingSlash);
QUrl url;
url.setPath(url.path() + '/');
KDialog::spacingHint()
QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing)
KDialog::marginHint()
QApplication::style()->pixelMetric(QStyle::PM_DefaultChildMargin)
KComponentData::mainComponent().componentName()
QApplication::applicationName()
KComponentData::mainComponent().aboutData()->homepage()
KAboutData::applicationData().homepage()
KIconLoader::SmallIcon("icon_name", size)

or

KIconLoader::global()->loadIcon("icon_name", size)
QIcon::fromTheme("icon_name").pixmap(size)
  • Adjust size value :
    • Small = 16 (default from KIconLoader::SmallIcon()),
    • SmallMedium = 22,
    • Medium = 32,
    • Large = 48,
    • Huge = 64,
    • Enormous = 128
  • Icon must be installed with desktop theme icons.
KStandardDirs::installPath("data") + QString("filename")
QStandardPaths::locate(QStandardPaths::GenericDataLocation,
QString("filename"))
File to open in read-only. File already exist.
KStandardDirs::installPath("xdgdata-apps") + QString("filename")
QStandardPaths::locate(QStandardPaths::ApplicationsLocation,
QString("filename"))
File to open in read-only. File already exist.
KStandardDirs::locateLocal("data", QString("filename"))
QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ '/' + QString("filename")
File to open in read-only. File already exist.
QString dir = KStandardDirs::locateLocal("data",
                       QString("dirname"), true)
QString dir =
QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ '/' + QString("dirname");
QDir().mkpath(dir);
Dir to open in read-write. Create dir if it do not exist.
KUrlLabel
KDcrawIface::RActiveLabel
  • Slot used to process url can be dropped.
KSeparator
KDcrawIface::RLineWidget
KXmlGuiWindow::restoreWindowSize(group);

KDialog::restoreDialogSize(group);

and

KXmlGuiWindow::saveWindowSize(group);

KDialog::saveDialogSize(group);
KWindowConfig::restoreWindowSize(windowHandle(), group);

and

KWindowConfig::saveWindowSize(windowHandle(), group);
KVBox* const vbox = new KVBox(this);
KDcrawIface::RVBox* const vbox = new KDcrawIface::RVBox(this);
KHBox* const hbox = new KHBox(this);
KDcrawIface::RHBox* const hbox = new KDcrawIface::RHBox(this);
KIO::NetAccess::del(url, QApplication::activeWindow());

KIO::NetAccess::mkdir(url, QApplication::activeWindow());

KIO::NetAccess::dircopy(srcUrl, dstUrl, QApplication::activeWindow())
auto deleteJob = KIO::file_delete(url);
KJobWidgets::setWindow(deleteJob, QApplication::activeWindow());
deleteJob->exec();

auto mkdirJob = KIO::mkdir(url);
KJobWidgets::setWindow(mkdirJob, QApplication::activeWindow());
mkdirJob->exec();

auto dircopyJob = KIO::copy(srcUrl, dstUrl);
KJobWidgets::setWindow(dircopyJob, QApplication::activeWindow());
dircopyJob->exec();
KD::rename(src, dst)
QFile::rename(src, dst)
KToolInvocation::invokeBrowser(url)
QDesktopServices::openUrl(url)
KGlobalSettings::singleClick()
qApp->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick)
KUrl::directory(KUrl::ObeyTrailingSlash)
QUrl url = adjusted(QUrl::RemoveFilename);
url.adjusted(QUrl::StripTrailingSlash).path()
KImageIO::typeForMime(str)
QMimeDatabase().mimeTypeForName(str)
KTemporaryFile temp;
temp.setPrefix(prefixStr);
temp.setSuffix(suffixStr);
QTemporaryFile temp;
temp.setFileTemplate(prefixStr + QLatin1String("XXXXXX") + suffixStr);
K_GLOBAL_STATIC
Q_GLOBAL_STATIC
KMenu::addTitle()
QMenu::addSection()
KStandardDirs::locate("data", "file")
QStandardPaths::locate(QStandardPaths::GenericDataLocation, "file")
KStandardDirs::locateLocal("data", "file")
QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ QChar('/') + QString("file")
KStandardDirs::locateLocal("appdata", "file")
QStandardPaths::writableLocation(QStandardPaths::DataLocation)
+ QChar('/') + QString("file")
KStandardDirs::locateLocal("cache", "file")
QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)
+ QChar('/') + QString("file")
KStandardDirs::locateLocal("tmp", "file")
QDir::tempPath() + QChar('/') + QString("file")
KStandardDirs::makeDir(path, permission);
if (!QDir(path).exists())
{
    if (QDir().mkpath(path))
    {
         QFile f(path);
         f.setPermissions(permission);
    }
}

permission = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser = 0700

KUrlRequester
KDcrawIface::RFileSelector

To select local only file or path, no need KUrlRequester.

KActionMenu
QMenu

Use QMenu::menuAction() to get Action instance of menu to plug in action collection.

KToggleAction
QAction

Use QAction::setCheckable(true) to switch Action as toggle state.

QUrl url;
url.addQueryItem(key, value);
QUrl url;
QUrlQuery q(url);
q.addQueryItem(key, value);
url.setQuery(q);
QPixmap pix, alphaMask;
pix.setAlphaChannel(mask);
QPixmap pix, alphaMask;
QPainter p(&pix);
p.setOpacity(0.2);
p.drawPixmap(0, 0, alphaMask);
p.end();

Link to documentation to port code

Scripts to port code

Laurent Montel has written scripts to port CMake and C++ code to KF5/Qt5 and remove kdelibs4support dependency. There are available in this repository (see kf5 sub-dir).

Scripts must be applied in this order, with a test compilation between each one :

  • Full safe scripts :
    • convert-to-k4aboutdata.pl (first one to apply, this help to compile)
    • adapt_cmakelists_file.pl (to convert CMake scripts, but code must don't be capititalized)
    • remove-kde4support.pl
    • convert-kicon.pl
    • convert-kmenu.pl
    • convert-kshortcut.pl
    • convert-kcolordialog.pl
    • convert-klistwidget.pl
    • convert-kmd5.pl
    • convert-kmenubar.pl
    • convert-ksplashscreen.pl
    • convert-kdebug.pl
  • Less safe scripts :
    • convert-kintnuminput.pl
    • convert-kintspinbox.pl
    • convert-ktextbrowser.pl
    • convert-kfontcombobox.pl
  • Scripts which need to check in-deep all changes :
    • convert-kvbox.pl
    • convert-kdialog.pl
    • convert-kcmdlineargs.pl
    • convert-kdebug-with-argument.sh (this one change kDebug(1556) en qCDebug with some info after to convert)
    • convert-kmimetype.pl
  • Last scripts to apply :
    • clean-forward-declaration.sh (remove forward declaration, to do when all compile fine)
    • clean-includes.sh (try to remove not used includes, not safe to 100%)
    • port_to_autogenerate_export_header.sh (convert to new signal/slot API, not safe to 100%)