Commit a3d1c899 authored by Sven Langkamp's avatar Sven Langkamp

move more plugins to KisViewPlugin

parent dd7cb174
......@@ -21,11 +21,8 @@
#include "colorrange.h"
#include <klocale.h>
#include <kcomponentdata.h>
#include <kstandarddirs.h>
#include <kis_debug.h>
#include <kpluginfactory.h>
#include <kactioncollection.h>
#include "kis_image.h"
#include "kis_layer.h"
......@@ -39,7 +36,6 @@
#include "kis_canvas2.h"
#include "kis_iterator_ng.h"
#include "kis_action.h"
#include "kis_action_manager.h"
#include "dlg_colorrange.h"
#include <KoColorSpace.h>
......@@ -48,24 +44,19 @@ K_PLUGIN_FACTORY(ColorRangeFactory, registerPlugin<ColorRange>();)
K_EXPORT_PLUGIN(ColorRangeFactory("krita"))
ColorRange::ColorRange(QObject *parent, const QVariantList &)
: KParts::Plugin(parent)
: KisViewPlugin(parent, "kritaplugins/colorrange.rc")
{
if (parent->inherits("KisView2")) {
setXMLFile(KStandardDirs::locate("data", "kritaplugins/colorrange.rc"),
true);
m_view = dynamic_cast<KisView2*>(parent);
m_selectRange = new KisAction(i18n("Select from Color Range..."), this);
m_selectRange->setActivationFlags(KisAction::ACTIVE_DEVICE);
m_selectRange->setActivationConditions(KisAction::SELECTION_EDITABLE);
m_view->actionManager()->addAction("colorrange", m_selectRange, actionCollection());
connect(m_selectRange, SIGNAL(triggered()), this, SLOT(slotActivated()));
m_selectOpaque = new KisAction(i18n("Select Opaque"), this);
m_selectOpaque->setActivationFlags(KisAction::ACTIVE_DEVICE);
m_selectOpaque->setActivationConditions(KisAction::SELECTION_EDITABLE);
m_view->actionManager()->addAction("selectopaque", m_selectOpaque, actionCollection());
connect(m_selectOpaque, SIGNAL(triggered()), this, SLOT(selectOpaque()));
}
KisAction* action = new KisAction(i18n("Select from Color Range..."), this);
action->setActivationFlags(KisAction::ACTIVE_DEVICE);
action->setActivationConditions(KisAction::SELECTION_EDITABLE);
addAction("colorrange", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotActivated()));
action = new KisAction(i18n("Select Opaque"), this);
action->setActivationFlags(KisAction::ACTIVE_DEVICE);
action->setActivationConditions(KisAction::SELECTION_EDITABLE);
addAction("selectopaque", action);
connect(action, SIGNAL(triggered()), this, SLOT(selectOpaque()));
}
ColorRange::~ColorRange()
......
......@@ -23,12 +23,9 @@
#include <QVariant>
#include <kparts/plugin.h>
#include <kis_view_plugin.h>
class KisAction;
class KisView2;
class KisPainter;
class ColorRange : public KParts::Plugin
class ColorRange : public KisViewPlugin
{
Q_OBJECT
public:
......@@ -38,12 +35,6 @@ public:
private slots:
void slotActivated();
void selectOpaque();
private:
KisView2 * m_view;
KisPainter * m_painter;
KisAction* m_selectRange;
KisAction* m_selectOpaque;
};
#endif // COLORRANGE_H
......@@ -24,11 +24,8 @@
#include <QCursor>
#include <klocale.h>
#include <kcomponentdata.h>
#include <kstandarddirs.h>
#include <kis_debug.h>
#include <kpluginfactory.h>
#include <kactioncollection.h>
#include <KoColorSpace.h>
#include <KoColorSpaceRegistry.h>
......@@ -48,7 +45,6 @@
#include <kis_view2.h>
#include <kis_paint_device.h>
#include <kis_action.h>
#include <kis_action_manager.h>
#include <kis_group_layer.h>
#include "dlg_colorspaceconversion.h"
......@@ -58,28 +54,21 @@ K_EXPORT_PLUGIN(ColorSpaceConversionFactory("krita"))
ColorSpaceConversion::ColorSpaceConversion(QObject *parent, const QVariantList &)
: KParts::Plugin(parent)
: KisViewPlugin(parent, "kritaplugins/colorspaceconversion.rc")
{
if (parent->inherits("KisView2")) {
m_view = (KisView2*) parent;
setXMLFile(KStandardDirs::locate("data", "kritaplugins/colorspaceconversion.rc"),
true);
KAction *action = new KAction(i18n("&Convert Image Type..."), this);
actionCollection()->addAction("imagecolorspaceconversion", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotImageColorSpaceConversion()));
KisAction* convertLayer = new KisAction(i18n("&Convert Layer Type..."), this);
convertLayer->setActivationFlags(KisAction::ACTIVE_LAYER);
convertLayer->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
m_view->actionManager()->addAction("layercolorspaceconversion", convertLayer, actionCollection());
connect(convertLayer, SIGNAL(triggered()), this, SLOT(slotLayerColorSpaceConversion()));
}
KisAction *action = new KisAction(i18n("&Convert Image Type..."), this);
addAction("imagecolorspaceconversion", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotImageColorSpaceConversion()));
action = new KisAction(i18n("&Convert Layer Type..."), this);
action->setActivationFlags(KisAction::ACTIVE_LAYER);
action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
addAction("layercolorspaceconversion", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotLayerColorSpaceConversion()));
}
ColorSpaceConversion::~ColorSpaceConversion()
{
m_view = 0;
}
void ColorSpaceConversion::slotImageColorSpaceConversion()
......
......@@ -23,14 +23,12 @@
#include <QVariant>
#include <kparts/plugin.h>
#include <kis_view_plugin.h>
class KisView2;
class KisPainter;
/**
* Dialog for converting between color models.
*/
class ColorSpaceConversion : public KParts::Plugin
class ColorSpaceConversion : public KisViewPlugin
{
Q_OBJECT
public:
......@@ -41,12 +39,6 @@ private slots:
void slotImageColorSpaceConversion();
void slotLayerColorSpaceConversion();
private:
KisView2 * m_view;
KisPainter * m_painter;
};
#endif // COLORSPACECONVERSION_H
......@@ -31,7 +31,7 @@
#include <kis_layer.h>
#include <kis_statusbar.h>
#include <kis_node_manager.h>
#include <kis_action.h>
#include "dlg_compose.h"
......@@ -39,15 +39,11 @@ K_PLUGIN_FACTORY(KisLayerComposePluginFactory, registerPlugin<KisLayerComposePlu
K_EXPORT_PLUGIN(KisLayerComposePluginFactory("krita"))
KisLayerComposePlugin::KisLayerComposePlugin(QObject *parent, const QVariantList &)
: KParts::Plugin(parent)
: KisViewPlugin(parent, "kritaplugins/imageseparate.rc")
{
if (parent->inherits("KisView2")) {
setXMLFile(KStandardDirs::locate("data", "kritaplugins/imageseparate.rc"), true);
m_view = (KisView2*) parent;
KAction *action = new KAction(i18n("Compose Layer..."), this);
actionCollection()->addAction("layercompose", action);
connect(action, SIGNAL(triggered(bool)), SLOT(slotCompose()));
}
KisAction *action = new KisAction(i18n("Compose Layer..."), this);
addAction("layercompose", action);
connect(action, SIGNAL(triggered(bool)), SLOT(slotCompose()));
}
KisLayerComposePlugin::~KisLayerComposePlugin()
......
......@@ -20,11 +20,9 @@
#include <QVariant>
#include <kparts/plugin.h>
#include <kis_view_plugin.h>
class KisView2;
class KisLayerComposePlugin : public KParts::Plugin
class KisLayerComposePlugin : public KisViewPlugin
{
Q_OBJECT
public:
......@@ -34,10 +32,6 @@ public:
private slots:
void slotCompose();
private:
KisView2 * m_view;
};
#endif
......@@ -21,13 +21,11 @@
#include "kis_dropshadow_plugin.h"
#include <klocale.h>
#include <kcomponentdata.h>
#include <kstandarddirs.h>
#include <kis_debug.h>
#include <kpluginfactory.h>
#include <kactioncollection.h>
#include "kis_view2.h"
#include <kis_action.h>
#include "kis_types.h"
#include "kis_image.h"
#include "kis_layer.h"
......@@ -43,16 +41,12 @@ K_PLUGIN_FACTORY(KisDropshadowPluginFactory, registerPlugin<KisDropshadowPlugin>
K_EXPORT_PLUGIN(KisDropshadowPluginFactory("krita"))
KisDropshadowPlugin::KisDropshadowPlugin(QObject *parent, const QVariantList &)
: KParts::Plugin(parent)
: KisViewPlugin(parent, "kritaplugins/dropshadow.rc")
{
if (parent->inherits("KisView2")) {
setXMLFile(KStandardDirs::locate("data", "kritaplugins/dropshadow.rc"), true);
m_view = (KisView2*) parent;
KAction *action = new KAction(i18n("Add Drop Shadow..."), this);
actionCollection()->addAction("dropshadow", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotDropshadow()));
}
KisAction *action = new KisAction(i18n("Add Drop Shadow..."), this);
action->setActivationFlags(KisAction::ACTIVE_LAYER);
addAction("dropshadow", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotDropshadow()));
}
KisDropshadowPlugin::~KisDropshadowPlugin()
......
......@@ -22,13 +22,9 @@
#include <QVariant>
#include <kparts/plugin.h>
#include <kis_view_plugin.h>
class KisView2;
class KisDropshadowPlugin : public KParts::Plugin
class KisDropshadowPlugin : public KisViewPlugin
{
Q_OBJECT
public:
......@@ -38,10 +34,6 @@ public:
private slots:
void slotDropshadow();
private:
KisView2 * m_view;
};
#endif
......@@ -21,11 +21,8 @@
#include "histogram.h"
#include <klocale.h>
#include <kcomponentdata.h>
#include <kstandarddirs.h>
#include <kis_debug.h>
#include <kpluginfactory.h>
#include <kactioncollection.h>
#include <kis_layer.h>
#include <kis_paint_device.h>
......@@ -35,25 +32,17 @@
#include "dlg_histogram.h"
#include "kis_node_manager.h"
#include <kis_action.h>
#include <kis_action_manager.h>
K_PLUGIN_FACTORY(HistogramFactory, registerPlugin<Histogram>();)
K_EXPORT_PLUGIN(HistogramFactory("krita"))
Histogram::Histogram(QObject *parent, const QVariantList &)
: KParts::Plugin(parent)
: KisViewPlugin(parent, "kritaplugins/histogram.rc")
{
if (parent->inherits("KisView2")) {
setXMLFile(KStandardDirs::locate("data", "kritaplugins/histogram.rc"),
true);
m_view = (KisView2*) parent;
KisAction* action = new KisAction(i18n("&Histogram..."), this);
action->setActivationFlags(KisAction::ACTIVE_LAYER);
m_view->actionManager()->addAction("histogram", action, actionCollection());
connect(action, SIGNAL(triggered()), this, SLOT(slotActivated()));
}
KisAction* action = new KisAction(i18n("&Histogram..."), this);
action->setActivationFlags(KisAction::ACTIVE_LAYER);
addAction("histogram", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotActivated()));
}
Histogram::~Histogram()
......
......@@ -23,11 +23,9 @@
#include <QVariant>
#include <kparts/plugin.h>
#include <kis_view_plugin.h>
class KisView2;
class Histogram : public KParts::Plugin
class Histogram : public KisViewPlugin
{
Q_OBJECT
public:
......@@ -36,9 +34,6 @@ public:
private slots:
void slotActivated();
private:
KisView2 * m_view;
};
#endif // HISTOGRAM_H
......@@ -21,12 +21,8 @@
#include "imagesize.h"
#include <klocale.h>
#include <kcomponentdata.h>
#include <kstandarddirs.h>
#include <kis_debug.h>
#include <kpluginfactory.h>
#include <kstandardaction.h>
#include <kactioncollection.h>
#include <KoProgressUpdater.h>
#include <KoUpdater.h>
......@@ -50,45 +46,37 @@
#include "kis_filter_strategy.h"
#include "kis_canvas_resource_provider.h"
#include "kis_action.h"
#include "kis_action_manager.h"
K_PLUGIN_FACTORY(ImageSizeFactory, registerPlugin<ImageSize>();)
K_EXPORT_PLUGIN(ImageSizeFactory("krita"))
ImageSize::ImageSize(QObject *parent, const QVariantList &)
: KParts::Plugin(parent)
: KisViewPlugin(parent, "kritaplugins/imagesize.rc")
{
if (parent->inherits("KisView2")) {
setXMLFile(KStandardDirs::locate("data", "kritaplugins/imagesize.rc"), true);
m_view = (KisView2*) parent;
KAction *action = new KAction(i18n("Scale To New Size..."), this);
actionCollection()->addAction("imagesize", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotImageSize()));
action = new KAction(i18n("Size Canvas..."), this);
actionCollection()->addAction("canvassize", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotCanvasSize()));
m_scaleLayerAction = new KisAction(i18n("Scale &Layer..."), this);
m_scaleLayerAction->setActivationFlags(KisAction::ACTIVE_LAYER);
m_scaleLayerAction->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
m_view->actionManager()->addAction("layersize", m_scaleLayerAction, actionCollection());
connect(m_scaleLayerAction, SIGNAL(triggered()), this, SLOT(slotLayerSize()));
m_scaleSelectionAction = new KisAction(i18n("&Scale..."), this);
m_scaleSelectionAction->setActivationFlags(KisAction::PIXELS_SELECTED);
m_scaleSelectionAction->setActivationConditions(KisAction::SELECTION_EDITABLE);
m_view->actionManager()->addAction("selectionscale", m_scaleSelectionAction, actionCollection());
Q_CHECK_PTR(m_scaleSelectionAction);
connect(m_scaleSelectionAction, SIGNAL(triggered()), this, SLOT(slotSelectionScale()));
}
KisAction *action = new KisAction(i18n("Scale To New Size..."), this);
addAction("imagesize", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotImageSize()));
action = new KisAction(i18n("Size Canvas..."), this);
addAction("canvassize", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotCanvasSize()));
action = new KisAction(i18n("Scale &Layer..."), this);
action->setActivationFlags(KisAction::ACTIVE_LAYER);
action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
addAction("layersize", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotLayerSize()));
action = new KisAction(i18n("&Scale..."), this);
action->setActivationFlags(KisAction::PIXELS_SELECTED);
action->setActivationConditions(KisAction::SELECTION_EDITABLE);
addAction("selectionscale", action);
Q_CHECK_PTR(action);
connect(action, SIGNAL(triggered()), this, SLOT(slotSelectionScale()));
}
ImageSize::~ImageSize()
{
m_view = 0;
}
void ImageSize::slotImageSize()
......
......@@ -22,14 +22,9 @@
#include <QVariant>
#include <kparts/plugin.h>
#include <kis_view_plugin.h>
#include "kis_types.h"
class KisAction;
class KisView2;
class ImageSize : public KParts::Plugin
class ImageSize : public KisViewPlugin
{
Q_OBJECT
public:
......@@ -42,12 +37,6 @@ private slots:
void slotCanvasSize();
void slotLayerSize();
void slotSelectionScale();
private:
KisView2 * m_view;
KisAction* m_scaleLayerAction;
KisAction* m_scaleSelectionAction;
};
#endif // IMAGESIZE_H
......@@ -22,14 +22,12 @@
#include "imagesplit.h"
#include <klocale.h>
#include <kcomponentdata.h>
#include <kstandarddirs.h>
#include <kis_debug.h>
#include <kpluginfactory.h>
#include <kactioncollection.h>
#include <kis_types.h>
#include <kis_view2.h>
#include <kis_image.h>
#include <kis_action.h>
#include <kis_doc2.h>
#include <KoDocument.h>
......@@ -48,21 +46,15 @@ K_PLUGIN_FACTORY(ImagesplitFactory, registerPlugin<Imagesplit>();)
K_EXPORT_PLUGIN(ImagesplitFactory("krita"))
Imagesplit::Imagesplit(QObject *parent, const QVariantList &)
: KParts::Plugin(parent)
: KisViewPlugin(parent, "kritaplugins/imagesplit.rc")
{
if (parent->inherits("KisView2")) {
setXMLFile(KStandardDirs::locate("data", "kritaplugins/imagesplit.rc"), true);
KAction *action = new KAction(i18n("Image Split "), this);
actionCollection()->addAction("imagesplit", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotImagesplit()));
m_view = (KisView2*) parent;
}
KisAction *action = new KisAction(i18n("Image Split "), this);
addAction("imagesplit", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotImagesplit()));
}
Imagesplit::~Imagesplit()
{
m_view = 0;
}
void Imagesplit::saveAsImage(QRect imgSize,QString mimeType,KUrl url)
......
......@@ -23,12 +23,10 @@
#include <QVariant>
#include <kparts/plugin.h>
#include <kurl.h>
#include <kis_view_plugin.h>
class KisView2;
class Imagesplit : public KParts::Plugin
class Imagesplit : public KisViewPlugin
{
Q_OBJECT
public:
......@@ -39,11 +37,6 @@ private slots:
void slotImagesplit();
void saveAsImage(QRect ,QString, KUrl);
private:
KisView2 * m_view;
};
#endif // IMAGESPLIT_H
......@@ -23,12 +23,9 @@
#include <QUiLoader>
#include <QVBoxLayout>
#include <kactioncollection.h>
#include <kcomponentdata.h>
#include <kis_debug.h>
#include <kpluginfactory.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include "kis_config.h"
#include "kis_cursor.h"
......@@ -38,7 +35,6 @@
#include "kis_types.h"
#include "kis_view2.h"
#include "kis_action.h"
#include "kis_action_manager.h"
#include "kis_image.h"
#include <kis_meta_data_store.h>
......@@ -53,30 +49,24 @@ K_PLUGIN_FACTORY(metadataeditorPluginFactory, registerPlugin<metadataeditorPlugi
K_EXPORT_PLUGIN(metadataeditorPluginFactory("krita"))
metadataeditorPlugin::metadataeditorPlugin(QObject *parent, const QVariantList &)
: KParts::Plugin(parent)
: KisViewPlugin(parent, "kritaplugins/metadataeditor.rc")
{
if (parent->inherits("KisView2")) {
m_view = (KisView2*) parent;
KisAction *action = new KisAction(i18n("&Edit metadata..."), this);
action->setActivationFlags(KisAction::ACTIVE_LAYER);
action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
addAction("EditLayerMetaData", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotEditLayerMetaData()));
setXMLFile(KStandardDirs::locate("data", "kritaplugins/metadataeditor.rc"), true);
QStringList runtimeVersion = QString(qVersion()).split('.');
QStringList compileVersion = QString(QT_VERSION_STR).split('.');
KisAction *action = new KisAction(i18n("&Edit metadata..."), this);
action->setActivationFlags(KisAction::ACTIVE_LAYER);
action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
m_view->actionManager()->addAction("EditLayerMetaData", action, actionCollection());
connect(action, SIGNAL(triggered()), this, SLOT(slotEditLayerMetaData()));
QStringList runtimeVersion = QString(qVersion()).split('.');
QStringList compileVersion = QString(QT_VERSION_STR).split('.');
action->setEnabled(runtimeVersion[1] == compileVersion[1]);
if (runtimeVersion[1] == compileVersion[1]) {
action->setActivationFlags(KisAction::NEVER_ACTIVATE);
}
}
metadataeditorPlugin::~metadataeditorPlugin()
{
m_view = 0;
}
void metadataeditorPlugin::slotEditLayerMetaData()
......
......@@ -21,9 +21,7 @@
#include <QVariant>
#include <kparts/plugin.h>
class KisView2;
#include <kis_view_plugin.h>
namespace KisMetaData
{
......@@ -33,7 +31,7 @@ class Store;
/**
* Template of view plugin
*/
class metadataeditorPlugin : public KParts::Plugin
class metadataeditorPlugin : public KisViewPlugin
{
Q_OBJECT
public:
......@@ -43,10 +41,6 @@ public:
private slots:
void slotEditLayerMetaData();
private:
KisView2 * m_view;
};
#endif // metadataeditorPlugin_H
<