aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEzekiel Smith <ezekielsmith@protonmail.com>2022-03-21 01:04:40 +1100
committerGitHub <noreply@github.com>2022-03-21 01:04:40 +1100
commit8bc6cdf55c143313616aefe12a3c8bf7f0b67557 (patch)
tree0915b572d68b13d4e9c2395045537cbd10f9f972
parent9841c0a63d360bc1708a7ba354084b9b7f23941b (diff)
parentc311dba465d0ad80ecde0493c308b587562ce392 (diff)
downloadPrismLauncher-8bc6cdf55c143313616aefe12a3c8bf7f0b67557.tar.gz
PrismLauncher-8bc6cdf55c143313616aefe12a3c8bf7f0b67557.tar.bz2
PrismLauncher-8bc6cdf55c143313616aefe12a3c8bf7f0b67557.zip
Merge pull request #306 from Scrumplex/limit-instance-lengths
Limit instance names to 128 chars
-rw-r--r--launcher/ui/dialogs/NewInstanceDialog.ui6
-rw-r--r--launcher/ui/instanceview/InstanceDelegate.cpp2
2 files changed, 7 insertions, 1 deletions
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 @@
</widget>
</item>
<item row="0" column="2">
- <widget class="QLineEdit" name="instNameTextBox"/>
+ <widget class="QLineEdit" name="instNameTextBox">
+ <property name="maxLength">
+ <number>128</number>
+ </property>
+ </widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="nameLabel">
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);