Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

more cleanup

parent 6237b839
......@@ -134,7 +134,7 @@ list(APPEND kdenlive_SRCS
gentime.cpp
doc/kthumb.cpp
mainwindow.cpp
renderer.cpp
# renderer.cpp
statusbarmessagelabel.cpp
timecode.cpp
timecodedisplay.cpp
......
......@@ -27,7 +27,6 @@
#include "profiles/profilerepository.hpp"
#include "profilesdialog.h"
#include "project/dialogs/profilewidget.h"
#include "renderer.h"
#ifdef USE_V4L
......
......@@ -38,7 +38,6 @@
#include "profiles/profilemodel.hpp"
#include "profiles/profilerepository.hpp"
#include "project/projectcommands.h"
#include "renderer.h"
#include "titler/titlewidget.h"
#include "transitions/transitionsrepository.hpp"
......
add_subdirectory(widgets/curves)
set(kdenlive_SRCS
${kdenlive_SRCS}
effectstack/abstractcollapsiblewidget.cpp
effectstack/collapsibleeffect.cpp
effectstack/collapsiblegroup.cpp
# effectstack/abstractcollapsiblewidget.cpp
# effectstack/collapsibleeffect.cpp
# effectstack/collapsiblegroup.cpp
# effectstack/effectstackedit.cpp
# effectstack/effectstackview2.cpp
effectstack/graphicsscenerectmove.cpp
......
/***************************************************************************
* Copyright (C) 2012 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* 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 "abstractcollapsiblewidget.h"
AbstractCollapsibleWidget::AbstractCollapsibleWidget(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
}
/***************************************************************************
* Copyright (C) 2012 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* 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 *
***************************************************************************/
#ifndef ABSTRACTCOLLAPSIBLEWIDGET_H
#define ABSTRACTCOLLAPSIBLEWIDGET_H
#include "ui_collapsiblewidget_ui.h"
#include <QDomElement>
#include <QWidget>
class AbstractCollapsibleWidget : public QWidget, public Ui::CollapsibleWidget_UI
{
Q_OBJECT
public:
explicit AbstractCollapsibleWidget(QWidget *parent = nullptr);
virtual void setActive(bool activate) = 0;
virtual bool isGroup() const = 0;
signals:
void addEffect(const QDomElement &e);
/** @brief Move effects in the stack one step up or down. */
void changeEffectPosition(const QList<int> &, bool upwards);
/** @brief Move effects in the stack. */
void moveEffect(const QList<int> &current_pos, int new_pos, int groupIndex, const QString &groupName);
/** @brief An effect was saved, trigger effect list reload. */
void reloadEffects();
};
#endif
This diff is collapsed.
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* 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 *
***************************************************************************/
#ifndef COLLAPSIBLEEFFECT_H
#define COLLAPSIBLEEFFECT_H
#include "abstractcollapsiblewidget.h"
#include "mltcontroller/effectscontroller.h"
#include "parametercontainer.h"
#include "timecode.h"
#include <QDomElement>
class QLabel;
class QTimeLine;
class KDualAction;
/**)
* @class CollapsibleEffect
* @brief A dialog for editing markers and guides.
* @author Jean-Baptiste Mardelle
*/
class CollapsibleEffect : public AbstractCollapsibleWidget
{
Q_OBJECT
public:
explicit CollapsibleEffect(const QDomElement &effect, const QDomElement &original_effect, const ItemInfo &info, EffectMetaInfo *metaInfo, bool canMoveUp,
bool lastEffect, QWidget *parent = nullptr);
~CollapsibleEffect();
QLabel *title;
void setupWidget(const ItemInfo &info, EffectMetaInfo *metaInfo);
void updateTimecodeFormat();
void setActive(bool activate) override;
/** @brief Install event filter so that scrolling with mouse wheel does not change parameter value. */
bool eventFilter(QObject *o, QEvent *e) override;
/** @brief Update effect GUI to reflect parameted changes. */
void updateWidget(const ItemInfo &info, const QDomElement &effect, EffectMetaInfo *metaInfo);
/** @brief Returns effect xml. */
QDomElement effect() const;
/** @brief Returns effect xml with keyframe offset for saving. */
QDomElement effectForSave() const;
int groupIndex() const;
bool isGroup() const override;
int effectIndex() const;
void setGroupIndex(int ix);
void setGroupName(const QString &groupName);
/** @brief Remove this effect from its group. */
void removeFromGroup();
QString infoString() const;
bool isActive() const;
bool isEnabled() const;
/** @brief Should the wheel event be sent to parent widget for scrolling. */
bool filterWheelEvent;
/** @brief Parent group was collapsed, update. */
void groupStateChanged(bool collapsed);
/** @brief Show / hide up / down buttons. */
void adjustButtons(int ix, int max);
/** @brief Returns this effect's monitor scene type if any is needed. */
MonitorSceneType needsMonitorEffectScene() const;
/** @brief Set clip in / out points. */
void setRange(int inPoint, int outPoint);
/** @brief Import keyframes from a clip's data. */
void setKeyframes(const QString &tag, const QString &keyframes);
/** @brief Pass frame size info (dar, etc). */
void updateFrameInfo();
/** @brief Select active keyframe. */
void setActiveKeyframe(int kf);
/** @brief Returns true if effect can be moved (false for speed effect). */
bool isMovable() const;
public slots:
void slotSyncEffectsPos(int pos);
void slotDisable(bool disable, bool emitInfo = true);
void slotResetEffect();
void importKeyframes(const QString &keyframes);
private slots:
void setWidgetHeight(qreal value);
private slots:
void slotSwitch();
void slotShow(bool show);
void slotDeleteEffect();
void slotEffectUp();
void slotEffectDown();
void slotSaveEffect();
void slotCreateGroup();
void slotCreateRegion();
void slotUnGroup();
/** @brief A sub effect parameter was changed */
void slotUpdateRegionEffectParams(const QDomElement & /*old*/, const QDomElement & /*e*/, int /*ix*/);
/** @brief Dis/enable effect before processing an operation (color picker) */
void slotDisableEffect(bool disable);
void prepareImportClipKeyframes();
private:
ParameterContainer *m_paramWidget;
QList<CollapsibleEffect *> m_subParamWidgets;
QDomElement m_effect;
ItemInfo m_itemInfo;
QDomElement m_original_effect;
QList<QDomElement> m_subEffects;
QMenu *m_menu;
QPoint m_clickPoint;
EffectInfo m_info;
bool m_isMovable;
QTimeLine *m_animation;
/** @brief True if this is a region effect, which behaves in a special way, like a group. */
bool m_regionEffect;
/** @brief The add group action. */
QAction *m_groupAction;
KDualAction *m_enabledButton;
QLabel *m_colorIcon;
QPixmap m_iconPix;
/** @brief Check if collapsed state changed and inform MLT. */
void updateCollapsedState();
protected:
void mouseDoubleClickEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) override;
void dragLeaveEvent(QDragLeaveEvent *event) override;
void dropEvent(QDropEvent *event) override;
signals:
void parameterChanged(const QDomElement &, const QDomElement &, int, bool update = true);
void syncEffectsPos(int);
void effectStateChanged(bool, int ix, MonitorSceneType effectNeedsMonitorScene);
void deleteEffect(const QDomElement &);
void activateEffect(int);
void checkMonitorPosition(int);
void seekTimeline(int);
/** @brief Start an MLT filter job on this clip. */
void startFilterJob(QMap<QString, QString> &, QMap<QString, QString> &, QMap<QString, QString> &);
/** @brief An effect was reset, trigger param reload. */
void resetEffect(int ix);
/** @brief Ask for creation of a group. */
void createGroup(int ix);
void unGroup(CollapsibleEffect *);
void createRegion(int, const QUrl &);
void deleteGroup(const QDomDocument &);
void importClipKeyframes(GraphicsRectItem, ItemInfo, QDomElement, const QMap<QString, QString> &keyframes = QMap<QString, QString>());
};
#endif
This diff is collapsed.
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* 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 *
***************************************************************************/
#ifndef COLLAPSIBLEGROUP_H
#define COLLAPSIBLEGROUP_H
#include "abstractcollapsiblewidget.h"
#include "collapsibleeffect.h"
#include "timecode.h"
#include <QLineEdit>
#include <QMutex>
class KDualAction;
class MyEditableLabel : public QLineEdit
{
Q_OBJECT
public:
explicit MyEditableLabel(QWidget *parent = nullptr);
protected:
void mouseDoubleClickEvent(QMouseEvent *e) override;
};
/**)
* @class CollapsibleEffect
* @brief A dialog for editing markers and guides.
* @author Jean-Baptiste Mardelle
*/
class CollapsibleGroup : public AbstractCollapsibleWidget
{
Q_OBJECT
public:
CollapsibleGroup(int ix, bool firstGroup, bool lastGroup, const EffectInfo &info, QWidget *parent = nullptr);
~CollapsibleGroup();
void updateTimecodeFormat();
void setActive(bool activate) override;
int groupIndex() const;
bool isGroup() const override;
QString infoString() const;
bool isActive() const;
void addGroupEffect(CollapsibleEffect *effect);
void removeGroup(int ix, QVBoxLayout *layout);
/** @brief Return all effects in group. */
QList<CollapsibleEffect *> effects();
/** @brief Return the editable title widget. */
QWidget *title() const;
/** @brief Return the XML data describing all effects in group. */
QDomDocument effectsData();
/** @brief Adjust sub effects buttons. */
void adjustEffects();
public slots:
void slotEnable(bool enable, bool emitInfo = true);
private slots:
void slotSwitch();
void slotShow(bool show);
void slotDeleteGroup();
void slotEffectUp();
void slotEffectDown();
void slotSaveGroup();
void slotResetGroup();
void slotUnGroup();
void slotRenameGroup();
private:
QList<CollapsibleEffect *> m_subWidgets;
QMenu *m_menu;
EffectInfo m_info;
MyEditableLabel *m_title;
QMutex m_mutex;
KDualAction *m_enabledButton;
protected:
void mouseDoubleClickEvent(QMouseEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) override;
void dragLeaveEvent(QDragLeaveEvent *event) override;
void dropEvent(QDropEvent *event) override;
signals:
void deleteGroup(const QDomDocument &);
void unGroup(CollapsibleGroup *);
void groupRenamed(CollapsibleGroup *);
};
#endif
/***************************************************************************
effecstackedit.cpp - description
-------------------
begin : Feb 15 2008
copyright : (C) 2008 by Marco Gittler
email : g.marco@freenet.de
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#include "effectstackedit.h"
#include "effectstackview2.h"
#include "effectslist/effectslist.h"
#include "kdenlivesettings.h"
#include "monitor/monitor.h"
#include <KComboBox>
#include <QCheckBox>
#include <QProgressBar>
#include <QPushButton>
#include <QScrollArea>
#include <QScrollBar>
#include <QVBoxLayout>
#include <QWheelEvent>
// For QDomNode debugging (output into files); leaving here as sample code.
//#define DEBUG_ESE
EffectStackEdit::EffectStackEdit(Monitor *monitor, QWidget *parent)
: QScrollArea(parent)
, m_paramWidget(nullptr)
{
m_baseWidget = new QWidget(this);
m_metaInfo.monitor = monitor;
setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setFrameStyle(QFrame::NoFrame);
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));
updatePalette();
setWidget(m_baseWidget);
/*m_vbox = new QVBoxLayout(m_baseWidget);
m_vbox->setContentsMargins(0, 0, 0, 0);
m_vbox->setSpacing(2); */
setWidgetResizable(true);
}
EffectStackEdit::~EffectStackEdit()
{
delete m_baseWidget;
}
void EffectStackEdit::updatePalette()
{
setStyleSheet(QString());
setPalette(qApp->palette());
setStyleSheet(EffectStackView2::getStyleSheet());
}
Monitor *EffectStackEdit::monitor()
{
return m_metaInfo.monitor;
}
void EffectStackEdit::setFrameSize(const QPoint &p)
{
m_metaInfo.frameSize = p;
}
void EffectStackEdit::updateTimecodeFormat()
{
/*
if (m_paramWidget) {
m_paramWidget->updateTimecodeFormat();
}
*/
}
void EffectStackEdit::updateParameter(const QString &name, const QString &value)
{
/*
m_paramWidget->updateParameter(name, value);
if (name == QLatin1String("disable")) {
// if effect is disabled, disable parameters widget
bool enabled = value.toInt() == 0 || !KdenliveSettings::disable_effect_parameters();
setEnabled(enabled);
emit effectStateChanged(enabled);
}
*/
}
bool EffectStackEdit::eventFilter(QObject *o, QEvent *e)
{
if (e->type() == QEvent::Wheel) {
QWheelEvent *we = static_cast<QWheelEvent *>(e);
bool filterWheel = (verticalScrollBar() != nullptr) && verticalScrollBar()->isVisible();
if (!filterWheel || we->modifiers() != Qt::NoModifier) {
e->accept();
return false;
}
if (qobject_cast<QAbstractSpinBox *>(o)) {
if (qobject_cast<QAbstractSpinBox *>(o)->focusPolicy() == Qt::WheelFocus) {
e->accept();
return false;
}
e->ignore();
return true;
}
if (qobject_cast<KComboBox *>(o)) {
if (qobject_cast<KComboBox *>(o)->focusPolicy() == Qt::WheelFocus) {
e->accept();
return false;
}
e->ignore();
return true;
}
if (qobject_cast<QProgressBar *>(o)) {
if (qobject_cast<QProgressBar *>(o)->focusPolicy() == Qt::WheelFocus) {
e->accept();
return false;
}
e->ignore();
return true;
}
}
return QWidget::eventFilter(o, e);
}
void EffectStackEdit::transferParamDesc(const QDomElement &d, const ItemInfo &info, bool /*isEffect*/)
{
/*
delete m_paramWidget;
m_paramWidget = new ParameterContainer(d, info, &m_metaInfo, m_baseWidget);
connect(m_paramWidget, &ParameterContainer::parameterChanged, this, &EffectStackEdit::parameterChanged);
connect(m_paramWidget, &ParameterContainer::importKeyframes, this, &EffectStackEdit::importKeyframes);
connect(m_paramWidget, &ParameterContainer::startFilterJob, this, &EffectStackEdit::startFilterJob);
connect(this, &EffectStackEdit::syncEffectsPos, m_paramWidget, &ParameterContainer::syncEffectsPos);
connect(this, &EffectStackEdit::initScene, m_paramWidget, &ParameterContainer::initScene);
connect(m_paramWidget, &ParameterContainer::checkMonitorPosition, this, &EffectStackEdit::checkMonitorPosition);
connect(m_paramWidget, &ParameterContainer::seekTimeline, this, &EffectStackEdit::seekTimeline);
connect(m_paramWidget, SIGNAL(importClipKeyframes()), this, SIGNAL(importClipKeyframes()));
Q_FOREACH (QSpinBox *sp, m_baseWidget->findChildren<QSpinBox *>()) {
sp->installEventFilter(this);
sp->setFocusPolicy(Qt::StrongFocus);
}
Q_FOREACH (KComboBox *cb, m_baseWidget->findChildren<KComboBox *>()) {
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
}
Q_FOREACH (QProgressBar *cb, m_baseWidget->findChildren<QProgressBar *>()) {
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
}
m_paramWidget->connectMonitor(true);
*/
}
void EffectStackEdit::slotSyncEffectsPos(int pos)
{
emit syncEffectsPos(pos);
}
void EffectStackEdit::initEffectScene(int pos)
{
emit initScene(pos);
}
MonitorSceneType EffectStackEdit::needsMonitorEffectScene() const
{
return MonitorSceneDefault;
/*
if (!m_paramWidget) {
return MonitorSceneDefault;
}
return m_paramWidget->needsMonitorEffectScene();
*/
}
void EffectStackEdit::setKeyframes(const QString &tag, const QString &keyframes)
{
/*
if (!m_paramWidget) {
return;
}
m_paramWidget->setKeyframes(tag, keyframes);
*/
}
bool EffectStackEdit::doesAcceptDrops() const
{
return false;
/*
if (!m_paramWidget) {
return false;
}
return m_paramWidget->doesAcceptDrops();
*/
}
void EffectStackEdit::importKeyframes(const QString &kf)
{
QMap<QString, QString> keyframes;
if (kf.contains(QLatin1Char('\n'))) {
const QStringList params = kf.split(QLatin1Char('\n'), QString::SkipEmptyParts);
for (const QString &param : params) {
keyframes.insert(param.section(QLatin1Char('='), 0, 0), param.section(QLatin1Char('='), 1));
}
} else {
keyframes.insert(kf.section(QLatin1Char('='), 0, 0), kf.section(QLatin1Char('='), 1));
}
emit importClipKeyframes(TransitionWidget, keyframes);
}
/***************************************************************************
effecstackedit.h - description
-------------------
begin : Feb 15 2008
copyright : (C) 2008 by Marco Gittler
email : g.marco@freenet.de
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef EFFECTSTACKEDIT_H
#define EFFECTSTACKEDIT_H
#include "parametercontainer.h"
#include "definitions.h"
#include "timecode.h"
#include <QDomElement>
#include <QMap>
#include <QScrollArea>
#include <QWidget>
class Monitor;
class EffectStackEdit : public QScrollArea
{
Q_OBJECT
public:
explicit EffectStackEdit(Monitor *monitor, QWidget *parent = nullptr);
~EffectStackEdit();
static QMap<QString, QImage> iconCache;
/** @brief Sets attribute @param name to @param value.
*
* Used to disable the effect, by setting disabled="1" */
void updateParameter(const QString &name, const QString &value);
void setFrameSize(const QPoint &p);
/** @brief Tells the parameters to update their timecode format according to KdenliveSettings. */
void updateTimecodeFormat();
/** @brief Returns true if this effect wants to keep track of current position in clip. */
bool effectNeedsSyncPosition() const;
Monitor *monitor();
/** @brief Install event filter so that scrolling with mouse wheel does not change parameter value. */
bool eventFilter(QObject *o, QEvent *e) override;
/** @brief Returns type of monitor scene requested by this transition. */
MonitorSceneType needsMonitorEffectScene() const;
/** @brief Set keyframes for this transition. */
void setKeyframes(const QString &tag, const QString &keyframes);
void updatePalette();
/** @brief Emit geometry settings. */
void initEffectScene(int pos);
bool doesAcceptDrops() const;