Commit 73d083e1 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Rename KoCanvasResourceManager to KoCanvasResourceProvider

parent 39b549a4
......@@ -28,7 +28,7 @@
#include <KoShapeController.h>
#include <KoShapeManager.h>
#include <KoSelection.h>
#include <KoCanvasResourceManager.h>
#include <KoCanvasResourceProvider.h>
#include <KoColor.h>
#include <KoPathPoint.h>
#include <KoPathPointData.h>
......
......@@ -18,7 +18,7 @@ set(kritaflake_SRCS
KoResourceManager_p.cpp
KoDerivedResourceConverter.cpp
KoResourceUpdateMediator.cpp
KoCanvasResourceManager.cpp
KoCanvasResourceProvider.cpp
KoDocumentResourceManager.cpp
KoCanvasObserverBase.cpp
KoCanvasSupervisor.cpp
......
......@@ -23,7 +23,7 @@
#include <QDebug>
#include "KoCanvasBase.h"
#include "KoCanvasResourceManager.h"
#include "KoCanvasResourceProvider.h"
#include "KoShapeController.h"
#include "KoCanvasController.h"
#include "KoViewConverter.h"
......@@ -53,17 +53,17 @@ public:
delete snapGuide;
}
QPointer<KoShapeController> shapeController;
QPointer<KoCanvasResourceManager> resourceManager;
QPointer<KoCanvasResourceProvider> resourceManager;
bool isResourceManagerShared;
KoCanvasController *controller;
KoSnapGuide *snapGuide;
};
KoCanvasBase::KoCanvasBase(KoShapeControllerBase *shapeController, KoCanvasResourceManager *sharedResourceManager)
KoCanvasBase::KoCanvasBase(KoShapeControllerBase *shapeController, KoCanvasResourceProvider *sharedResourceManager)
: d(new Private())
{
d->resourceManager = sharedResourceManager ?
sharedResourceManager : new KoCanvasResourceManager();
sharedResourceManager : new KoCanvasResourceProvider();
d->isResourceManagerShared = sharedResourceManager;
d->shapeController = new KoShapeController(this, shapeController);
......@@ -99,7 +99,7 @@ void KoCanvasBase::disconnectCanvasObserver(QObject *object)
}
KoCanvasResourceManager *KoCanvasBase::resourceManager() const
KoCanvasResourceProvider *KoCanvasBase::resourceManager() const
{
return d->resourceManager;
}
......
......@@ -30,7 +30,7 @@
class KUndo2Command;
class KoUnit;
class KoCanvasResourceManager;
class KoCanvasResourceProvider;
class KoShapeManager;
class KoToolProxy;
class KoViewConverter;
......@@ -64,7 +64,7 @@ public:
* @param shapeController the implementation of the shapeController that the
* application provides to allow shapes to be added in multiple views.
*/
explicit KoCanvasBase(KoShapeControllerBase *shapeController, KoCanvasResourceManager *sharedResourceManager = 0);
explicit KoCanvasBase(KoShapeControllerBase *shapeController, KoCanvasResourceProvider *sharedResourceManager = 0);
~KoCanvasBase() override;
public:
......@@ -213,7 +213,7 @@ public:
* @endcode
* @see KoShapeController::resourceManager()
*/
KoCanvasResourceManager *resourceManager() const;
KoCanvasResourceProvider *resourceManager() const;
/**
* Return the shape controller for this canvas.
......
......@@ -19,7 +19,7 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "KoCanvasResourceManager.h"
#include "KoCanvasResourceProvider.h"
#include <QVariant>
#include <FlakeDebug.h>
......@@ -29,13 +29,13 @@
#include "KoResourceManager_p.h"
#include <KoColorSpaceRegistry.h>
class Q_DECL_HIDDEN KoCanvasResourceManager::Private
class Q_DECL_HIDDEN KoCanvasResourceProvider::Private
{
public:
KoResourceManager manager;
};
KoCanvasResourceManager::KoCanvasResourceManager(QObject *parent)
KoCanvasResourceProvider::KoCanvasResourceProvider(QObject *parent)
: QObject(parent)
, d(new Private())
{
......@@ -45,136 +45,136 @@ KoCanvasResourceManager::KoCanvasResourceManager(QObject *parent)
setResource(ApplicationSpeciality, NoSpecial);
connect(&d->manager, &KoResourceManager::resourceChanged,
this, &KoCanvasResourceManager::canvasResourceChanged);
this, &KoCanvasResourceProvider::canvasResourceChanged);
}
KoCanvasResourceManager::~KoCanvasResourceManager()
KoCanvasResourceProvider::~KoCanvasResourceProvider()
{
delete d;
}
void KoCanvasResourceManager::setResource(int key, const QVariant &value)
void KoCanvasResourceProvider::setResource(int key, const QVariant &value)
{
d->manager.setResource(key, value);
}
QVariant KoCanvasResourceManager::resource(int key) const
QVariant KoCanvasResourceProvider::resource(int key) const
{
return d->manager.resource(key);
}
void KoCanvasResourceManager::setResource(int key, const KoColor &color)
void KoCanvasResourceProvider::setResource(int key, const KoColor &color)
{
QVariant v;
v.setValue(color);
setResource(key, v);
}
void KoCanvasResourceManager::setResource(int key, KoShape *shape)
void KoCanvasResourceProvider::setResource(int key, KoShape *shape)
{
QVariant v;
v.setValue(shape);
setResource(key, v);
}
void KoCanvasResourceManager::setResource(int key, const KoUnit &unit)
void KoCanvasResourceProvider::setResource(int key, const KoUnit &unit)
{
QVariant v;
v.setValue(unit);
setResource(key, v);
}
KoColor KoCanvasResourceManager::koColorResource(int key) const
KoColor KoCanvasResourceProvider::koColorResource(int key) const
{
return d->manager.koColorResource(key);
}
void KoCanvasResourceManager::setForegroundColor(const KoColor &color)
void KoCanvasResourceProvider::setForegroundColor(const KoColor &color)
{
setResource(ForegroundColor, color);
}
KoColor KoCanvasResourceManager::foregroundColor() const
KoColor KoCanvasResourceProvider::foregroundColor() const
{
return koColorResource(ForegroundColor);
}
void KoCanvasResourceManager::setBackgroundColor(const KoColor &color)
void KoCanvasResourceProvider::setBackgroundColor(const KoColor &color)
{
setResource(BackgroundColor, color);
}
KoColor KoCanvasResourceManager::backgroundColor() const
KoColor KoCanvasResourceProvider::backgroundColor() const
{
return koColorResource(BackgroundColor);
}
KoShape *KoCanvasResourceManager::koShapeResource(int key) const
KoShape *KoCanvasResourceProvider::koShapeResource(int key) const
{
return d->manager.koShapeResource(key);
}
KoUnit KoCanvasResourceManager::unitResource(int key) const
KoUnit KoCanvasResourceProvider::unitResource(int key) const
{
return resource(key).value<KoUnit>();
}
bool KoCanvasResourceManager::boolResource(int key) const
bool KoCanvasResourceProvider::boolResource(int key) const
{
return d->manager.boolResource(key);
}
int KoCanvasResourceManager::intResource(int key) const
int KoCanvasResourceProvider::intResource(int key) const
{
return d->manager.intResource(key);
}
QString KoCanvasResourceManager::stringResource(int key) const
QString KoCanvasResourceProvider::stringResource(int key) const
{
return d->manager.stringResource(key);
}
QSizeF KoCanvasResourceManager::sizeResource(int key) const
QSizeF KoCanvasResourceProvider::sizeResource(int key) const
{
return d->manager.sizeResource(key);
}
bool KoCanvasResourceManager::hasResource(int key) const
bool KoCanvasResourceProvider::hasResource(int key) const
{
return d->manager.hasResource(key);
}
void KoCanvasResourceManager::clearResource(int key)
void KoCanvasResourceProvider::clearResource(int key)
{
d->manager.clearResource(key);
}
void KoCanvasResourceManager::addDerivedResourceConverter(KoDerivedResourceConverterSP converter)
void KoCanvasResourceProvider::addDerivedResourceConverter(KoDerivedResourceConverterSP converter)
{
d->manager.addDerivedResourceConverter(converter);
}
bool KoCanvasResourceManager::hasDerivedResourceConverter(int key)
bool KoCanvasResourceProvider::hasDerivedResourceConverter(int key)
{
return d->manager.hasDerivedResourceConverter(key);
}
void KoCanvasResourceManager::removeDerivedResourceConverter(int key)
void KoCanvasResourceProvider::removeDerivedResourceConverter(int key)
{
d->manager.removeDerivedResourceConverter(key);
}
void KoCanvasResourceManager::addResourceUpdateMediator(KoResourceUpdateMediatorSP mediator)
void KoCanvasResourceProvider::addResourceUpdateMediator(KoResourceUpdateMediatorSP mediator)
{
d->manager.addResourceUpdateMediator(mediator);
}
bool KoCanvasResourceManager::hasResourceUpdateMediator(int key)
bool KoCanvasResourceProvider::hasResourceUpdateMediator(int key)
{
return d->manager.hasResourceUpdateMediator(key);
}
void KoCanvasResourceManager::removeResourceUpdateMediator(int key)
void KoCanvasResourceProvider::removeResourceUpdateMediator(int key)
{
d->manager.removeResourceUpdateMediator(key);
}
......@@ -36,7 +36,7 @@ class QVariant;
class QSizeF;
/**
* The KoCanvasResourceManager contains a set of per-canvas
* The KoCanvasResourceProvider contains a set of per-canvas
* properties, like current foreground color, current background
* color and more. All tools belonging to the current canvas are
* notified when a Resource changes (is set).
......@@ -56,7 +56,7 @@ class QSizeF;
* document = static_cast<QTextDocument*>(var.value<void*>());
* @endcode
*/
class KRITAFLAKE_EXPORT KoCanvasResourceManager : public QObject
class KRITAFLAKE_EXPORT KoCanvasResourceProvider : public QObject
{
Q_OBJECT
......@@ -99,15 +99,15 @@ public:
* Constructor.
* @param parent the parent QObject, used for memory management.
*/
explicit KoCanvasResourceManager(QObject *parent = 0);
~KoCanvasResourceManager() override;
explicit KoCanvasResourceProvider(QObject *parent = 0);
~KoCanvasResourceProvider() override;
public Q_SLOTS:
/**
* Set a resource of any type.
* @param key the integer key
* @param value the new value for the key.
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
void setResource(int key, const QVariant &value);
......@@ -115,7 +115,7 @@ public Q_SLOTS:
* Set a resource of type KoColor.
* @param key the integer key
* @param color the new value for the key.
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
void setResource(int key, const KoColor &color);
......@@ -123,7 +123,7 @@ public Q_SLOTS:
* Set a resource of type KoShape*.
* @param key the integer key
* @param id the new value for the key.
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
void setResource(int key, KoShape *shape);
......@@ -131,7 +131,7 @@ public Q_SLOTS:
* Set a resource of type KoUnit
* @param key the integer key
* @param id the new value for the key.
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
void setResource(int key, const KoUnit &unit);
......@@ -140,7 +140,7 @@ public:
* Returns a qvariant containing the specified resource or a standard one if the
* specified resource does not exist.
* @param key the key
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
QVariant resource(int key) const;
......@@ -168,56 +168,56 @@ public:
/**
* Return the resource determined by param key as a boolean.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
bool boolResource(int key) const;
/**
* Return the resource determined by param key as an integer.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
int intResource(int key) const;
/**
* Return the resource determined by param key as a KoColor.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
KoColor koColorResource(int key) const;
/**
* Return the resource determined by param key as a pointer to a KoShape.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
KoShape *koShapeResource(int key) const;
/**
* Return the resource determined by param key as a QString .
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
QString stringResource(int key) const;
/**
* Return the resource determined by param key as a QSizeF.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
QSizeF sizeResource(int key) const;
/**
* Return the resource determined by param key as a KoUnit.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
KoUnit unitResource(int key) const;
/**
* Returns true if there is a resource set with the requested key.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
bool hasResource(int key) const;
......@@ -225,7 +225,7 @@ public:
* Remove the resource with @p key from the provider.
* @param key the key that will be used to remove the resource
* There will be a signal emitted with a variable that will return true on QVariable::isNull();
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
void clearResource(int key);
......@@ -266,13 +266,13 @@ Q_SIGNALS:
* new or different from the previous set value.
* @param key the identifying key for the resource
* @param value the variants new value.
* @see KoCanvasResourceManager::CanvasResource
* @see KoCanvasResourceProvider::CanvasResource
*/
void canvasResourceChanged(int key, const QVariant &value);
private:
KoCanvasResourceManager(const KoCanvasResourceManager&);
KoCanvasResourceManager& operator=(const KoCanvasResourceManager&);
KoCanvasResourceProvider(const KoCanvasResourceProvider&);
KoCanvasResourceProvider& operator=(const KoCanvasResourceProvider&);
class Private;
Private *const d;
......
......@@ -46,7 +46,7 @@ public:
* Set a resource of any type.
* @param key the integer key
* @param value the new value for the key.
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
void setResource(int key, const QVariant &value);
......@@ -54,7 +54,7 @@ public:
* Set a resource of type KoColor.
* @param key the integer key
* @param color the new value for the key.
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
void setResource(int key, const KoColor &color);
......@@ -62,7 +62,7 @@ public:
* Set a resource of type KoShape*.
* @param key the integer key
* @param id the new value for the key.
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
void setResource(int key, KoShape *shape);
......@@ -70,7 +70,7 @@ public:
* Set a resource of type KoUnit
* @param key the integer key
* @param id the new value for the key.
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
void setResource(int key, const KoUnit &unit);
......@@ -78,70 +78,70 @@ public:
* Returns a qvariant containing the specified resource or a standard one if the
* specified resource does not exist.
* @param key the key
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
QVariant resource(int key) const;
/**
* Return the resource determined by param key as a boolean.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
bool boolResource(int key) const;
/**
* Return the resource determined by param key as an integer.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
int intResource(int key) const;
/**
* Return the resource determined by param key as a KoColor.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
KoColor koColorResource(int key) const;
/**
* Return the resource determined by param key as a pointer to a KoShape.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
KoShape *koShapeResource(int key) const;
/**
* Return the resource determined by param key as a QString .
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
QString stringResource(int key) const;
/**
* Return the resource determined by param key as a QSizeF.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
QSizeF sizeResource(int key) const;
/**
* Return the resource determined by param key as a KoUnit.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
KoUnit unitResource(int key) const;
/**
* Returns true if there is a resource set with the requested key.
* @param key the identifying key for the resource
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
bool hasResource(int key) const;
/**
* Remove the resource with @p key from the provider.
* @param key the key that will be used to remove the resource
* @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource
* @see KoCanvasResourceProvider::CanvasResource KoDocumentResourceManager::DocumentResource
*/
void clearResource(int key);
......
......@@ -32,7 +32,7 @@ void KoShapeConfigWidgetBase::setUnit(const KoUnit &)
{
}
void KoShapeConfigWidgetBase::setResourceManager(KoCanvasResourceManager *rm)
void KoShapeConfigWidgetBase::setResourceManager(KoCanvasResourceProvider *rm)
{
m_resourceManager = rm;
}
......
......@@ -27,7 +27,7 @@
class KoShape;
class KUndo2Command;
class KoUnit;
class KoCanvasResourceManager;
class KoCanvasResourceProvider;
/**
* Base widget for shape-configuration panels.
......@@ -74,7 +74,7 @@ public:
virtual void setUnit(const KoUnit &unit);
/// called to set the canvas resource manager of the canvas the user used to insert the new shape.
void setResourceManager(KoCanvasResourceManager *rm);
void setResourceManager(KoCanvasResourceProvider *rm);
/// Return true if the shape config panel should be shown after the shape is created
virtual bool showOnShapeCreate();
......@@ -93,7 +93,7 @@ Q_SIGNALS:
void accept();
protected:
KoCanvasResourceManager *m_resourceManager; ///< the resource provider with data for this canvas
KoCanvasResourceProvider *m_resourceManager; ///< the resource provider with data for this canvas
};
#endif
......@@ -18,7 +18,7 @@
#include "KoShapeFillResourceConnector.h"
#include <KoCanvasResourceManager.h>
#include <KoCanvasResourceProvider.h>
#include <KoSelectedShapesProxy.h>
#include "kis_assert.h"
......@@ -76,9 +76,9 @@ void KoShapeFillResourceConnector::slotCanvasResourceChanged(int key, const QVar
{
KIS_SAFE_ASSERT_RECOVER_RETURN(m_d->canvas);
if (key == KoCanvasResourceManager::ForegroundColor) {
if (key == KoCanvasResourceProvider::ForegroundColor) {
m_d->applyShapeColoring(KoFlake::Fill, value.value<KoColor>());
} else if (key == KoCanvasResourceManager::BackgroundColor) {
} else if (key == KoCanvasResourceProvider::BackgroundColor) {
m_d->applyShapeColoring(KoFlake::StrokeFill, value.value<KoColor>());
}
}
......
......@@ -20,7 +20,7 @@
#include "KoShapePaintingContext.h"
#include "KoCanvasBase.h"
#include "KoCanvasResourceManager.h"
#include "KoCanvasResourceProvider.h"
KoShapePaintingContext::KoShapePaintingContext()
: showFormattingCharacters(false)
......@@ -36,9 +36,9 @@ KoShapePaintingContext::KoShapePaintingContext()
KoShapePaintingContext::KoShapePaintingContext(KoCanvasBase *canvas, bool forPrint)
{
KoCanvasResourceManager *rm = canvas->resourceManager();
KoCanvasResourceProvider *rm = canvas->resourceManager();
showFormattingCharacters = rm->boolResource(KoCanvasResourceManager::ShowFormattingCharacters);
showFormattingCharacters = rm->boolResource(KoCanvasResourceProvider::ShowFormattingCharacters);
if (forPrint) {
showTextShapeOutlines = false;
showFormattingCharacters = false;
......@@ -46,15 +46,15 @@ KoShapePaintingContext::KoShapePaintingContext(KoCanvasBase *canvas, bool forPri
showSectionBounds = false;
showInlineObjectVisualization = false;
} else {
showTextShapeOutlines = rm->boolResource(KoCanvasResourceManager::ShowTextShapeOutlines);
showInlineObjectVisualization = rm->boolResource(KoCanvasResourceManager::ShowInlineObjectVisualization);
if (rm->hasResource(KoCanvasResourceManager::ShowTableBorders)) {
showTableBorders = rm->boolResource(KoCanvasResourceManager::ShowTableBorders);
showTextShapeOutlines = rm->boolResource(KoCanvasResourceProvider::ShowTextShapeOutlines);
showInlineObjectVisualization = rm->boolResource(KoCanvasResourceProvider::ShowInlineObjectVisualization);
if (rm->hasResource(KoCanvasResourceProvider::ShowTableBorders)) {
showTableBorders = rm->boolResource(KoCanvasResourceProvider::ShowTableBorders);
} else {
showTableBorders = true;
}
if (rm->hasResource(KoCanvasResourceManager::ShowSectionBounds)) {
showSectionBounds = rm->boolResource(KoCanvasResourceManager::ShowSectionBounds);
if (rm->hasResource(KoCanvasResourceProvider::ShowSectionBounds)) {
showSectionBounds = rm->boolResource(KoCanvasResourceProvider::ShowSectionBounds);
} else {
showSectionBounds = true;
}
......
......@@ -27,7 +27,7 @@
#include "KoCanvasBase.h"
#include "KoPointerEvent.h"
#include "KoDocumentResourceManager.h"
#include "KoCanvasResourceManager.h"
#include "KoCanvasResourceProvider.h"