diff --git a/NEWS b/NEWS index f6f93b354f..f315ffc1f4 100644 --- a/NEWS +++ b/NEWS @@ -1,50 +1,50 @@ digiKam 6.4.0 - Release date: 2019-??-?? ***************************************************************************************************** NEW FEATURES: General : new RawImport plugin interface to delegate Raw decoding function to extra engine with ImageEditor. ImageEditor: add new setting from setup dialog to select right Raw Import plugin. ImageEditor: add new clone tool to fix artifacts on image. ImageEditor: add new tool to import RAW image using UFRaw. ImageEditor: add new tool to import RAW image using RawTherapee. +ImageEditor: add new tool to import RAW image using DarkTable. ***************************************************************************************************** BUGFIXES: 001 ==> 411587 - [digiKam] Crash when reopening Google Photos import wizard. 002 ==> 411578 - White Balance changes global luminosity. 003 ==> 411696 - Cannot launch digikam-6.3.0-x86-64.appimage in Kubuntu 14.04. 004 ==> 406503 - Histogram initializes greyer than white. 005 ==> 411714 - Correction of ticket 408881 (Restore default tools settings) is not enforced. 006 ==> 411702 - Video/picture Filter. 007 ==> 411726 - Geolocation not working. 008 ==> 387768 - File system corruption after renaming folder. 009 ==> 411808 - digiKam quit unexpectedly. 010 ==> 411880 - Existing file is count but not displayed. 011 ==> 411882 - I don't get image stack or panorama. 012 ==> 403269 - Stacked image and Panorama tools cannot find required binaries. 013 ==> 411651 - New tool to export photos to Canon Irista. 014 ==> 411927 - Crash during initial scan. 015 ==> 389652 - Interface freezes during initial scan. 016 ==> 389949 - Very slow startup [patch]. 017 ==> 316865 - SCAN : Add new option to don't scan file bigger than n Mb or stop scan if longer than n seconds. 018 ==> 370019 - Sidecar metadata not loading sporadically. 019 ==> 329353 - Make slow processing better. 020 ==> 392090 - While scanning collection the progess bar shows 0%. 021 ==> 411929 - Can not move or delete videos that were not played till the end. 022 ==> 392727 - Images are missing (Windows). 023 ==> 396559 - "digikam.dbengine: Database is locked." when scanning for new items. 024 ==> 411946 - Crash when saving captions to picture. 025 ==> 411902 - Interface icons become very large and unusable. 026 ==> 330168 - MYSQL : allow read only database. 027 ==> 351658 - Prevent to fill whole memory when all CPU cores are used to process Maintenance tools. 028 ==> 110920 - Support for removing complex objects from photos. 029 ==> 103332 - Blurring brushes for image correction. 030 ==> 150161 - UFRaw as tool for RAW. 032 ==> 411214 - digiKam git beta 6.4 eats huge memory. 033 ==> 181941 - Add an option to image editor to remember or not tools settings between sessions. 034 ==> 221571 - Integrate RawTherapee into digikam -035 ==> - - +035 ==> 341186 - Integrate with darktable. +036 ==> diff --git a/core/dplugins/rawimport/CMakeLists.txt b/core/dplugins/rawimport/CMakeLists.txt index ff095a8e9c..1492f7ef21 100644 --- a/core/dplugins/rawimport/CMakeLists.txt +++ b/core/dplugins/rawimport/CMakeLists.txt @@ -1,10 +1,11 @@ # # Copyright (c) 2010-2019 by Gilles Caulier, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # NOTE: Native plugin use internal libraw from digiKam core. add_subdirectory(native) add_subdirectory(ufraw) add_subdirectory(rawtherapee) +add_subdirectory(darktable) diff --git a/core/dplugins/rawimport/darktable/CMakeLists.txt b/core/dplugins/rawimport/darktable/CMakeLists.txt new file mode 100644 index 0000000000..4cf92e6b96 --- /dev/null +++ b/core/dplugins/rawimport/darktable/CMakeLists.txt @@ -0,0 +1,23 @@ +# +# Copyright (c) 2015-2019 by Gilles Caulier, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +include(MacroDPlugins) + +include_directories($ + $ + $ + + $ + $ +) + +set(rawimportdarktableplugin_SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/rawimportdarktableplugin.cpp +) + +DIGIKAM_ADD_RAWIMPORT_PLUGIN(NAME DarkTable + SOURCES ${rawimportdarktableplugin_SRCS} +) diff --git a/core/dplugins/rawimport/darktable/rawimportdarktableplugin.cpp b/core/dplugins/rawimport/darktable/rawimportdarktableplugin.cpp new file mode 100644 index 0000000000..536bc60f20 --- /dev/null +++ b/core/dplugins/rawimport/darktable/rawimportdarktableplugin.cpp @@ -0,0 +1,249 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * https://www.digikam.org + * + * Date : 2019-09-18 + * Description : DarkTable raw import plugin. + * + * Copyright (C) 2019 by Gilles Caulier + * + * Lua script inspired from Darktable Gimp plugin + * Copyright (C) 2015-2017 by Tobias Ellinghaus + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * ============================================================ */ + +#include "rawimportdarktableplugin.h" + +// Qt includes + +#include +#include +#include +#include +#include +#include + +// KDE includes + +#include + +// Local includes + +#include "digikam_debug.h" + +namespace DigikamRawImportDarkTablePlugin +{ + +const QString s_luaScriptData = QLatin1String("\n" \ +"local dt = require \"darktable\"\n" \ +"\n" \ +"local min_api_version = \"2.1.0\"\n" \ +"if dt.configuration.api_version_string < min_api_version then\n" \ +" dt.print(\"the exit export script requires at least darktable version 1.7.0\")\n" \ +" dt.print_error(\"the exit export script requires at least darktable version 1.7.0\")\n" \ +" return\n" \ +"else\n" \ +" dt.print(\"closing darktable will export the image and make image editor load it\")\n" \ +"end\n" \ +"\n" \ +"local export_filename = dt.preferences.read(\"export_on_exit\", \"export_filename\", \"string\")\n" \ +"\n" \ +"dt.register_event(\"exit\", function()\n" \ +" -- safegurad against someone using this with their library containing 50k images\n" \ +" if #dt.database > 1 then\n" \ +" dt.print_error(\"too many images, only exporting the first\")\n" \ +" -- return\n" \ +" end\n" \ +"\n" \ +" -- change the view first to force writing of the history stack\n" \ +" dt.gui.current_view(dt.gui.views.lighttable)\n" \ +" -- now export\n" \ +" local format = dt.new_format(\"png\")\n" \ +" format.max_width = 0\n" \ +" format.max_height = 0\n" \ +" -- lets have the export in a loop so we could easily support > 1 images\n" \ +" for _, image in ipairs(dt.database) do\n" \ +" dt.print_error(\"exporting `\"..tostring(image)..\"' to `\"..export_filename..\"'\")\n" \ +" format:write_image(image, export_filename)\n" \ +" break -- only export one image. see above for the reason\n" \ +" end\n" \ +"end)\n" \ +""); + +DarkTableRawImportPlugin::DarkTableRawImportPlugin(QObject* const parent) + : DPluginRawImport(parent), + m_darktable(nullptr), + m_tempFile(nullptr) +{ + m_luaFile.open(); + QTextStream stream(&m_luaFile); + stream << s_luaScriptData; + stream.flush(); +} + +DarkTableRawImportPlugin::~DarkTableRawImportPlugin() +{ +} + +QString DarkTableRawImportPlugin::name() const +{ + return QString::fromUtf8("Raw Import using DarkTable"); +} + +QString DarkTableRawImportPlugin::iid() const +{ + return QLatin1String(DPLUGIN_IID); +} + +QIcon DarkTableRawImportPlugin::icon() const +{ + return QIcon::fromTheme(QLatin1String("image-x-adobe-dng")); +} + +QString DarkTableRawImportPlugin::description() const +{ + return QString::fromUtf8("A RAW import plugin based on DarkTable"); +} + +QString DarkTableRawImportPlugin::details() const +{ + return QString::fromUtf8("

