mirror of https://github.com/procxx/kepka.git
parent
38d799de24
commit
5aee0f642a
|
@ -28,10 +28,13 @@ namespace {
|
||||||
auto ok3 = true;
|
auto ok3 = true;
|
||||||
auto minutes = minutes1.toString();
|
auto minutes = minutes1.toString();
|
||||||
minutes += minutes2;
|
minutes += minutes2;
|
||||||
const auto result = (hours.isEmpty() ? 0 : hours.toInt(&ok1)) * 3600
|
const auto value1 = (hours.isEmpty() ? 0 : hours.toInt(&ok1));
|
||||||
+ minutes.toInt(&ok2) * 60
|
const auto value2 = minutes.toInt(&ok2);
|
||||||
+ seconds.toInt(&ok3);
|
const auto value3 = seconds.toInt(&ok3);
|
||||||
return (ok1 && ok2 && ok3) ? result : -1;
|
const auto ok = ok1 && ok2 && ok3;
|
||||||
|
return (ok && value3 < 60 && (hours.isEmpty() || value2 < 60))
|
||||||
|
? (value1 * 3600 + value2 * 60 + value3)
|
||||||
|
: -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -49,7 +52,7 @@ TextWithEntities AddTimestampLinks(
|
||||||
TimeId duration,
|
TimeId duration,
|
||||||
const QString &base) {
|
const QString &base) {
|
||||||
static const auto expression = QRegularExpression(
|
static const auto expression = QRegularExpression(
|
||||||
"(?<![^\\s])(?:(?:(\\d{1,2}):)?(\\d))?(\\d):(\\d\\d)(?![^\\s])");
|
"(?<![^\\s\\(\\)\"\\,\\.\\-])(?:(?:(\\d{1,2}):)?(\\d))?(\\d):(\\d\\d)(?![^\\s\\(\\)\",\\.\\-])");
|
||||||
const auto &string = text.text;
|
const auto &string = text.text;
|
||||||
auto offset = 0;
|
auto offset = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
Loading…
Reference in New Issue