Commit 8cf47668 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove the unused KoShapeConfigFactoryBase system

This apparently wasn't used anywhere (anymore -- or ever?)
parent b6bddb57
......@@ -76,7 +76,6 @@ set(kritaflake_SRCS
KoHatchBackground.cpp
KoPatternBackground.cpp
KoShapeConfigWidgetBase.cpp
KoShapeConfigFactoryBase.cpp
KoDrag.cpp
KoDragOdfSaveHelper.cpp
KoShapeOdfSaveHelper.cpp
......
/* This file is part of the KDE project
* Copyright (C) 2006,2010 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KoShapeConfigFactoryBase.h"
KoShapeConfigFactoryBase::KoShapeConfigFactoryBase()
{
}
KoShapeConfigFactoryBase::~KoShapeConfigFactoryBase()
{
}
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_SHAPE_CONFIG_FACTORY_
#define _KO_SHAPE_CONFIG_FACTORY_
#include "kritaflake_export.h"
#include <QString>
class KoShape;
class KoShapeConfigWidgetBase;
/**
* A factory that creates config panels (widgets) for just a created shape.
* The KoCreateShapesTool is able to show a number of configuration panels after
* it created a shape via user interaction. Each shape configuration panel type
* has its own factory, which will inherit from this class.
* @see KoShapeFactoryBase::panelFactories()
* @see KoShapeConfigWidgetBase
*/
class KRITAFLAKE_EXPORT KoShapeConfigFactoryBase
{
public:
/// default constructor
KoShapeConfigFactoryBase();
virtual ~KoShapeConfigFactoryBase();
/**
* create a new config widget, intialized with the param shape
* @param shape the shape that will be configured in the config widget.
* @see KoShapeConfigWidgetBase::open()
*/
virtual KoShapeConfigWidgetBase *createConfigWidget(KoShape *shape) = 0;
/// return the (translated) name of this configuration
virtual QString name() const = 0;
/**
* Return a sorting ordering to specify where in the list of config widgets this
* one will be shown.
* Higher sorting numbers will be shown first. The default is 1.
*/
virtual int sortingOrder() const {
return 1;
}
/**
* Return true if the createConfigWidget() should be called at all for a shape of
* the specified type.
* @param id an ID like the KoShapeFactoryBase::shapeId()
*/
virtual bool showForShapeId(const QString &id) const {
Q_UNUSED(id); return true;
}
/// \internal a compare for sorting.
static bool compare(KoShapeConfigFactoryBase *f1, KoShapeConfigFactoryBase *f2) {
return f1->sortingOrder() - f2->sortingOrder() > 0;
}
};
#endif
......@@ -32,7 +32,6 @@
#include "commands/KoShapeConnectionChangeCommand.h"
#include "KoCanvasBase.h"
#include "KoShapeConfigWidgetBase.h"
#include "KoShapeConfigFactoryBase.h"
#include "KoShapeFactoryBase.h"
#include "KoShape.h"
#include "KoConnectionShape.h"
......@@ -71,26 +70,7 @@ public:
dialog->setWindowTitle(i18n("%1 Options", factory->name()));
int pageCount = 0;
QList<KoShapeConfigFactoryBase*> panels = factory->panelFactories();
qSort(panels.begin(), panels.end(), KoShapeConfigFactoryBase::compare);
QList<KoShapeConfigWidgetBase*> widgets;
foreach(KoShapeConfigFactoryBase *panelFactory, panels) {
if (! panelFactory->showForShapeId(shape->shapeId()))
continue;
KoShapeConfigWidgetBase *widget = panelFactory->createConfigWidget(shape);
if (widget == 0)
continue;
if (! widget->showOnShapeCreate()) {
delete widget;
continue;
}
widget->connect(widget, SIGNAL(accept()), dialog, SLOT(accept()));
widgets.append(widget);
widget->setResourceManager(canvas->resourceManager());
widget->setUnit(canvas->unit());
dialog->addPage(widget, panelFactory->name());
pageCount ++;
}
foreach(KoShapeConfigWidgetBase* panel, factory->createShapeOptionPanels()) {
if (! panel->showOnShapeCreate())
continue;
......
......@@ -64,7 +64,6 @@ public:
QMutex pluginLoadingMutex;
QString deferredPluginName;
QList<KoShapeTemplate> templates;
QList<KoShapeConfigFactoryBase*> configPanels;
const QString id;
const QString name;
QString family;
......@@ -144,16 +143,6 @@ QString KoShapeFactoryBase::id() const
return d->id;
}
void KoShapeFactoryBase::setOptionPanels(const QList<KoShapeConfigFactoryBase*> &panelFactories)
{
d->configPanels = panelFactories;
}
QList<KoShapeConfigFactoryBase*> KoShapeFactoryBase::panelFactories() const
{
return d->configPanels;
}
QList<KoShapeTemplate> KoShapeFactoryBase::templates() const
{
return d->templates;
......
......@@ -33,7 +33,6 @@
class KoShape;
class KoProperties;
class KoShapeConfigFactoryBase;
class KoShapeConfigWidgetBase;
class KoShapeLoadingContext;
class KoDocumentResourceManager;
......@@ -111,29 +110,6 @@ public:
return QList<KoShapeConfigWidgetBase*>();
}
/**
* Set app specific panel factories to show config options after creating a new shape.
* The application that lets the user create shapes is able to set option
* widgets that will be shown after the user inserted a new shape of the
* type that this factory presents.
* Example:
* @code
* // Init shape Factories with our frame based configuration panels.
* QList<KoShapeConfigFactoryBase *> panels;
* panels.append(new AppConfigFactory()); // insert some factory
* foreach(QString id, KoShapeRegistry::instance()->keys())
* KoShapeRegistry::instance()->value(id)->setOptionPanels(panels);
* @endcode
* @see panelFactories()
*/
void setOptionPanels(const QList<KoShapeConfigFactoryBase*> &panelFactories);
/**
* Return the app-specific panels.
* @see setOptionPanels()
*/
QList<KoShapeConfigFactoryBase*> panelFactories() const;
/**
* return the id for the shape this factory creates.
* @return the id for the shape this factory creates.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment