Commit d8af0907 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

Remove SuperImpose tool from digiKam image editor. This one been pretty old...

Remove SuperImpose tool from digiKam image editor. This one been pretty old and used yet Qt3 support class.
PhotoLayoutEditor tool from kipi-plugins must be used now instead. Template support using SVG file have been
added by Lukas during Coding Sprint 2012 at Genoa. It will be avaialble for next release 2.6.0.
CCMAIL: digikam-devel@kde.org
CCMAIL: lukasz.spas@gmail.com
CCBUGS: 171823
CCBUGS: 103696
CCBUGS: 117343
CCBUGS: 103695
parent 29edce0c
......@@ -21,7 +21,6 @@ decorate
/border DONE NO DONE
/inserttext TODO NO TODO (though BQM Watermark tool)
/texture DONE DONE TODO
/superimpose NO NO NO
filters
/colorfx TODO TODO TODO
......
......@@ -3,10 +3,6 @@ SET(digikamimageplugin_decorate_PART_SRCS imageplugin_decorate.cpp
inserttexttool.cpp
bordertool.cpp
texturetool.cpp
superimpose/dirselectwidget.cpp
superimpose/superimposewidget.cpp
superimpose/superimpose.cpp
superimpose/superimposetool.cpp
)
KDE4_ADD_PLUGIN(digikamimageplugin_decorate ${digikamimageplugin_decorate_PART_SRCS})
......@@ -19,10 +15,6 @@ TARGET_LINK_LIBRARIES(
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${KDCRAW_LIBRARIES}
# For Superimpose tool which is not yet ported to pure Qt4 implementation.
${KDE4_KDE3SUPPORT_LIBS}
${QT_QT3SUPPORT_LIBRARY}
)
INSTALL(TARGETS digikamimageplugin_decorate DESTINATION ${PLUGIN_INSTALL_DIR})
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<gui version="12" name="digikamimageplugin_decorate" >
<gui version="13" name="digikamimageplugin_decorate" >
<MenuBar>
<Menu name="Decorate" ><text>&amp;Decorate</text>
<Action name="imageplugin_inserttext" />
<Action name="imageplugin_border" />
<Action name="imageplugin_texture" />
<Action name="imageplugin_superimpose" />
<Action name="imageplugin_texture" />
</Menu>
</MenuBar>
......@@ -18,9 +17,8 @@
<ActionProperties>
<Action name="imageplugin_inserttext" />
<Action name="imageplugin_border" />
<Action name="imageplugin_texture" />
<Action name="imageplugin_superimpose" />
<Action name="imageplugin_border" />
<Action name="imageplugin_texture" />
</ActionProperties>
</gui>
......@@ -6,7 +6,7 @@
* Date : 2005-02-14
* Description : a plugin to insert a text over an image.
*
* Copyright (C) 2005-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2005-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
......@@ -39,7 +39,6 @@
#include "inserttexttool.h"
#include "bordertool.h"
#include "texturetool.h"
#include "superimposetool.h"
using namespace DigikamDecorateImagePlugin;
......@@ -51,14 +50,12 @@ class ImagePlugin_Decorate::ImagePlugin_DecoratePriv
public:
ImagePlugin_DecoratePriv() :
superimposeAction(0),
textureAction(0),
borderAction(0),
insertTextAction(0)
{
}
KAction* superimposeAction;
KAction* textureAction;
KAction* borderAction;
KAction* insertTextAction;
......@@ -84,11 +81,6 @@ ImagePlugin_Decorate::ImagePlugin_Decorate(QObject* parent, const QVariantList&)
connect(d->textureAction, SIGNAL(triggered(bool)),
this, SLOT(slotTexture()));
d->superimposeAction = new KAction(KIcon("superimpose"), i18n("Template Superimpose..."), this);
actionCollection()->addAction("imageplugin_superimpose", d->superimposeAction );
connect(d->superimposeAction, SIGNAL(triggered(bool)),
this, SLOT(slotSuperImpose()));
setXMLFile("digikamimageplugin_decorate_ui.rc");
kDebug() << "ImagePlugin_Decorate plugin loaded";
......@@ -104,7 +96,6 @@ void ImagePlugin_Decorate::setEnabledActions(bool b)
d->insertTextAction->setEnabled(b);
d->borderAction->setEnabled(b);
d->textureAction->setEnabled(b);
d->superimposeAction->setEnabled(b);
}
void ImagePlugin_Decorate::slotInsertText()
......@@ -124,9 +115,3 @@ void ImagePlugin_Decorate::slotTexture()
TextureTool* tool = new TextureTool(this);
loadTool(tool);
}
void ImagePlugin_Decorate::slotSuperImpose()
{
SuperImposeTool* tool = new SuperImposeTool(this);
loadTool(tool);
}
......@@ -6,7 +6,7 @@
* Date : 2005-02-14
* Description : a plugin to insert a text over an image.
*
* Copyright (C) 2005-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2005-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
......
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2005-01-04
* Description : a Digikam image editor plugin for superimpose a
* template to an image.
*
* Copyright (C) 2005-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2006-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
*
* 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 "dirselectwidget.moc"
// Qt includes
#include <Q3Header>
#include <Q3ListView>
#include <QLayout>
#include <QDir>
// KDE includes
#include <klocale.h>
#include <kfiletreebranch.h>
#include <kdebug.h>
namespace DigikamDecorateImagePlugin
{
class DirSelectWidget::DirSelectWidgetPrivate
{
public:
DirSelectWidgetPrivate() {};
KFileTreeBranch* m_item;
QStringList m_pendingPath;
QString m_handled;
KUrl m_rootUrl;
};
DirSelectWidget::DirSelectWidget(QWidget* parent, const char* name, const QString& headerLabel)
: K3FileTreeView( parent), d(new DirSelectWidgetPrivate)
{
setObjectName(name);
addColumn(headerLabel);
if ( headerLabel.isNull() )
{
header()->hide();
}
setAlternateBackground(QColor());
}
DirSelectWidget::DirSelectWidget(const KUrl& rootUrl, const KUrl& currentUrl,
QWidget* parent, const char* name, const QString& headerLabel)
: K3FileTreeView( parent), d(new DirSelectWidgetPrivate)
{
setObjectName(name);
addColumn(headerLabel);
if ( headerLabel.isNull() )
{
header()->hide();
}
setAlternateBackground(QColor());
setRootPath(rootUrl, currentUrl);
}
DirSelectWidget::~DirSelectWidget()
{
delete d;
}
KUrl DirSelectWidget::path() const
{
return currentUrl();
}
void DirSelectWidget::load()
{
if ( d->m_pendingPath.isEmpty() )
{
disconnect( d->m_item, SIGNAL(populateFinished(K3FileTreeViewItem*)),
this, SLOT(load()) );
emit folderItemSelected(currentUrl());
return;
}
QString item = d->m_pendingPath.front();
d->m_pendingPath.pop_front();
d->m_handled += item;
K3FileTreeViewItem* branch = findItem( d->m_item, d->m_handled );
if ( !branch )
{
kDebug() << "Unable to open " << d->m_handled;
}
else
{
branch->setOpen( true );
setSelected( branch, true );
ensureItemVisible ( branch );
d->m_handled += '/';
if ( branch->alreadyListed() )
{
load();
}
}
}
void DirSelectWidget::setCurrentPath(const KUrl& currentUrl)
{
if ( !currentUrl.isValid() )
{
return;
}
QString currentPath = QDir::cleanPath(currentUrl.toLocalFile());
currentPath = currentPath.mid(d->m_rootUrl.toLocalFile().length());
d->m_pendingPath.clear();
d->m_handled = QString("");
d->m_pendingPath = currentPath.split('/', QString::KeepEmptyParts);
if (!d->m_pendingPath.at(0).isEmpty())
{
d->m_pendingPath.prepend(""); // ensure we open the root first.
}
connect( d->m_item, SIGNAL(populateFinished(K3FileTreeViewItem*)),
this, SLOT(load()) );
load();
}
void DirSelectWidget::setRootPath(const KUrl& rootUrl, const KUrl& currentUrl)
{
d->m_rootUrl = rootUrl;
clear();
QString root = QDir::cleanPath(rootUrl.toLocalFile());
if (!root.endsWith('/'))
{
root.append("/");
}
QString currentPath = QDir::cleanPath(currentUrl.isValid() ? currentUrl.toLocalFile() : root);
d->m_item = addBranch( rootUrl, rootUrl.fileName() );
setDirOnlyMode( d->m_item, true );
currentPath = currentPath.mid( root.length() );
d->m_pendingPath = currentPath.split('/', QString::KeepEmptyParts);
if ( !d->m_pendingPath.at(0).isEmpty() )
{
d->m_pendingPath.prepend( "" ); // ensure we open the root first.
}
connect( d->m_item, SIGNAL(populateFinished(K3FileTreeViewItem*)),
this, SLOT(load()) );
load();
connect( this, SIGNAL(executed(Q3ListViewItem*)),
this, SLOT(slotFolderSelected(Q3ListViewItem*)) );
}
KUrl DirSelectWidget::rootPath() const
{
return d->m_rootUrl;
}
void DirSelectWidget::slotFolderSelected(Q3ListViewItem*)
{
emit folderItemSelected(currentUrl());
}
} // namespace DigikamDecorateImagePlugin
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2005-01-04
* Description : a Digikam image editor plugin for superimpose a
* template to an image.
*
* Copyright (C) 2005-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2006-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
*
* 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 DIRSELECTWIDGET_H
#define DIRSELECTWIDGET_H
// Qt includes
#include <QWidget>
#include <QString>
// KDE includes
#include <k3filetreeview.h>
#include <kurl.h>
namespace DigikamDecorateImagePlugin
{
class DirSelectWidget : public K3FileTreeView
{
Q_OBJECT
public:
explicit DirSelectWidget(QWidget* parent, const char* name=0, const QString& headerLabel=QString());
explicit DirSelectWidget(const KUrl& rootUrl=KUrl("/"), const KUrl& currentUrl=KUrl(),
QWidget* parent=0, const char* name=0, const QString& headerLabel=QString());
~DirSelectWidget();
KUrl path() const;
KUrl rootPath() const;
void setRootPath(const KUrl& rootUrl, const KUrl& currentUrl=KUrl(QString()));
void setCurrentPath(const KUrl& currentUrl);
Q_SIGNALS:
void folderItemSelected(const KUrl& url);
protected Q_SLOTS:
void load();
void slotFolderSelected(Q3ListViewItem*);
private:
class DirSelectWidgetPrivate;
DirSelectWidgetPrivate* const d;
};
} // namespace DigikamDecorateImagePlugin
#endif /* DIRSELECTWIDGET_H */
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2006-18-03
* Description : Superimpose filter.
*
* Copyright (C) 2006-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
*
* 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 "superimpose.h"
namespace DigikamDecorateImagePlugin
{
SuperImpose::SuperImpose(DImg* orgImage, DImg* templ,
QRect orgImageSelection,
DColorComposer::CompositingOperation compositeRule)
{
m_orgImage = *orgImage;
m_template = *templ;
m_selection = orgImageSelection;
m_compositeRule = compositeRule;
filterImage();
}
void SuperImpose::filterImage()
{
if (m_template.isNull())
{
return;
}
int templateWidth = m_template.width();
int templateHeight = m_template.height();
// take selection of src image and scale it to size of template
m_destImage = m_orgImage.smoothScaleSection(m_selection.x(), m_selection.y(),
m_selection.width(), m_selection.height(), templateWidth, templateHeight);
// convert depth if necessary
m_template.convertToDepthOfImage(&m_destImage);
// get composer for compositing rule
DColorComposer* composer = DColorComposer::getComposer(m_compositeRule);
DColorComposer::MultiplicationFlags flags = DColorComposer::NoMultiplication;
if (m_compositeRule != DColorComposer::PorterDuffNone)
{
flags = DColorComposer::MultiplicationFlagsDImg;
}
// do alpha blending of template on dest image
m_destImage.bitBlendImage(composer, &m_template, 0, 0, templateWidth, templateHeight, 0, 0, flags);
delete composer;
}
} // namespace DigikamDecorateImagePlugin
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2006-18-03
* Description : Superimpose filter.
*
* Copyright (C) 2006-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
*
* 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 SUPERIMPOSE_H
#define SUPERIMPOSE_H
// Qt includes
#include <QRect>
// Local includes
#include "dimg.h"
#include "dcolor.h"
using namespace Digikam;
namespace DigikamDecorateImagePlugin
{
class SuperImpose
{
public:
SuperImpose(DImg* orgImage, DImg* templ,
QRect orgImageSelection,
DColorComposer::CompositingOperation
compositeRule = DColorComposer::PorterDuffNone);
DImg getTargetImage() const
{
return m_destImage;
}
private:
void filterImage();
private:
QRect m_selection;
DImg m_orgImage;
DImg m_template;
DImg m_destImage;
DColorComposer::CompositingOperation m_compositeRule;
};
} // namespace DigikamDecorateImagePlugin
#endif /* SUPERIMPOSE_H */
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2005-01-04
* Description : a Digikam image editor plugin for superimpose a
* template to an image.
*
* Copyright (C) 2005-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2006-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
*
* 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 "superimposetool.moc"
// Qt includes
#include <QButtonGroup>
#include <QDir>
#include <QFile>
#include <QFrame>
#include <QGridLayout>
#include <QGroupBox>
#include <QLabel>
#include <QPixmap>
#include <QPushButton>
#include <QToolButton>
#include <QProgressBar>
// KDE includes
#include <kapplication.h>
#include <kconfig.h>
#include <kcursor.h>
#include <kfiledialog.h>
#include <kglobal.h>
#include <kglobalsettings.h>
#include <khelpmenu.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kmenu.h>
#include <kstandarddirs.h>
// Local includes
#include "dimg.h"
#include "dirselectwidget.h"
#include "editortoolsettings.h"
#include "imageiface.h"