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

Fix effects/composition names sometimes not displaying translated

parent f28f7566
......@@ -137,7 +137,7 @@ template <typename AssetType> bool AbstractAssetsRepository<AssetType>::parseInf
if (metadata && metadata->is_valid()) {
if (metadata->get("title") && metadata->get("identifier") && strlen(metadata->get("title")) > 0) {
QString id = metadata->get("identifier");
res.name = metadata->get("title");
res.name = i18n(metadata->get("title"));
res.name[0] = res.name[0].toUpper();
res.description = i18n(metadata->get("description")) + QString(" (%1)").arg(id);
res.author = metadata->get("creator");
......@@ -338,7 +338,7 @@ template <typename AssetType> bool AbstractAssetsRepository<AssetType>::parseInf
// Update name if the xml provide one
QString name = Xml::getSubTagContent(currentAsset, QStringLiteral("name"));
if (!name.isEmpty()) {
res.name = name;
res.name = i18n(name.toUtf8().constData());
}
return true;
}
......
......@@ -263,7 +263,7 @@ Rectangle {
Label {
id: assetText
font.bold : assetThumb.isFavorite
text: i18n(assetlist.getName(styleData.index))
text: assetlist.getName(styleData.index)
}
}
MouseArea {
......
......@@ -37,11 +37,9 @@ AssetCommand::AssetCommand(const std::shared_ptr<AssetParameterModel> &model, co
m_name = m_model->data(index, AssetParameterModel::NameRole).toString();
const QString id = model->getAssetId();
if (EffectsRepository::get()->exists(id)) {
QString effectName = EffectsRepository::get()->getName(id);
setText(i18n("Edit %1", i18n(effectName.toUtf8().data())));
setText(i18n("Edit %1", EffectsRepository::get()->getName(id)));
} else if (TransitionsRepository::get()->exists(id)) {
QString compoName = TransitionsRepository::get()->getName(id);
setText(i18n("Edit %1", i18n(compoName.toUtf8().data())));
setText(i18n("Edit %1", TransitionsRepository::get()->getName(id)));
}
QVariant previousVal = m_model->data(index, AssetParameterModel::ValueRole);
m_oldValue = previousVal.type() == QVariant::Double ? locale.toString(previousVal.toDouble()) : previousVal.toString();
......@@ -88,11 +86,9 @@ AssetMultiCommand::AssetMultiCommand(const std::shared_ptr<AssetParameterModel>
m_name = m_model->data(indexes.first(), AssetParameterModel::NameRole).toString();
const QString id = model->getAssetId();
if (EffectsRepository::get()->exists(id)) {
QString effectName = EffectsRepository::get()->getName(id);
setText(i18n("Edit %1", i18n(effectName.toUtf8().data())));
setText(i18n("Edit %1", EffectsRepository::get()->getName(id)));
} else if (TransitionsRepository::get()->exists(id)) {
QString compoName = TransitionsRepository::get()->getName(id);
setText(i18n("Edit %1", i18n(compoName.toUtf8().data())));
setText(i18n("Edit %1", TransitionsRepository::get()->getName(id)));
}
for (QModelIndex ix : m_indexes) {
QVariant previousVal = m_model->data(ix, AssetParameterModel::ValueRole);
......@@ -150,11 +146,9 @@ AssetKeyframeCommand::AssetKeyframeCommand(const std::shared_ptr<AssetParameterM
{
const QString id = model->getAssetId();
if (EffectsRepository::get()->exists(id)) {
QString effectName = EffectsRepository::get()->getName(id);
setText(i18n("Edit %1 keyframe", i18n(effectName.toUtf8().data())));
setText(i18n("Edit %1 keyframe", EffectsRepository::get()->getName(id)));
} else if (TransitionsRepository::get()->exists(id)) {
QString compoName = TransitionsRepository::get()->getName(id);
setText(i18n("Edit %1 keyframe", i18n(compoName.toUtf8().data())));
setText(i18n("Edit %1 keyframe", TransitionsRepository::get()->getName(id)));
}
m_oldValue = m_model->getKeyframeModel()->getKeyModel(m_index)->getInterpolatedValue(m_pos);
}
......@@ -194,11 +188,9 @@ AssetUpdateCommand::AssetUpdateCommand(const std::shared_ptr<AssetParameterModel
{
const QString id = model->getAssetId();
if (EffectsRepository::get()->exists(id)) {
QString effectName = EffectsRepository::get()->getName(id);
setText(i18n("Update %1", i18n(effectName.toUtf8().data())));
setText(i18n("Update %1", EffectsRepository::get()->getName(id)));
} else if (TransitionsRepository::get()->exists(id)) {
QString compoName = TransitionsRepository::get()->getName(id);
setText(i18n("Update %1", i18n(compoName.toUtf8().data())));
setText(i18n("Update %1", TransitionsRepository::get()->getName(id)));
}
m_oldValue = m_model->getAllParameters();
}
......
......@@ -459,7 +459,6 @@ bool EffectStackModel::appendEffect(const QString &effectId, bool makeCurrent)
} else if (m_ownerId.first == ObjectType::TimelineTrack) {
effect->filter().set("out", pCore->getItemDuration(m_ownerId));
}
QString effectName = EffectsRepository::get()->getName(effectId);
Fun update = [this, inFades, outFades]() {
// TODO: only update if effect is fade or keyframe
QVector<int> roles = {TimelineModel::EffectNamesRole};
......@@ -475,7 +474,7 @@ bool EffectStackModel::appendEffect(const QString &effectId, bool makeCurrent)
update();
PUSH_LAMBDA(update, redo);
PUSH_LAMBDA(update, undo);
PUSH_UNDO(undo, redo, i18n("Add effect %1", i18n(effectName.toUtf8().data())));
PUSH_UNDO(undo, redo, i18n("Add effect %1", EffectsRepository::get()->getName(effectId)));
} else if (makeCurrent) {
if (auto srvPtr = m_masterService.lock()) {
srvPtr->set("kdenlive:activeeffect", currentActive);
......@@ -769,8 +768,7 @@ void EffectStackModel::moveEffect(int destRow, const std::shared_ptr<AbstractEff
update();
UPDATE_UNDO_REDO(update, update, undo, redo);
auto effectId = std::static_pointer_cast<EffectItemModel>(item)->getAssetId();
QString effectName = EffectsRepository::get()->getName(effectId);
PUSH_UNDO(undo, redo, i18n("Move effect %1").arg(i18n(effectName.toUtf8().data())));
PUSH_UNDO(undo, redo, i18n("Move effect %1").arg(EffectsRepository::get()->getName(effectId)));
}
}
......@@ -1191,7 +1189,7 @@ const QString EffectStackModel::effectNames() const
{
QStringList effects;
for (int i = 0; i < rootItem->childCount(); ++i) {
effects.append(i18n(EffectsRepository::get()->getName(std::static_pointer_cast<EffectItemModel>(rootItem->child(i))->getAssetId()).toUtf8().data()));
effects.append(EffectsRepository::get()->getName(std::static_pointer_cast<EffectItemModel>(rootItem->child(i))->getAssetId()));
}
return effects.join(QLatin1Char('/'));
}
......
......@@ -58,7 +58,7 @@ CollapsibleEffectView::CollapsibleEffectView(const std::shared_ptr<EffectItemMod
, m_blockWheel(false)
{
QString effectId = effectModel->getAssetId();
QString effectName = i18n(EffectsRepository::get()->getName(effectId).toUtf8().data());
QString effectName = EffectsRepository::get()->getName(effectId);
if (effectId == QLatin1String("region")) {
m_regionEffect = true;
decoframe->setObjectName(QStringLiteral("decoframegroup"));
......
......@@ -35,7 +35,7 @@ Menu {
onObjectAdded: menuRoot.insertItem( index, object )
onObjectRemoved: menuRoot.removeItem( object )
delegate: MenuItem {
text: i18n(timeline.getAssetName(modelData, isTransition)) //name
text: timeline.getAssetName(modelData, isTransition) //name
property string assetId: modelData //identifier
onTriggered: {
console.log(assetId)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment