new feature: changing the name of modes

This commit is contained in:
Jan Käberich 2025-05-12 17:04:23 +02:00
parent 6b81b307b7
commit 0cdc4b138a
4 changed files with 33 additions and 4 deletions

View file

@ -179,10 +179,14 @@ void ModeHandler::setStatusBarMessageChanged(const QString &msg)
}
}
bool ModeHandler::nameAllowed(const QString &name)
bool ModeHandler::nameAllowed(const QString &name, unsigned int ignoreIndex)
{
for(auto m : modes) {
if(m->getName() == name) {
for(unsigned int i=0;i<modes.size();i++) {
if(i == ignoreIndex) {
// ignore possible collision at this index
continue;
}
if(modes[i]->getName() == name) {
/* name already taken, no duplicates allowed
* when importing, name is used as value
*/