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 composition description not appearing in info box

parent 72a1ea0d
......@@ -21,11 +21,13 @@
#include "xml/xml.hpp"
#include "kdenlivesettings.h"
#include <QDir>
#include <QFile>
#include <QStandardPaths>
#include <QString>
#include <QTextStream>
#include <KLocalizedString>
#include <locale>
#ifdef Q_OS_MAC
......@@ -137,8 +139,7 @@ template <typename AssetType> bool AbstractAssetsRepository<AssetType>::parseInf
QString id = metadata->get("identifier");
res.name = metadata->get("title");
res.name[0] = res.name[0].toUpper();
res.description = metadata->get("description");
res.description.append(QString(" (%1)").arg(id));
res.description = i18n(metadata->get("description")) + QString(" (%1)").arg(id);
res.author = metadata->get("creator");
res.version_str = metadata->get("version");
res.version = ceil(100 * metadata->get_double("version"));
......@@ -331,7 +332,7 @@ template <typename AssetType> bool AbstractAssetsRepository<AssetType>::parseInf
// Update description if the xml provide one
QString description = Xml::getSubTagContent(currentAsset, QStringLiteral("description"));
if (!description.isEmpty()) {
res.description = description;
res.description = i18n(description.toUtf8().constData()) + QString(" (%1)").arg(res.id);
}
// Update name if the xml provide one
......
......@@ -68,20 +68,20 @@ bool AssetTreeModel::isFavorite(const QModelIndex &index) const
return item->dataColumn(AssetTreeModel::favCol).toBool();
}
QString AssetTreeModel::getDescription(const QModelIndex &index) const
QString AssetTreeModel::getDescription(bool isEffect, const QModelIndex &index) const
{
if (!index.isValid()) {
return QString();
}
std::shared_ptr<TreeItem> item = getItemById((int)index.internalId());
if (item->depth() == 1) {
if (isEffect && item->depth() == 1) {
return QString();
}
auto id = item->dataColumn(AssetTreeModel::idCol).toString();
if (EffectsRepository::get()->exists(id)) {
if (isEffect && EffectsRepository::get()->exists(id)) {
return EffectsRepository::get()->getDescription(id);
}
if (TransitionsRepository::get()->exists(id)) {
if (!isEffect && TransitionsRepository::get()->exists(id)) {
return TransitionsRepository::get()->getDescription(id);
}
return QString();
......
......@@ -41,7 +41,7 @@ public:
// Helper function to retrieve name
QString getName(const QModelIndex &index) const;
// Helper function to retrieve description
QString getDescription(const QModelIndex &index) const;
QString getDescription(bool isEffect, const QModelIndex &index) const;
// Helper function to retrieve if an effect is categorized as favorite
bool isFavorite(const QModelIndex &index) const;
QHash<int, QByteArray> roleNames() const override;
......
......@@ -78,9 +78,9 @@ void AssetListWidget::setFavorite(const QModelIndex &index, bool favorite, bool
m_model->setFavorite(m_proxyModel->mapToSource(index), favorite, isEffect);
}
QString AssetListWidget::getDescription(const QModelIndex &index) const
QString AssetListWidget::getDescription(bool isEffect, const QModelIndex &index) const
{
return m_model->getDescription(m_proxyModel->mapToSource(index));
return m_model->getDescription(isEffect, m_proxyModel->mapToSource(index));
}
void AssetListWidget::setFilterName(const QString &pattern)
......
......@@ -53,7 +53,7 @@ public:
void setFavorite(const QModelIndex &index, bool favorite = true, bool isEffect = true);
/* @brief Returns the description of the asset given its model index */
QString getDescription(const QModelIndex &index) const;
QString getDescription(bool isEffect, const QModelIndex &index) const;
/* @brief Sets the pattern against which the assets' names are filtered */
void setFilterName(const QString &pattern);
......
......@@ -212,7 +212,7 @@ Rectangle {
id: sel
model: assetListModel
onSelectionChanged: {
assetDescription.text = i18n(assetlist.getDescription(sel.currentIndex))
assetDescription.text = assetlist.getDescription(sel.currentIndex)
}
}
SplitView {
......
......@@ -77,7 +77,7 @@ public:
q->setFavorite(index, favorite, true);
q->updateFavorite(index);
}
Q_INVOKABLE QString getDescription(const QModelIndex &index) const { return q->getDescription(index); }
Q_INVOKABLE QString getDescription(const QModelIndex &index) const { return q->getDescription(true, index); }
Q_INVOKABLE QVariantMap getMimeData(const QString &assetId) const { return q->getMimeData(assetId); }
Q_INVOKABLE void activate(const QModelIndex &ix) { q->activate(ix); }
......
......@@ -71,7 +71,7 @@ public:
q->updateFavorite(index);
}
Q_INVOKABLE void setFilterType(const QString &type) { q->setFilterType(type); }
Q_INVOKABLE QString getDescription(const QModelIndex &index) const { return q->getDescription(index); }
Q_INVOKABLE QString getDescription(const QModelIndex &index) const { return q->getDescription(false, index); }
Q_INVOKABLE QVariantMap getMimeData(const QString &assetId) const { return q->getMimeData(assetId); }
Q_INVOKABLE void activate(const QModelIndex &ix) { q->activate(ix); }
......
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