Changeset View
Changeset View
Standalone View
Standalone View
discover/qml/ApplicationPage.qml
Show First 20 Lines • Show All 259 Lines • ▼ Show 20 Line(s) | 258 | Rectangle { | |||
---|---|---|---|---|---|
260 | Layout.fillWidth: true | 260 | Layout.fillWidth: true | ||
261 | height: 1 | 261 | height: 1 | ||
262 | Layout.bottomMargin: Kirigami.Units.largeSpacing | 262 | Layout.bottomMargin: Kirigami.Units.largeSpacing | ||
263 | } | 263 | } | ||
264 | GridLayout { | 264 | GridLayout { | ||
265 | rowSpacing: 0 | 265 | rowSpacing: 0 | ||
266 | columns: 2 | 266 | columns: 2 | ||
267 | 267 | | |||
268 | // Date row | | |||
269 | Label { | | |||
270 | Layout.alignment: Qt.AlignRight | | |||
271 | text: i18n("Release date:") | | |||
272 | visible: releaseDateLabel.text.length !== 0 | | |||
273 | } | | |||
274 | Label { | | |||
275 | id: releaseDateLabel | | |||
276 | Layout.fillWidth: true | | |||
277 | elide: Text.ElideRight | | |||
278 | text: appInfo.application.releaseDate.toDateString() | | |||
279 | visible: releaseDateLabel.text.length !== 0 | | |||
280 | } | | |||
281 | | ||||
282 | // Category row | 268 | // Category row | ||
283 | Label { | 269 | Label { | ||
284 | Layout.alignment: Qt.AlignRight | 270 | Layout.alignment: Qt.AlignRight | ||
285 | text: i18n("Category:") | 271 | text: i18n("Category:") | ||
286 | } | 272 | } | ||
287 | Label { | 273 | Label { | ||
288 | Layout.fillWidth: true | 274 | Layout.fillWidth: true | ||
289 | elide: Text.ElideRight | 275 | elide: Text.ElideRight | ||
290 | text: appInfo.application.categoryDisplay | 276 | text: appInfo.application.categoryDisplay | ||
291 | } | 277 | } | ||
292 | 278 | | |||
293 | // Version row | 279 | // Version row | ||
294 | Label { | 280 | Label { | ||
295 | visible: versionLabel.visible | 281 | visible: versionLabel.visible | ||
296 | Layout.alignment: Qt.AlignRight | 282 | Layout.alignment: Qt.AlignRight | ||
297 | text: i18n("Version:") | 283 | text: i18n("Version:") | ||
298 | } | 284 | } | ||
299 | Label { | 285 | Label { | ||
300 | readonly property string version: appInfo.application.isInstalled ? appInfo.application.installedVersion : appInfo.application.availableVersion | 286 | readonly property string version: appInfo.application.isInstalled ? appInfo.application.installedVersion : appInfo.application.availableVersion | ||
287 | readonly property string releaseDate: appInfo.application.releaseDate.toDateString() | ||||
288 | | ||||
289 | function versionString() { | ||||
290 | if (version.length == 0) { | ||||
291 | return "" | ||||
292 | } else { | ||||
293 | if (releaseDate.length > 0) { | ||||
294 | return i18n("%1, released on %2", version, releaseDate) | ||||
295 | } else { | ||||
296 | return version | ||||
297 | } | ||||
298 | } | ||||
299 | } | ||||
300 | | ||||
301 | id: versionLabel | 301 | id: versionLabel | ||
302 | visible: text.length > 0 | 302 | visible: text.length > 0 | ||
303 | Layout.fillWidth: true | 303 | Layout.fillWidth: true | ||
304 | elide: Text.ElideRight | 304 | elide: Text.ElideRight | ||
305 | text: version ? version : "" | 305 | text: versionString() | ||
apol: how about:
```
text: version.length === 0 ? ""
: releaseDate.length === 0 ? version… | |||||
ngraham: Clever, but IMHO a bit less readable. | |||||
306 | } | 306 | } | ||
307 | 307 | | |||
308 | // Size row | 308 | // Size row | ||
309 | Label { | 309 | Label { | ||
310 | Layout.alignment: Qt.AlignRight | 310 | Layout.alignment: Qt.AlignRight | ||
311 | text: i18n("Size:") | 311 | text: i18n("Size:") | ||
312 | } | 312 | } | ||
313 | Label { | 313 | Label { | ||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |
how about: