File indexing completed on 2024-06-16 04:16:05

0001 /*
0002  *  SPDX-FileCopyrightText: 2015 Jouni Pentikäinen <joupent@gmail.com>
0003  *  SPDX-FileCopyrightText: 2020 Emmet O 'Neill <emmetoneill.pdx@gmail.com>
0004  *  SPDX-FileCopyrightText: 2020 Eoin O 'Neill <eoinoneill1991@gmail.com>
0005  *
0006  *  SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #ifndef _TIMELINE_DOCKER_H_
0010 #define _TIMELINE_DOCKER_H_
0011 
0012 #include "kritaimage_export.h"
0013 
0014 #include <QScopedPointer>
0015 #include <QDockWidget>
0016 
0017 #include <kis_mainwindow_observer.h>
0018 #include <kis_utility_title_bar.h>
0019 
0020 #ifdef Q_OS_MACOS
0021 #include <sys/types.h>
0022 #endif
0023 
0024 class QToolButton;
0025 class KisTransportControls;
0026 class KisIntParseSpinBox;
0027 class KisSliderSpinBox;
0028 
0029 class KisCanvas2;
0030 class KisAction;
0031 class KisPlaybackEngine;
0032 
0033 
0034 /** @brief A customized titlebar for the Animation Timeline Docker that's
0035  * packed with useful widgets and menus.
0036  *
0037  * To avoid cluttering the UI, elements that are important to the
0038  * animator's workflow should be available at a glace, while
0039  * set-and-forget types of things should be hidden inside of menus.
0040  */
0041 class KisAnimTimelineDockerTitlebar : public KisUtilityTitleBar
0042 {
0043     Q_OBJECT
0044 
0045 public:
0046     KisAnimTimelineDockerTitlebar(QWidget *parent = nullptr);
0047 
0048     KisTransportControls* transport;
0049 
0050     KisIntParseSpinBox *frameRegister;
0051 
0052     QToolButton *btnAddKeyframe;
0053     QToolButton *btnDuplicateKeyframe;
0054     QToolButton *btnRemoveKeyframe;
0055 
0056     QToolButton *btnOnionSkinsMenu;
0057     QToolButton *btnAudioMenu;
0058     QToolButton *btnSettingsMenu;
0059 
0060     QString strImportAudio;
0061     QAction *importAudioAction;
0062     QAction *removeAudioAction;
0063     QAction *muteAudioAction;
0064     KisSliderSpinBox *volumeSlider;
0065 
0066     KisIntParseSpinBox *sbStartFrame;
0067     KisIntParseSpinBox *sbEndFrame;
0068     KisIntParseSpinBox *sbFrameRate;
0069     KisSliderSpinBox *sbSpeed;
0070 
0071     QToolButton *btnDropFrames;
0072 
0073     QToolButton *btnAutoKey;
0074     QAction *autoKeyBlank;
0075     QAction *autoKeyDuplicate;
0076 
0077 private:
0078     const int MAX_FRAMES = 9999;
0079 };
0080 
0081 
0082 /** @brief Krita's Animation Timeline Docker.
0083  * This is the GUI heart of Krita's traditional animation workflow,
0084  * and is where artists can configure, edit, scrub and play their animation.
0085  *
0086  * Currently interacts with the TimelineFramesView/Model as well as
0087  * the KisImageAnimationInterface. (TODO: Consider refactoring to
0088  * streamline this interaction towards Docker -> AnimationPlayer -> ImageAnimInterface)
0089  */
0090 class KisAnimTimelineDocker : public QDockWidget, public KisMainwindowObserver
0091 {
0092     Q_OBJECT
0093 public:
0094     KisAnimTimelineDocker();
0095     ~KisAnimTimelineDocker() override;
0096 
0097     QString observerName() override { return "TimelineDocker"; }
0098     void setCanvas(KoCanvasBase *canvas) override;
0099     void unsetCanvas() override;
0100     void setViewManager(KisViewManager *kisview) override;
0101     void setPlaybackEngine(KisPlaybackEngine *playbackEngine);
0102 
0103 public Q_SLOTS:
0104     void setAutoKey(bool value);
0105 
0106     void handleFrameRateChange();
0107 
0108     void updateFrameCache();
0109     void updateFrameRegister();
0110     void updatePlaybackStatistics();
0111 
0112     void handleThemeChange();
0113 
0114 private:
0115     struct Private;
0116     const QScopedPointer<Private> m_d;
0117 };
0118 
0119 
0120 #endif