improved reload of msr-files in musredit after a msr2data command.

This commit is contained in:
2025-07-07 10:02:14 +02:00
parent 2e951d92f1
commit 06a509a420
2 changed files with 66 additions and 2 deletions

View File

@ -3510,7 +3510,8 @@ void PTextEdit::fillRecentFiles()
//----------------------------------------------------------------------------------------------------
/**
* <p> run list is split (space separated) and expanded (start-end -> start, start+1, ..., end) to a list
* <p> run list is split (space separated), expanded (start-end -> start, start+1, ..., end) or
* (start:end:step -> start, start+step, ..., end) to a list.
*
* \param runListStr list to be split and expanded
* \param ok true if everything is fine; false if an error has been encountered
@ -3560,6 +3561,37 @@ QStringList PTextEdit::getRunList(QString runListStr, bool &ok)
str = QString("%1").arg(i);
result << str;
}
} else if (tok[i].contains(':')) { // list given, hence need to expand
QStringList runListTok = tok[i].split(':', Qt::SkipEmptyParts);
int start{0}, end{0}, step{0};
if (runListTok.size() != 3) { // error
ok = false;
result.clear();
return result;
}
start = runListTok[0].toInt(&isInt);
if (!isInt) {
ok = false;
result.clear();
return result;
}
end = runListTok[1].toInt(&isInt);
if (!isInt) {
ok = false;
result.clear();
return result;
}
step = runListTok[2].toInt(&isInt);
if (!isInt) {
ok = false;
result.clear();
return result;
}
do {
str = QString("%1").arg(start);
result << str;
start += step;
} while (start <= end);
} else { // keep it
result << tok[i];
}

View File

@ -3487,7 +3487,8 @@ void PTextEdit::fillRecentFiles()
//----------------------------------------------------------------------------------------------------
/**
* <p> run list is split (space separated) and expanded (start-end -> start, start+1, ..., end) to a list
* <p> run list is split (space separated), expanded (start-end -> start, start+1, ..., end) or
* (start:end:step -> start, start+step, ..., end) to a list.
*
* \param runListStr list to be split and expanded
* \param ok true if everything is fine; false if an error has been encountered
@ -3529,6 +3530,37 @@ QStringList PTextEdit::getRunList(QString runListStr, bool &ok)
str = QString("%1").arg(i);
result << str;
}
} else if (tok[i].contains(':')) { // list given, hence need to expand
QStringList runListTok = tok[i].split(':', Qt::SkipEmptyParts);
int start{0}, end{0}, step{0};
if (runListTok.size() != 3) { // error
ok = false;
result.clear();
return result;
}
start = runListTok[0].toInt(&isInt);
if (!isInt) {
ok = false;
result.clear();
return result;
}
end = runListTok[1].toInt(&isInt);
if (!isInt) {
ok = false;
result.clear();
return result;
}
step = runListTok[2].toInt(&isInt);
if (!isInt) {
ok = false;
result.clear();
return result;
}
do {
str = QString("%1").arg(start);
result << str;
start += step;
} while (start <= end);
} else { // keep it
result << tok[i];
}