mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-24 16:43:17 +08:00
NEW:limit the length of project name
jira:[project name] Change-Id: I955620f7073b3b7fda280d1118524f561d047751
This commit is contained in:
parent
9f545fd18d
commit
594a189108
@ -76,9 +76,15 @@ std::string PrintJob::truncate_string(const std::string& str, size_t maxLength)
|
||||
}
|
||||
|
||||
wxString local_str = wxString::FromUTF8(str);
|
||||
wxString truncatedStr = local_str.Mid(0, maxLength - 3);
|
||||
truncatedStr.append("...");
|
||||
wxString truncatedStr;
|
||||
|
||||
for (auto i = 1; i < local_str.Length(); i++) {
|
||||
wxString tagStr = local_str.Mid(0, i);
|
||||
if (tagStr.ToUTF8().length() >= maxLength) {
|
||||
truncatedStr = local_str.Mid(0, i - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return truncatedStr.utf8_string();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user