improved reload of msr-files in musredit after a msr2data command.
This commit is contained in:
@ -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 runListStr list to be split and expanded
|
||||||
* \param ok true if everything is fine; false if an error has been encountered
|
* \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);
|
str = QString("%1").arg(i);
|
||||||
result << str;
|
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
|
} else { // keep it
|
||||||
result << tok[i];
|
result << tok[i];
|
||||||
}
|
}
|
||||||
|
@ -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 runListStr list to be split and expanded
|
||||||
* \param ok true if everything is fine; false if an error has been encountered
|
* \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);
|
str = QString("%1").arg(i);
|
||||||
result << str;
|
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
|
} else { // keep it
|
||||||
result << tok[i];
|
result << tok[i];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user