grindplayer html5,digiKam: digiKam API reference page.

digiKam is an advanced open-source digital photo management application that runs on Linux, Windows, and MacOS.Author(c) 2001-2021 digiKam team.

e0ea1b99bf2840c9dcf4cb649f8a9896.png

Source Code Directories

digiKam is split into a number of components, each ones located to a dedicated directory. The main namespace is Digikam for the digiKam application and all sub components. A second one is ShowFoto for the stand alone version of image editor.

See below the complete list of directories used by the project:

SOURCE TREE-VIEWDETAILS

├── AUTHORSList of developers and contributors to the project

├── bootstrap.linuxConfiguration script to compile under Linux

├── bootstrap.localConfiguration script to compile a local version under Linux

├── bootstrap.macportsConfiguration script to compile under MacOS with Macports

├── bootstrap.mxeConfiguration script to cross-compile for Windows under Linux with MXE

├── buildTemporary directory created by bootstrap script to host compiled files

├── ChangeLogComplete list of source code changes since the project origin

├── CMakeLists.txtMain Cmake script including lead compilation rules for the project

├── COPYINGMain project license

├── COPYING-CMAKE-SCRIPTSCmake files license

├── COPYING.LIBInternal shared libraries license

├── download-reposScript to download all source code including extra repositories

├── gitsScript to perform git in recursive mode over multiple repositories

├── gitupScript to perform git pull –rebase in reccursive mode

API documentation main page based on Doxygen

├── Messages.shScript to extract strings for translators

├── NEWSNotice to resume all project changes done at release time

├── README.DEVELRead me file for developers

├── README.mdFirst start helper documentation

├── README.BUNDLESRead me for Linux, MacOs, and Windows bundles support

├── buildDirectory to store compiled files and binary targets

├── coreAll source code are hosted in this directory

│ ├── appLead application component

│ │ ├── dateAll date relevant views

│ │ ├── dragdropDrag and drop helper classes

│ │ ├── filtersTags filter widgets

│ │ ├── itemsItem management classes

│ │ │ ├── delegateItem view delegate

│ │ │ ├── overlaysItem overlays

│ │ │ ├── thumbbarItem thumbbar widget

│ │ │ ├── utilsItem utility classes

│ │ │ └── viewsItem view classes

│ │ ├── mainMain digiKam application

│ │ ├── utilsGeneric utility classes

│ │ └── viewsViews classes

│ │ ├── previewItem preview classes

│ │ ├── sidebarLeft sidebar contents

│ │ ├── stackStacked-view show in central place of main digiKam window

│ │ ├── tableviewTable-view classes

│ │ └── utilsView utility classes

│ ├── cmakeExtra Cmake scripts will be hosted here

│ │ ├── modulesCmake scripts to find extra dependencies

│ │ └── templatesCmake template files used at configuration time

│ ├── dataApplication data files will be hosted here

│ │ ├── aboutWelcome page files (HTML + CSS)

│ │ ├── colorschemesGUI Color scheme files

│ │ ├── databaseDatabase XML configuration files

│ │ ├── facesengineFace detection and recognition data files

│ │ ├── filtersImage filters data files

│ │ ├── geolocationGeolocation tool data files

│ │ ├── hotplugHotplug Linux integration files

│ │ ├── htmlgalleryHTML gallery tool data files

│ │ ├── iconsApplication icons

│ │ ├── metadataMetadata tool data files

│ │ ├── picsApplication pictures

│ │ ├── printcreatorPrint Creator tool data files

│ │ ├── profilesBasis open source ICC color profiles

│ │ └── scriptsMiscs maintenance scripts

│ ├── dpluginsAll digiKam plugins will be hosted in this directory

│ │ ├── bqmAll Batch Queue Manager plugins

│ │ │ ├── colorsAll color adjustments plugins

│ │ │ ├── convertAll file convert plugins

│ │ │ ├── customAll user-custom processing plugins

│ │ │ ├── decorateAll decorate item plugins

│ │ │ ├── enhanceAll enhance item plugins

│ │ │ ├── filtersAll filter item plugins

│ │ │ ├── metadataAll metadata edit plugins

│ │ │ └── transformAll tranform item plugins

│ │ ├── editorAll Image Editor plugins

│ │ │ ├── colorsAll color adjustments plugins

│ │ │ ├── decorateAll decorate item plugins

│ │ │ ├── enhanceAll enhance item plugins

│ │ │ ├── fileAll file processing plugins

│ │ │ ├── filtersAll filter item plugins

│ │ │ └── transformAll tranform item plugins

│ │ ├── genericAll generic plugins

│ │ │ ├── importTools to import items

│ │ │ ├── metadataPlugins to change items metadata

│ │ │ ├── toolsPlugins hosted in Tools main menu

│ │ │ ├── viewPlugins to display items

│ │ │ └── webservicesAll plugins to import and export items to remote web-services

│ │ ├── rawimportAll Raw import plugins

