Commit 99a85e1a authored by Boudewijn Rempt's avatar Boudewijn Rempt

Add a new docker to select SVG symbols

parent 88fe8c28
......@@ -3,6 +3,7 @@ project(calligradockers)
set(calligradockers_SRCS
shapecollection/ShapeCollectionDocker.cpp
shapecollection/CollectionItemModel.cpp
svgsymbolcollection/SvgSymbolCollectionDocker.cpp
Plugin.cpp
)
......
......@@ -18,6 +18,7 @@
*/
#include "Plugin.h"
#include "shapecollection/ShapeCollectionDocker.h"
#include "svgsymbolcollection/SvgSymbolCollectionDocker.h"
#include <KoDockRegistry.h>
......@@ -30,6 +31,7 @@ Plugin::Plugin(QObject *parent, const QVariantList &)
{
Q_UNUSED(parent);
KoDockRegistry::instance()->add(new ShapeCollectionDockerFactory());
KoDockRegistry::instance()->add(new SvgSymbolCollectionDockerFactory());
}
#include <Plugin.moc>
......
/* This file is part of the KDE project
* Copyright (C) 2008 Peter Simonsson <peter.simonsson@gmail.com>
*
* 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 "SvgSymbolCollectionDocker.h"
#include <klocalizedstring.h>
#include <QDebug>
//
// SvgSymbolCollectionDockerFactory
//
SvgSymbolCollectionDockerFactory::SvgSymbolCollectionDockerFactory()
: KoDockFactoryBase()
{
}
QString SvgSymbolCollectionDockerFactory::id() const
{
return QString("SvgSymbolCollectionDocker");
}
QDockWidget *SvgSymbolCollectionDockerFactory::createDockWidget()
{
SvgSymbolCollectionDocker *docker = new SvgSymbolCollectionDocker();
return docker;
}
//
// SvgSymbolCollectionDocker
//
SvgSymbolCollectionDocker::SvgSymbolCollectionDocker(QWidget *parent)
: QDockWidget(parent)
{
setWindowTitle(i18n("Vector Libraries"));
}
void SvgSymbolCollectionDocker::setCanvas(KoCanvasBase *canvas)
{
setEnabled(canvas != 0);
}
void SvgSymbolCollectionDocker::unsetCanvas()
{
setEnabled(false);
}
/* This file is part of the KDE project
* Copyright (C) 2017 Boudewijn Rempt <boud@valdyas.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 SVGSYMBOLCOLLECTIONDOCKER_H
#define SVGSYMBOLCOLLECTIONDOCKER_H
#include <QDockWidget>
#include <QModelIndex>
#include <QMap>
#include <QIcon>
#include <KoDockFactoryBase.h>
#include <KoCanvasObserverBase.h>
class SvgSymbolCollectionDockerFactory : public KoDockFactoryBase
{
public:
SvgSymbolCollectionDockerFactory();
QString id() const override;
QDockWidget *createDockWidget() override;
DockPosition defaultDockPosition() const override
{
return DockRight;
}
};
class SvgSymbolCollectionDocker : public QDockWidget, public KoCanvasObserverBase
{
Q_OBJECT
public:
explicit SvgSymbolCollectionDocker(QWidget *parent = 0);
/// reimplemented
void setCanvas(KoCanvasBase *canvas) override;
void unsetCanvas() override;
};
#endif //KOSHAPECOLLECTIONDOCKER_H
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