ICE (In Case Of Emergency) field on lock screen

I’m glad you managed to make it work!

In such case please simply erase the text of the fourth line on the settings screen and the fourth row won’t be shown.

Maybe I’ll add a font size setting so that smaller font could be used to fit all four lines on low resolution Jolla 1 and Jolla C screens.

Yes it’s OK, I just wanted to give some feedback.

1 Like

Is the difference small enough that a slightly smaller font would make all four rows fit on Jolla C? Or maybe the spacing from the weather icon is too big on Jolla/Jolla C screens?

I don’t know if a slightly smaller font will be enough, the fourth row is actually covering the the whole song title and a bit more, in media control widget.
My guess is that you will need to reduce the font size quite substantially.
I’ll take a screenshot.

Thank you for the screenshot. Indeed, it would have to be a really tiny font for all four lines to fit on JollaC. But maybe combined with smaller spacing between lines and smaller top padding… I’ll see. I guess that if smaller font turns out to be still not enough for the fourth line to fit there, at least it would allow to fit more text in the remaining three lines, so I guess it’d be useful, anyway.

I could get some more space by moving the default items (clock, date, weather) a bit higher, but I’d prefer not to tamper with unnecessary things, and while giving more space on the Jolla C it would in turn look ugly on tall screens of the X10 series.

1 Like

OK, here it goes. Version 0.0.3 :wink:

Changes:

  • Choose between 7 font sizes (default Silica font sizes enums: Tiny, Extra Small, Small, Medium, Large, Extra Large, Huge)
  • Choose between 7 line heights: 70-130% with 10% step
  • Preview added to the settings page to instantly show the selected text and font/spacing combination


Oh, and as the Lock screen Label element’s text format is set to Text.RichText, you can be creative yourself and use simple HTML tags not only to set parts of the text to bold or italics or to change text color, but also to add even more lines (using the <br> tag to split one line into multiple lines) if there’s still space on your phone’s screen for that. (Just remember to leave enough space for the media playback controls or else it’ll overlap them).

This way everyone should now be able to adjust all text parameters to own preferences and phone screen size/resolution.

Files:

unified_diff.patch

--- a/usr/share/lipstick-jolla-home-qt5/lockscreen/LockItem.qml	Mon Oct  3 18:31:06 2022
+++ b/usr/share/lipstick-jolla-home-qt5/lockscreen/LockItem.qml	Sun Oct  9 00:02:38 2022
@@ -15,6 +15,7 @@
 import com.jolla.lipstick 0.1
 import com.jolla.settings.system 1.0
 import org.nemomobile.lipstick 0.1
+import org.nemomobile.configuration 1.0
 import "../backgrounds"
 import "../main"
 import "../statusarea"
@@ -181,6 +182,17 @@
         enabled: !lockScreen.lowPowerMode && lockScreen.locked && !lockScreen.panning
         onClicked: hintEdges()
     }
+    
+    ConfigurationGroup {
+        id: config
+        path: "/desktop/lipstick-jolla-home/devicelock/customText"
+        property string firstLine: []
+        property string secondLine: []
+        property string thirdLine: []
+        property string fourthLine: []
+        property int fontSize: Theme.fontSizeLarge
+        property real lineSpacing: 1.0
+}
 
     ContrastBackground {
         id: centerBackground
@@ -190,8 +202,8 @@
                 ? Theme.paddingLarge
                 : (lockItem.height - lockItem.contentTopMargin - height) / 2)
 
-        width: Math.max(clock.width, weatherIndicator.width)
-        height: clock.height + weatherIndicator.height
+        width: Math.max(clock.width, weatherIndicator.width, if_found.width)
+        height: clock.height + weatherIndicator.height + (Theme.paddingLarge * 2) + (if_found.height * 1.1)
 
         opacity: Math.min(clock.transitionOpacity, clock.unlockOpacity)
 
@@ -287,6 +299,25 @@
             temperatureFontPixelSize: clock.weekdayFont.pixelSize
             active: visible
         }