│ │ └── dimgAll DImg image loader plugins

│ ├── libsdigiKam core sub-components (few are shared with Showfoto)

│ │ ├── albumAll classes use to manage digiKam albums operations and properties

│ │ ├── databaseAll low level database interface is here

│ │ │ ├── collectionAll classes relevant of collections management

│ │ │ ├── coredbThe core database interface used to host all image properties

│ │ │ ├── dbjobsAll database multi-threaded jobs

│ │ │ ├── engineThe low level database engine classes

│ │ │ ├── haarThe similarity low level algorithms to compute image finger-prints

│ │ │ ├── historyThe item history classes for the database

│ │ │ ├── itemThe database item classes, including containers, lister, and scanner

│ │ │ ├── modelsThe databse model classes

│ │ │ ├── serverThe Mysql internal server

│ │ │ ├── similaritydbThe similarity database

│ │ │ ├── tagsThe database tags management classes

│ │ │ ├── thumbsdbThe thumbnails database

│ │ │ └── utilsMiscs tools and widgets used with database

│ │ ├── dialogsCommon dialogs

│ │ ├── dimgThe Qt digiKam image data container support ICC and 16 bits color depth

│ │ │ ├── filtersAll image filters will be hosted here. All support 16 bits color depth

│ │ │ │ ├── autoAuto colors correction filters

│ │ │ │ ├── bcgBrightness-Contrast-Gamma filter

│ │ │ │ ├── bwBlack and White image converter, including infrared filter

│ │ │ │ ├── cbColors balance filter

│ │ │ │ ├── curvesColors curves filter

│ │ │ │ ├── decorateDecorate filters

│ │ │ │ ├── filmAnalog film emulation filters

│ │ │ │ ├── fxSpecial effect filters

│ │ │ │ ├── greycstorationCimg based restoration filter

│ │ │ │ ├── hslHue-Saturation-Lightness filter

│ │ │ │ ├── iccIcc color profile filters

│ │ │ │ ├── imgqsortThe image quality sort algorithms

│ │ │ │ ├── lcLocal contrast filter (pseudo HDR)

│ │ │ │ ├── lensLens corrections filters, including Qt Lensfun interface

│ │ │ │ ├── levelsColor levels filter

│ │ │ │ ├── nrWavelets noise reduction filter

│ │ │ │ ├── redeyeRed-eyes parser and fixer

│ │ │ │ ├── sharpImage sharp filter, including Unsharped-mask and Refocus

│ │ │ │ ├── transformAll image transformation filters

│ │ │ │ └── wbWhite balance filter

│ │ │ ├── imagehistoryImage history interface for image container

│ │ │ └── loadersAll DImg image loaders interface

│ │ ├── metadataengineThe metadata wrapper based on Exiv2 for image and FFMpeg for video

│ │ ├── dngwriterQt classes to convert RAW files to DNG format

│ │ │ └── extraDNG and XMP sdks from Adobe

│ │ ├── dpluginsAll shared dplugins classes are hosted here

│ │ │ ├── coreLow level classes for plugins definitions

│ │ │ ├── ifaceLow level classes for host interface definitions

│ │ │ ├── setupClasses to setup plugins in configuration pannel

│ │ │ ├── webservicesCommon classes for Webservices tools

│ │ │ └── widgetsCommon widget sfor plugins

│ │ ├── dtrashdigiKam trash manager full independant of desktop trash

│ │ ├── facesengineFace detection and recognition engine + Faces database implementations

│ │ │ ├── alignment-congealingFace alignment based on congealing method

│ │ │ ├── alignment-flandmarkFace alignment based on flandmark method

│ │ │ ├── detectionFace detection algorithms

│ │ │ ├── dnnfaceDeep-learning face algorithms

│ │ │ ├── facedbFaces database classes

│ │ │ ├── opencv3-faceOpenCV version 3 face management classes

│ │ │ ├── preprocessing-tantriggsFace pre-processing based on tantriggs method

│ │ │ ├── recognition-dlib-dnnDeep-learning faces recognition module

│ │ │ ├── recognition-opencv-eigenfacesEigen faces recognition mudule

│ │ │ ├── recognition-opencv-fisherfacesFisher faces recognition module

│ │ │ ├── recognition-opencv-lbphLBPH bases faces recognition module

│ │ │ └── shape-predictorShape predictor algorithms

│ │ ├── fileactionmanagerClasses to connect database and metadata actions to file operations

│ │ ├── filtersWidgets to filter items by metadata properties

│ │ ├── imagepropertiesAll widgets used in right side-bar from all main views

│ │ ├── iojobsMultithreaded jobs manager used with files operations

│ │ ├── jpegutilsUtilities to process JPEG files

│ │ │ └── libjpegJPEG loss-less transform private implementations from libjpeg

│ │ ├── kmemoryinfoQt backend to analyze system memory information

│ │ ├── modelsQt models used with item views

