Commit db0c7539 authored by Sashmita Raghav's avatar Sashmita Raghav
Browse files

Merge branch 'master' into 'patch3'

# Conflicts:
#   src/timeline2/view/timelinecontroller.h
parents a939e20f eccb4c14
......@@ -262,14 +262,14 @@
</ul>
</description>
<releases>
<release date="2019-12-05" version="20.03.70"/>
<release date="2020-01-06" version="20.03.70"/>
</releases>
<url type="homepage">https://kdenlive.org/</url>
<url type="bugtracker">https://bugs.kde.org</url>
<url type="help">https://userbase.kde.org/Kdenlive/Manual</url>
<url type="donation">https://www.kde.org/community/donations/?app=kdenlive&amp;source=appdata</url>
<screenshots>
<screenshot type="default"><caption>Kdenlive Timeline</caption><caption xml:lang="ca">Línia del temps del Kdenlive</caption><caption xml:lang="cs">Časová osa Kdenlive</caption><caption xml:lang="de">Kdenlive-Zeitleiste</caption><caption xml:lang="en-GB">Kdenlive Timeline</caption><caption xml:lang="es">Línea de tiempo de Kdenlive</caption><caption xml:lang="et">Kdenlive ajatelg</caption><caption xml:lang="eu">Kdenlive-n denbora-lerroa</caption><caption xml:lang="fr">Montage Kdenlive</caption><caption xml:lang="id">Linimasa Kdenlive</caption><caption xml:lang="it">Linea temporale Kdenlive</caption><caption xml:lang="nl">Kdenlive tijdlijn</caption><caption xml:lang="pt">Linha Temporal do Kdenlive</caption><caption xml:lang="pt-BR">Linha do tempo do Kdenlive</caption><caption xml:lang="sv">Kdenlive tidslinje</caption><caption xml:lang="uk">Монтажний стіл Kdenlive</caption><caption xml:lang="x-test">xxKdenlive Timelinexx</caption><caption xml:lang="zh-TW">Kdenlive 時間軸</caption><image type="source">https://cdn.kde.org/screenshots/kdenlive/k2.png</image>/image&gt;
<screenshot type="default"><caption>Kdenlive Timeline</caption><caption xml:lang="ca">Línia del temps del Kdenlive</caption><caption xml:lang="cs">Časová osa Kdenlive</caption><caption xml:lang="de">Kdenlive-Zeitleiste</caption><caption xml:lang="en-GB">Kdenlive Timeline</caption><caption xml:lang="es">Línea de tiempo de Kdenlive</caption><caption xml:lang="et">Kdenlive ajatelg</caption><caption xml:lang="eu">Kdenlive-n denbora-lerroa</caption><caption xml:lang="fr">Montage Kdenlive</caption><caption xml:lang="id">Linimasa Kdenlive</caption><caption xml:lang="it">Linea temporale Kdenlive</caption><caption xml:lang="ko">Kdenlive 타임라인</caption><caption xml:lang="nl">Kdenlive tijdlijn</caption><caption xml:lang="pt">Linha Temporal do Kdenlive</caption><caption xml:lang="pt-BR">Linha do tempo do Kdenlive</caption><caption xml:lang="sk">Kdenlive časová os</caption><caption xml:lang="sv">Kdenlive tidslinje</caption><caption xml:lang="uk">Монтажний стіл Kdenlive</caption><caption xml:lang="x-test">xxKdenlive Timelinexx</caption><caption xml:lang="zh-TW">Kdenlive 時間軸</caption><image type="source">https://cdn.kde.org/screenshots/kdenlive/k2.png</image>/image&gt;
</screenshot>
<screenshot type="source">
<caption>Kdenlive Audio Adjustments</caption>
......@@ -281,9 +281,11 @@
<caption xml:lang="fr">Ajustements audio Kdenlive</caption>
<caption xml:lang="id">Penyetelan Audio Kdenlive</caption>
<caption xml:lang="it">Regolazioni audio Kdenlive</caption>
<caption xml:lang="ko">Kdenlive 오디오 조정</caption>
<caption xml:lang="nl">Kdenlive geluidsaanpassingen</caption>
<caption xml:lang="pt">Ajustes de Áudio do Kdenlive</caption>
<caption xml:lang="pt-BR">Ajustes de áudio do Kdenlive</caption>
<caption xml:lang="sk">Kdenlive prispôsobenie zvuku</caption>
<caption xml:lang="sv">Kdenlive ljudjusteringar</caption>
<caption xml:lang="uk">Коригування звукових даних у Kdenlive</caption>
<caption xml:lang="x-test">xxKdenlive Audio Adjustmentsxx</caption>
......@@ -302,9 +304,11 @@
<caption xml:lang="fr">Effets Kdenlive</caption>
<caption xml:lang="id">Efek Kdenlive</caption>
<caption xml:lang="it">Effetti Kdenlive</caption>
<caption xml:lang="ko">Kdenlive 효과</caption>
<caption xml:lang="nl">Kdenlive effecten</caption>
<caption xml:lang="pt">Efeitos do Kdenlive</caption>
<caption xml:lang="pt-BR">Efeitos do Kdenlive</caption>
<caption xml:lang="sk">Kdenlive efekty</caption>
<caption xml:lang="sv">Kdenlive effekter</caption>
<caption xml:lang="uk">Ефекти Kdenlive</caption>
<caption xml:lang="x-test">xxKdenlive Effectsxx</caption>
......
......@@ -398,6 +398,13 @@ void AssetPanel::deleteCurrentEffect()
}
}
void AssetPanel::collapseCurrentEffect()
{
if (m_effectStackWidget->isVisible()) {
m_effectStackWidget->switchCollapsed();
}
}
void AssetPanel::slotCheckWheelEventFilter()
{
// If the effect stack widget has no scrollbar, we will not filter the
......@@ -410,7 +417,7 @@ void AssetPanel::slotCheckWheelEventFilter()
m_effectStackWidget->blockWheenEvent(blockWheel);
}
void AssetPanel::assetPanelWarning(const QString service, const QString id, const QString message)
void AssetPanel::assetPanelWarning(const QString service, const QString /*id*/, const QString message)
{
QString finalMessage;
if (!service.isEmpty() && EffectsRepository::get()->exists(service)) {
......
......@@ -74,6 +74,8 @@ public slots:
void clearAssetPanel(int itemId);
void assetPanelWarning(const QString service, const QString id, const QString message);
void deleteCurrentEffect();
/** @brief Collapse/expand current effect */
void collapseCurrentEffect();
void slotCheckWheelEventFilter();
protected:
......
......@@ -878,6 +878,7 @@ QVariant KeyframeModel::updateInterpolated(const QVariant &interpValue, double v
{
QStringList vals = interpValue.toString().split(QLatin1Char(' '));
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
if (!vals.isEmpty()) {
vals[vals.size() - 1] = locale.toString(val);
}
......@@ -1105,7 +1106,6 @@ QList<QPoint> KeyframeModel::getRanges(const QString &animData, const std::share
{
Mlt::Properties mlt_prop;
model->passProperties(mlt_prop);
QLocale locale;
mlt_prop.set("key", animData.toUtf8().constData());
// This is a fake query to force the animation to be parsed
(void)mlt_prop.anim_get_int("key", 0, 0);
......
......@@ -23,6 +23,7 @@
#include "kdenlivesettings.h"
#include <QMouseEvent>
#include <QApplication>
#include <QStylePainter>
#include <KColorScheme>
......@@ -38,19 +39,25 @@ KeyframeView::KeyframeView(std::shared_ptr<KeyframeModelList> model, int duratio
, m_currentKeyframeOriginal(-1)
, m_hoverKeyframe(-1)
, m_scale(1)
, m_zoomHandle(0,1)
, m_hoverZoomIn(false)
, m_hoverZoomOut(false)
, m_hoverZoom(false)
, m_clickOffset(0)
{
setMouseTracking(true);
setMinimumSize(QSize(150, 20));
setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred));
setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
QPalette p = palette();
KColorScheme scheme(p.currentColorGroup(), KColorScheme::Window);
m_colSelected = palette().highlight().color();
m_colKeyframe = scheme.foreground(KColorScheme::NormalText).color();
m_size = QFontInfo(font()).pixelSize() * 1.8;
m_lineHeight = m_size / 2;
m_offset = m_lineHeight;
m_size = QFontInfo(font()).pixelSize() * 3;
m_lineHeight = m_size / 2.1;
m_zoomHeight = m_size * 3 / 4;
m_offset = m_size / 4;
setFixedHeight(m_size);
setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
connect(m_model.get(), &KeyframeModelList::modelChanged, this, &KeyframeView::slotModelChanged);
}
......@@ -165,16 +172,43 @@ void KeyframeView::slotGoToPrev()
void KeyframeView::mousePressEvent(QMouseEvent *event)
{
int offset = pCore->getItemIn(m_model->getOwnerId());
int pos = (event->x() - m_offset) / m_scale;
if (event->y() < m_lineHeight && event->button() == Qt::LeftButton) {
bool ok;
GenTime position(pos + offset, pCore->getCurrentFps());
auto keyframe = m_model->getClosestKeyframe(position, &ok);
if (ok && qAbs(keyframe.first.frames(pCore->getCurrentFps()) - pos - offset) * m_scale < ceil(m_lineHeight / 1.5)) {
m_currentKeyframeOriginal = keyframe.first.frames(pCore->getCurrentFps()) - offset;
// Select and seek to keyframe
m_currentKeyframe = m_currentKeyframeOriginal;
emit seekToPos(m_currentKeyframeOriginal);
double zoomStart = m_zoomHandle.x() * (width() - 2 * m_offset);
double zoomEnd = m_zoomHandle.y() * (width() - 2 * m_offset);
double zoomFactor = (width() - 2 * m_offset) / (zoomEnd - zoomStart);
int pos = ((event->x() - m_offset) / zoomFactor + zoomStart ) / m_scale;
pos = qBound(0, pos, m_duration - 1);
if (event->button() == Qt::LeftButton) {
if (event->y() < m_lineHeight) {
// mouse click in keyframes area
bool ok;
GenTime position(pos + offset, pCore->getCurrentFps());
auto keyframe = m_model->getClosestKeyframe(position, &ok);
if (ok && qAbs(keyframe.first.frames(pCore->getCurrentFps()) - pos - offset) * m_scale < ceil(m_lineHeight / 1.5)) {
m_currentKeyframeOriginal = keyframe.first.frames(pCore->getCurrentFps()) - offset;
// Select and seek to keyframe
m_currentKeyframe = m_currentKeyframeOriginal;
emit seekToPos(m_currentKeyframeOriginal);
return;
}
} else if (event->y() > m_zoomHeight + 2) {
// click on zoom area
if (m_hoverZoom) {
m_clickOffset = ((double) event->x() - m_offset) / (width() - 2 * m_offset);
}
return;
}
} else if (event->button() == Qt::RightButton && event->y() > m_zoomHeight + 2) {
// Right click on zoom, switch between no zoom and last zoom status
if (m_zoomHandle == QPointF(0, 1)) {
if (!m_lastZoomHandle.isNull()) {
m_zoomHandle = m_lastZoomHandle;
update();
return;
}
} else {
m_lastZoomHandle = m_zoomHandle;
m_zoomHandle = QPointF(0, 1);
update();
return;
}
}
......@@ -188,9 +222,45 @@ void KeyframeView::mousePressEvent(QMouseEvent *event)
void KeyframeView::mouseMoveEvent(QMouseEvent *event)
{
int offset = pCore->getItemIn(m_model->getOwnerId());
int pos = qBound(0, (int)((event->x() - m_offset) / m_scale), m_duration - 1);
double zoomStart = m_zoomHandle.x() * (width() - 2 * m_offset);
double zoomEnd = m_zoomHandle.y() * (width() - 2 * m_offset);
double zoomFactor = (width() - 2 * m_offset) / (zoomEnd - zoomStart);
int pos = ((event->x() - m_offset) / zoomFactor + zoomStart ) / m_scale;
pos = qBound(0, pos, m_duration - 1);
GenTime position(pos + offset, pCore->getCurrentFps());
if ((event->buttons() & Qt::LeftButton) != 0u) {
if (m_hoverZoomIn || m_hoverZoomOut || m_hoverZoom) {
// Moving zoom handles
if (m_hoverZoomIn) {
m_zoomHandle.setX(qMax(0., (double)(event->x() - m_offset) / (width() - 2 * m_offset)));
update();
return;
}
if (m_hoverZoomOut) {
m_zoomHandle.setY(qMin(1., (double)(event->x() - m_offset) / (width() - 2 * m_offset)));
update();
return;
}
// moving zoom zone
if (m_hoverZoom) {
double clickOffset = ((double)event->x() - m_offset) / (width() - 2 * m_offset) - m_clickOffset;
double newX = m_zoomHandle.x() + clickOffset;
if (newX < 0) {
clickOffset = - m_zoomHandle.x();
newX = 0;
}
double newY = m_zoomHandle.y() + clickOffset;
if (newY > 1) {
clickOffset = 1 - m_zoomHandle.y();
newY = 1;
newX = m_zoomHandle.x() + clickOffset;
}
m_clickOffset = ((double)event->x() - m_offset) / (width() - 2 * m_offset);
m_zoomHandle = QPointF(newX, newY);
update();
}
return;
}
if (m_currentKeyframe == pos) {
return;
}
......@@ -211,13 +281,46 @@ void KeyframeView::mouseMoveEvent(QMouseEvent *event)
if (ok && qAbs(keyframe.first.frames(pCore->getCurrentFps()) - pos - offset) * m_scale < ceil(m_lineHeight / 1.5)) {
m_hoverKeyframe = keyframe.first.frames(pCore->getCurrentFps()) - offset;
setCursor(Qt::PointingHandCursor);
m_hoverZoomIn = false;
m_hoverZoomOut = false;
m_hoverZoom = false;
update();
return;
}
}
if (event->y() > m_zoomHeight + 2) {
// Moving in zoom area
if (qAbs(event->x() - m_offset - (m_zoomHandle.x() * (width() - 2 * m_offset))) < QApplication::startDragDistance()) {
setCursor(Qt::SizeHorCursor);
m_hoverZoomIn = true;
m_hoverZoomOut = false;
m_hoverZoom = false;
update();
return;
}
if (qAbs(event->x() - m_offset - (m_zoomHandle.y() * (width() - 2 * m_offset))) < QApplication::startDragDistance()) {
setCursor(Qt::SizeHorCursor);
m_hoverZoomOut = true;
m_hoverZoomIn = false;
m_hoverZoom = false;
update();
return;
}
if (m_zoomHandle != QPointF(0, 1) && event->x() > m_offset + (m_zoomHandle.x() * (width() - 2 * m_offset)) && event->x() < m_offset + (m_zoomHandle.y() * (width() - 2 * m_offset))) {
setCursor(Qt::PointingHandCursor);
m_hoverZoom = true;
m_hoverZoomIn = false;
m_hoverZoomOut = false;
update();
return;
}
}
if (m_hoverKeyframe != -1) {
if (m_hoverKeyframe != -1 || m_hoverZoomOut || m_hoverZoomIn || m_hoverZoom) {
m_hoverKeyframe = -1;
m_hoverZoomOut = false;
m_hoverZoomIn = false;
m_hoverZoom = false;
setCursor(Qt::ArrowCursor);
update();
}
......@@ -239,8 +342,12 @@ void KeyframeView::mouseReleaseEvent(QMouseEvent *event)
void KeyframeView::mouseDoubleClickEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton && event->y() < m_lineHeight) {
int pos = qBound(0, (int)((event->x() - m_offset) / m_scale), m_duration - 1);
int offset = pCore->getItemIn(m_model->getOwnerId());
double zoomStart = m_zoomHandle.x() * (width() - 2 * m_offset);
double zoomEnd = m_zoomHandle.y() * (width() - 2 * m_offset);
double zoomFactor = (width() - 2 * m_offset) / (zoomEnd - zoomStart);
int pos = ((event->x() - m_offset) / zoomFactor + zoomStart ) / m_scale;
pos = qBound(0, pos, m_duration - 1);
GenTime position(pos + offset, pCore->getCurrentFps());
bool ok;
auto keyframe = m_model->getClosestKeyframe(position, &ok);
......@@ -286,8 +393,11 @@ void KeyframeView::paintEvent(QPaintEvent *event)
QStylePainter p(this);
m_scale = (width() - 2 * m_offset) / (double)(m_duration - 1);
// p.translate(0, m_lineHeight);
int headOffset = m_lineHeight / 1.5;
int headOffset = m_lineHeight / 2;
int offset = pCore->getItemIn(m_model->getOwnerId());
double zoomStart = m_zoomHandle.x() * (width() - 2 * m_offset);
double zoomEnd = m_zoomHandle.y() * (width() - 2 * m_offset);
double zoomFactor = (width() - 2 * m_offset) / (zoomEnd - zoomStart);
/*
* keyframes
......@@ -300,8 +410,14 @@ void KeyframeView::paintEvent(QPaintEvent *event)
} else {
p.setBrush(m_colKeyframe);
}
double scaledPos = m_offset + (pos * m_scale);
p.drawLine(QPointF(scaledPos, headOffset), QPointF(scaledPos, m_lineHeight + headOffset / 2.0));
double scaledPos = pos * m_scale;
if (scaledPos < zoomStart || scaledPos > zoomEnd) {
continue;
}
scaledPos -= zoomStart;
scaledPos *= zoomFactor;
scaledPos += m_offset;
p.drawLine(QPointF(scaledPos, headOffset), QPointF(scaledPos, m_lineHeight - 1));
switch (keyframe.second.first) {
case KeyframeType::Linear: {
QPolygonF position = QPolygonF() << QPointF(-headOffset / 2.0, headOffset / 2.0) << QPointF(0, 0) << QPointF(headOffset / 2.0, headOffset / 2.0)
......@@ -320,25 +436,37 @@ void KeyframeView::paintEvent(QPaintEvent *event)
}
p.setPen(palette().dark().color());
/*
* Time-"line"
*/
p.setPen(m_colKeyframe);
p.drawLine(m_offset, m_lineHeight + (headOffset / 2), width() - m_offset, m_lineHeight + (headOffset / 2));
p.drawLine(m_offset, m_lineHeight, width() - m_offset, m_lineHeight);
p.drawLine(m_offset, m_lineHeight - headOffset / 2, m_offset, m_lineHeight + headOffset / 2);
p.drawLine(width() - m_offset, m_lineHeight - headOffset / 2, width() - m_offset, m_lineHeight + headOffset / 2);
/*
* current position
* current position cursor
*/
if (m_position >= 0 && m_position < m_duration) {
QPolygon pa(3);
int cursorwidth = (m_size - (m_lineHeight + headOffset / 2)) / 2 + 1;
QPolygonF position = QPolygonF() << QPointF(-cursorwidth, m_size) << QPointF(cursorwidth, m_size) << QPointF(0, m_lineHeight + (headOffset / 2) + 1);
position.translate(m_offset + (m_position * m_scale), 0);
p.setBrush(m_colKeyframe);
p.drawPolygon(position);
double scaledPos = m_position * m_scale;
if (scaledPos >= zoomStart && scaledPos <= zoomEnd) {
scaledPos -= zoomStart;
scaledPos *= zoomFactor;
scaledPos += m_offset;
QPolygon pa(3);
int cursorwidth = (m_zoomHeight - m_lineHeight) / 1.8;
QPolygonF position = QPolygonF() << QPointF(-cursorwidth, m_zoomHeight - 3) << QPointF(cursorwidth, m_zoomHeight - 3) << QPointF(0, m_lineHeight + 1);
position.translate(scaledPos, 0);
p.setBrush(m_colKeyframe);
p.drawPolygon(position);
}
}
p.setOpacity(0.5);
p.drawLine(m_offset, m_lineHeight, m_offset, m_lineHeight + headOffset);
p.drawLine(width() - m_offset, m_lineHeight, width() - m_offset, m_lineHeight + headOffset);
// Zoom bar
p.setPen(Qt::NoPen);
p.setBrush(palette().mid());
p.drawRoundedRect(m_offset, m_zoomHeight + 3, width() - 2 * m_offset, m_size - m_zoomHeight - 3, m_lineHeight / 5, m_lineHeight / 5);
p.setBrush(palette().highlight());
p.drawRoundedRect(m_offset + (width() - m_offset) * m_zoomHandle.x(), m_zoomHeight + 3, (width() - 2 * m_offset) * (m_zoomHandle.y() - m_zoomHandle.x()), m_size - m_zoomHeight - 3, m_lineHeight / 5, m_lineHeight / 5);
}
......@@ -73,8 +73,20 @@ private:
int m_currentKeyframeOriginal;
int m_hoverKeyframe;
int m_lineHeight;
int m_zoomHeight;
int m_offset;
double m_scale;
/** @brief The zoom factor (start, end - between 0 and 1) */
QPointF m_zoomHandle;
QPointF m_lastZoomHandle;
/** @brief Mouse is the zoom left handle */
bool m_hoverZoomIn;
/** @brief Mouse is the zoom right handle */
bool m_hoverZoomOut;
/** @brief Mouse is over the zoom bar */
bool m_hoverZoom;
/** @brief the x click position offset for moving zoom */
double m_clickOffset;
int m_size;
QColor m_colSelected;
......
......@@ -34,6 +34,7 @@ AssetCommand::AssetCommand(const std::shared_ptr<AssetParameterModel> &model, co
, m_stamp(QTime::currentTime())
{
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
m_name = m_model->data(index, AssetParameterModel::NameRole).toString();
const QString id = model->getAssetId();
if (EffectsRepository::get()->exists(id)) {
......@@ -82,6 +83,7 @@ AssetMultiCommand::AssetMultiCommand(const std::shared_ptr<AssetParameterModel>
, m_stamp(QTime::currentTime())
{
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
qDebug()<<"CREATING MULTIPLE COMMAND!!!\nVALUES: "<<m_values;
m_name = m_model->data(indexes.first(), AssetParameterModel::NameRole).toString();
const QString id = model->getAssetId();
......
......@@ -50,6 +50,7 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
QChar separator, oldSeparator;
// Check locale, default effects xml has no LC_NUMERIC defined and always uses the C locale
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
if (assetXml.hasAttribute(QStringLiteral("LC_NUMERIC"))) {
QLocale effectLocale = QLocale(assetXml.attribute(QStringLiteral("LC_NUMERIC")));
if (QLocale::c().decimalPoint() != effectLocale.decimalPoint()) {
......@@ -598,7 +599,6 @@ QVector<QPair<QString, QVariant>> AssetParameterModel::getAllParameters() const
QJsonDocument AssetParameterModel::toJson(bool includeFixed) const
{
QJsonArray list;
QLocale locale;
if (includeFixed) {
for (const auto &fixed : m_fixedParams) {
QJsonObject currentParam;
......@@ -813,6 +813,7 @@ const QVector<QPair<QString, QVariant>> AssetParameterModel::loadPreset(const QS
void AssetParameterModel::setParameters(const QVector<QPair<QString, QVariant>> &params)
{
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
for (const auto &param : params) {
if (param.second.type() == QVariant::Double) {
setParameter(param.first, locale.toString(param.second.toDouble()), false);
......
......@@ -136,6 +136,7 @@ void AssetParameterView::setModel(const std::shared_ptr<AssetParameterModel> &mo
QVector<QPair<QString, QVariant>> AssetParameterView::getDefaultValues() const
{
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
QVector<QPair<QString, QVariant>> values;
for (int i = 0; i < m_model->rowCount(); ++i) {
QModelIndex index = m_model->index(i, 0);
......
......@@ -779,7 +779,6 @@ void AnimationWidget::addParameter(QModelIndex ix)
void AnimationWidget::buildSliderWidget(const QString &paramTag, QModelIndex ix)
{
QLocale locale;
QString paramName = i18n(m_model->data(ix, Qt::DisplayRole).toString().toUtf8().data());
QString comment = m_model->data(ix, AssetParameterModel::CommentRole).toString();
if (!comment.isEmpty()) {
......@@ -1072,6 +1071,7 @@ const QMap<QString, QString> AnimationWidget::getAnimation()
mlt_keyframe_type type;
QString key;
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
QStringList result;
int duration = m_outPoint;
for (int j = 0; j < m_animController.key_count(); ++j) {
......@@ -1413,7 +1413,6 @@ void AnimationWidget::reload(const QString &tag, const QString &data)
}
// Also add keyframes positions in other parameters
QStringList paramNames = m_doubleWidgets.keys();
QLocale locale;
m_animController = m_animProperties.get_animation(tag.toUtf8().constData());
for (int i = 0; i < paramNames.count(); i++) {
const QString &currentParam = paramNames.at(i);
......
......@@ -648,6 +648,7 @@ void KeyframeImport::importSelectedData()
QPoint rectOffset;
int finalAlign = m_alignCombo->currentIndex();
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
for (const auto &ix : m_indexes) {
// update keyframes in other indexes
KeyframeModel *km = kfrModel->getKeyModel(ix);
......@@ -707,27 +708,27 @@ void KeyframeImport::importSelectedData()
}
switch (convertMode) {
case ImportRoles::FullGeometry:
kfrData[0] = locale.toString(rect.x);
kfrData[1] = locale.toString(rect.y);
kfrData[2] = locale.toString(rect.w);
kfrData[3] = locale.toString(rect.h);
kfrData[0] = locale.toString((int)rect.x);
kfrData[1] = locale.toString((int)rect.y);
kfrData[2] = locale.toString((int)rect.w);
kfrData[3] = locale.toString((int)rect.h);
break;
case ImportRoles::Position:
kfrData[0] = locale.toString(rect.x);
kfrData[1] = locale.toString(rect.y);
kfrData[0] = locale.toString((int)rect.x);
kfrData[1] = locale.toString((int)rect.y);
break;
case ImportRoles::SimpleValue:
case ImportRoles::XOnly:
kfrData[0] = locale.toString(rect.x);
kfrData[0] = locale.toString((int)rect.x);
break;
case ImportRoles::YOnly:
kfrData[1] = locale.toString(rect.y);
kfrData[1] = locale.toString((int)rect.y);
break;
case ImportRoles::WidthOnly:
kfrData[2] = locale.toString(rect.w);
kfrData[2] = locale.toString((int)rect.w);
break;
case ImportRoles::HeightOnly:
kfrData[3] = locale.toString(rect.h);
kfrData[3] = locale.toString((int)rect.h);
break;
default:
break;
......
......@@ -54,7 +54,6 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode
{
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
m_lay = new QVBoxLayout(this);
m_lay->setContentsMargins(2, 2, 2, 0);
m_lay->setSpacing(0);
bool ok = false;
......@@ -170,7 +169,11 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode
connect(m_buttonAddDelete, &QAbstractButton::pressed, m_keyframeview, &KeyframeView::slotAddRemove);
connect(m_buttonPrevious, &QAbstractButton::pressed, m_keyframeview, &KeyframeView::slotGoToPrev);
connect(m_buttonNext, &QAbstractButton::pressed, m_keyframeview, &KeyframeView::slotGoToNext);
m_baseHeight = m_keyframeview->minimumHeight() + m_toolbar->sizeHint().height() + 2;
//m_baseHeight = m_keyframeview->height() + m_selectType->defaultWidget()->sizeHint().height();
int tm = 0;
int bm = 0;
m_lay->getContentsMargins(nullptr, &tm, nullptr, &bm);
m_baseHeight = m_keyframeview->height() + m_toolbar->sizeHint().height() + 2 + tm + bm;
setFixedHeight(m_baseHeight);
addParameter(index);
......
......@@ -43,7 +43,6 @@ ListParamWidget::ListParamWidget(std::shared_ptr<AssetParameterModel> model, QMo
// setup the name
m_labelName->setText(m_model->data(m_index, Qt::DisplayRole).toString());
slotRefresh();
QLocale locale;
// emit the signal of the base class when appropriate
// The connection is ugly because the signal "currentIndexChanged" is overloaded in QComboBox
......@@ -130,6 +129,7 @@ void ListParamWidget::slotRefresh()
names = values;
}
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
for (int i = 0; i < names.count(); i++) {
QString val = values.at(i);
bool ok;
......
......@@ -783,6 +783,8 @@ Bin::Bin(std::shared_ptr<ProjectItemModel> model, QWidget *parent)
, m_propertiesPanel(nullptr)
, m_blankThumb()
, m_filterGroup(this)
, m_filterRateGroup(this)
, m_filterTypeGroup(this)
, m_invalidClipDialog(nullptr)
, m_gainedFocus(false)
, m_audioDuration(0)
......@@ -989,29 +991,98 @@ Bin::Bin(std::shared_ptr<ProjectItemModel> model, QWidget *parent)
});
// Filter menu
m_filterGroup.setExclusive(false);
m_filterMenu = new QMenu(i18n("Filter"), this);
m_filterButton = new QToolButton;
m_filterButton->setPopupMode(QToolButton::MenuButtonPopup);
m_filterButton->setCheckable(true);
m_filterButton->setPopupMode(QToolButton::MenuButtonPopup);
m_filterButton->setIcon(QIcon::fromTheme(QStringLiteral("view-filter")));
m_filterButton->setToolTip(i18n("Filter"));
m_filterButton->setStyleSheet(QString("QToolButton:checked{ background-color: %1;border: none; border-radius: 2px;padding-right: 20px;}").arg(palette().highlight().color().name()));
m_filterButton->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
m_filterButton->setMenu(m_filterMenu);
connect(m_filterButton, &QToolButton::toggled, [&](bool toggled) {
if (toggled) {