Commit b331578c authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

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