Commit 067a15c4 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

DPlugin interface; add new method to be able to open an host application setup...

DPlugin interface; add new method to be able to open an host application setup dialog page from a plugin.
DNGWriter: add ExifTool error view to settings Widget. If ExifTool is not available, show error view and allow
CCBUGS: 134486, 170693, 219856, 237504, 264210, 309341, 325458, 326408, 377622, 384092, 406540, 416516, 421464, 436286, 381967
to customize installation from configuration panel.
parent 73548835
......@@ -79,7 +79,7 @@ DigikamApp::DigikamApp()
d->splashScreen->setMessage(i18n("Initializing..."));
}
// ensure creation
// Ensure creation
AlbumManager::instance();
LoadingCacheInterface::initialize();
......
......@@ -128,6 +128,7 @@
#include "metadataedit.h"
#include "dfiledialog.h"
#include "dpluginloader.h"
#include "exiftoolparser.h"
#ifdef HAVE_MARBLE
# include "geolocationedit.h"
......
......@@ -32,6 +32,11 @@
#include <klocalizedstring.h>
// Local includes
#include "dinfointerface.h"
#include "dpluginbqm.h"
namespace DigikamBqmConvertToDngPlugin
{
......@@ -57,6 +62,9 @@ void ConvertToDNG::registerSettingsWidget()
connect(DNGBox, SIGNAL(signalSettingsChanged()),
this, SLOT(slotSettingsChanged()));
connect(DNGBox, SIGNAL(signalSetupExifTool()),
this, SLOT(slotSetupExifTool()));
m_settingsWidget = DNGBox;
BatchTool::registerSettingsWidget();
......@@ -104,6 +112,24 @@ void ConvertToDNG::slotSettingsChanged()
}
}
void ConvertToDNG::slotSetupExifTool()
{
DInfoInterface* const iface = plugin()->infoIface();
if (iface)
{
DNGSettings* const DNGBox = dynamic_cast<DNGSettings*>(m_settingsWidget);
if (DNGBox)
{
connect(iface, SIGNAL(signalSetupChanged()),
DNGBox, SLOT(slotSetupChanged()));
}
iface->openSetupPage(DInfoInterface::ExifToolPage);
}
}
QString ConvertToDNG::outputSuffix() const
{
return QLatin1String("dng");
......@@ -118,7 +144,9 @@ void ConvertToDNG::cancel()
bool ConvertToDNG::toolOperations()
{
if (!isRawFile(inputUrl()))
{
return false;
}
m_dngProcessor.reset();
m_dngProcessor.setInputFile(inputUrl().toLocalFile());
......
......@@ -56,7 +56,7 @@ private Q_SLOTS:
void slotSettingsChanged() override;
void slotAssignSettings2Widget() override;
void slotSetupExifTool();
private:
bool toolOperations() override;
......
......@@ -60,6 +60,7 @@
#include "dio.h"
#include "fileactionmngr.h"
#include "tagsactionmngr.h"
#include "setup.h"
#ifdef HAVE_MARBLE
# include "itemgps.h"
......@@ -569,7 +570,7 @@ void DBInfoIface::setItemInfo(const QUrl& url, const DInfoMap& map) const
if (!keys.isEmpty())
{
qCWarning(DIGIKAM_GENERAL_LOG) << "Keys not yet supported in DMetaInfoIface::setItemInfo():" << keys;
qCWarning(DIGIKAM_GENERAL_LOG) << "Keys not yet supported in DBInfoIface::setItemInfo():" << keys;
}
}
......@@ -797,4 +798,22 @@ void DBInfoIface::deleteImage(const QUrl& url)
DIO::del(info, true);
}
void DBInfoIface::openSetupPage(SetupPage page)
{
switch (page)
{
case ExifToolPage:
{
if (Setup::execExifTool(nullptr))
{
emit signalSetupChanged();
}
}
default:
{
}
}
}
} // namespace Digikam
......@@ -82,6 +82,8 @@ public:
void deleteImage(const QUrl& url) override;
void openSetupPage(SetupPage page) override;
#ifdef HAVE_MARBLE
QList<GPSItemContainer*> currentGPSItems() const override;
......
......@@ -172,7 +172,11 @@ bool DNGSettings::backupOriginalRawFile() const
void DNGSettings::slotSetupChanged()
{
d->errorView->setVisible(!ExifToolParser().exifToolAvailable());
ExifToolParser* const parser = new ExifToolParser();
d->errorView->setVisible(!parser->exifToolAvailable());
delete parser;
}
} // namespace Digikam
......@@ -29,17 +29,17 @@ int DNGWriter::Private::exifToolPostProcess()
{
qCDebug(DIGIKAM_GENERAL_LOG) << "DNGWriter: Post-process metadata with ExifTool";
ExifToolParser etParser;
ExifToolParser* const parser = new ExifToolParser();
if (etParser.exifToolAvailable())
if (parser->exifToolAvailable())
{
bool ret = etParser.copyTags(
bool ret = parser->copyTags(
inputInfo.filePath(),
dngFilePath,
ExifToolProcess::COPY_MAKERNOTES |
ExifToolProcess::COPY_IPTC |
ExifToolProcess::COPY_XMP
);
);
if (!ret)
{
......
......@@ -156,7 +156,10 @@ QMap<QString, QString> DInfoInterface::passShortcutActionsToWidget(QWidget* cons
void DInfoInterface::deleteImage(const QUrl&)
{
return;
}
void DInfoInterface::openSetupPage(SetupPage)
{
}
// -----------------------------------------------------------------
......
......@@ -56,6 +56,7 @@ class DIGIKAM_EXPORT DInfoInterface : public QObject
{
Q_OBJECT
public:
typedef QMap<QString, QVariant> DInfoMap; ///< Map of properties name and value.
......@@ -150,6 +151,18 @@ public:
/// Manipulate with item
virtual void deleteImage(const QUrl& url);
public:
enum SetupPage
{
ExifToolPage = 0
};
/// Open configuration dialog page.
virtual void openSetupPage(SetupPage page);
Q_SIGNAL void signalSetupChanged();
};
// -------------------------------------------------------------------------------------------------------------
......
......@@ -32,7 +32,7 @@ ExifToolParser::ExifToolParser(QObject* const parent)
{
// Create ExifTool parser instance.
d->proc = new ExifToolProcess(this);
d->proc = new ExifToolProcess(this);
for (int i = ExifToolProcess::LOAD_METADATA ; i < ExifToolProcess::NO_ACTION ; ++i)
{
......
......@@ -162,21 +162,21 @@ void ExifToolConfPanel::slotExifToolBinaryFound(bool found)
}
d->exifToolFormats->clear();
ExifToolParser parser;
parser.setExifToolProgram(exifToolDirectory());
ExifToolParser* const parser = new ExifToolParser();
parser->setExifToolProgram(exifToolDirectory());
ExifToolParser::ExifToolData parsed;
QStringList read;
QStringList write;
if (parser.readableFormats())
if (parser->readableFormats())
{
parsed = parser.currentData();
parsed = parser->currentData();
read = parsed.find(QLatin1String("READ_FORMATS")).value()[0].toStringList();
}
if (parser.writableFormats())
if (parser->writableFormats())
{
parsed = parser.currentData();
parsed = parser->currentData();
write = parsed.find(QLatin1String("WRITE_FORMATS")).value()[0].toStringList();
}
......
......@@ -73,7 +73,7 @@ ExifToolListView::ExifToolListView(QWidget* const parent)
setHeaderHidden(true);
header()->setSectionResizeMode(QHeaderView::Stretch);
d->parser = new ExifToolParser(this);
d->parser = new ExifToolParser();
connect(this, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
this, SLOT(slotSelectionChanged(QTreeWidgetItem*,int)));
......
......@@ -40,6 +40,7 @@ set(showfoto_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/thumbbar/showfotothumbnailbar.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/showfotosettings.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/showfotoinfoiface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/showfoto.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/showfoto_setup.cpp
......
......@@ -922,7 +922,7 @@ void ShowFoto::slotOpenWith(QAction* action)
DInfoInterface* ShowFoto::infoIface(DPluginAction* const)
{
DMetaInfoIface* const iface = new DMetaInfoIface(this, d->thumbBar->urls());
ShowfotoInfoIface* const iface = new ShowfotoInfoIface(this, d->thumbBar->urls());
qCDebug(DIGIKAM_GENERAL_LOG) << "ShowFoto::infoIface: nb of file" << d->thumbBar->urls().size();
......
......@@ -98,10 +98,11 @@
#include "showfotothumbnailmodel.h"
#include "showfotocategorizedview.h"
#include "showfotosettings.h"
#include "dmetainfoiface.h"
#include "showfotoinfoiface.h"
#include "dexpanderbox.h"
#include "dfiledialog.h"
#include "dpluginloader.h"
#include "exiftoolparser.h"
namespace ShowFoto
{
......
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2017-05-06
* Description : interface to item information for Showfoto
*
* Copyright (C) 2017-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2019-2020 by Minh Nghia Duong <minhnghiaduong997 at gmail dot com>
*
* 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 "showfotoinfoiface.h"
// KDE includes
#include <klocalizedstring.h>
// Local includes
#include "showfotosetup.h"
#include "digikam_debug.h"
namespace ShowFoto
{
ShowfotoInfoIface::ShowfotoInfoIface(QObject* const parent, const QList<QUrl>& lst)
: DMetaInfoIface(parent, lst)
{
}
ShowfotoInfoIface::~ShowfotoInfoIface()
{
}
void ShowfotoInfoIface::openSetupPage(SetupPage page)
{
switch (page)
{
case ExifToolPage:
{
if (Setup::execExifTool(nullptr))
{
emit signalSetupChanged();
}
}
default:
{
}
}
}
} // namespace ShowFoto
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2017-05-06
* Description : interface to item information for Showfoto
*
* Copyright (C) 2017-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2019-2020 by Minh Nghia Duong <minhnghiaduong997 at gmail dot com>
*
* 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 SHOWFOTO_META_INFO_IFACE_H
#define SHOWFOTO_META_INFO_IFACE_H
// Local includes
#include "dmetainfoiface.h"
using namespace Digikam;
namespace ShowFoto
{
class ShowfotoInfoIface : public DMetaInfoIface
{
Q_OBJECT
public:
explicit ShowfotoInfoIface(QObject* const, const QList<QUrl>&);
~ShowfotoInfoIface() override;
void openSetupPage(SetupPage page) override;
};
} // namespace ShowFoto
#endif // SHOWFOTO_META_INFO_IFACE_H
......@@ -42,7 +42,7 @@ using namespace Digikam;
bool exifToolParse(const QString& file)
{
ExifToolParser* const parser = new ExifToolParser;
ExifToolParser* const parser = new ExifToolParser();
// Read metadata from the file. Start ExifToolParser
......@@ -52,7 +52,7 @@ bool exifToolParse(const QString& file)
return false;
}
QString path = parser->currentPath();
QString path = parser->currentPath();
ExifToolParser::ExifToolData parsed = parser->currentData();
qDebug().noquote() << "Processing source file:" << path;
......
......@@ -31,6 +31,7 @@
#include "digikam_version.h"
#include "digikam_debug.h"
#include "batchtoolsfactory.h"
namespace Digikam
{
......@@ -48,7 +49,7 @@ public:
DPluginBqm::DPluginBqm(QObject* const parent)
: DPlugin(parent),
d(new Private)
d (new Private)
{
}
......@@ -102,6 +103,18 @@ void DPluginBqm::addTool(BatchTool* const t)
d->tools.append(t);
}
DInfoInterface* DPluginBqm::infoIface() const
{
DInfoInterface* const iface = BatchToolsFactory::instance()->infoIface();
if (iface)
{
return iface;
}
return nullptr;
}
QStringList DPluginBqm::categories() const
{
QStringList list;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment