From 58957122b9dd2a19a0504efe8944cfb50e29a012 Mon Sep 17 00:00:00 2001 From: Ezekiel Smith Date: Mon, 21 Mar 2022 01:04:40 +1100 Subject: [PATCH] Merge pull request #306 from Scrumplex/limit-instance-lengths Limit instance names to 128 chars --- launcher/ui/dialogs/NewInstanceDialog.ui | 6 +++++- launcher/ui/instanceview/InstanceDelegate.cpp | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/launcher/ui/dialogs/NewInstanceDialog.ui b/launcher/ui/dialogs/NewInstanceDialog.ui index 7fb19ff5..8ca0b786 100644 --- a/launcher/ui/dialogs/NewInstanceDialog.ui +++ b/launcher/ui/dialogs/NewInstanceDialog.ui @@ -44,7 +44,11 @@ - + + + 128 + + diff --git a/launcher/ui/instanceview/InstanceDelegate.cpp b/launcher/ui/instanceview/InstanceDelegate.cpp index 3c4ca63f..22ff78cd 100644 --- a/launcher/ui/instanceview/InstanceDelegate.cpp +++ b/launcher/ui/instanceview/InstanceDelegate.cpp @@ -405,6 +405,8 @@ void ListViewDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, QString text = realeditor->toPlainText(); text.replace(QChar('\n'), QChar(' ')); text = text.trimmed(); + // Prevent instance names longer than 128 chars + text.truncate(128); if(text.size() != 0) { model->setData(index, text);