│ │ ├── notificationmanagerMulti-desktop notifications wrapper

│ │ ├── pgfutilsQt Classes to work with PGF image format

│ │ ├── progressmanagerMulti-level operations progress widget

│ │ ├── rawengineQt classes to work with libraw decoder

│ │ │ └── librawInternal Libraw sdk

│ │ ├── settingsdigiKam settings manager

│ │ ├── tagsClasses to play with tags

│ │ │ └── tagsmanagerTags manager view

│ │ ├── templateMetadata template support

│ │ ├── threadimageioClasses to process thumbs and preview extraction including video support

│ │ ├── threadsClasses to manage and chain threads using multi-core

│ │ ├── timeadjustCommon classes time adjustements tools

│ │ ├── transitionmngrFrames transitions manager

│ │ ├── versionmanagerClasses to manage versionning operations

│ │ ├── videoClasses to play with video contents

│ │ └── widgetsTo host plenty of widgets used everywhere

│ │ ├── colorsColors relevant views

│ │ ├── comboCombo-box helper classes

│ │ ├── commonUncategorized widgets

│ │ ├── filesFile operation classes

│ │ ├── fontsFont management classes

│ │ ├── graphicsviewGraphics-view implementation (model-view)

│ │ ├── iccprofilesICC color profiles widgets

│ │ ├── imagehistoryImage history widgets

│ │ ├── itemviewItem-view implementations (model-view)

│ │ ├── layoutLayout helper classes

│ │ ├── mainviewCommon top-level view implementations

│ │ ├── metadataMetadata widgets

│ │ └── rangeRange helper classes

│ ├── showfotoStand alone image editor

│ │ ├── mainMain Showfoto application

│ │ ├── setupShowfoto Setup views

│ │ └── thumbbarShowfoto thumb-bar views

│ ├── testsUnit tests

│ └── utilitiesdigiKam utilities and advanced tools (few are shared with showfoto)

│ ├── advancedrenameAdvance rename tool

│ ├── extrasupportExtra desktop features support as Baloo search engine

│ ├── facemanagementFace management classes and tools

│ ├── firstrunFirst-run assistant to configure lead digiKam settings

│ ├── fuzzysearchSimilarity search tools

│ ├── geolocationAll geo-location tools are located here

│ │ ├── editorTool to edit items geo-location

│ │ ├── geoifaceAll shared classes used by geo-location tools

│ │ ├── geomapwrapperLegacy helper classes for geo-location support

│ │ └── mapsearchesTool to perform map searches

│ ├── imageeditorThe famous digiKam image editor, a lots of classes shared with Showfoto

│ │ ├── coreCore implementation including canvas and tools interface

│ │ ├── dialogsImage editor dialogs

│ │ ├── editorThe core image editors classes

│ │ ├── mainThe main digiKam image editor view, not shared with Showfoto

│ │ └── widgetsAll common widgets

│ ├── importThe import tools, including USB MAss Storage, Gphoto2, and Sane support

│ │ ├── backendCamera backends

│ │ ├── dialogsImport tools dialogs

│ │ ├── itemsImport item classes

│ │ ├── mainImport tool main view

│ │ ├── modelsImport model classes

│ │ ├── viewsImport view classes

│ │ └── widgetsImport common widgets

│ ├── lighttableThe Light-table tool to compare images side by side

│ ├── maintenanceThe digiKam tool to maintain the database contents

│ ├── queuemanagerThe famous Batch Queue Manager tool

│ │ ├── mainThe main BQM view

│ │ ├── managerThe multi-core manager to run tools in background

│ │ ├── toolsAll BQM tools classed by functions

│ │ └── viewsThe BQM internal views

│ ├── searchwindowThe powerfull advanced search tool

│ ├── setupAll digiKam setup panel, with few ones shared with Showfoto

│ │ ├── albumAlbum configuration views

│ │ ├── cameraCamera configuration views

│ │ ├── collectionsCollection configuration views

│ │ ├── editorImage Editor configuration views

│ │ └── metadataMetadata configuration views

│ └── slideshowThe simple slideshow tool

├── docHandbooks directory

│ ├── digikamdigiKam manual

│ ├── projectExtra files for the documentation

│ └── showfotoShowfoto manual

├── extraOptional extra libraries to compile advanced features

└── projectExtra project parts

├── bundlesBundles build scripts

│ ├── 3rdpartyExternal components required to build bundles

│ ├── CDContinuous Deployement configurations

│ ├── appimageLinux AppImage

│ ├── flatpakLinux Flatpak

│ ├── macportsMacOs package

│ └── mxeWindows installer

├── documentsProject documentations

├── releaseRelease scripts

├── reportsStatic analyzers report scripts for Continuous Integration

└── scripts3rdparty source code management scripts

External Dependencies

Dependencies To Checkout All Source Code

Dependencies To Process Translations Files (optional)

Ruby http://www.ruby-lang.org (to extract translations files from remote repositories)

