auto-hide clear password button

This commit is contained in:
eximus
2017-08-06 12:48:02 +01:00
parent ddc9ba61f9
commit 43029a5937
4 changed files with 27 additions and 39 deletions

View File

@@ -181,7 +181,7 @@ Rectangle {
color: "#25000000" color: "#25000000"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 2*parent.height // this sets button width, this way its a square anchors.rightMargin: parent.height // this sets button width, this way its a square
anchors.left: password_label.right anchors.left: password_label.right
anchors.leftMargin: config.passwordLeftMargin anchors.leftMargin: config.passwordLeftMargin
borderColor: "transparent" borderColor: "transparent"
@@ -189,6 +189,14 @@ Rectangle {
tooltipBG: "#25000000" tooltipBG: "#25000000"
tooltipFG: "#dc322f" tooltipFG: "#dc322f"
image: "warning_red.png" image: "warning_red.png"
onTextChanged: {
if (password_input_box.text == "") {
clear_passwd_button.visible = false
}
if (password_input_box.text != "" && config.showClearPasswordButton != "false") {
clear_passwd_button.visible = true
}
}
Keys.onPressed: { Keys.onPressed: {
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
@@ -203,23 +211,26 @@ Rectangle {
Button { Button {
id: clear_passwd_button id: clear_passwd_button
height: parent.height height: parent.height
//color: "#393939" width: parent.height
color: "#25000000" color: "transparent"
text: "x" text: "x"
font: textFont.name font: textFont.name
border.color: "#00000000" border.color: "transparent"
border.width: 0
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: password_input_box.right
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 0 anchors.leftMargin: 0
anchors.rightMargin: parent.height anchors.rightMargin: parent.height
disabledColor: "#dc322f" disabledColor: "#dc322f"
activeColor: "#268bd2" activeColor: "#393939"
pressedColor: "#2aa198" pressedColor: "#2aa198"
onClicked: password_input_box.text='' onClicked: {
password_input_box.text=''
password_input_box.focus = true
}
} }
Button { Button {
@@ -229,11 +240,8 @@ Rectangle {
text: ">" text: ">"
border.color: "#00000000" border.color: "#00000000"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
//anchors.left: password_input_box.right anchors.left: password_input_box.right
anchors.left: clear_passwd_button.right
anchors.right: parent.right anchors.right: parent.right
//anchors.leftMargin: 0
//anchors.rightMargin: 0
disabledColor: "#dc322f" disabledColor: "#dc322f"
activeColor: "#268bd2" activeColor: "#268bd2"
pressedColor: "#2aa198" pressedColor: "#2aa198"
@@ -283,7 +291,6 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: "transparent" color: "transparent"
arrowColor: "transparent" arrowColor: "transparent"
//textColor: "white"
textColor: "#505050" textColor: "#505050"
borderColor: "transparent" borderColor: "transparent"
hoverColor: "#5692c4" hoverColor: "#5692c4"
@@ -386,7 +393,9 @@ Rectangle {
if (config.showLoginButton == "false") { if (config.showLoginButton == "false") {
login_button.visible = false login_button.visible = false
password_input_box.anchors.rightMargin = 0 password_input_box.anchors.rightMargin = 0
clear_passwd_button.anchors.rightMargin = 0
} }
clear_passwd_button.visible = false
} }
} }

View File

@@ -25,10 +25,13 @@ The theme can be tested by running `sddm-greeter --theme <path-to-this-repositor
### Other notes ### Other notes
- video
This theme streams the HD videos so a good internet connection is necessary. This theme streams the HD videos so a good internet connection is necessary.
If there is no active connection or the video can't be played the background will fallback to the image background.jpg If there is no active connection or the video can't be played the background will fallback to the image background.jpg
If you wish to play local videos files just use the following command to generate the playlist-file (playlist_day.m3u or playlist_night.m3u) from a directory containing the videos:
`find <path-to-your-directory> -maxdepth 1 -type f > <playlist-file>`
### Changing settings in `theme.conf.user` ### Changing settings in `theme.conf.user`
You can change a few settings in this file You can change a few settings in this file
@@ -36,6 +39,7 @@ You can change a few settings in this file
- `background_day` and `background_night` - video playlists - `background_day` and `background_night` - video playlists
- `displayFont` - font - `displayFont` - font
- `showLoginButton` - if set to false will hide the login button - `showLoginButton` - if set to false will hide the login button
- `showClearPasswordButton` - if set to false will hide the clear password button that appears when text is inputed
- `passwordLeftMargin` and `usernameLeftMargin` - set margin between input boxes and labels, some fonts are messy and allows fixing of overlap - `passwordLeftMargin` and `usernameLeftMargin` - set margin between input boxes and labels, some fonts are messy and allows fixing of overlap
- `relativePositionX` and `relativePositionY` - position the login text box and clock - `relativePositionX` and `relativePositionY` - position the login text box and clock
@@ -51,13 +55,6 @@ passwordLeftMargin=15
usernameLeftMargin=15 usernameLeftMargin=15
``` ```
If you want to use the local videos but not via internet, you can put your day-videos and night-videos to `playlist_videos/day` and `playlist_videos/night` directory and then run the code below:
```bash
./generate_playlist.sh local
```
## Preview ## Preview
![preview1](preview1.gif) ![preview1](preview1.gif)

View File

@@ -1,21 +1,5 @@
#!/bin/bash #!/bin/bash
if [ "$1" == "local" ]; then
python -c '
import os
day=open("playlist_day.m3u", "w")
night=open("playlist_night.m3u", "w")
for x in os.listdir("./playlist_videos/day"):
day.write("./playlist_videos/day/" + x + "\n")
for x in os.listdir("./playlist_videos/night"):
night.write("./playlist_videos/night/" + x + "\n")
day.close()
night.close()
'
echo "Generated local video playlist successful!"
else
curl 'http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/entries.json' 2>/dev/null | python2 -c ' curl 'http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/entries.json' 2>/dev/null | python2 -c '
import sys, json; import sys, json;
day=open("playlist_day.m3u", "w") day=open("playlist_day.m3u", "w")
@@ -31,5 +15,3 @@ for x in json.load(sys.stdin):
day.close() day.close()
night.close() night.close()
' '
echo "Generated internet video playlist successful!"
fi