mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-05 10:12:46 +00:00
Give fallback images random background colours
[UI] Added: if an image cannot be loaded, it will have a random background colour.
This commit is contained in:
parent
5057867ade
commit
7221fda1d5
4 changed files with 26 additions and 19 deletions
|
@ -44,6 +44,7 @@ BackgroundItem {
|
|||
bottom: parent.bottom
|
||||
}
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
fallbackColor: Utils.colorFromString(title)
|
||||
}
|
||||
|
||||
/*Rectangle {
|
||||
|
|
|
@ -26,23 +26,24 @@ import Sailfish.Silica 1.0
|
|||
HighlightImage {
|
||||
property string fallbackImage
|
||||
property bool usingFallbackImage
|
||||
property color fallbackColor: Theme.highlightColor
|
||||
asynchronous: true
|
||||
|
||||
BusyIndicator {
|
||||
anchors.centerIn: parent
|
||||
running: parent.status == Image.Loading
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: fallbackBackground
|
||||
anchors.fill: parent
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.0; color: Theme.highlightColor; }
|
||||
GradientStop { position: 1.0; color: Theme.highlightDimmerColor; }
|
||||
GradientStop { position: 0.0; color: fallbackColor; }
|
||||
GradientStop { position: 1.0; color: Theme.highlightDimmerFromColor(fallbackColor, Theme.colorScheme); }
|
||||
}
|
||||
visible: parent.status == Image.Error || parent.status == Image.Null
|
||||
visible: parent.status == Image.Error || parent.status == Image.Null || parent.status == Image.Loading
|
||||
}
|
||||
|
||||
|
||||
BusyIndicator {
|
||||
anchors.centerIn: parent
|
||||
running: parent.status == Image.Loading
|
||||
}
|
||||
|
||||
HighlightImage {
|
||||
id: fallbackImageItem
|
||||
anchors.centerIn: parent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue