Changeset View
Changeset View
Standalone View
Standalone View
discover/qml/UpdatesPage.qml
Show First 20 Lines • Show All 253 Lines • ▼ Show 20 Line(s) | 252 | Kirigami.Heading { | |||
---|---|---|---|---|---|
254 | text: i18n("%1", display) | 254 | text: i18n("%1", display) | ||
255 | level: 3 | 255 | level: 3 | ||
256 | elide: Text.ElideRight | 256 | elide: Text.ElideRight | ||
257 | } | 257 | } | ||
258 | 258 | | |||
259 | // Version numbers | 259 | // Version numbers | ||
260 | Label { | 260 | Label { | ||
261 | Layout.fillWidth: true | 261 | Layout.fillWidth: true | ||
262 | elide: Text.ElideRight | 262 | 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… | |||||
263 | text: { | 263 | text: { | ||
264 | if (installedVersion == availableVersion && !truncated) { | 264 | if (installedVersion == availableVersion) { | ||
265 | // Update of the same version; show when old and new are | 265 | // Update of the same version; show when old and new are | ||
266 | // the same (common with Flatpak runtimes) | 266 | // the same (common with Flatpak runtimes) | ||
267 | return i18n("Update to version %1", availableVersion); | 267 | return i18n("Update to version %1", availableVersion); | ||
268 | } else if (installedVersion && availableVersion && !truncated) { | 268 | } else if (installedVersion && availableVersion) { | ||
269 | // Old and new version numbers; show when there's enough room | 269 | // Old and new version numbers | ||
270 | return i18n("%1 → %2", installedVersion, availableVersion); | 270 | // This thing with \x9 is a fancy feature in QML text handling: | ||
271 | } else { | 271 | // when the string will be elided, it shows the string after | ||
272 | // Available version only, for when the installed version | 272 | // the last \x9. This allows us to show a smaller string | ||
273 | // isn't available for some reason, or when old+new would be | 273 | // when there's now enough room | ||
274 | // elided. Use squeezey text to gain more room, and if it's | | |||
275 | // still so long that it would be elided, elide from the left | | |||
276 | // so the most important part on the right is still visible | | |||
277 | 274 | | |||
278 | // All of this is mostly for the benefit of KDE Neon users, | 275 | // All of this is mostly for the benefit of KDE Neon users, | ||
279 | // since the version strings there are really really long | 276 | // since the version strings there are really really long | ||
280 | return availableVersion | 277 | return i18nc("Do not translate or alter \\x9", "%1 → %2\x9C%1 → %2\x9C%2", installedVersion, availableVersion); | ||
278 | } else { | ||||
279 | // Available version only, for when the installed version | ||||
280 | // isn't available for some reason | ||||
281 | 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… | |||||
281 | } | 282 | } | ||
282 | } | 283 | } | ||
283 | font.letterSpacing: truncated ? -0.5 : 0 | | |||
284 | opacity: listItem.hovered? 0.8 : 0.6 | 284 | opacity: listItem.hovered? 0.8 : 0.6 | ||
285 | } | 285 | } | ||
286 | } | 286 | } | ||
287 | 287 | | |||
288 | LabelBackground { | 288 | LabelBackground { | ||
289 | Layout.minimumWidth: Kirigami.Units.gridUnit * 6 | 289 | Layout.minimumWidth: Kirigami.Units.gridUnit * 6 | ||
290 | text: resourceState == 2 ? i18n("Installing") : size | 290 | text: resourceState == 2 ? i18n("Installing") : size | ||
291 | 291 | | |||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |
WAAAAAT
how that is supposed to work