Subversion https://subversion.apache.org/ (to extract translations files from remote repositories)

Gettext https://www.gnu.org/software/gettext (including Msgfmt to compile po files to mo files)

Dependencies To Compile And Link Source Code

The full list of mandatory (X) and optional (opt) external dependencies required to compile and link digiKam source code is listed below.

DependencyStatusVersionProject URLRemarksTODO

Qt5::SqlX>= 5.9Including Qt5::Sqlite and Qt5::Mysql plugins

Qt5::WebEngineX>= 5.9To render web contents (ENABLE_QWEBENGINE=on)To replace Qt5::WebKitWidgets everywhere, excepted for MXE

Qt5::WebKitWidgetsopt>= 5.9To render web contentsUsed with MXE only as WebEngine do not compile with Mingw

Qt5::XmlPatternsopt>= 5.9To parse and validate XmlUsed by Rajce plugin

Qt5::X11Extrasopt>= 5.9For color management support under Linux

Qt5::DBusopt>= 5.9Optional: only for Linux Desktop

Qt5::OpenGLopt>= 5.9For Presentation tool

Qt5::Testopt>= 5.9To compile test codes (BUILD_TESTING=on)

Qt5::Qmlopt>= 5.9To compile test codes (BUILD_TESTING=on) O2 unit tests

Qt5::WebViewopt>= 5.9To compile test codes (BUILD_TESTING=on) O2 unit tests

KF5::ServiceX>= 5.5.0TODO: make optional for Linux desktop (DFileOperations)

KF5::NotifyConfigopt>= 5.5.0For Linux desktop application notify configuration

KF5::Notificationsopt>= 5.5.0For Linux desktop notifications integrations

KF5::IconThemesopt>= 5.5.0Optional: only for Linux Desktop (KIconDialog)

KF5::FileMetaDataopt>= 5.5.0KDE files indexer (ENABLE_KFILEMETADATASUPPORT=on)Still experimental, disabled by default. Implementation from KDE side very unstable

KF5::CalendarCoreopt>= 5.5.0For calendar tool to setup ical special events

KF5::KIOopt>= 5.5.0Optional: only for Linux Desktop

KF5::AkonadiContactopt>= 4.89.0KDE Mail contacts (ENABLE_AKONADICONTACTSUPPORT=on)Still experimental, disabled by default. Need testing

libopencvX>= 3.3OpenCV 4 supported with digiKam 6.1.0DNN module required for face management

libjpegX>= 6bjpeglib >= 8.0 hightly recommended for RawEngine

libboostX>= 1.55.0For Versionning support

liblcmsX>= 2.xFor Color Management support

libexpatX>= 2.1.0For DNG converter

libexiv2X>= 0.27.0Metadata low level management.

libxml2opt>= 2.7.0For HtmlGallery tool

libxsltopt>= 1.1.0For HtmlGallery tool

libqtavopt>= 1.12.0To play video and audio (ENABLE_MEDIAPLAYER=on)

libffmpegopt>= 3.3.xTo play video and audio (ENABLE_MEDIAPLAYER=on)libavformat, libavutil, libavcodec used to extract video metadata

Flexopt>= 2.5.0For Panorama tool

libmesaopt>= 11.0For Presentation tools (Linux only)

libksaneopt>= 5.0.0Digital scanner support

libjpasperopt>= 1.900.1For JPEG-2000 support

libmarbleopt>= 0.22For geolocation support

libeigen3opt>= 3.2For Refocus toolSee if Clapack from OpenCV can be used instead

liblensfunopt>= 0.2.8For LensCorrection tool

liblqr-1opt>= 0.4.2For Liquid rescale tool

libgphoto2opt>= 2.5Digital camera drivers support. Need libusb-1

libgompopt>= 5.0OpenMP support for RawEngine

libmagick++opt>= 6.7.0ImageMagick codecs support for DImg image loaderVersion >= 7.0 recommended

DrMingwopt>= 0.8.2Mingw crash handler (run-time deps only for windows)

libx265opt>= 2.2For HEIC encoding support

Get Source Code

Software Components

digiKam project use a single git repository from GitLab to host whole source code base. The project page is given below:

The digikam handbook source code is hosted in a separate GitLab repository:

Development Environment

If you are a developer with push access to the git repositories, it is strongly recommended to use the "kde:" prefix and let git use the read-only mirrors for pulling.

If you did not clone this repository from "kde:", do it again:

git config --global url.git://anongit.kde.org/.insteadof kde:

git config --global url.ssh://git@git.kde.org/.pushinsteadof kde:

git clone kde:digikam

See below an example of .gitconfig file working with a developer account :

[url "git://anongit.kde.org/"]

insteadof = kde://

[url "git@git.kde.org:"]

pushinsteadof = kde://

[url "ssh://git@git.kde.org/"]

pushinsteadof = kde://

[alias]

up = pull --rebase -v --stat