+        
+        Label {
+          id: if_found
+          
+          anchors {
+              horizontalCenter: clock.horizontalCenter
+              top: weatherIndicator.bottom
+              topMargin: Theme.paddingLarge * 2
+              }
+              
+          font.pixelSize: config.fontSize
+          lineHeightMode: Text.ProportionalHeight
+          lineHeight: config.lineSpacing
+          color: lockScreen.textColor
+          textFormat: Text.RichText
+          horizontalAlignment: Text.AlignHCenter
+          text: (config.firstLine ? config.firstLine + "<br>" : "") + (config.secondLine ? config.secondLine + "<br>" : "") + (config.thirdLine ? config.thirdLine + "<br>" : "") + (config.fourthLine ? config.fourthLine : "")
+          }
+          
     }
 
     ContrastBackground {

main.qml

import QtQuick 2.0
import Sailfish.Silica 1.0
import org.nemomobile.configuration 1.0

Page {
    id: page

    ConfigurationGroup {
        id: config
        path: "/desktop/lipstick-jolla-home/devicelock/customText"
        property string firstLine: ""
        property string secondLine: ""
        property string thirdLine: ""
        property string fourthLine: ""
        property int fontSize: Theme.fontSizeLarge 
        property real lineSpacing: 1.0
    }

    SilicaFlickable {
            anchors.fill: parent
            contentHeight: (content.height + preview.height) * 1.3


            Column {
                id: content
                width: parent.width
                spacing: Theme.paddingSmall

                PageHeader {
                                title: "My text on Lock Screen"
                                description: "(To hide a row, just clear its text)"
                            }

                TextArea {
                    id: firstLine
                    label: "First row"
                    width: parent.width
                    placeholderText: "First row"
                    text: config.firstLine
                    onTextChanged: config.firstLine = text
                    rightItem: IconButton {
                         onClicked: {
                             firstLine.text = ""
                         }
                         width: icon.width
                         height: icon.height
                         icon.source: "image://theme/icon-m-input-clear"
                         opacity: firstLine.text.length > 0 ? 1.0 : 0.0
                         Behavior on opacity { FadeAnimation {} }
                     }
                    }

                TextArea {
                    id: secondLine
                    label: "Second row"
                    width: parent.width
                    placeholderText: "Second row"
                    text: config.secondLine
                    onTextChanged: config.secondLine = text
                    rightItem: IconButton {
                         onClicked: {
                             secondLine.text = ""
                         }
                         width: icon.width
                         height: icon.height
                         icon.source: "image://theme/icon-m-input-clear"
                         opacity: secondLine.text.length > 0 ? 1.0 : 0.0
                         Behavior on opacity { FadeAnimation {} }
                     }
                    }
                    
                TextArea {
                    id: thirdLine
                    label: "Third row"
                    width: parent.width
                    placeholderText: "Third row"
                    text: config.thirdLine
                    onTextChanged: config.thirdLine = text
                    rightItem: IconButton {
                         onClicked: {
                             thirdLine.text = ""
                         }
                         width: icon.width
                         height: icon.height
                         icon.source: "image://theme/icon-m-input-clear"
                         opacity: thirdLine.text.length > 0 ? 1.0 : 0.0
                         Behavior on opacity { FadeAnimation {} }
                     }
                    }
                    
                 TextArea {
                    id: fourthLine
                    label: "Fourth row"
                    width: parent.width
                    placeholderText: "Fourth row"
                    text: config.fourthLine
                    onTextChanged: config.fourthLine = text
                    rightItem: IconButton {
                         onClicked: {
                             fourthLine.text = ""
                         }
                         width: icon.width
                         height: icon.height
                         icon.source: "image://theme/icon-m-input-clear"
                         opacity: fourthLine.text.length > 0 ? 1.0 : 0.0
                         Behavior on opacity { FadeAnimation {} }
                     }
                    }
                 
                  ComboBox {
                    id: fonts
                    label: "Font size: "
                    currentIndex: {
                    if (config.fontSize == Theme.fontSizeTiny) return 0
                    else if (config.fontSize == Theme.fontSizeExtraSmall) return 1
                    else if (config.fontSize == Theme.fontSizeSmall) return 2
                    else if (config.fontSize == Theme.fontSizeMedium) return 3
                    else if (config.fontSize == Theme.fontSizeLarge) return 4
                    else if (config.fontSize == Theme.fontSizeExtraLarge) return 5
                    else if (config.fontSize == Theme.fontSizeHuge) return 6
                    else return 4
                    }
                    
                    menu: ContextMenu {

                       MenuItem {
                            text: "Tiny"
                            onClicked: config.fontSize = Theme.fontSizeTiny
                            }
                       MenuItem {
                            text: "Extra Small"
                            onClicked: config.fontSize = Theme.fontSizeExtraSmall
                            }
                       MenuItem {
                            text: "Small"
                            onClicked: config.fontSize = Theme.fontSizeSmall
                            }
                       MenuItem {
                            text: "Medium"
                            onClicked: config.fontSize = Theme.fontSizeMedium
                            }
                       MenuItem {
                            text: "Large"
                            onClicked: config.fontSize = Theme.fontSizeLarge
                            }
                       MenuItem {
                            text: "Extra Large"
                            onClicked: config.fontSize = Theme.fontSizeExtraLarge
                            }
                       MenuItem {
                            text: "Huge"
                            onClicked: config.fontSize = Theme.fontSizeHuge
                            }
                       }

                 }
                 
                 ComboBox {
                    id: spacing
                    label: "Line spacing: "
                    currentIndex: {
                    if (config.lineSpacing == 0.7) return 0
                    else if (config.lineSpacing == 0.8) return 1
                    else if (config.lineSpacing == 0.9) return 2
                    else if (config.lineSpacing == 1.0) return 3
                    else if (config.lineSpacing == 1.1) return 4
                    else if (config.lineSpacing == 1.2) return 5
                    else if (config.lineSpacing == 1.3) return 6
                    else return 3
                    }
                    
                    menu: ContextMenu {

                       MenuItem {
                            text: "70%"
                            onClicked: config.lineSpacing = 0.7
                            }
                       MenuItem {
                            text: "80%"
                            onClicked: config.lineSpacing = 0.8
                            }
                       MenuItem {
                            text: "90%"
                            onClicked: config.lineSpacing = 0.9
                            }
                       MenuItem {
                            text: "100%"
                            onClicked: config.lineSpacing = 1.0
                            }
                       MenuItem {
                            text: "110%"
                            onClicked: config.lineSpacing = 1.1
                            }
                       MenuItem {
                            text: "120%"
                            onClicked: config.lineSpacing = 1.2
                            }
                       MenuItem {
                            text: "130%"
                            onClicked: config.lineSpacing = 1.3
                            }
                       }

                 }
                 
           }
           
           Column {
              id: preview
              width: parent.width
              spacing: Theme.paddingLarge
              anchors.top: content.bottom

                 Separator {
                     anchors.horizontalCenter: parent.horizontalCenter
                     color: Theme.highlightColor
                     width: parent.width
                 }              
                
                 Label {
                     text: "Preview"
                     color: Theme.highlightColor
                     anchors.horizontalCenter: parent.horizontalCenter

                 }
                 
                 Label {
                     font.pixelSize: config.fontSize
                     lineHeightMode: Text.ProportionalHeight
                     lineHeight: config.lineSpacing
                     textFormat: Text.RichText
                     anchors.horizontalCenter: parent.horizontalCenter
                     horizontalAlignment: Text.AlignHCenter
                     text: (config.firstLine ? config.firstLine + "<br>" : "") + (config.secondLine ? config.secondLine + "<br>" : "") + (config.thirdLine ? config.thirdLine + "<br>" : "") + (config.fourthLine ? config.fourthLine : "")
                 }
           }
    }

}

patch.json

{"description": "Shows four lines of custom text on Lock screen, right below the Clock and Weather widgets", "name": "custom-text-on-lockscreen", "display_name": "Custom text on Lock Screen", "category": "silica", "author": "wetab73", "discussion": "", "donations": "", "sources": "", "version": "0.0.3", "compatible": ["4.4.0.72","4.4.0.68","4.4.0.58"]}

Enjoy :slight_smile:

4 Likes

Wow, thank you again for this great patch. You simply must put it on web catalogue.
Just one more thing, it’s actually version 0.0.4. :wink:

For those who want to customise their text but don’t know HTML, I can recommend W3Schools.

I installed this new version on an old xa2 with a cracked screen, this time without the weather app and it works fine, so the weather app is not a prerequisite.
Just out of curiosity, apart from html formatting, is it possible to embed an image?

I will. Please just test it a few more days and report if it works OK. If you don’t experience any issues, I will submit it to the web catalogue. As version 1.0.0 :slight_smile:

Actually, I haven’t tried. It depends on whether Text.RichText supports HTML’s <img> tag. If so, then it should work. In such case, I’d suggest using it with explicit width and height attributes to make sure that the size of the image will be correct.

Will do!
HTML’s <h*> tag is supported.

<img> tag is supported, too, and images are nicely shown on the Lock Screen.

3 Likes

I’m confused, where is the input data stored?

Apparently in this dconf key:

1 Like

Thanks, so that’s why I didn’t find it, I didn’t realize it was a dconf key.

Where can I get the current progress for this patch?

1 Like

But I meant, where I could grab a prerelease to test.

As for now, you’d need to copy the above listed code from here, save it as corresponding files and manually add it to Patchmanager. Instructions were given in one of the previous posts above. I will submit it to the Web catalog in the future.

1 Like

I added an image, it shows up on preview but not on the lockscreen. Also, my attempts to centre the image (html5 deprecated) had no effect and I didn’t want to go down a CSS rabbit hole. A QRcode might be one way of including a lot of info in a small space.
Screenshot_contactdata