Changeset View
Changeset View
Standalone View
Standalone View
runners/converter/converterrunner.cpp
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | 69 | { | |||
---|---|---|---|---|---|
74 | 74 | | |||
75 | const QRegularExpressionMatch valueRegexMatch = valueRegex.match(context.query()); | 75 | const QRegularExpressionMatch valueRegexMatch = valueRegex.match(context.query()); | ||
76 | if (!valueRegexMatch.hasMatch()) { | 76 | if (!valueRegexMatch.hasMatch()) { | ||
77 | return; | 77 | return; | ||
78 | } | 78 | } | ||
79 | const QString inputValueString = valueRegexMatch.captured(1); | 79 | const QString inputValueString = valueRegexMatch.captured(1); | ||
80 | 80 | | |||
81 | // Get the different units by splitting up the query with the regex | 81 | // Get the different units by splitting up the query with the regex | ||
82 | QStringList unitStrings = context.query().simplified().remove(valueRegex).split(unitSeperatorRegex); | 82 | #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) | ||
83 | QStringList unitStrings = context.query().simplified().remove(valueRegex) | ||||
84 | .split(unitSeperatorRegex, QString::SkipEmptyParts); | ||||
85 | #else | ||||
86 | QStringList unitStrings = context.query().simplified().remove(valueRegex) | ||||
87 | .split(unitSeperatorRegex, Qt::SkipEmptyParts); | ||||
88 | #endif | ||||
83 | if (unitStrings.isEmpty()) { | 89 | if (unitStrings.isEmpty()) { | ||
84 | return; | 90 | return; | ||
85 | } | 91 | } | ||
86 | // Check if unit is valid, otherwise check for the value in the compatibleUnits map | 92 | // Check if unit is valid, otherwise check for the value in the compatibleUnits map | ||
87 | QString inputUnitString = unitStrings.first().simplified(); | 93 | QString inputUnitString = unitStrings.first().simplified(); | ||
88 | KUnitConversion::UnitCategory inputCategory = converter.categoryForUnit(inputUnitString); | 94 | KUnitConversion::UnitCategory inputCategory = converter.categoryForUnit(inputUnitString); | ||
89 | if (inputCategory.id() == KUnitConversion::InvalidCategory) { | 95 | if (inputCategory.id() == KUnitConversion::InvalidCategory) { | ||
90 | inputUnitString = compatibleUnits.value(inputUnitString.toUpper()); | 96 | inputUnitString = compatibleUnits.value(inputUnitString.toUpper()); | ||
▲ Show 20 Lines • Show All 171 Lines • Show Last 20 Lines |