Changeset View
Changeset View
Standalone View
Standalone View
discover/qml/UpdatesPage.qml
Show First 20 Lines • Show All 262 Lines • ▼ Show 20 Line(s) | 261 | Kirigami.Heading { | |||
---|---|---|---|---|---|
263 | text: i18n("%1", display) | 263 | text: i18n("%1", display) | ||
264 | level: 3 | 264 | level: 3 | ||
265 | elide: Text.ElideRight | 265 | elide: Text.ElideRight | ||
266 | } | 266 | } | ||
267 | 267 | | |||
268 | // Version numbers | 268 | // Version numbers | ||
269 | Label { | 269 | Label { | ||
270 | Layout.fillWidth: true | 270 | Layout.fillWidth: true | ||
271 | elide: Text.ElideRight | 271 | elide: truncated ? Text.ElideLeft : Text.ElideRight | ||
ratijas: WAAAAAT
how that is supposed to work | |||||
OK, so that's a "multi-length string" feature using Unicode "String Terminator" character U009C, as described in QtQuick documentation: https://doc.qt.io/qt-6/qml-qtquick-text.html#elide-prop This still does not explain why does it need different eliding modes in ternary expression ratijas: OK, so that's a "multi-length string" feature using Unicode "String Terminator" character U009C… | |||||
272 | text: { | 272 | text: { | ||
273 | if (installedVersion == availableVersion && !truncated) { | 273 | if (installedVersion == availableVersion) { | ||
274 | // Update of the same version; show when old and new are | 274 | // Update of the same version; show when old and new are | ||
275 | // the same (common with Flatpak runtimes) | 275 | // the same (common with Flatpak runtimes) | ||
276 | return i18n("Update to version %1", availableVersion); | 276 | return i18n("Update to version %1", availableVersion); | ||
277 | } else if (installedVersion && availableVersion && !truncated) { | 277 | } else if (installedVersion && availableVersion) { | ||
278 | // Old and new version numbers; show when there's enough room | 278 | // Old and new version numbers | ||
279 | return i18n("%1 → %2", installedVersion, availableVersion); | 279 | // This thing with \x9 is a fancy feature in QML text handling: | ||
280 | } else { | 280 | // when the string will be elided, it shows the string after | ||
281 | // Available version only, for when the installed version | 281 | // the last \x9. This allows us to show a smaller string | ||
282 | // isn't available for some reason, or when old+new would be | 282 | // when there's now enough room | ||
283 | // elided. Use squeezey text to gain more room, and if it's | | |||
284 | // still so long that it would be elided, elide from the left | | |||
285 | // so the most important part on the right is still visible | | |||
286 | 283 | | |||
287 | // All of this is mostly for the benefit of KDE Neon users, | 284 | // All of this is mostly for the benefit of KDE Neon users, | ||
288 | // since the version strings there are really really long | 285 | // since the version strings there are really really long | ||
286 | return i18nc("Do not translate or alter '\x9'", "%1 → %2\x9C%1 → %2\x9C%2", installedVersion, availableVersion); | ||||
287 | } else { | ||||
288 | // Available version only, for when the installed version | ||||
289 | // isn't available for some reason | ||||
289 | return availableVersion | 290 | return availableVersion | ||
this is very interesting and a good idea.. mart: this is very interesting and a good idea..
are you sure tough it doesn't cause binding loops?
i… | |||||
290 | } | 291 | } | ||
291 | } | 292 | } | ||
292 | font.letterSpacing: truncated ? -0.5 : 0 | 293 | font.letterSpacing: truncated ? -0.5 : 0 | ||
293 | opacity: listItem.hovered? 0.8 : 0.6 | 294 | opacity: listItem.hovered? 0.8 : 0.6 | ||
294 | } | 295 | } | ||
295 | } | 296 | } | ||
296 | 297 | | |||
297 | LabelBackground { | 298 | LabelBackground { | ||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |
WAAAAAT
how that is supposed to work