Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
2.0 KB
Raw Blame
/* This file is part of the KDE project
 * SPDX-FileCopyrightText: 2006 Thomas Zander <[email protected]>
 *
 * SPDX-License-Identifier: LGPL-2.0-or-later
 */

#include "KoToolManager_p.h"

#include <KoShapeManager.h>
#include <KoSelection.h>
#include <KoToolBase.h>
#include <KoToolFactoryBase.h>
#include "kis_action_registry.h"

//   ************ KoToolAction::Private **********

class Q_DECL_HIDDEN KoToolAction::Private
{
public:
    KoToolFactoryBase *toolFactory;
    KoToolManager *toolManager;
};

KoToolAction::KoToolAction(KoToolFactoryBase* toolFactory, KoToolManager *toolManager)
    : d(new Private)
{
    d->toolFactory = toolFactory;
    d->toolManager = toolManager;
}

KoToolAction::~KoToolAction()
{
    delete d;
}

void KoToolAction::trigger()
{
    d->toolManager->switchToolRequested(id());
}


QString KoToolAction::iconText() const
{
    // There is no specific iconText in KoToolFactoryBase
    return d->toolFactory->toolTip();
}

QString KoToolAction::toolTip() const
{
    return d->toolFactory->toolTip();
}

QString KoToolAction::toolName() const
{
    return d->toolFactory->toolName();
}

QString KoToolAction::id() const
{
    return d->toolFactory->id();
}

QString KoToolAction::iconName() const
{
    return d->toolFactory->iconName();
}

QKeySequence KoToolAction::shortcut() const
{
    return d->toolFactory->shortcut();
}


QString KoToolAction::section() const
{
    return d->toolFactory->section();
}

int KoToolAction::priority() const
{
    return d->toolFactory->priority();
}

QString KoToolAction::visibilityCode() const
{
    return d->toolFactory->activationShapeId();
}

KoToolFactoryBase *KoToolAction::toolFactory() const
{
    return d->toolFactory;
}

//   ************ Connector **********
Connector::Connector(KoShapeManager *parent)
        : QObject(parent),
        m_shapeManager(parent)
{
    connect(m_shapeManager, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
}

void Connector::selectionChanged()
{
    Q_EMIT selectionChanged(m_shapeManager->selection()->selectedShapes());
}