Ensure clips have an "unnamed" label if name is empty

parent 3316f377
......@@ -34,7 +34,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QPainter>
#include <QPainterPath>
#include <QVariant>
#include <KLocalizedString>
#include <utility>
AbstractProjectItem::AbstractProjectItem(PROJECTITEMTYPE type, QString id, const std::shared_ptr<ProjectItemModel> &model, bool isRoot)
: TreeItem(QList<QVariant>(), std::static_pointer_cast<AbstractTreeModel>(model), isRoot)
, m_name()
......@@ -123,7 +126,7 @@ QVariant AbstractProjectItem::getData(DataType type) const
QVariant data;
switch (type) {
case DataName:
data = QVariant(m_name);
data = m_name.isEmpty() ? i18n("Unnamed") : QVariant(m_name);
break;
case DataDescription:
data = QVariant(m_description);
......
......@@ -3448,7 +3448,7 @@ void Bin::renameSubClip(const QString &id, const QString &newName, int in, int o
if (!sub) {
return;
}
sub->setName(newName);
sub->setName(newName.isEmpty() ? i18n("Unnamed") : newName);
clip->updateZones();
emit itemUpdated(sub);
}
......
......@@ -560,7 +560,7 @@ QString ClipController::clipName() const
if (!name.isEmpty()) {
return name;
}
return QFileInfo(m_path).fileName();
return m_path.isEmpty() ? i18n("Unnamed") : QFileInfo(m_path).fileName();
}
QString ClipController::description() const
......
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