ci = commit -a -v

[core]

editor = mcedit

[user]

name = my name

email = my email

[push]

default = tracking

[color]

# turn on color

diff = auto

status = auto

branch = auto

interactive = auto

ui = auto

[color "branch"]

current = green bold

local = green

remote = red bold

[color "diff"]

meta = yellow bold

frag = magenta bold

old = red bold

new = green bold

[color "status"]

added = green bold

changed = yellow bold

untracked = red

[color "sh"]

branch = yellow

[color "sh"]

Cmake Configuration Options

To configure the project with CMake, use dedicated "bootstrap" script for your platform where all available configuration options are present with default values.

There are two configuration sections : the top level and the core.

Top Level Configuration

Packaging options:DIGIKAMSC_COMPILE_DIGIKAM : Build digiKam core (default=ON).

DIGIKAMSC_CHECKOUT_PO : Extract application translation files from remote repositories (default=ON).

DIGIKAMSC_CHECKOUT_DOC : Extract documentation translation files from remote repositories (default=ON).

DIGIKAMSC_COMPILE_DOC : Build handbook i18n files. It require to checkout documentation translations files before from remote repositories (default=ON).

DIGIKAMSC_COMPILE_PO : Build GUI i18n files. It require to checkout application translations files before from remote repositories (default=ON).

Developers only options:BUILD_TESTING=ON : Build tests code (default=ON).

Core Configuration

Extra feature support options:ENABLE_KFILEMETADATASUPPORT : Build digiKam with KDE files indexer support (default=OFF).

ENABLE_AKONADICONTACTSUPPORT : Build digiKam with KDE Mail Contacts support (default=OFF).

ENABLE_MEDIAPLAYER : Build digiKam with Media Player support (default=OFF).

ENABLE_DBUS : Build digiKam with DBUS support (default=ON).

ENABLE_APPSTYLES : Build digiKam with support for changing the widget application style (default=OFF).

ENABLE_QWEBENGINE : Build digiKam with QWebEngine instead of QWebKit (default=ON).

Experimental support optionsENABLE_MYSQLSUPPORT : Build digiKam with MySQL dabatase support (default=ON).

ENABLE_INTERNALMYSQL : Build digiKam with internal MySQL server executable (default=ON).

Developers only options:ENABLE_DIGIKAM_MODELTEST : Enable ModelTest on some models for debugging (default=OFF).

ENABLE_SANITIZERS : Enable ASAN and UBSAN sanitizers when available (default=OFF).

BUILD_WITH_CCACHE : Use ccache to speed up compilations (default=OFF)

Packaging optionsENABLE_DRMINGW : Enable the Dr. Mingw crash handler for windows (default=ON).

ENABLE_MINGW_HARDENING_LINKER : Enable DEP (NX), ASLR, and high-entropy ASLR linker flags for MinGW (default ON).

Setup Local Compilation and Run-Time

This section describes how to install digiKam from the git repository, while keeping a system-wide digiKam install.

This procedure is based on the configure script bootstrap.local

Set the root directory for your git install in bootstrap.local (DIGIKAM_INSTALL_PREFIX variable)

If you want a clean build directory, set CLEANROOT to 1

Type the following command in your terminal:

$ ./bootstrap.local # or "./bootstrap.local --eclipse" if you intend to use Eclipse

$ cd build

$ make

$ make install

$ KDESYCOCA="/your/root/directory/var/tmp/kde-$USER/ksycoca5" kbuildsycoca5

To run digikam, use the following commands:

$ export KDESYCOCA=/your/root/directory/var/tmp/kde-$USER/ksycoca5

$ export QT_PLUGIN_PATH=/your/root/directory/lib64/plugins:/your/root/directory/lib/plugins:$QT_PLUGIN_PATH

$ export XDG_DATA_DIRS=/your/root/directory/share:$XDG_DATA_DIRS

$ /your/root/directory/bin/digikam

The same applies for all binaries in /your/root/directory/bin/

If your shell is bash, you can edit your .bashrc file (in $HOME) and add the follwing alias:

DIGIKAMROOT="/your/root/directory"

alias digikam-dev="KDESYCOCA=\$DIGIKAMROOT/var/tmp/kde-$USER/ksycoca5 XDG_DATA_DIRS=\$DIGIKAMROOT/share:\$XDG_DATA_DIRS QT_PLUGIN_PATH=\$DIGIKAMROOT/lib64/plugins:\$DIGIKAMROOT/lib/plugins:\$QT_PLUGIN_PATH \$DIGIKAMROOT/bin/digikam"

then you can start your newly installed digikam with

$ digikam-dev

Debug Traces At Run-Time

digiKam uses categorized logging at run-time. By default, all debug messages are printed on the console. To disable output, you can either fine-grained control by using one or more logging categories listed below.

Note: under Windows, to catch all debug messages you need to install an extra Microsoft application named DebugView available at this url: http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

Logging Using an Environment Variable

