animation_dockers.cpp 4.08 KB
Newer Older
1
/*
2
 *  Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#include "animation_dockers.h"
#include "animation_docker.h"
Jouni Pentikäinen's avatar
Jouni Pentikäinen committed
21
#include "timeline_docker.h"
22
#include "onion_skins_docker.h"
23
#include "kis_animation_curve_docker.h"
24 25

#include <kpluginfactory.h>
26

27 28 29
#include <KoDockFactoryBase.h>
#include <KoDockRegistry.h>

30 31 32
#include "KisViewManager.h"

K_PLUGIN_FACTORY_WITH_JSON(AnimationDockersPluginFactory, "krita_animationdocker.json", registerPlugin<AnimationDockersPlugin>();)
33 34 35 36 37 38 39

class AnimationDockerFactory : public KoDockFactoryBase {
public:
    AnimationDockerFactory()
    {
    }

40
    QString id() const override
41 42 43 44 45 46 47 48 49
    {
        return QString( "AnimationDocker" );
    }

    virtual Qt::DockWidgetArea defaultDockWidgetArea() const
    {
        return Qt::RightDockWidgetArea;
    }

50
    QDockWidget *createDockWidget() override
51 52 53 54 55 56 57
    {
        AnimationDocker *dockWidget = new AnimationDocker();
        dockWidget->setObjectName(id());

        return dockWidget;
    }

58
    DockPosition defaultDockPosition() const override
59 60 61 62 63 64
    {
        return DockMinimized;
    }
private:
};

Jouni Pentikäinen's avatar
Jouni Pentikäinen committed
65 66 67 68 69 70
class TimelineDockerFactory : public KoDockFactoryBase {
public:
    TimelineDockerFactory()
    {
    }

71
    QString id() const override
Jouni Pentikäinen's avatar
Jouni Pentikäinen committed
72 73 74 75 76 77 78 79 80
    {
        return QString( "TimelineDocker" );
    }

    virtual Qt::DockWidgetArea defaultDockWidgetArea() const
    {
        return Qt::RightDockWidgetArea;
    }

81
    QDockWidget *createDockWidget() override
Jouni Pentikäinen's avatar
Jouni Pentikäinen committed
82 83 84 85 86 87 88
    {
        TimelineDocker *dockWidget = new TimelineDocker();
        dockWidget->setObjectName(id());

        return dockWidget;
    }

89
    DockPosition defaultDockPosition() const override
Jouni Pentikäinen's avatar
Jouni Pentikäinen committed
90 91 92 93 94 95
    {
        return DockMinimized;
    }
private:
};

96 97 98 99 100 101
class OnionSkinsDockerFactory : public KoDockFactoryBase {
public:
    OnionSkinsDockerFactory()
    {
    }

102
    QString id() const override
103 104 105 106 107 108 109 110 111
    {
        return QString( "OnionSkinsDocker" );
    }

    virtual Qt::DockWidgetArea defaultDockWidgetArea() const
    {
        return Qt::RightDockWidgetArea;
    }

112
    QDockWidget *createDockWidget() override
113
    {
114
        OnionSkinsDocker *dockWidget = new OnionSkinsDocker();
115 116 117 118 119
        dockWidget->setObjectName(id());

        return dockWidget;
    }

120
    DockPosition defaultDockPosition() const override
121 122 123 124 125 126
    {
        return DockMinimized;
    }
private:
};

127 128 129 130 131 132
class AnimationCurvesDockerFactory : public KoDockFactoryBase {
public:
    AnimationCurvesDockerFactory()
    {
    }

133
    QString id() const override
134 135 136 137 138 139 140 141 142
    {
        return QString( "AnimationCurvesDocker" );
    }

    virtual Qt::DockWidgetArea defaultDockWidgetArea() const
    {
        return Qt::RightDockWidgetArea;
    }

143
    QDockWidget *createDockWidget() override
144 145 146 147 148 149 150
    {
        KisAnimationCurveDocker *dockWidget = new KisAnimationCurveDocker();
        dockWidget->setObjectName(id());

        return dockWidget;
    }

151
    DockPosition defaultDockPosition() const override
152 153 154 155 156 157
    {
        return DockMinimized;
    }
private:
};

158 159 160 161
AnimationDockersPlugin::AnimationDockersPlugin(QObject *parent, const QVariantList &)
    : QObject(parent)
{
    KoDockRegistry::instance()->add(new AnimationDockerFactory());
Jouni Pentikäinen's avatar
Jouni Pentikäinen committed
162
    KoDockRegistry::instance()->add(new TimelineDockerFactory());
163
    KoDockRegistry::instance()->add(new OnionSkinsDockerFactory());
164
    KoDockRegistry::instance()->add(new AnimationCurvesDockerFactory());
165 166 167 168 169 170 171 172
}

AnimationDockersPlugin::~AnimationDockersPlugin()
{
    m_view = 0;
}

#include "animation_dockers.moc"