From ddc9ba61f9edbe738e1a90ce09952fa8729e8fd4 Mon Sep 17 00:00:00 2001 From: yehuohan <550034086@qq.com> Date: Sun, 6 Aug 2017 16:22:57 +0000 Subject: [PATCH 1/2] added a extra way to play local video; change the postition of login-faild-msg; added a button to clear the password; change the color of session and us-layout font --- .gitignore | 3 ++ Main.qml | 61 +++++++++++++++++-------- README.md | 8 ++++ generate_playlist.sh | 22 ++++++++- playlist_videos/put-your-videos-here.md | 0 theme.conf | 5 +- 6 files changed, 78 insertions(+), 21 deletions(-) create mode 100644 playlist_videos/put-your-videos-here.md diff --git a/.gitignore b/.gitignore index e039936..a0597e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ Main.qmlc + +/playlist_videos/* +!/playlist_videos/*.md diff --git a/Main.qml b/Main.qml index a38d7df..df50de3 100644 --- a/Main.qml +++ b/Main.qml @@ -150,16 +150,6 @@ Rectangle { KeyNavigation.backtab: password_input_box; KeyNavigation.tab: password_input_box } - - Text { - id: error_message - height: parent.height - font.family: textFont.name - font.pixelSize: 12 - color: "white" - anchors.left: username_input_box.left - anchors.leftMargin: 0 - } } Rectangle { @@ -191,7 +181,7 @@ Rectangle { color: "#25000000" anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right - anchors.rightMargin: parent.height // this sets button width, this way its a square + anchors.rightMargin: 2*parent.height // this sets button width, this way its a square anchors.left: password_label.right anchors.leftMargin: config.passwordLeftMargin borderColor: "transparent" @@ -210,17 +200,40 @@ Rectangle { KeyNavigation.backtab: username_input_box; KeyNavigation.tab: login_button } + Button { + id: clear_passwd_button + height: parent.height + //color: "#393939" + color: "#25000000" + text: "x" + font: textFont.name + + border.color: "#00000000" + anchors.verticalCenter: parent.verticalCenter + anchors.left: password_input_box.right + anchors.right: parent.right + anchors.leftMargin: 0 + anchors.rightMargin: parent.height + + disabledColor: "#dc322f" + activeColor: "#268bd2" + pressedColor: "#2aa198" + + onClicked: password_input_box.text='' + } + Button { id: login_button height: parent.height color: "#393939" text: ">" - anchors.verticalCenter: parent.verticalCenter border.color: "#00000000" + anchors.verticalCenter: parent.verticalCenter + //anchors.left: password_input_box.right + anchors.left: clear_passwd_button.right anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: password_input_box.right - anchors.leftMargin: 0 + //anchors.leftMargin: 0 + //anchors.rightMargin: 0 disabledColor: "#dc322f" activeColor: "#268bd2" pressedColor: "#2aa198" @@ -231,10 +244,20 @@ Rectangle { KeyNavigation.backtab: password_input_box; KeyNavigation.tab: reboot_button } + + Text { + id: error_message + height: parent.height + font.family: textFont.name + font.pixelSize: 12 + color: "white" + anchors.top: password_input_box.bottom + anchors.left: password_input_box.left + anchors.leftMargin: 0 + } } } - } // Top Bar @@ -260,7 +283,8 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter color: "transparent" arrowColor: "transparent" - textColor: "white" + //textColor: "white" + textColor: "#505050" borderColor: "transparent" hoverColor: "#5692c4" @@ -305,7 +329,8 @@ Rectangle { text: modelItem ? modelItem.modelData.shortName : "zz" font.family: textFont.name font.pixelSize: 14 - color: "white" + //color: "white" + color: "#505050" } } KeyNavigation.backtab: session; KeyNavigation.tab: username_input_box diff --git a/README.md b/README.md index 4c0ed3e..682bd48 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ The theme can be tested by running `sddm-greeter --theme /dev/null | python2 -c ' +#!/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 ' import sys, json; day=open("playlist_day.m3u", "w") night=open("playlist_night.m3u", "w") @@ -13,3 +31,5 @@ for x in json.load(sys.stdin): day.close() night.close() ' + echo "Generated internet video playlist successful!" +fi diff --git a/playlist_videos/put-your-videos-here.md b/playlist_videos/put-your-videos-here.md new file mode 100644 index 0000000..e69de29 diff --git a/theme.conf b/theme.conf index 6b088c5..6f4d567 100644 --- a/theme.conf +++ b/theme.conf @@ -2,8 +2,9 @@ background=background.jpg background_day=playlist_day.m3u background_night=playlist_night.m3u -displayFont="Droid Sans Mono for Powerline" +displayFont="DejaVu Sans" showLoginButton=true +passwordLeftMargin=15 +usernameLeftMargin=15 relativePositionX=0.3 relativePositionY=0.7 - From 43029a59373112439e9280d00f256a6eea631da6 Mon Sep 17 00:00:00 2001 From: eximus Date: Sun, 6 Aug 2017 12:48:02 +0100 Subject: [PATCH 2/2] auto-hide clear password button --- Main.qml | 33 ++++++++++++++++--------- README.md | 13 ++++------ generate_playlist.sh | 20 +-------------- playlist_videos/put-your-videos-here.md | 0 4 files changed, 27 insertions(+), 39 deletions(-) delete mode 100644 playlist_videos/put-your-videos-here.md diff --git a/Main.qml b/Main.qml index df50de3..270bc4d 100644 --- a/Main.qml +++ b/Main.qml @@ -181,7 +181,7 @@ Rectangle { color: "#25000000" anchors.verticalCenter: parent.verticalCenter 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.leftMargin: config.passwordLeftMargin borderColor: "transparent" @@ -189,6 +189,14 @@ Rectangle { tooltipBG: "#25000000" tooltipFG: "#dc322f" 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: { if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { @@ -203,23 +211,26 @@ Rectangle { Button { id: clear_passwd_button height: parent.height - //color: "#393939" - color: "#25000000" + width: parent.height + color: "transparent" text: "x" font: textFont.name - border.color: "#00000000" + border.color: "transparent" + border.width: 0 anchors.verticalCenter: parent.verticalCenter - anchors.left: password_input_box.right anchors.right: parent.right anchors.leftMargin: 0 anchors.rightMargin: parent.height disabledColor: "#dc322f" - activeColor: "#268bd2" + activeColor: "#393939" pressedColor: "#2aa198" - onClicked: password_input_box.text='' + onClicked: { + password_input_box.text='' + password_input_box.focus = true + } } Button { @@ -229,11 +240,8 @@ Rectangle { text: ">" border.color: "#00000000" anchors.verticalCenter: parent.verticalCenter - //anchors.left: password_input_box.right - anchors.left: clear_passwd_button.right + anchors.left: password_input_box.right anchors.right: parent.right - //anchors.leftMargin: 0 - //anchors.rightMargin: 0 disabledColor: "#dc322f" activeColor: "#268bd2" pressedColor: "#2aa198" @@ -283,7 +291,6 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter color: "transparent" arrowColor: "transparent" - //textColor: "white" textColor: "#505050" borderColor: "transparent" hoverColor: "#5692c4" @@ -386,7 +393,9 @@ Rectangle { if (config.showLoginButton == "false") { login_button.visible = false password_input_box.anchors.rightMargin = 0 + clear_passwd_button.anchors.rightMargin = 0 } + clear_passwd_button.visible = false } } diff --git a/README.md b/README.md index 682bd48..9cae397 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,13 @@ The theme can be tested by running `sddm-greeter --theme -maxdepth 1 -type f > ` + ### Changing settings in `theme.conf.user` 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 - `displayFont` - font - `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 - `relativePositionX` and `relativePositionY` - position the login text box and clock @@ -51,13 +55,6 @@ passwordLeftMargin=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 ![preview1](preview1.gif) diff --git a/generate_playlist.sh b/generate_playlist.sh index a97ee14..6091478 100755 --- a/generate_playlist.sh +++ b/generate_playlist.sh @@ -1,22 +1,6 @@ #!/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; day=open("playlist_day.m3u", "w") night=open("playlist_night.m3u", "w") @@ -31,5 +15,3 @@ for x in json.load(sys.stdin): day.close() night.close() ' - echo "Generated internet video playlist successful!" -fi diff --git a/playlist_videos/put-your-videos-here.md b/playlist_videos/put-your-videos-here.md deleted file mode 100644 index e69de29..0000000