generic: drop Kipi support

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-08-04 02:10:23 +03:00
parent 2869d91781
commit 6876731c65
37 changed files with 5 additions and 1683 deletions

View file

@ -17,12 +17,6 @@ set_package_properties(Exiv2 PROPERTIES
TYPE REQUIRED
)
macro_optional_find_package(Kipi)
set_package_properties(Kipi PROPERTIES
URL "https://github.com/KDE/kipi-plugins"
PURPOSE "Provides various image manipulation and export features"
)
find_package(LibKonq)
set_package_properties(LibKonq PROPERTIES
URL "http://fluxer.github.io/katana/"
@ -57,8 +51,3 @@ add_subdirectory(icons)
add_subdirectory(images)
add_subdirectory(cursors)
add_subdirectory(color-schemes)
configure_file(
config-gwenview.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-gwenview.h
)

View file

@ -2,14 +2,10 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/..
${EXIV2_INCLUDE_DIR}
${LIBKONQ_INCLUDE_DIR}
# For lib/gwenviewconfig.h and config-gwenview.h
# For lib/gwenviewconfig.h
${CMAKE_CURRENT_BINARY_DIR}/..
)
if(KIPI_FOUND)
include_directories(${KIPI_INCLUDE_DIR})
endif()
set(gwenview_SRCS
abstractcontextmanageritem.cpp
configdialog.cpp
@ -41,31 +37,16 @@ set(gwenview_SRCS
browsemainpage.ui
)
if(KIPI_FOUND)
set(gwenview_SRCS
${gwenview_SRCS}
kipiexportaction.cpp
kipiimagecollectionselector.cpp
kipiinterface.cpp
kipiuploadwidget.cpp
)
endif()
add_executable(gwenview ${gwenview_SRCS})
target_link_libraries(gwenview
${KDE4_KFILE_LIBS}
gwenviewlib
${KDE4_KIO_LIBS}
${LIBKONQ_LIBRARY}
${QT_QTCORE_LIBRARY}
${KDE4_KIO_LIBS}
gwenviewlib
)
if(KIPI_FOUND)
target_link_libraries(gwenview ${KIPI_LIBRARIES})
endif()
install(TARGETS gwenview ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES gwenviewui.rc DESTINATION ${KDE4_DATA_INSTALL_DIR}/gwenview)

View file

@ -21,8 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
// Self
#include "moc_filtercontroller.cpp"
#include <config-gwenview.h>
// Qt
#include <QAction>
#include <QCompleter>

View file

@ -21,8 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#ifndef FILTERCONTROLLER_H
#define FILTERCONTROLLER_H
#include <config-gwenview.h>
// Qt
#include <QList>
#include <QObject>

View file

@ -61,9 +61,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>
<!--
@ -91,8 +88,6 @@
<Separator/>
<Action name="rotate_left" />
<Action name="rotate_right" />
<Separator/>
<Action name="kipi_export" />
</ToolBar>
</kpartgui>

View file

@ -1,132 +0,0 @@
// 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 "moc_kipiexportaction.cpp"
// Qt
#include <QMenu>
// KDE
#include <KDebug>
#include <KMenu>
#include <KLocale>
// Local
#include <lib/gwenviewconfig.h>
#include "kipiinterface.h"
namespace Gwenview
{
struct KIPIExportActionPrivate
{
KIPIExportAction* q;
KIPIInterface* mKIPIInterface;
QAction* mDefaultAction;
QList<QAction*> mExportActionList;
void updateMenu()
{
KMenu* menu = static_cast<KMenu*>(q->menu());
menu->clear();
if (mDefaultAction) {
menu->addTitle(i18n("Last Used Plugin"));
menu->addAction(mDefaultAction);
menu->addTitle(i18n("Other Plugins"));
}
Q_FOREACH(QAction * action, mExportActionList) {
action->setIconVisibleInMenu(true);
if (action != mDefaultAction) {
menu->addAction(action);
}
}
if (menu->isEmpty()) {
QAction* action = new QAction(menu);
action->setText(i18n("No Plugin Found"));
action->setEnabled(false);
menu->addAction(action);
}
}
};
KIPIExportAction::KIPIExportAction(QObject* parent)
: KToolBarPopupAction(KIcon("document-share"), i18nc("@action", "Share"), parent)
, d(new KIPIExportActionPrivate)
{
d->q = this;
d->mKIPIInterface = 0;
d->mDefaultAction = 0;
setToolTip(i18nc("@info:tooltip", "Share images using various services"));
setDelayed(false);
connect(menu(), SIGNAL(aboutToShow()), SLOT(init()));
connect(menu(), SIGNAL(triggered(QAction*)), SLOT(slotPluginTriggered(QAction*)));
}
KIPIExportAction::~KIPIExportAction()
{
delete d;
}
void KIPIExportAction::setKIPIInterface(KIPIInterface* interface)
{
d->mKIPIInterface = interface;
}
void KIPIExportAction::init()
{
d->mExportActionList = d->mKIPIInterface->pluginActions(KIPI::ExportPlugin);
if (d->mKIPIInterface->isLoadingFinished()) {
// Look for default action
QString defaultActionText = GwenviewConfig::defaultExportPluginText();
Q_FOREACH(QAction* action, d->mExportActionList) {
if (action->text() == defaultActionText) {
setDefaultAction(action);
break;
}
}
// We are done, don't come back next time menu is shown
disconnect(menu(), SIGNAL(aboutToShow()), this, SLOT(init()));
} else {
// Loading is in progress, come back when it is done
connect(d->mKIPIInterface, SIGNAL(loadingFinished()), SLOT(init()));
}
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

View file

@ -1,57 +0,0 @@
// 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
// KDE
#include <KToolBarPopupAction>
// Local
namespace Gwenview
{
class KIPIInterface;
struct KIPIExportActionPrivate;
class KIPIExportAction : public KToolBarPopupAction
{
Q_OBJECT
public:
KIPIExportAction(QObject* parent);
~KIPIExportAction();
void setKIPIInterface(KIPIInterface*);
private Q_SLOTS:
void init();
void setDefaultAction(QAction*);
void slotPluginTriggered(QAction*);
private:
KIPIExportActionPrivate* const d;
};
} // namespace
#endif /* KIPIEXPORTACTION_H */

View file

@ -1,91 +0,0 @@
// 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 "moc_kipiimagecollectionselector.cpp"
// Qt
#include <QListWidget>
#include <QVBoxLayout>
// KDE
#include <KLocale>
// 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;
QList<KIPI::ImageCollection> list = interface->allAlbums();
Q_FOREACH(const KIPI::ImageCollection & collection, list) {
QListWidgetItem* 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, SIGNAL(currentRowChanged(int)),
SIGNAL(selectionChanged()));
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(d->mListWidget);
layout->setMargin(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();
QList<KIPI::ImageCollection> list = d->mInterface->allAlbums();
Q_FOREACH(const KIPI::ImageCollection & collection, list) {
if (collection.name() == name) {
selectedList << collection;
break;
}
}
}
return selectedList;
}
} // namespace

View file

@ -1,54 +0,0 @@
// 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
// KDE
// KIPI
#include <libkipi/imagecollection.h>
#include <libkipi/imagecollectionselector.h>
// Local
#include "kipiinterface.h"
namespace Gwenview
{
struct KIPIImageCollectionSelectorPrivate;
class KIPIImageCollectionSelector : public KIPI::ImageCollectionSelector
{
Q_OBJECT
public:
KIPIImageCollectionSelector(KIPIInterface*, QWidget* parent);
~KIPIImageCollectionSelector();
virtual QList<KIPI::ImageCollection> selectedImageCollections() const;
private:
KIPIImageCollectionSelectorPrivate* const d;
};
} // namespace
#endif /* KIPIIMAGECOLLECTIONSELECTOR_H */

View file

@ -1,459 +0,0 @@
// 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 "moc_kipiinterface.cpp"
// Qt
#include <QList>
#include <QMenu>
#include <QRegExp>
// KDE
#include <KAction>
#include <KActionCollection>
#include <KDebug>
#include <KUrl>
#include <KXMLGUIFactory>
#include <KDirLister>
// KIPI
#include <libkipi/imagecollectionshared.h>
#include <libkipi/imageinfo.h>
#include <libkipi/imageinfoshared.h>
#include <libkipi/plugin.h>
#include <libkipi/pluginloader.h>
#include <libkipi/version.h>
// local
#include "mainwindow.h"
#include "kipiimagecollectionselector.h"
#include "kipiuploadwidget.h"
#include <lib/contextmanager.h>
#include <lib/mimetypeutils.h>
#include <lib/timeutils.h>
#include <lib/sorteddirmodel.h>
namespace Gwenview
{
#undef ENABLE_LOG
#undef LOG
//#define ENABLE_LOG
#ifdef ENABLE_LOG
#define LOG(x) kDebug() << x
#else
#define LOG(x) ;
#endif
class KIPIImageInfo : public KIPI::ImageInfoShared
{
static const QRegExp sExtensionRE;
public:
KIPIImageInfo(KIPI::Interface* interface, const KUrl& url)
: KIPI::ImageInfoShared(interface, url)
{
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
mAttributes.insert("name", url.fileName());
mAttributes.insert("comment", comment());
mAttributes.insert("date", TimeUtils::dateTimeForFileItem(item).dateTime());
mAttributes.insert("orientation", orientation());
mAttributes.insert("title", prettyFileName());
int size = item.size();
if (size > 0) {
mAttributes.insert("filesize", size);
}
}
#if (KIPI_VERSION < 0x020000)
QString name()
{
return mAttributes.value("name").toString();
}
QString description()
{
return mAttributes.value("comment").toString();
}
void setDescription(const QString&)
{}
int angle()
{
return mAttributes.value("angle").toInt();
}
#endif
QMap<QString, QVariant> attributes() {
return mAttributes;
}
void delAttributes(const QStringList& attributeNames)
{
Q_FOREACH(const QString& name, attributeNames) {
mAttributes.remove(name);
}
}
void clearAttributes()
{
mAttributes.clear();
}
void addAttributes(const QVariantMap& attributes)
{
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
{
#warning dummy comment support, is exiv2 support not enough?
return QString();
}
int orientation() const
{
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 int orientation = mii.value().toInt(&ok);
if (!ok) {
return 0;
} else if(orientation != 0 || orientation != 90
|| orientation != 180 || orientation != 270) {
kWarning() << "Can't represent an orientation value of" << orientation << "as an angle (" << _url << ')';
return 0;
} else {
return orientation;
}
}
#warning unreachable attributes reset?
QVariantMap mAttributes;
};
const QRegExp KIPIImageInfo::sExtensionRE("\\.[a-z0-9]+$", Qt::CaseInsensitive);
struct MenuInfo
{
QString mName;
QList<QAction*> mActions;
MenuInfo()
{}
MenuInfo(const QString& name)
: mName(name)
{}
};
typedef QMap<KIPI::Category, MenuInfo> MenuInfoMap;
struct KIPIInterfacePrivate
{
KIPIInterface* q;
MainWindow* mMainWindow;
QMenu* mPluginMenu;
KIPI::PluginLoader* mPluginLoader;
KIPI::PluginLoader::PluginList mPluginQueue;
MenuInfoMap mMenuInfoMap;
KAction* mLoadingAction;
KAction* mNoPluginAction;
void setupPluginsMenu()
{
mPluginMenu = static_cast<QMenu*>(
mMainWindow->factory()->container("plugins", mMainWindow));
QObject::connect(mPluginMenu, SIGNAL(aboutToShow()),
q, SLOT(loadPlugins()));
}
KAction* createDummyPluginAction(const QString& text)
{
KAction* action = new KAction(q);
action->setText(text);
action->setShortcutConfigurable(false);
action->setEnabled(false);
return action;
}
};
KIPIInterface::KIPIInterface(MainWindow* mainWindow)
: KIPI::Interface(mainWindow)
, d(new KIPIInterfacePrivate)
{
d->q = this;
d->mMainWindow = mainWindow;
d->mPluginLoader = 0;
d->mLoadingAction = d->createDummyPluginAction(i18n("Loading..."));
d->mNoPluginAction = d->createDummyPluginAction(i18n("No Plugin Found"));
d->setupPluginsMenu();
QObject::connect(d->mMainWindow->contextManager(), SIGNAL(selectionChanged()),
this, SLOT(slotSelectionChanged()));
QObject::connect(d->mMainWindow->contextManager(), SIGNAL(currentDirUrlChanged(KUrl)),
this, SLOT(slotDirectoryChanged()));
#if 0
//TODO instead of delaying can we load them all at start-up to use actions somewhere else?
// delay a bit, so that it's called after loadPlugins()
QTimer::singleShot(0, this, SLOT(init()));
#endif
}
KIPIInterface::~KIPIInterface()
{
delete d;
}
static bool actionLessThan(QAction* a1, QAction* a2)
{
QString a1Text = a1->text().replace('&', QString());
QString a2Text = a2->text().replace('&', QString());
return QString::compare(a1Text, a2Text, Qt::CaseInsensitive) < 0;
}
void KIPIInterface::loadPlugins()
{
// Already done
if (d->mPluginLoader) {
return;
}
d->mMenuInfoMap[KIPI::ImagesPlugin] = MenuInfo(i18nc("@title:menu", "Images"));
d->mMenuInfoMap[KIPI::ToolsPlugin] = MenuInfo(i18nc("@title:menu", "Tools"));
d->mMenuInfoMap[KIPI::ImportPlugin] = MenuInfo(i18nc("@title:menu", "Import"));
d->mMenuInfoMap[KIPI::ExportPlugin] = MenuInfo(i18nc("@title:menu", "Export"));
d->mMenuInfoMap[KIPI::BatchPlugin] = MenuInfo(i18nc("@title:menu", "Batch Processing"));
d->mMenuInfoMap[KIPI::CollectionsPlugin] = MenuInfo(i18nc("@title:menu", "Collections"));
#if (KIPI_VERSION >= 0x020000)
d->mPluginLoader = new KIPI::PluginLoader();
d->mPluginLoader->setInterface(this);
d->mPluginLoader->init();
#else
d->mPluginLoader = new KIPI::PluginLoader(QStringList(), this);
#endif
d->mPluginQueue = d->mPluginLoader->pluginList();
d->mPluginMenu->addAction(d->mLoadingAction);
loadOnePlugin();
}
void KIPIInterface::loadOnePlugin()
{
while (!d->mPluginQueue.isEmpty()) {
KIPI::PluginLoader::Info* pluginInfo = d->mPluginQueue.takeFirst();
if (!pluginInfo->shouldLoad()) {
continue;
}
KIPI::Plugin* plugin = pluginInfo->plugin();
if (!plugin) {
kWarning() << "Plugin from library" << pluginInfo->library() << "failed to load";
continue;
}
plugin->setup(d->mMainWindow);
QList<KAction*> actions = plugin->actions();
Q_FOREACH(KAction * action, actions) {
KIPI::Category category = plugin->category(action);
if (!d->mMenuInfoMap.contains(category)) {
kWarning() << "Unknown category '" << category;
continue;
}
d->mMenuInfoMap[category].mActions << action;
}
// FIXME: Port
//plugin->actionCollection()->readShortcutSettings();
// If we reach this point, we just loaded one plugin. Go back to the
// event loop. We will come back to load the remaining plugins or create
// the menu later
QMetaObject::invokeMethod(this, "loadOnePlugin", Qt::QueuedConnection);
return;
}
// If we reach this point, all plugins have been loaded. We can fill the
// menu
MenuInfoMap::Iterator
it = d->mMenuInfoMap.begin(),
end = d->mMenuInfoMap.end();
for (; it != end; ++it) {
MenuInfo& info = it.value();
if (!info.mActions.isEmpty()) {
QMenu* menu = d->mPluginMenu->addMenu(info.mName);
qSort(info.mActions.begin(), info.mActions.end(), actionLessThan);
Q_FOREACH(QAction * action, info.mActions) {
menu->addAction(action);
}
}
}
d->mPluginMenu->removeAction(d->mLoadingAction);
if (d->mPluginMenu->isEmpty()) {
d->mPluginMenu->addAction(d->mNoPluginAction);
}
loadingFinished();
}
QList<QAction*> KIPIInterface::pluginActions(KIPI::Category category) const
{
const_cast<KIPIInterface*>(this)->loadPlugins();
if (isLoadingFinished()) {
QList<QAction*> list = d->mMenuInfoMap.value(category).mActions;
if (list.isEmpty()) {
list << d->mNoPluginAction;
}
return list;
} else {
return QList<QAction*>() << d->mLoadingAction;
}
}
bool KIPIInterface::isLoadingFinished() const
{
if (!d->mPluginLoader) {
// Not even started
return false;
}
return d->mPluginQueue.isEmpty();
}
void KIPIInterface::init()
{
slotDirectoryChanged();
slotSelectionChanged();
}
KIPI::ImageCollection KIPIInterface::currentAlbum()
{
LOG("");
const ContextManager* contextManager = d->mMainWindow->contextManager();
const KUrl url = contextManager->currentDirUrl();
const SortedDirModel* model = contextManager->dirModel();
KUrl::List list;
const int count = model->rowCount();
for (int row = 0; row < count; ++row) {
const QModelIndex& index = model->index(row, 0);
const KFileItem item = model->itemForIndex(index);
if (MimeTypeUtils::fileItemKind(item) == MimeTypeUtils::KIND_RASTER_IMAGE) {
list << item.targetUrl();
}
}
return KIPI::ImageCollection(new ImageCollection(url, url.fileName(), list));
}
KIPI::ImageCollection KIPIInterface::currentSelection()
{
LOG("");
KFileItemList fileList = d->mMainWindow->contextManager()->selectedFileItemList();
KUrl::List list = fileList.urlList();
KUrl url = d->mMainWindow->contextManager()->currentUrl();
return KIPI::ImageCollection(new ImageCollection(url, url.fileName(), list));
}
QList<KIPI::ImageCollection> KIPIInterface::allAlbums()
{
LOG("");
QList<KIPI::ImageCollection> list;
list << currentAlbum() << currentSelection();
return list;
}
KIPI::ImageInfo KIPIInterface::info(const KUrl& url)
{
LOG("");
return KIPI::ImageInfo(new KIPIImageInfo(this, url));
}
int KIPIInterface::features() const
{
return KIPI::HostAcceptNewImages;
}
/**
* KDirLister will pick up the image if necessary, so no updating is needed
* here, it is however necessary to discard caches if the plugin preserves timestamp
*/
bool KIPIInterface::addImage(const KUrl&, QString&)
{
//TODO setContext(const KUrl& currentUrl, const KFileItemList& selection)?
//Cache::instance()->invalidate( url );
return true;
}
void KIPIInterface::delImage(const KUrl&)
{
//TODO
}
void KIPIInterface::refreshImages(const KUrl::List&)
{
// TODO
}
KIPI::ImageCollectionSelector* KIPIInterface::imageCollectionSelector(QWidget *parent)
{
return new KIPIImageCollectionSelector(this, parent);
}
KIPI::UploadWidget* KIPIInterface::uploadWidget(QWidget *parent)
{
return (new KIPIUploadWidget(this, parent));
}
void KIPIInterface::slotSelectionChanged()
{
emit selectionChanged(!d->mMainWindow->contextManager()->selectedFileItemList().isEmpty());
}
void KIPIInterface::slotDirectoryChanged()
{
emit currentAlbumChanged(true);
}
} //namespace

View file

@ -1,119 +0,0 @@
// 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.
*/
#ifndef KIPIINTERFACE_H
#define KIPIINTERFACE_H
// KIPI
#include <libkipi/interface.h>
#include <libkipi/imagecollectionshared.h>
#include <libkipi/plugin.h>
#include <QAction>
namespace Gwenview
{
struct KIPIInterfacePrivate;
class MainWindow;
class KIPIInterface : public KIPI::Interface
{
Q_OBJECT
public:
KIPIInterface(MainWindow*);
virtual ~KIPIInterface();
KIPI::ImageCollection currentAlbum();
KIPI::ImageCollection currentSelection();
QList<KIPI::ImageCollection> allAlbums();
KIPI::ImageInfo info(const KUrl& url);
int features() const;
virtual bool addImage(const KUrl&, QString& err);
virtual void delImage(const KUrl&);
virtual void refreshImages(const KUrl::List& urls);
virtual KIPI::ImageCollectionSelector* imageCollectionSelector(QWidget *parent);
virtual KIPI::UploadWidget* uploadWidget(QWidget *parent);
QList<QAction*> pluginActions(KIPI::Category) const;
bool isLoadingFinished() const;
Q_SIGNALS:
void loadingFinished();
public Q_SLOTS:
void loadPlugins();
private Q_SLOTS:
void slotSelectionChanged();
void slotDirectoryChanged();
void init();
void loadOnePlugin();
private:
KIPIInterfacePrivate* const d;
};
class ImageCollection : public KIPI::ImageCollectionShared
{
public:
ImageCollection(KUrl dirURL, const QString& name, const KUrl::List& images)
: KIPI::ImageCollectionShared()
, mDirURL(dirURL)
, mName(name)
, mImages(images) {}
QString name() {
return mName;
}
QString comment() {
return QString();
}
KUrl::List images() {
return mImages;
}
KUrl uploadRoot() {
return KUrl("/");
}
KUrl uploadPath() {
return mDirURL;
}
QString uploadRootName()
{
return "/";
}
bool isDirectory() {
return true;
}
private:
KUrl mDirURL;
QString mName;
KUrl::List mImages;
};
} // namespace
#endif /* KIPIINTERFACE_H */

View file

@ -1,56 +0,0 @@
// 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 "moc_kipiuploadwidget.cpp"
// Qt
#include <QLabel>
#include <QVBoxLayout>
// KDE
#include <KLocale>
// Local
#include "kipiinterface.h"
namespace Gwenview
{
KIPIUploadWidget::KIPIUploadWidget(KIPIInterface* interface, QWidget* parent)
: KIPI::UploadWidget(parent)
, mInterface(interface)
{
QLabel* label = new QLabel(this);
KUrl url = mInterface->currentAlbum().uploadPath();
label->setText(i18n("Images will be uploaded here:\n%1", url.pathOrUrl()));
label->setWordWrap(true);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->addWidget(label);
}
KIPI::ImageCollection KIPIUploadWidget::selectedImageCollection() const
{
return mInterface->currentAlbum();
}
} // namespace

View file

@ -1,53 +0,0 @@
// 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 KIPIUPLOADWIDGET_H
#define KIPIUPLOADWIDGET_H
// Qt
// KDE
// KIPI
#include <libkipi/imagecollection.h>
#include <libkipi/uploadwidget.h>
// Local
namespace Gwenview
{
class KIPIInterface;
class KIPIUploadWidget : public KIPI::UploadWidget
{
Q_OBJECT
public:
KIPIUploadWidget(KIPIInterface*, QWidget* parent);
virtual KIPI::ImageCollection selectedImageCollection() const;
private:
KIPIInterface* mInterface;
};
} // namespace
#endif /* KIPIUPLOADWIDGET_H */

View file

@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <config-gwenview.h>
// STL
#include <memory>

View file

@ -18,7 +18,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "moc_mainwindow.cpp"
#include <config-gwenview.h>
// Qt
#include <QApplication>
@ -72,10 +71,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gvcore.h"
#include "imageopscontextmanageritem.h"
#include "infocontextmanageritem.h"
#ifdef KIPI_FOUND
#include "kipiexportaction.h"
#include "kipiinterface.h"
#endif
#include "preloader.h"
#include "savebar.h"
#include "sidebar.h"
@ -176,9 +171,6 @@ struct MainWindow::Private
SlideShow* mSlideShow;
Preloader* mPreloader;
bool mPreloadDirectionIsForward;
#ifdef KIPI_FOUND
KIPIInterface* mKIPIInterface;
#endif
QActionGroup* mViewModeActionGroup;
KRecentFilesAction* mFileOpenRecentAction;
@ -193,9 +185,6 @@ struct MainWindow::Private
KToggleFullScreenAction* mFullScreenAction;
KAction* mToggleSlideShowAction;
KToggleAction* mShowMenuBarAction;
#ifdef KIPI_FOUND
KIPIExportAction* mKIPIExportAction;
#endif
SortedDirModel* mDirModel;
DocumentOnlyProxyModel* mThumbnailBarModel;
@ -468,11 +457,6 @@ struct MainWindow::Private
view->addAction(KStandardAction::ConfigureToolbars, q,
SLOT(configureToolbars()));
#ifdef KIPI_FOUND
mKIPIExportAction = new KIPIExportAction(q);
actionCollection->addAction("kipi_export", mKIPIExportAction);
#endif
}
void setupUndoActions()
@ -774,10 +758,6 @@ MainWindow::MainWindow()
connect(DocumentFactory::instance(), SIGNAL(modifiedDocumentListChanged()),
SLOT(slotModifiedDocumentListChanged()));
#ifdef KIPI_FOUND
d->mKIPIInterface = new KIPIInterface(this);
d->mKIPIExportAction->setKIPIInterface(d->mKIPIInterface);
#endif
setAutoSaveSettings();
}