You can set the environment variable QT_LOGGING_RULES. Rules are divided by semicolons.

E.g. you can start digiKam like this on the command line with thumbnails and core database messages disabled:

export QT_LOGGING_RULES='digikam.thumbsdb=false:digikam.coredb=false'

digikam

Logging Categories in digiKam

All loggin categories are listed in digikam_debug.cpp source code.

Further Reading

For more details see the Qt framework documentation about logging categories available at this url: https://doc.qt.io/qt-5/qloggingcategory.html#details

Cmake compilation rules

Introduction

The whole project is written mostly in C++/Qt and the Cmake framework is used to compile under Linux, MacOs, and Windows. The Cmake rules have been configured to reduce the linking overhead and improve CPU utilization with modular design.

Independent Cmake configuration is presents in following folders:

root source dir

core

doc

The Cmake rules will build the following targets:

digikamcore shared lib

digikamdatabase shared lib

digikamgui shared lib

digikam executable

showfoto executable

plugin shared libraries (dplugins)

various test executables - if testing is enabled

various unit-tests - if testing is enabled

Each of them depend on various sources which must be compiled before. A complete description of source code direction is given to the sourcedirs section.

CMake Implementation Details

Include Directories

Local include directories are all managed by this snippet of code:

set(DK_INCLUDES_ALL "")

HEADER_DIRECTORIES(DK_LOCAL_INCLUDES_RAW)

The libjpeg- folders are all included, so we need to delete them all and include the correct one only:

# This macro will set all paths which do not contain libjpeg-

# We will add later the directory we need

FOREACH(var ${DK_LOCAL_INCLUDES_RAW})

STRING(REGEX MATCH "libjpeg-" item ${var})

IF(item STREQUAL "")

LIST(APPEND DK_LOCAL_INCLUDES ${var})

ENDIF(item)

ENDFOREACH(var)

set(DK_LOCAL_INCLUDES ${DK_LOCAL_INCLUDES}

libs/jpegutils/${DIGIKAM_LIBJPEG_DIR})

include_directories(${DK_LOCAL_INCLUDES})

There is no need for manual intervention to add new includes, even if you add a new folder, just keep in mind to use:

instead of :

Shared Libraries

To avoid linking overhead and make a better use of sources there are some dynamic libs as these one:

digikamcore : core components used by almost all executables as digiKam and Showfoto.

digikamdatabase : database components, also used together with digikamcore but only for digiKam

Please add sources to digikam core or digikam database only if they don't depend on any big component from digikam main executable. These two shared libs must be kept small because they link in a lot of places

Static Libraries

Currently cmake configuration features a lots of shared libraries as:

metadataedit

geolocationedit

digikamfaceengine

This libraries are linked in digikam main executable and some tests tools.

Avoid making static libraries if possible, and use OBJECT libraries instead. Only make STATIC libraries which does not depend on other digikam code. Also make sure you put the PRIVATE parameter when setting the target_link_libraries.

target_link_libraries(digikamcore

PRIVATE

Qt5::Core

Qt5::Gui

Qt5::Widgets

)

Object Libraries

While static libraries are still collection of objects, CMake offer a better approach by allowing to specify an OBJECT library:

set(libslideshow_SRCS

slidetoolbar.cpp

slideosd.cpp

slideproperties.cpp

slideimage.cpp

slideerror.cpp

slideend.cpp

slideshow.cpp

slidehelp.cpp

slideshowsettings.cpp

)

add_library(slideshow_src OBJECT ${libslideshow_SRCS})

OBJECT library is a cmake internal implementation feature and allow to easily manage sources. Here is an example of how to make a shared lib using OBJECT libraries:

add_library(digikamcore

SHARED

$ # the lib we made few lines above

$

$

....

)

Contribute To The Code

This section's purpose is to guide contributors and developers to help on the digiKam project.

Starting With Open-Source

Before to contribute to digiKam project, please take a look to this link which provide 10 golden rules for starting with open source project:

Source Code Formatting

Adhere to this style guide strictly while adding new code to digiKam or working on existing code.

Indentation length

Indent with 4 spaces exactly.

For example:

void function()

{

....int a; // 4 spaces from beginning

....for (int i = 0 ; i < 10 ; ++i) // 4 spaces from beginning

....{ // 4 spaces from beginning

........a = i; // 4 spaces from previous indent block

Emacs by default will indent to 4 spaces vim users add this to you .vimrc set tabstop=4

Tabs vs Spaces

Absolutely no tabs. Use a sensible editor which will convert tabs to spaces. This will reduce unnecessary changes in your git commits.

Emacs by default will convert tab to spaces. For vim users, add this to your .vimrc set expandtab

Line length

Line length should never exceed 80 chars (unless really necessary - these cases are rare). Having long lines greatly reduces readability of code

Bracketing

In all cases, {} brackets should start on a newline and should be aligned with previous line (follow the indentation spaces). For example.

classA

{ //new line

...

for (int i = 0 ; i < 10 ; ++i)

{ //new line

if (a == foobar)

{ //new line

...

}

else

{ // new line

..

}

Positioning of Access modifiers

public, private, protected, public slots, ... should be aligned to the beginning of the line with no margin

classA

{

public: // aligned to left

...

private Q_SLOTS: // aligned to left

Follow a consistent order in defining these attributes. The recommended order is public, protected (functions), private (functions), signals, public slots, protected slots, private slots, private (variables)

Class, file and Variable names

Class and filenames

filenames should always be in lower-case

class names should match the filenames. Capitalize the first letter and other letters logically to improve readability

Protected Member variables

protected member variable names should always be of the form m_varName.

Capitalize logically so that it becomes easy to read it. Do not capitalize the first letter after _ (Use m_varName not m_VarName)

variable names should be indicative of their functionality and also of the type they belong too if they are instances of qt widgets. For example, QCheckBox* m_autoRotateCheckBox;

Non-Member variables

non-member variables should follow the same naming convention as the member variables, except for the leading m_

Private Member variables

private member variables must be stored in a d private container to reduce compilation time and improve binary compatibility between digiKam components. See more information how to use a 'd' private class at this url:

Comments and Whitespace

Use whitespaces liberally to improve readability. Add blank lines between logical sections of the code.

Comment as much as possible. Position comments at the beginning of the section/line you want to comment, NEVER at the end of the line, excepted for special cases for ex to describe enum values.

// put your comments here

a = (b == foobar) ? 1 : -1;

a = (b == foobar) ? 1 : -1; // you are asking for trouble by putting comments here

Header Files

Add copyright to top of every file. Use the same header than others digiKam source code.

Double inclusion protection defines are all upper case letters and are composed of the class name and a H suffix separated by underscore

#ifndef DIGIKAM_ANOTHER_NICE_CLASS_H

#define DIGIKAM_ANOTHER_NICE_CLASS_H

classAnotherNiceClass

{

...

}

#endif// DIGIKAM_ANOTHER_NICE_CLASS_HUse forward declarations as much as possible.

classQFileInfo;

classA

{

....QFileInfo* m_fileInfo;

Automatic source code formatting

The above coding style guidelines can be automatically applied with astyle (http://astyle.sourceforge.net/).

Run it in the directory where the files are located that should be formatted.

To apply the coding guidelines with astyle is to use the fileformatter.py script in project/scripts directory. This script will also clean up the source tree and remove backup files that had been created by astyle, if the appropriate command line argument is given.

To handle the command easier, create a bash function in ~/.bashrc, e.g.

dkfrmcode()

{

astyle --style=allman \

--indent=spaces=4 \

--convert-tabs \

--indent-switches \

--break-blocks \

--break-closing-brackets \

--pad-header \

--align-pointer=type \

--indent-col1-comments \

--add-brackets \

--min-conditional-indent=0 \

`find $1 -type f -name '*.cpp'` `find $1 -type f -name '*.c'` `find $1 -type f -name '*.h'`

}

You can pass a parameter to the function, in this case the first parameter is the directory, where files should be formatted.

Examples:

Run astyle in the current directory

$> dkfrmcode

Run astyle in a different directory

$> dkfrmcode /home/user/code/git/digikam/

General recommendations

Please take a look into this contrib page tips before to write code/patches for digiKam project : http://techbase.kde.org/Contribute

Use the same .cpp/.h header than the rest of digiKam project.

Use a decent editor which does auto-indentation/syntax-highlighting for you, as Kate or QtCreator

There are excellent initializer scripts in the kdesdk package for xemacs and vim which can substantially increase your productivity.

Just to give a taste of what i can do with emacs (and kdesdk):

automatically insert copyright (and ifdefs) in new files. insertion of class function definitions for declared class functions in header with one keystroke switch between header and declaration files with one keystroke go to corresponding definition/declaration with one keystroke tab completion of variable/function names already declared.

GDB Backtrace

If you found a context to crash digiKam, you can provide a backtrace using GDB debugger. digiKam need to be compiled with all debug info else the backtrace will not suitable. There is a configure option for that:

$> cmake . -DCMAKE_BUILD_TYPE=debugfull

$> make

$> su

$> make install/fast

To make a backtrace with GDB use following command:

$ gdb digikam

> catch throw

> run

> ...

> _crash here_

> ...

> bt

> _the backtrace is here_

> quit

Post this backtrace at the right place (Bugzilla or development mailing list) for investigation by developers.

For Windows users, take a look on this tutorial :

Memory Leak

To check any memory leak problem in digiKam, valgrind is your friend (http://valgrind.org) Try this command line to use with valgrind :

valgrind --tool=memcheck --leak-check=full --error-limit=no --suppressions=project/reports/digikam.supp digikam

NOTE: digikam.supp file is available in digikam/project sub-folder.

Profiling With Cachegrind

Valgrind also includes a tool to find out in which parts of your code time is spent.

valgrind --tool=callgrind digikam

Profiling can be disabled at startup to limit the output to the code you are interested in. Start with

valgrind --tool=callgrind --instr-atstart=no digikam

and prepare the situation you want to profile. Then, in another console, start profiling with "callgrind_control -i on" and, after the situation has passed, request a profile dump with "callgrind_control -d". The resulting callgrind.out files need to be viewed with the kcachegrind program, e.g.:

kcachegrind callgrind.out.16693.1

Unit Testing / Automated Testing

Unit Testing is great way to ensure that software units (in OOP this normally means classes) work as expected. Wikipedia gives a good introduction to Unit Testing:

It is also worth to follow most of QTTest API rules with digiKam:

The digiKam test suite is located under tests and will be compiled if BUILD_TESTING is turned ON at cmake configuration time. After compiling the source code the tests can be executed via

make test

The console output while running the tests is stored in Testing/Temporary/LastTest.log in the CMake binary dir.

All tests are simple binaries that can be executed separately if needed.

Checking For Corrupt Qt Signal Slot Connection

Use this alias for running digikam:

alias digikamdbg="digikam 2>&1 | tee - /tmp/digikam.out; echo -e \"\n\n\nPossible connection errors:\n\n\"; cat /tmp/digikam.out | grep -A2 'Object::connect'"

It will print a list of connection warnings after terminating the program. Moreover the complete console log of the last session is stored in /tmp/digikam.out.

Finding Duplicated Code

Code duplication should be avoided as bugs have to be fixed for every piece of duplicated code. The current duplication can be analyzed eg. with Simian: http://www.redhillconsulting.com.au/products/simian/

In the digikam checkout directory run:

java -jar simian.jar `find . -regex '.*\.cpp\|.*\.h' | grep -v 3rdparty`

This prints out a list of duplicated code segments.

API Documentation Validation, User Documentation Validation, Source Code Checking

The following site check on a daily basis for the a.m. errors: www.englishbreakfastnetwork.org/krazy/

It can be very useful, in particular before major releases. Don't trust it blindly! Sometimes they propose too advanced modifications that are no compatible with the prevailing include files.

Usability Issues

OpenUsability project has define default menu structure and keyboard shortcuts:

Generate API Documentation

To generate API documentation, you need to install:

After cmake generated a Makefile you can call 'make doc'. A new subfolder named 'html' will be created. Warning, this can take a while.

For finding documentation errors, doxygen generates a warning log file at the cmake binary dir called 'doxygen-warn.log'.

Speed Up The Code-Compile-Test Cycle

Assuming you have setup your environment in ~/.bashrc as is suggested for development, you can add something like this to your ~/.bashrc:

function digikam_start

{

LD_LIBRARY_PATH=${KDE_BUILD}/extragear/graphics/lib:${LD_LIBRARY_PATH} ${KDE_BUILD}/extragear/graphics/digikam/digikam/digikam

}

function digikam_start_gdb

{

LD_LIBRARY_PATH=${KDE_BUILD}/extragear/graphics/lib:${LD_LIBRARY_PATH} gdb ${KDE_BUILD}/extragear/graphics/digikam/digikam/digikam

}

This allows you to run digikam after compiling without the need of a "make install", even if you changed code in the libraries.

Working With Branches From Git Repository

Example to create a local 'dplugins' development branch based on master:

git checkout master

git checkout -b development/dplugins

Example to delete the local 'dplugins' developement branch:

git checkout master

git branch -d development/dplugins

Example to create a remote 'dplugins' development branch from the local branch:

git push -u origin development/dplugins

Example to delete the remote 'dplugins' development branch:

git push origin :development/dplugins

Sync a Branch With Master From Git Repository

It typical to use a dedicated development branch in Git to keep the master code stable for production. To synchronize branches with master, use these commands in your local branch checkout:

$>git checkout master

$>git pull --rebase

$>git checkout -b MY_DEVEL_BRANCH GIT_REMOTE_PATH

Branch 'MY_DEVEL_BRANCH' set up to track remote branch path 'GIT_REMOTE_PATH' from origin.

To list GIT_REMOTE_PATH, use 'git branch -a' command

Switched to a new branch 'MY_DEVEL_BRANCH'

$>git merge master

Merge made by the 'recursive' strategy.

...

$>git push

...

DIGIKAM_DATABASE_EXPORT QString merge(const QStringList &keywordList)

Definition: coredbsearchxml.cpp:861

The first 2 lines make sure that your local master repository is up to date. The 3rd line creates the local development branch "MY_DEVEL_BRANCH". If you have already created this branch, just run "git checkout MY_DEVEL_BRANCH". Merging between master and "MY_DEVEL_BRANCH" branch is done in the 4th line. Git might ask you to resolve conflicts here. When it's done, it will ask you to provide a commit message. Finally you push your merge into the remote repository.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值