Commit 0f39bcc7 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Drop KIPI support

KIPI offers export functionality for various external services

However it has been abandoned from its original authors and receives no real development any more

A lot, if not all of its providers are defunct and it severly lacks UI polish

Gwenview already has integration with Purpose which offers a similar (albeit theoretically reduced) functionality with a much more polished experience
parent 3d0f70c8
Pipeline #104433 passed with stage
in 5 minutes and 58 seconds
......@@ -25,6 +25,5 @@ Dependencies:
'frameworks/kiconthemes': '@stable'
'frameworks/kparts': '@stable'
'frameworks/knotifications': '@stable'
'graphics/libkipi': '@same'
'graphics/libkdcraw': '@same'
'libraries/phonon': '@stable'
......@@ -110,12 +110,6 @@ if (TIFF_FOUND)
set(HAVE_TIFF true)
endif()
find_package(KF5Kipi)
if (KF5Kipi_FOUND)
set(KIPI_FOUND true)
endif()
set_package_properties(KF5Kipi PROPERTIES URL "https://phabricator.kde.org/source/kipi-plugins/" DESCRIPTION "Provides various image manipulation and export features" TYPE OPTIONAL)
find_package(LCMS2)
set_package_properties(LCMS2 PROPERTIES URL "http://www.littlecms.com" DESCRIPTION "Color management engine" TYPE REQUIRED)
......
......@@ -45,16 +45,6 @@ if (NOT GWENVIEW_SEMANTICINFO_BACKEND_NONE)
)
endif()
if (KF5Kipi_FOUND)
set (gwenview_SRCS
${gwenview_SRCS}
kipiexportaction.cpp
kipiimagecollectionselector.cpp
kipiinterface.cpp
kipiuploadwidget.cpp
)
endif()
ki18n_wrap_ui(gwenview_SRCS
advancedconfigpage.ui
fullscreenconfigwidget.ui
......@@ -95,10 +85,6 @@ endif()
target_link_libraries(gwenview LINK_INTERFACE_LIBRARIES KF5::KIOCore Qt5::Core)
if (KF5Kipi_FOUND)
target_link_libraries(gwenview KF5::Kipi)
endif()
if (HAVE_TIFF)
target_link_libraries(gwenview TIFF::TIFF)
endif()
......
<?xml version="1.0"?>
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
<gui name="gwenview" version="64">
<gui name="gwenview" version="65">
<MenuBar>
<Menu name="file" >
......@@ -79,9 +79,6 @@
<Separator/>
<Action name="go_start_page"/>
</Menu>
<Menu name="plugins">
<text>&amp;Plugins</text>
</Menu>
<Menu name="settings" noMerge="1">
<text>&amp;Settings</text>
<!--
......
// vim: set tabstop=4 shiftwidth=4 expandtab:
/*
Gwenview: an image viewer
Copyright 2010 Aurélien Gâteau <agateau@kde.org>
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
of the License, 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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
*/
// Self
#include "kipiexportaction.h"
// Qt
#include <QMenu>
// KF
#include <KLocalizedString>
// Local
#include "kipiinterface.h"
#include <lib/gwenviewconfig.h>
namespace Gwenview
{
struct KIPIExportActionPrivate {
KIPIExportAction *q;
KIPIInterface *mKIPIInterface;
QAction *mDefaultAction;
QList<QAction *> mExportActionList;
void updateMenu()
{
auto *menu = static_cast<QMenu *>(q->menu());
menu->clear();
if (mDefaultAction && mExportActionList.contains(mDefaultAction)) {
if (mExportActionList.count() > 1) {
menu->addSection(i18n("Last Used Plugin"));
}
menu->addAction(mDefaultAction);
menu->addSection(i18n("Other Plugins"));
}
for (QAction *action : qAsConst(mExportActionList)) {
action->setIconVisibleInMenu(true);
if (action != mDefaultAction) {
menu->addAction(action);
}
}
}
};
KIPIExportAction::KIPIExportAction(QObject *parent)
: KToolBarPopupAction(QIcon::fromTheme(QStringLiteral("document-share")), i18nc("@action", "Share"), parent)
, d(new KIPIExportActionPrivate)
{
d->q = this;
d->mKIPIInterface = nullptr;
d->mDefaultAction = nullptr;
setToolTip(i18nc("@info:tooltip", "Share images using various services"));
setDelayed(false);
connect(menu(), &QMenu::aboutToShow, this, &KIPIExportAction::init);
connect(menu(), &QMenu::triggered, this, &KIPIExportAction::slotPluginTriggered);
}
KIPIExportAction::~KIPIExportAction()
{
delete d;
}
void KIPIExportAction::setKIPIInterface(KIPIInterface *interface)
{
d->mKIPIInterface = interface;
connect(d->mKIPIInterface, &KIPIInterface::loadingFinished, this, &KIPIExportAction::init);
}
void KIPIExportAction::init()
{
d->mExportActionList = d->mKIPIInterface->pluginActions(KIPI::ExportPlugin);
if (d->mKIPIInterface->isLoadingFinished()) {
// Look for default action
QString defaultActionText = GwenviewConfig::defaultExportPluginText();
for (QAction *action : qAsConst(d->mExportActionList)) {
if (action->text() == defaultActionText) {
setDefaultAction(action);
break;
}
}
// We are done, don't come back next time menu is shown
disconnect(menu(), &QMenu::aboutToShow, this, &KIPIExportAction::init);
// TODO: Temporary fix for the 'Share' menu not showing when updated
// the second time. See Bug 395034 and D13312
d->updateMenu();
}
d->updateMenu();
}
void KIPIExportAction::setDefaultAction(QAction *action)
{
if (action == d->mDefaultAction) {
return;
}
d->mDefaultAction = action;
GwenviewConfig::setDefaultExportPluginText(action->text());
}
void KIPIExportAction::slotPluginTriggered(QAction *action)
{
setDefaultAction(action);
d->updateMenu();
}
} // namespace
// vim: set tabstop=4 shiftwidth=4 expandtab:
/*
Gwenview: an image viewer
Copyright 2010 Aurélien Gâteau <agateau@kde.org>
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
of the License, 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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
*/
#ifndef KIPIEXPORTACTION_H
#define KIPIEXPORTACTION_H
// Qt
// KF
#include <KToolBarPopupAction>
// Local
namespace Gwenview
{
class KIPIInterface;
struct KIPIExportActionPrivate;
class KIPIExportAction : public KToolBarPopupAction
{
Q_OBJECT
public:
explicit KIPIExportAction(QObject *parent);
~KIPIExportAction() override;
void setKIPIInterface(KIPIInterface *);
private Q_SLOTS:
void init();
void setDefaultAction(QAction *);
void slotPluginTriggered(QAction *);
private:
KIPIExportActionPrivate *const d;
};
} // namespace
#endif /* KIPIEXPORTACTION_H */
// vim: set tabstop=4 shiftwidth=4 expandtab:
/*
Gwenview: an image viewer
Copyright 2008 Aurélien Gâteau <agateau@kde.org>
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
of the License, 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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
*/
// Self
#include "kipiimagecollectionselector.h"
// Qt
#include <QListWidget>
#include <QVBoxLayout>
// KF
#include <KLocalizedString>
// Local
namespace Gwenview
{
struct KIPIImageCollectionSelectorPrivate {
KIPIInterface *mInterface;
QListWidget *mListWidget;
};
KIPIImageCollectionSelector::KIPIImageCollectionSelector(KIPIInterface *interface, QWidget *parent)
: KIPI::ImageCollectionSelector(parent)
, d(new KIPIImageCollectionSelectorPrivate)
{
d->mInterface = interface;
d->mListWidget = new QListWidget;
const QList<KIPI::ImageCollection> list = interface->allAlbums();
for (const KIPI::ImageCollection &collection : list) {
auto *item = new QListWidgetItem(d->mListWidget);
QString name = collection.name();
int imageCount = collection.images().size();
QString title = i18ncp("%1 is collection name, %2 is image count in collection", "%1 (%2 image)", "%1 (%2 images)", name, imageCount);
item->setText(title);
item->setData(Qt::UserRole, name);
}
connect(d->mListWidget, &QListWidget::currentRowChanged, this, &KIPIImageCollectionSelector::selectionChanged);
auto *layout = new QVBoxLayout(this);
layout->addWidget(d->mListWidget);
layout->setContentsMargins(0, 0, 0, 0);
}
KIPIImageCollectionSelector::~KIPIImageCollectionSelector()
{
delete d;
}
QList<KIPI::ImageCollection> KIPIImageCollectionSelector::selectedImageCollections() const
{
QListWidgetItem *item = d->mListWidget->currentItem();
QList<KIPI::ImageCollection> selectedList;
if (item) {
QString name = item->data(Qt::UserRole).toString();
const QList<KIPI::ImageCollection> list = d->mInterface->allAlbums();
for (const KIPI::ImageCollection &collection : list) {
if (collection.name() == name) {
selectedList << collection;
break;
}
}
}
return selectedList;
}
} // namespace
// vim: set tabstop=4 shiftwidth=4 expandtab:
/*
Gwenview: an image viewer
Copyright 2008 Aurélien Gâteau <agateau@kde.org>
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
of the License, 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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
*/
#ifndef KIPIIMAGECOLLECTIONSELECTOR_H
#define KIPIIMAGECOLLECTIONSELECTOR_H
// Qt
// KF
// KIPI
#include <kipi/imagecollection.h>
#include <kipi/imagecollectionselector.h>
// Local
#include "kipiinterface.h"
namespace Gwenview
{
struct KIPIImageCollectionSelectorPrivate;
class KIPIImageCollectionSelector : public KIPI::ImageCollectionSelector
{
Q_OBJECT
public:
KIPIImageCollectionSelector(KIPIInterface *, QWidget *parent);
~KIPIImageCollectionSelector() override;
QList<KIPI::ImageCollection> selectedImageCollections() const override;
private:
KIPIImageCollectionSelectorPrivate *const d;
};
} // namespace
#endif /* KIPIIMAGECOLLECTIONSELECTOR_H */
// vim: set tabstop=4 shiftwidth=4 expandtab:
/*
Gwenview: an image viewer
Copyright 2000-2008 Aurélien Gâteau <agateau@kde.org>
Copyright 2008 Angelo Naselli <anaselli@linux.it>
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
of the License, 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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
*/
#include "kipiinterface.h"
// Qt
#include <QAction>
#include <QDesktopServices>
#include <QFileSystemWatcher>
#include <QList>
#include <QMenu>
#include <QRegExp>
#include <QTimer>
#include <QUrl>
// KF
#include <KActionCollection>
#include <KDirLister>
#include <KIO/DesktopExecParser>
#include <KLocalizedString>
#include <KXMLGUIFactory>
// KIPI
#include <kipi/imageinfo.h>
#include <kipi/imageinfoshared.h>
#include <kipi/pluginloader.h>
// local
#include "gwenview_app_debug.h"
#include "kipiimagecollectionselector.h"
#include "kipiuploadwidget.h"
#include "mainwindow.h"
#include <lib/contextmanager.h>
#include <lib/jpegcontent.h>
#include <lib/mimetypeutils.h>
#include <lib/semanticinfo/sorteddirmodel.h>
#include <lib/timeutils.h>
#define KIPI_PLUGINS_URL QStringLiteral("appstream://org.kde.kipi_plugins")
namespace Gwenview
{
#undef ENABLE_LOG
#undef LOG
//#define ENABLE_LOG
#ifdef ENABLE_LOG
#define LOG(x) qCDebug(GWENVIEW_APP_LOG) << x
#else
#define LOG(x) ;
#endif
class KIPIImageInfo : public KIPI::ImageInfoShared
{
static const QRegExp sExtensionRE;
public:
KIPIImageInfo(KIPI::Interface *interface, const QUrl &url)
: KIPI::ImageInfoShared(interface, url)
{
KFileItem item(url);
mAttributes.insert(QStringLiteral("name"), url.fileName());
mAttributes.insert(QStringLiteral("comment"), comment());
mAttributes.insert(QStringLiteral("date"), TimeUtils::dateTimeForFileItem(item));
mAttributes.insert(QStringLiteral("orientation"), orientation());
mAttributes.insert(QStringLiteral("title"), prettyFileName());
int size = item.size();
if (size > 0) {
mAttributes.insert(QStringLiteral("filesize"), size);
}
}
QMap<QString, QVariant> attributes() override
{
return mAttributes;
}
void delAttributes(const QStringList &attributeNames) override
{
for (const QString &name : attributeNames) {
mAttributes.remove(name);
}
}
void clearAttributes() override
{
mAttributes.clear();
}
void addAttributes(const QVariantMap &attributes) override
{
QVariantMap::ConstIterator it = attributes.constBegin(), end = attributes.constEnd();
for (; it != end; ++it) {
mAttributes.insert(it.key(), it.value());
}
}
private:
QString prettyFileName() const
{
QString txt = _url.fileName();
txt.replace('_', ' ');
txt.remove(sExtensionRE);
return txt;
}
QString comment() const
{
if (!_url.isLocalFile())
return QString();
JpegContent content;
bool ok = content.load(_url.toLocalFile());
if (!ok)
return QString();
return content.comment();
}
int orientation() const
{
#if 0 // PORT QT5
KFileMetaInfo metaInfo(_url);
if (!metaInfo.isValid()) {
return 0;
}
const KFileMetaInfoItem& mii = metaInfo.item("http://freedesktop.org/standards/xesam/1.0/core#orientation");
bool ok = false;
const Orientation orientation = (Orientation)mii.value().toInt(&ok);
if (!ok) {
return 0;
}
switch (orientation) {
case NOT_AVAILABLE:
case NORMAL:
return 0;
case ROT_90:
return 90;
case ROT_180:
return 180;
case ROT_270:
return 270;
case HFLIP:
case VFLIP:
case TRANSPOSE:
case TRANSVERSE:
qCWarning(GWENVIEW_APP_LOG) << "Can't represent an orientation value of" << orientation << "as an angle (" << _url << ')';
return 0;
}
#endif
// qCWarning(GWENVIEW_APP_LOG) << "Don't know how to handle an orientation value of" << orientation << '(' << _url << ')';
return 0;
}
QVariantMap mAttributes;
};
const QRegExp KIPIImageInfo::sExtensionRE("\\.[a-z0-9]+$", Qt::CaseInsensitive);
struct MenuInfo {
QString mName;
QList<QAction *> mActions;
QString mIconName;
MenuInfo()
{
}
MenuInfo(const QString &name, const QString &iconName)
: mName(name)
, mIconName(iconName)
{
}
};
using MenuInfoMap = QMap<KIPI::Category, MenuInfo>;
struct KIPIInterfacePrivate {
KIPIInterface *q;
MainWindow *mMainWindow;
QMenu *mPluginMenu;
KIPI::PluginLoader *mPluginLoader;
KIPI::PluginLoader::PluginList mPluginQueue;
MenuInfoMap mMenuInfoMap;
QAction *mLoadingAction;
QAction *mNoPluginAction;
QAction *mInstallPluginAction;
QFileSystemWatcher mPluginWatcher;
QTimer mPluginLoadTimer;
void setupPluginsMenu()
{
mPluginMenu = static_cast<QMenu *>(mMainWindow->factory()->container("plugins", mMainWindow));
QObject::connect(mPluginMenu, &QMenu::aboutToShow, q, &KIPIInterface::loadPlugins);
}
QAction *createDummyPluginAction(const QString &text)
{
auto *action = new QAction(q);
action->setText(text);
// PORT QT5 action->setShortcutConfigurable(false);
action->setEnabled(false);
return action;
}
};
KIPIInterface::KIPIInterface(MainWindow *mainWindow)
: KIPI::Interface(mainWindow)
, d(new KIPIInterfacePrivate