View file

@ -21,8 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
// Self
#include "moc_startmainpage.cpp"
#include <config-gwenview.h>
// Qt
#include <QListView>
#include <QMenu>

View file

@ -21,8 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Self
#include "moc_thumbnailviewhelper.cpp"
#include <config-gwenview.h>
// Qt
#include <QAction>
#include <QCursor>

View file

@ -1 +0,0 @@
#cmakedefine KIPI_FOUND 1

View file

@ -2,8 +2,6 @@ project(gwenviewlib)
include_directories(
# For config-gwenview.h
${CMAKE_CURRENT_BINARY_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}
${EXIV2_INCLUDE_DIR}

View file

@ -65,9 +65,6 @@
<default>false</default>
</entry>
<entry name="DefaultExportPluginText" type="String">
</entry>
<entry name="SideBarPage" type="String">
<default>information</default>
</entry>

View file

@ -18,7 +18,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "moc_sorteddirmodel.cpp"
#include <config-gwenview.h>
// Qt
#include <QTimer>

View file

@ -20,8 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef SORTEDDIRMODEL_H
#define SORTEDDIRMODEL_H
#include <config-gwenview.h>
// Qt
#include <QPointer>

View file

@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
*/
// Self
#include "moc_previewitemdelegate.cpp"
#include <config-gwenview.h>
// Qt
#include <QHash>

View file

@ -16,9 +16,6 @@ include_directories(
${importer_SOURCE_DIR}
)
# For config-gwenview.h
include_directories(${gwenview_BINARY_DIR})
gv_add_unit_test(imagescalertest testutils.cpp)
gv_add_unit_test(paintutilstest)
gv_add_unit_test(documenttest testutils.cpp)

View file

@ -7,12 +7,6 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
endif()
macro_optional_find_package(Kipi)
set_package_properties(Kipi PROPERTIES
URL "https://github.com/KDE/kipi-plugins"
PURPOSE "Provides various image manipulation and export features"
)
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
set(HAVE_X11_EXTENSIONS_SHAPE_H ${X11_Xshape_FOUND})
@ -29,10 +23,6 @@ add_feature_info(
"X11 Fixes Extension (xfixes.h)"
)
if (KIPI_FOUND)
include_directories(${KIPI_INCLUDE_DIR})
endif()
configure_file(
config-ksnapshot.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-ksnapshot.h
@ -57,16 +47,6 @@ set(ksnapshot_SRCS
${ksnapshot_file_SRCS}
)
if (KIPI_FOUND)
set(ksnapshot_SRCS
kipiinterface.cpp
ksnapshotimagecollectionshared.cpp
ksnapshotinfoshared.cpp
kipiimagecollectionselector.cpp
${ksnapshot_SRCS}
)
endif()
qt4_add_dbus_adaptor(ksnapshot_SRCS org.kde.ksnapshot.xml ksnapshot.h KSnapshot)
add_executable(ksnapshot ${ksnapshot_SRCS})
@ -77,10 +57,6 @@ if (X11_Xfixes_FOUND)
target_link_libraries(ksnapshot ${X11_Xfixes_LIB})
endif (X11_Xfixes_FOUND)
if (KIPI_FOUND)
target_link_libraries(ksnapshot ${KIPI_LIBRARIES})
endif()
install(TARGETS ksnapshot ${INSTALL_TARGETS_DEFAULT_ARGS})
########### next target ###############

View file

@ -3,6 +3,3 @@
/* Define to 1 if you have the <X11/extensions/Xfixes.h> header file. */
#cmakedefine HAVE_X11_EXTENSIONS_XFIXES_H 1
/* Define to 1 if you have libkipi */
#cmakedefine KIPI_FOUND 1

View file

@ -1,87 +0,0 @@
// vim: set tabstop=4 shiftwidth=4 noexpandtab:
/*
Copyright 2010 Pau Garcia i Quiles <pgquiles@elpauer.org>
based on code for Gwenview by
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 "moc_kipiimagecollectionselector.cpp"
// Qt
#include <QListWidget>
#include <QVBoxLayout>
// KDE
#include <klocale.h>
// Local
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;
QList<KIPI::ImageCollection> list = interface->allAlbums();
Q_FOREACH(const KIPI::ImageCollection& collection, list) {
QListWidgetItem* 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, SIGNAL(currentRowChanged(int)),
SIGNAL(selectionChanged()) );
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(d->mListWidget);
layout->setMargin(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();
QList<KIPI::ImageCollection> list = d->mInterface->allAlbums();
Q_FOREACH(const KIPI::ImageCollection& collection, list) {
if (collection.name() == name) {
selectedList << collection;
break;
}
}
}
return selectedList;
}

View file

@ -1,45 +0,0 @@
// vim: set tabstop=4 shiftwidth=4 noexpandtab:
/*
Copyright 2010 Pau Garcia i Quiles <pgquiles@elpauer.org>
based on code for Gwenview by
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
// KIPI
#include <libkipi/imagecollection.h>
#include <libkipi/imagecollectionselector.h>
// Local
#include "kipiinterface.h"
struct KIPIImageCollectionSelectorPrivate;
class KIPIImageCollectionSelector : public KIPI::ImageCollectionSelector {
Q_OBJECT
public:
KIPIImageCollectionSelector(KIPIInterface*, QWidget* parent);
~KIPIImageCollectionSelector();
virtual QList<KIPI::ImageCollection> selectedImageCollections() const;
private:
KIPIImageCollectionSelectorPrivate* const d;
};
#endif /* KIPIIMAGECOLLECTIONSELECTOR_H */

View file

@ -1,94 +0,0 @@
/*
* Copyright (C) 2010 Pau Garcia i Quiles <pgquiles@elpauer.org>
* Essentially a rip-off of code for Kamoso by:
* Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org>
* Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser 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 Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "kipiinterface.h"
#include "ksnapshotinfoshared.h"
#include "ksnapshotimagecollectionshared.h"
#include "ksnapshot.h"
#include "kipiimagecollectionselector.h"
#include <libkipi/uploadwidget.h>
#include <libkipi/imagecollectionshared.h>
#include <libkipi/imageinfo.h>
#include <libkipi/imageinfoshared.h>
#include <libkipi/plugin.h>
#include <libkipi/interface.h>
#include <libkipi/pluginloader.h>
#include <libkipi/imagecollection.h>
#include <libkipi/imagecollectionselector.h>
struct KIPIInterfacePrivate {
KSnapshot *ksnapshot;
KIPI::PluginLoader* pluginLoader;
};
KIPIInterface::KIPIInterface(KSnapshot* ksnapshot)
:KIPI::Interface(ksnapshot)
, d(new KIPIInterfacePrivate) {
d->ksnapshot = ksnapshot;
}
KIPIInterface::~KIPIInterface() {
delete d;
}
KIPI::ImageCollection KIPIInterface::currentAlbum() {
return KIPI::ImageCollection(new KSnapshotImageCollectionShared(d->ksnapshot));
}
KIPI::ImageCollection KIPIInterface::currentSelection() {
return KIPI::ImageCollection(new KSnapshotImageCollectionShared(d->ksnapshot));
}
QList<KIPI::ImageCollection> KIPIInterface::allAlbums() {
QList<KIPI::ImageCollection> list;
list << currentSelection();
return list;
}
KIPI::ImageInfo KIPIInterface::info(const KUrl& url) {
return KIPI::ImageInfo(new KSnapshotInfoShared(this,url));
}
bool KIPIInterface::addImage(const KUrl&, QString&)
{
return true;
}
void KIPIInterface::delImage( const KUrl& )
{
}
void KIPIInterface::refreshImages( const KUrl::List& )
{
// TODO Implement?
}
KIPI::ImageCollectionSelector* KIPIInterface::imageCollectionSelector(QWidget *parent) {
return new KIPIImageCollectionSelector(this, parent);
}
KIPI::UploadWidget* KIPIInterface::uploadWidget(QWidget *parent) {
return (new KIPI::UploadWidget(parent));
}
int KIPIInterface::features() const {
return KIPI::HostAcceptNewImages;
}

View file

@ -1,59 +0,0 @@
/*
* Copyright (C) 2010 Pau Garcia i Quiles <pgquiles@elpauer.org>
* Essentially a rip-off of code for Kamoso by:
* Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org>
* Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser 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 Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIPIINTERFACE_H
#define KIPIINTERFACE_H
#include <QList>
#include <libkipi/interface.h>
#include <libkipi/uploadwidget.h>
#include <libkipi/imagecollectionshared.h>
class KSnapshot;
struct KIPIInterfacePrivate;
class KIPIInterface :public KIPI::Interface {
Q_OBJECT
public:
KIPIInterface(KSnapshot* ksnapshot);
virtual ~KIPIInterface();
virtual bool addImage(const KUrl&, QString& err);
virtual void delImage( const KUrl& );
virtual void refreshImages( const KUrl::List& urls );
virtual KIPI::ImageCollectionSelector* imageCollectionSelector(QWidget *parent);
virtual KIPI::UploadWidget* uploadWidget(QWidget *parent);
virtual QList<KIPI::ImageCollection> allAlbums();
virtual KIPI::ImageCollection currentAlbum();
virtual KIPI::ImageCollection currentSelection();
virtual int features() const;
virtual KIPI::ImageInfo info(const KUrl& );
private:
KIPIInterfacePrivate* const d;
};
#endif // KIPIINTERFACE_H

View file

@ -70,13 +70,6 @@
#include "ksnapshotpreview.h"
#include "ui_ksnapshotwidget.h"
#ifdef KIPI_FOUND
#include <libkipi/plugin.h>
#include <libkipi/version.h>
#include "kipiinterface.h"
#include <KAction>
#endif
#ifdef HAVE_X11_EXTENSIONS_XFIXES_H
#include <X11/extensions/Xfixes.h>
#include <X11/Xatom.h>
@ -165,16 +158,6 @@ KSnapshot::KSnapshot(QWidget *parent, KSnapshotObject::CaptureMode mode )
KConfigGroup conf(KGlobal::config(), "GENERAL");
#ifdef KIPI_FOUND
#if(KIPI_VERSION >= 0x020000)
mPluginLoader = new KIPI::PluginLoader();
mPluginLoader->setInterface(new KIPIInterface(this));
mPluginLoader->init();
#else
mPluginLoader = new KIPI::PluginLoader(QStringList(), new KIPIInterface(this), "");
#endif
#endif
#ifdef HAVE_X11_EXTENSIONS_XFIXES_H
{
int tmp1, tmp2;
@ -534,45 +517,6 @@ void KSnapshot::slotPopulateOpenMenu()
name, this));
}
#ifdef KIPI_FOUND
KIPI::PluginLoader::PluginList pluginList = mPluginLoader->pluginList();
Q_FOREACH(KIPI::PluginLoader::Info* pluginInfo, pluginList) {
if (!pluginInfo->shouldLoad()) {
continue;
}
KIPI::Plugin* plugin = pluginInfo->plugin();
if (!plugin) {
kWarning() << "Plugin from library" << pluginInfo->library() << "failed to load";
continue;
}
plugin->setup(this);
QList<KAction*> actions = plugin->actions();
QSet<KAction*> exportActions;
Q_FOREACH(KAction* action, actions) {
KIPI::Category category = plugin->category(action);
if(category == KIPI::ExportPlugin) {
exportActions << action;
} else if (category == KIPI::ImagesPlugin) {
// Horrible hack. Why are the print images and the e-mail images plugins in the same category as rotate and edit metadata!?
if( pluginInfo->library().contains("kipiplugin_printimages") || pluginInfo->library().contains("kipiplugin_sendimages")) {
exportActions << action;
}
}
}
Q_FOREACH(KAction* action, exportActions) {
openMenu->addAction(action);
}
// FIXME: Port
// plugin->actionCollection()->readShortcutSettings();
}
#endif
openMenu->addSeparator();
KService::Ptr none;
openMenu->addAction(new KSnapshotServiceAction(none,

View file

@ -28,6 +28,7 @@
#include <QAction>
#include <QTimer>
#include <QPixmap>
#include <QMenu>
#include <kglobalsettings.h>
#include <kdialog.h>
@ -39,13 +40,6 @@
#include <config-ksnapshot.h>
class KSnapshotWidget;
#include <QMenu>
#ifdef KIPI_FOUND
#include "ksnapshotimagecollectionshared.h"
#include <libkipi/pluginloader.h>
#endif
class KSnapshotServiceAction : public QAction
{
Q_OBJECT
@ -143,11 +137,6 @@ private:
bool includeAlpha;
QPolygon lastFreeRegion;
QRect lastRegion;
#ifdef KIPI_FOUND
KIPI::PluginLoader* mPluginLoader;
friend KUrl::List KSnapshotImageCollectionShared::images();
#endif
};
#endif // KSNAPSHOT_H

View file

@ -1,54 +0,0 @@
/*
* Copyright (C) 2010 Pau Garcia i Quiles <pgquiles@elpauer.org>
* Essentially a rip-off of code for Kamoso by:
* Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org>
* Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser 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 Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "ksnapshotimagecollectionshared.h"
#include <KUrl>
#include <QtGlobal>
#include <QDebug>
#include "ksnapshot.h"
struct KSnapshotImageCollectionShared::Private
{
KSnapshot* ksnapshot;
};
KSnapshotImageCollectionShared::KSnapshotImageCollectionShared(KSnapshot* ksnapshot): d(new Private), mImages(KUrl::List())
{
d->ksnapshot = ksnapshot;
}
KSnapshotImageCollectionShared::~KSnapshotImageCollectionShared()
{
delete d;
}
KUrl::List KSnapshotImageCollectionShared::images()
{
// TODO (pgquiles) Clean up this mess. I'm not even sure all this is required!
bool isTempfile = false;
KUrl url = d->ksnapshot->urlToOpen(&isTempfile);
if (!url.isValid())
{
return KUrl::List();
}
return KUrl::List(KUrl(url));
}

View file

@ -1,49 +0,0 @@
/*
* Copyright (C) 2010 Pau Garcia i Quiles <pgquiles@elpauer.org>
* Essentially a rip-off of code for Kamoso by:
* Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org>
* Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser 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 Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KSNAPSHOTIMAGECOLLECTIONSHARED_H
#define KSNAPSHOTIMAGECOLLECTIONSHARED_H
#include <libkipi/imagecollectionshared.h>
class KSnapshot;
class KSnapshotImageCollectionShared : public KIPI::ImageCollectionShared
{
public:
KSnapshotImageCollectionShared(KSnapshot* ksnapshot);
~KSnapshotImageCollectionShared();
QString name() { return "KSnapshot"; }
QString comment() { return QString(); }
KUrl::List images();
KUrl uploadRoot() { return KUrl("/"); }
// KUrl uploadPath() { return mDirURL; }
QString uploadRootName() { return "/"; }
bool isDirectory() { return false; }
private:
struct Private;
Private* d;
KUrl::List mImages;
};
#endif

View file

@ -1,58 +0,0 @@
/*
* Copyright (C) 2010 Pau Garcia i Quiles <pgquiles@elpauer.org>
* Essentially a rip-off of code for Kamoso by:
* Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org>
* Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser 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 Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "ksnapshotinfoshared.h"
KSnapshotInfoShared::KSnapshotInfoShared(KIPIInterface* interface, const KUrl& url) : KIPI::ImageInfoShared(interface,url)
{
}
void KSnapshotInfoShared::delAttributes(const QStringList& )
{
}
void KSnapshotInfoShared::addAttributes(const QMap< QString, QVariant >& )
{
}
void KSnapshotInfoShared::clearAttributes()
{
}
QMap< QString, QVariant > KSnapshotInfoShared::attributes()
{
return QMap<QString,QVariant>();
}
void KSnapshotInfoShared::setDescription(const QString& )
{
}
QString KSnapshotInfoShared::description()
{
return "Taken with KSnapshot";
}

View file

@ -1,41 +0,0 @@
/*
* Copyright (C) 2010 Pau Garcia i Quiles <pgquiles@elpauer.org>
* Essentially a rip-off of code for Kamoso by:
* Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org>
* Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser 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 Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KSNAPSHOTINFOSHARED_H
#define KSNAPSHOTINFOSHARED_H
#include <libkipi/imageinfoshared.h>
#include "kipiinterface.h"
class KSnapshotInfoShared : public KIPI::ImageInfoShared
{
public:
KSnapshotInfoShared(KIPIInterface* interface, const KUrl& url);
virtual void delAttributes(const QStringList& );
virtual void addAttributes(const QMap< QString, QVariant >& );
virtual void clearAttributes();
virtual QMap< QString, QVariant > attributes();
virtual void setDescription(const QString& );
virtual QString description();
};
#endif

View file

@ -44,7 +44,7 @@ int main(int argc, char **argv)
"nhasan@kde.org" );
aboutData.addCredit( ki18n("Marcus Hufgard"), ki18n("\"Open With\" function"),
"Marcus.Hufgard@hufgard.de" );
aboutData.addCredit( ki18n("Pau Garcia i Quiles"), ki18n("Free region grabbing, KIPI plugins support, port to Windows"),
aboutData.addCredit( ki18n("Pau Garcia i Quiles"), ki18n("Free region grabbing"),
"pgquiles@elpauer.org" );
KCmdLineArgs::init( argc, argv, &aboutData );