This RAW Import plugin use DarkTable tool to pre-process file in Image Editor.

"); +} + +QList DarkTableRawImportPlugin::authors() const +{ + return QList() + << DPluginAuthor(QString::fromUtf8("Gilles Caulier"), + QString::fromUtf8("caulier dot gilles at gmail dot com"), + QString::fromUtf8("(C) 2019")) + ; +} + +void DarkTableRawImportPlugin::setup(QObject* const /*parent*/) +{ + // Nothing to do +} + +bool DarkTableRawImportPlugin::run(const QString& filePath, const DRawDecoding& /*def*/) +{ + m_fileInfo = QFileInfo(filePath); + m_props = LoadingDescription(m_fileInfo.filePath(), LoadingDescription::ConvertForEditor); + m_decoded = DImg(); + + delete m_tempFile; + + m_tempFile = new QTemporaryFile(); + m_tempFile->open(); + + m_darktable = new QProcess(this); + m_darktable->setProcessChannelMode(QProcess::MergedChannels); + m_darktable->setWorkingDirectory(m_fileInfo.path()); + + connect(m_darktable, SIGNAL(errorOccurred(QProcess::ProcessError)), + this, SLOT(slotErrorOccurred(QProcess::ProcessError))); + + connect(m_darktable, SIGNAL(finished(int,QProcess::ExitStatus)), + this, SLOT(slotProcessFinished(int,QProcess::ExitStatus))); + + connect(m_darktable, SIGNAL(readyRead()), + this, SLOT(slotProcessReadyRead())); + + // -------- + + m_fileInfo = QFileInfo(filePath); + + m_darktable->setProgram(QLatin1String("darktable")); + m_darktable->setArguments(QStringList() << QLatin1String("--library") + << QLatin1String(":memory:") // Run DarkTable to process only one file + << QLatin1String("--luacmd") + << QString::fromUtf8("dofile('%1')") + .arg(m_luaFile.fileName()) // LUA script to run in DarkTable + << QLatin1String("--conf") + << QLatin1String("plugins/lighttable/export/icctype=3") // Output color-space + << QLatin1String("--conf") + << QString::fromUtf8("lua/export_on_exit/export_filename=%1") + .arg(m_tempFile->fileName()) // Ouput file + << filePath); // Input file + + qCDebug(DIGIKAM_GENERAL_LOG) << "DarkTable arguments:" << m_darktable->arguments(); + + m_darktable->start(); + + return true; +} + +void DarkTableRawImportPlugin::slotErrorOccurred(QProcess::ProcessError error) +{ + switch (error) + { + case QProcess::FailedToStart: + qCDebug(DIGIKAM_GENERAL_LOG) << "DarkTable :: Process has failed to start"; + break; + case QProcess::Crashed: + qCDebug(DIGIKAM_GENERAL_LOG) << "DarkTable :: Process has crashed"; + break; + case QProcess::Timedout: + qCDebug(DIGIKAM_GENERAL_LOG) << "DarkTable :: Process time-out"; + break; + case QProcess::WriteError: + qCDebug(DIGIKAM_GENERAL_LOG) << "DarkTable :: Process write error"; + break; + case QProcess::ReadError: + qCDebug(DIGIKAM_GENERAL_LOG) << "DarkTable :: Process read error"; + break; + default: + qCDebug(DIGIKAM_GENERAL_LOG) << "DarkTable :: Process error unknown"; + break; + } +} + +void DarkTableRawImportPlugin::slotProcessFinished(int code, QProcess::ExitStatus status) +{ + qCDebug(DIGIKAM_GENERAL_LOG) << "DarkTable :: return code:" << code << ":: Exit status:" << status; + + m_decoded = DImg(m_tempFile->fileName()); + + if (m_decoded.isNull()) + { + QString message = i18n("Error to import RAW image with DarkTable\nClose this dialog to load RAW image with native import tool"); + QMessageBox::information(0, qApp->applicationName(), message); + + qCDebug(DIGIKAM_GENERAL_LOG) << "Decoded image is null! Load with Native tool..."; + qCDebug(DIGIKAM_GENERAL_LOG) << m_props.filePath; + emit signalLoadRaw(m_props); + } + else + { + qCDebug(DIGIKAM_GENERAL_LOG) << "Decoded image is not null..."; + qCDebug(DIGIKAM_GENERAL_LOG) << m_props.filePath; + m_props = LoadingDescription(m_tempFile->fileName(), LoadingDescription::ConvertForEditor); + emit signalDecodedImage(m_props, m_decoded); + } + + delete m_tempFile; + m_tempFile = nullptr; +} + +void DarkTableRawImportPlugin::slotProcessReadyRead() +{ + QByteArray data = m_darktable->readAllStandardError(); + QStringList lines = QString::fromUtf8(data).split(QLatin1Char('\n'), QString::SkipEmptyParts); + + foreach (const QString& one, lines) + { + qCDebug(DIGIKAM_GENERAL_LOG) << "DarkTable ::" << one; + } +} + +} // namespace DigikamRawImportDarkTablePlugin diff --git a/core/dplugins/rawimport/ufraw/rawimportufrawplugin.h b/core/dplugins/rawimport/darktable/rawimportdarktableplugin.h similarity index 76% copy from core/dplugins/rawimport/ufraw/rawimportufrawplugin.h copy to core/dplugins/rawimport/darktable/rawimportdarktableplugin.h index a07362e810..3b784be852 100644 --- a/core/dplugins/rawimport/ufraw/rawimportufrawplugin.h +++ b/core/dplugins/rawimport/darktable/rawimportdarktableplugin.h @@ -1,85 +1,85 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-18 - * Description : UFRaw raw import plugin. + * Description : DarkTable raw import plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ -#ifndef DIGIKAM_UFRAW_RAW_IMPORT_PLUGIN_H -#define DIGIKAM_UFRAW_RAW_IMPORT_PLUGIN_H +#ifndef DIGIKAM_DARKTABLE_RAW_IMPORT_PLUGIN_H +#define DIGIKAM_DARKTABLE_RAW_IMPORT_PLUGIN_H // Qt includes #include #include #include // Local includes #include "dpluginrawimport.h" -#include "dhistoryview.h" #include "dimg.h" #include "loadingdescription.h" -#define DPLUGIN_IID "org.kde.digikam.plugin.rawimport.UFRaw" +#define DPLUGIN_IID "org.kde.digikam.plugin.rawimport.DarkTable" using namespace Digikam; -namespace DigikamRawImportUFRawPlugin +namespace DigikamRawImportDarkTablePlugin { -class UFRawRawImportPlugin : public DPluginRawImport +class DarkTableRawImportPlugin : public DPluginRawImport { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginRawImport) public: - explicit UFRawRawImportPlugin(QObject* const parent = nullptr); - ~UFRawRawImportPlugin(); + explicit DarkTableRawImportPlugin(QObject* const parent = nullptr); + ~DarkTableRawImportPlugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; bool run(const QString& filePath, const DRawDecoding& def); private Q_SLOTS: void slotErrorOccurred(QProcess::ProcessError); void slotProcessFinished(int, QProcess::ExitStatus); void slotProcessReadyRead(); private: - QProcess* m_ufraw; + QProcess* m_darktable; DImg m_decoded; LoadingDescription m_props; QFileInfo m_fileInfo; QTemporaryFile* m_tempFile; + QTemporaryFile m_luaFile; }; -} // namespace DigikamRawImportUFRawPlugin +} // namespace DigikamRawImportDarkTablePlugin -#endif // DIGIKAM_UFRAW_RAW_IMPORT_PLUGIN_H +#endif // DIGIKAM_DARKTABLE_RAW_IMPORT_PLUGIN_H diff --git a/core/dplugins/rawimport/rawtherapee/rawimportrawtherapeeplugin.h b/core/dplugins/rawimport/rawtherapee/rawimportrawtherapeeplugin.h index 4c0019bb89..8257fde98b 100644 --- a/core/dplugins/rawimport/rawtherapee/rawimportrawtherapeeplugin.h +++ b/core/dplugins/rawimport/rawtherapee/rawimportrawtherapeeplugin.h @@ -1,85 +1,84 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-18 * Description : RawTherapee raw import plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ #ifndef DIGIKAM_RAWTHERAPEE_RAW_IMPORT_PLUGIN_H #define DIGIKAM_RAWTHERAPEE_RAW_IMPORT_PLUGIN_H // Qt includes #include #include #include // Local includes #include "dpluginrawimport.h" -#include "dhistoryview.h" #include "dimg.h" #include "loadingdescription.h" #define DPLUGIN_IID "org.kde.digikam.plugin.rawimport.RawTherapee" using namespace Digikam; namespace DigikamRawImportRawTherapeePlugin { class RawTherapeeRawImportPlugin : public DPluginRawImport { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginRawImport) public: explicit RawTherapeeRawImportPlugin(QObject* const parent = nullptr); ~RawTherapeeRawImportPlugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; bool run(const QString& filePath, const DRawDecoding& def); private Q_SLOTS: void slotErrorOccurred(QProcess::ProcessError); void slotProcessFinished(int, QProcess::ExitStatus); void slotProcessReadyRead(); private: QProcess* m_rawtherapee; DImg m_decoded; LoadingDescription m_props; QFileInfo m_fileInfo; QTemporaryFile* m_tempFile; }; } // namespace DigikamRawImportRawTherapeePlugin #endif // DIGIKAM_RAWTHERAPEE_RAW_IMPORT_PLUGIN_H diff --git a/core/dplugins/rawimport/ufraw/rawimportufrawplugin.h b/core/dplugins/rawimport/ufraw/rawimportufrawplugin.h index a07362e810..10925d6853 100644 --- a/core/dplugins/rawimport/ufraw/rawimportufrawplugin.h +++ b/core/dplugins/rawimport/ufraw/rawimportufrawplugin.h @@ -1,85 +1,84 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-18 * Description : UFRaw raw import plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ #ifndef DIGIKAM_UFRAW_RAW_IMPORT_PLUGIN_H #define DIGIKAM_UFRAW_RAW_IMPORT_PLUGIN_H // Qt includes #include #include #include // Local includes #include "dpluginrawimport.h" -#include "dhistoryview.h" #include "dimg.h" #include "loadingdescription.h" #define DPLUGIN_IID "org.kde.digikam.plugin.rawimport.UFRaw" using namespace Digikam; namespace DigikamRawImportUFRawPlugin { class UFRawRawImportPlugin : public DPluginRawImport { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginRawImport) public: explicit UFRawRawImportPlugin(QObject* const parent = nullptr); ~UFRawRawImportPlugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; bool run(const QString& filePath, const DRawDecoding& def); private Q_SLOTS: void slotErrorOccurred(QProcess::ProcessError); void slotProcessFinished(int, QProcess::ExitStatus); void slotProcessReadyRead(); private: QProcess* m_ufraw; DImg m_decoded; LoadingDescription m_props; QFileInfo m_fileInfo; QTemporaryFile* m_tempFile; }; } // namespace DigikamRawImportUFRawPlugin #endif // DIGIKAM_UFRAW_RAW_IMPORT_PLUGIN_H