Compare commits

..

No commits in common. "master" and "1.3" have entirely different histories.
master ... 1.3

19 changed files with 447 additions and 822 deletions

2
.gitignore vendored
View file

@ -1 +1 @@
theme.conf.user
slice/theme.conf.user

View file

@ -1,77 +1,41 @@
# Slice (SDDM Theme)
Simple dark SDDM theme with many customization options.
Simple dark SDDM theme.
[![Theme preview (YouTube)](https://user-images.githubusercontent.com/2903496/45325970-142dd700-b55b-11e8-8396-dc6aba6282e5.png)](https://youtu.be/X6lXkBwo--s)
[![Theme preview (YouTube)](http://img.youtube.com/vi/y2zzlDdJTUU/0.jpg)](https://youtu.be/y2zzlDdJTUU)
## Install from KDE system settings
If you're using KDE, you can install theme from `System Settings > Startup and Shutdown > Login Screen (SDDM)`. You can download this repo as zip and install with `Install From File...`, or you can find it in `Get New Login Screens...` window.
## Manual install
## Installing
1. Install `Qt Graphical Effects` QML module
2. Install Roboto font (optional, you can change to other font, [see below](#font-scheme))
3. `git clone https://github.com/EricKotato/sddm-slice.git`
4. `cp -r sddm-slice /usr/share/sddm/themes/sddm-slice`
5. Open `/etc/sddm.conf` and put `Current=sddm-slice` in `[Theme]` section
2. Install Roboto font (optional, you can change to other font, see below)
3. `git clone https://github.com/RadRussianRus/sddm-slice.git`
4. `cp -r sddm-slice/slice /usr/share/sddm/themes/slice`
5. Open `/etc/sddm.conf` and put `Current=slice` in `[Theme]` section
## Configuration
Create file `theme.conf.user` in theme folder. See `theme.conf` for reference. Also sample configs can be found [in wiki](https://github.com/EricKotato/sddm-slice/wiki#sample-configs).
Create file `theme.conf.user` in theme folder. See `slice/theme.conf` for reference.
### Base options
* `font` - overall font. Defaults to `Roboto`.
* `background` - path to background image. If not set, falls back to `color_bg`. Not set by default.
* `bg_mode` - background image fill mode. Can be either `aspect`, `fill`, `tile` or `none`. Defaults to `aspect`.
* `parallax_bg_shift` - shifting of parallax background on tab change in pixels. `0` disables parallax motion. Negative values will scroll background in opposite direction. Default is `20`.
* `manual` - enables manual login mode and disables user selection. You can use "0/1", "true/false" and "yes/no" on this option. Disabled by default.
### Color scheme
There are many color options. In fact, too many. So now they are grouped by layers in [color scheme](https://github.com/EricKotato/sddm-slice/wiki/Color-Scheme). Most of them are optional, only mandatory options are from [layer 1](https://github.com/EricKotato/sddm-slice/wiki/Color-Scheme-Layer-1):
There are many color options. In fact, too many. So now they are grouped by layers in [color scheme](https://github.com/RadRussianRus/sddm-slice/wiki/Color-scheme). Most of them are optional, only mandatory options are from [layer 1](https://github.com/RadRussianRus/sddm-slice/wiki/Layer-1):
* `color_bg` - background color. Defaults to `#222222`.
* `color_main` - main color. Defaults to `#dddddd`.
* `color_dimmed` - dimmed main color. Defaults to `#888888`.
* `color_contrast` - color that contrasting to both main and dimmed. Defaults to `#1f1f1f`.
Info about other layers can be found on wiki: [layer 2](https://github.com/EricKotato/sddm-slice/wiki/Color-Scheme-Layer-2), [layer 3](https://github.com/EricKotato/sddm-slice/wiki/Color-Scheme-Layer-3).
### Font scheme
There are also many font options, so there is now [font scheme](https://github.com/EricKotato/sddm-slice/wiki/Font-Scheme) too. Most of them are optional, only mandatory option is from [layer 1](https://github.com/EricKotato/sddm-slice/wiki/Font-Scheme-Layer-1):
* `font` - overall font. Defaults to `Roboto`.
Info about other layers can be found on wiki: [layer 2](https://github.com/EricKotato/sddm-slice/wiki/Font-Scheme-Layer-2), [layer 3](https://github.com/EricKotato/sddm-slice/wiki/Font-Scheme-Layer-3).
### Debug mode options
There are some things that can't be tested well in greeter (e.g. shutdown options or login error). So there is a debug mode.
#### Boolean options
> You can use "0/1", "true/false" and "yes/no" on boolean options. All debug options are disabled by default.
* `debug` - activates debug mode.
* `debug_can_power_off` - sets `sddm.canPowerOff` (shows "Shutdown").
* `debug_can_reboot` - sets `sddm.canReboot` (shows "Reboot").
* `debug_can_suspend` - sets `sddm.canSuspend` (shows "Suspend").
* `debug_can_hibernate` - sets `sddm.canHibernate` (shows "Hibernate").
* `debug_can_hybrid_sleep` - sets `sddm.canHybridSleep` (shows "Hybrid Sleep").
* `debug_login_error` - forces login error.
#### Number options
* `debug_login_timeout` - time between pressing "Login" and login error in seconds. Not effective if `debug_login_error` is disabled.
#### String options
* `debug_hostname` - sets `sddm.hostName`.
Info about other layers can be found on wiki: [layer 2](https://github.com/RadRussianRus/sddm-slice/wiki/Layer-2), [layer 3](https://github.com/RadRussianRus/sddm-slice/wiki/Layer-3).
## License
Icons: [Material Design Icons](https://github.com/Templarian/MaterialDesign)
[![CC-BY-SA](https://i.creativecommons.org/l/by-sa/4.0/88x31.png)](http://creativecommons.org/licenses/by-sa/4.0/)
[![CC-BY-SA](https://i.creativecommons.org/l/by-sa/4.0/88x31.png)](http://creativecommons.org/licenses/by-sa/4.0/)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

View file

@ -1,38 +0,0 @@
import QtQuick 2.7
import SddmComponents 2.0
Item
{
readonly property bool active: bool(config.debug)
function debugbool(config_value, real_property)
{
return (active && bool(config_value)) || real_property;
}
function debugnum(config_value, real_property)
{
if (config_value === null || config_value === undefined)
return real_property;
return active ? Number(config_value).valueOf() : real_property;
}
function debugstr(config_value, real_property)
{
if (config_value === null || config_value === undefined)
return real_property;
return active ? config_value : real_property;
}
readonly property bool canPowerOff: debugbool(config.debug_can_power_off, sddm.canPowerOff)
readonly property bool canReboot: debugbool(config.debug_can_reboot, sddm.canReboot)
readonly property bool canSuspend: debugbool(config.debug_can_suspend, sddm.canSuspend)
readonly property bool canHibernate: debugbool(config.debug_can_hibernate, sddm.canHibernate)
readonly property bool canHybridSleep: debugbool(config.debug_can_hybrid_sleep, sddm.canHybridSleep)
readonly property bool loginError: debugbool(config.debug_login_error, false)
readonly property int loginTimeout: debugnum(config.debug_login_timeout, 0)
readonly property string hostName: debugstr(config.debug_hostname, sddm.hostName)
}

View file

@ -1,178 +0,0 @@
import QtQuick 2.7
Item
{
/* * * * * * * * * * * * * * * * * *
*
* Functions
*
* * * * * * * * * * * * * * * * * */
function cap(str)
{
str = str.toLowerCase();
switch (str)
{
case 'upper':
return Font.AllUppercase;
case 'lower':
return Font.AllLowercase;
case 'smallcaps':
return Font.SmallCaps;
case 'capitalize':
return Font.Capitalize;
default:
return Font.MixedCase;
}
}
/* * * * * * * * * * * * * * * * * *
*
* Layer 1 options
* Required
*
* * * * * * * * * * * * * * * * * */
property string main: config.font
/* * * * * * * * * * * * * * * * * *
*
* Layer 2 options
* Common
*
* * * * * * * * * * * * * * * * * */
property font slices: Qt.font({
family: config.font_slices ? config.font_slices : config.font,
pointSize: config.font_slices_size ? Number(config.font_slices_size) : 13,
bold: not_null(config.font_slices_bold) ? bool(config.font_slices_bold) : true,
italic: not_null(config.font_slices_italic) ? bool(config.font_slices_italic) : false,
underline: not_null(config.font_slices_underline) ? bool(config.font_slices_underline) : false,
capitalization: not_null(config.font_slices_capitalize) ? cap(config.font_slices_capitalize) : Font.AllUppercase
});
property font inputGroup: Qt.font({
family: config.font_input_group ? config.font_input_group : config.font,
pointSize: config.font_input_group_size ? Number(config.font_input_group_size) : 18,
bold: not_null(config.font_input_group_bold) ? bool(config.font_input_group_bold) : false,
italic: not_null(config.font_input_group_italic) ? bool(config.font_input_group_italic) : false,
underline: not_null(config.font_input_group_underline) ? bool(config.font_input_group_underline) : false,
capitalization: not_null(config.font_input_group_capitalize) ? cap(config.font_input_group_capitalize) : Font.MixedCase
});
property font listItemBig: Qt.font({
family: config.font_list_item_big ? config.font_list_item_big : config.font,
pointSize: config.font_list_item_big_size ? Number(config.font_list_item_big_size) : 36,
bold: not_null(config.font_list_item_big_bold) ? bool(config.font_list_item_big_bold) : true,
italic: not_null(config.font_list_item_big_italic) ? bool(config.font_list_item_big_italic) : false,
underline: not_null(config.font_list_item_big_underline) ? bool(config.font_list_item_big_underline) : false,
capitalization: not_null(config.font_list_item_big_capitalize) ? cap(config.font_list_item_big_capitalize) : Font.MixedCase
});
property font listItemMed: Qt.font({
family: config.font_list_item_med ? config.font_list_item_med : config.font,
pointSize: config.font_list_item_med_size ? Number(config.font_list_item_med_size) : 28,
bold: not_null(config.font_list_item_med_bold) ? bool(config.font_list_item_med_bold) : true,
italic: not_null(config.font_list_item_med_italic) ? bool(config.font_list_item_med_italic) : false,
underline: not_null(config.font_list_item_med_underline) ? bool(config.font_list_item_med_underline) : false,
capitalization: not_null(config.font_list_item_med_capitalize) ? cap(config.font_list_item_med_capitalize) : Font.MixedCase
});
property font listItemSub: Qt.font({
family: config.font_list_item_sub ? config.font_list_item_sub : config.font,
pointSize: config.font_list_item_sub_size ? Number(config.font_list_item_sub_size) : 20,
bold: not_null(config.font_list_item_sub_bold) ? bool(config.font_list_item_sub_bold) : false,
italic: not_null(config.font_list_item_sub_italic) ? bool(config.font_list_item_sub_italic) : false,
underline: not_null(config.font_list_item_sub_underline) ? bool(config.font_list_item_sub_underline) : false,
capitalization: not_null(config.font_list_item_sub_capitalize) ? cap(config.font_list_item_sub_capitalize) : Font.MixedCase
});
property font error: Qt.font({
family: config.font_error ? config.font_error : config.font,
pointSize: config.font_error_size ? Number(config.font_error_size) : 18,
bold: not_null(config.font_error_bold) ? bool(config.font_error_bold) : true,
italic: not_null(config.font_error_italic) ? bool(config.font_error_italic) : false,
underline: not_null(config.font_error_underline) ? bool(config.font_error_underline) : false,
capitalization: not_null(config.font_error_capitalize) ? cap(config.font_error_capitalize) : Font.MixedCase
});
/* * * * * * * * * * * * * * * * * *
*
* Layer 3 options
* Control types
*
* * * * * * * * * * * * * * * * * */
// Slices
property font slicesTop: Qt.font({
family: config.font_slices_top ? config.font_slices_top : slices.family,
pointSize: config.font_slices_top_size ? Number(config.font_slices_top_size) : slices.pointSize,
bold: not_null(config.font_slices_top_bold) ? bool(config.font_slices_top_bold) : slices.bold,
italic: not_null(config.font_slices_top_italic) ? bool(config.font_slices_top_italic) : slices.italic,
underline: not_null(config.font_slices_top_underline) ? bool(config.font_slices_top_underline) : slices.underline,
capitalization: not_null(config.font_slices_top_capitalize) ? cap(config.font_slices_top_capitalize) : slices.capitalization
});
property font slicesBottomLeft: Qt.font({
family: config.font_slices_bottom_left ? config.font_slices_bottom_left : slices.family,
pointSize: config.font_slices_bottom_left_size ? Number(config.font_slices_bottom_left_size) : slices.pointSize,
bold: not_null(config.font_slices_bottom_left_bold) ? bool(config.font_slices_bottom_left_bold) : slices.bold,
italic: not_null(config.font_slices_bottom_left_italic) ? bool(config.font_slices_bottom_left_italic) : slices.italic,
underline: not_null(config.font_slices_bottom_left_underline) ? bool(config.font_slices_bottom_left_underline) : slices.underline,
capitalization: not_null(config.font_slices_bottom_left_capitalize) ? cap(config.font_slices_bottom_left_capitalize) : slices.capitalization
});
property font slicesBottomRight: Qt.font({
family: config.font_slices_bottom_right ? config.font_slices_bottom_right : slices.family,
pointSize: config.font_slices_bottom_right_size ? Number(config.font_slices_bottom_right_size) : slices.pointSize,
bold: not_null(config.font_slices_bottom_right_bold) ? bool(config.font_slices_bottom_right_bold) : slices.bold,
italic: not_null(config.font_slices_bottom_right_italic) ? bool(config.font_slices_bottom_right_italic) : slices.italic,
underline: not_null(config.font_slices_bottom_right_underline) ? bool(config.font_slices_bottom_right_underline) : slices.underline,
capitalization: not_null(config.font_slices_bottom_right_capitalize) ? cap(config.font_slices_bottom_right_capitalize) : slices.capitalization
});
property font slicesLoginButtons: Qt.font({
family: config.font_slices_login_buttons ? config.font_slices_login_buttons : slices.family,
pointSize: config.font_slices_login_buttons_size ? Number(config.font_slices_login_buttons_size) : slices.pointSize,
bold: not_null(config.font_slices_login_buttons_bold) ? bool(config.font_slices_login_buttons_bold) : slices.bold,
italic: not_null(config.font_slices_login_buttons_italic) ? bool(config.font_slices_login_buttons_italic) : slices.italic,
underline: not_null(config.font_slices_login_buttons_underline) ? bool(config.font_slices_login_buttons_underline) : slices.underline,
capitalization: not_null(config.font_slices_login_buttons_capitalize) ? cap(config.font_slices_login_buttons_capitalize) : slices.capitalization
});
// Input group
property font input: Qt.font({
family: config.font_input ? config.font_input : inputGroup.family,
pointSize: config.font_input_size ? Number(config.font_input_size) : inputGroup.pointSize,
bold: not_null(config.font_input_bold) ? bool(config.font_input_bold) : inputGroup.bold,
italic: not_null(config.font_input_italic) ? bool(config.font_input_italic) : inputGroup.italic,
underline: not_null(config.font_input_underline) ? bool(config.font_input_underline) : inputGroup.underline,
capitalization: not_null(config.font_input_capitalize) ? cap(config.font_input_capitalize) : inputGroup.capitalization
});
property font loginInput: Qt.font({
family: config.font_login_input ? config.font_login_input : inputGroup.family,
pointSize: config.font_login_input_size ? Number(config.font_login_input_size) : inputGroup.pointSize,
bold: not_null(config.font_login_input_bold) ? bool(config.font_login_input_bold) : true,
italic: not_null(config.font_login_input_italic) ? bool(config.font_login_input_italic) : inputGroup.italic,
underline: not_null(config.font_login_input_underline) ? bool(config.font_login_input_underline) : inputGroup.underline,
capitalization: not_null(config.font_login_input_capitalize) ? cap(config.font_login_input_capitalize) : inputGroup.capitalization
});
property font placeholder: Qt.font({
family: config.font_placeholder ? config.font_placeholder : inputGroup.family,
pointSize: config.font_placeholder_size ? Number(config.font_placeholder_size) : inputGroup.pointSize,
bold: not_null(config.font_placeholder_bold) ? bool(config.font_placeholder_bold) : inputGroup.bold,
italic: not_null(config.font_placeholder_italic) ? bool(config.font_placeholder_italic) : inputGroup.italic,
underline: not_null(config.font_placeholder_underline) ? bool(config.font_placeholder_underline) : inputGroup.underline,
capitalization: not_null(config.font_placeholder_capitalize) ? cap(config.font_placeholder_capitalize) : inputGroup.capitalization
});
}

View file

@ -1,5 +1,5 @@
import QtQuick 2.7
import Qt5Compat.GraphicalEffects
import QtGraphicalEffects 1.0
Item
{
@ -14,8 +14,8 @@ Item
transform: Scale
{
origin.x: descriptionLabel.height + 10 + 2
origin.y: descriptionLabel.height + 10 / 2
origin.x: 54
origin.y: 29
xScale: distance
yScale: distance
}
@ -29,22 +29,14 @@ Item
property string icon: "icons/no_avatar.svg"
property string title: ""
Rectangle
{
width: descriptionLabel.height + 10
height: descriptionLabel.height + 10
color: ( hover ? colors.iconBgHover : colors.iconBg )
}
Image
{
id: powerItemIcon
source: icon
sourceSize.width: descriptionLabel.height + 10 - 4
sourceSize.height: descriptionLabel.height + 10 - 4
sourceSize.width: 48
sourceSize.height: 48
x: 2
y: 2
opacity: 0
}
ColorOverlay
@ -53,15 +45,13 @@ Item
anchors.fill: powerItemIcon
source: powerItemIcon
color: ( hover ? colors.iconHover : colors.icon )
opacity: parent.opacity
}
Rectangle
{
x: descriptionLabel.height + 10 + 2
width: parent.width - descriptionLabel.height + 10 - 2
height: descriptionLabel.height + 10
color: ( hover ? colors.textBgHover : colors.textBg )
width: 52
height: 52
color: ( hover ? colors.iconBgHover : colors.iconBg )
}
Text
@ -69,19 +59,30 @@ Item
id: descriptionLabel
text: itemRoot.title
color: ( hover ? colors.textHover : colors.text )
width: parent.width - descriptionLabel.height + 10 - 2 - 24
font: fonts.listItemMed
elide: Text.ElideRight
font
{
family: config.font
pointSize: 28
bold: true
}
x: descriptionLabel.height + 10 + 12
x: 64
y: 5
}
Rectangle
{
x: 54
width: parent.width - 54
height: 52
color: ( hover ? colors.textBgHover : colors.textBg )
}
MouseArea
{
width: descriptionLabel.x + descriptionLabel.width
height: descriptionLabel.height + 10
height: 52
hoverEnabled: true
onClicked: itemRoot.clicked()

View file

@ -1,18 +1,35 @@
import QtQuick 2.7
import Qt5Compat.GraphicalEffects
import QtGraphicalEffects 1.0
import SddmComponents 2.0
Item
{
id: itemRoot
opacity: computedDistance
scale: computedDistance
opacity: distance
scale: distance
property real distance: 1.0
readonly property real computedDistance: Math.sin(Math.PI / 2 * distance)
property string sessionName: ""
property bool hover: false
Text
{
id: sessionNameLabel
anchors.centerIn: parent
text: sessionName
color: ( hover ? colors.textHover : colors.text )
font
{
family: config.font
pointSize: 28
bold: true
}
x: parent.x + 10
y: 5
}
Rectangle
{
x: sessionNameLabel.x - 10
@ -21,17 +38,4 @@ Item
height: sessionNameLabel.height + 10
color: ( hover ? colors.textBgHover : colors.textBg )
}
Text
{
id: sessionNameLabel
anchors.centerIn: parent
text: sessionName
color: ( hover ? colors.textHover : colors.text )
font: fonts.listItemMed
x: parent.x + 10
y: 5
}
}

View file

@ -1,83 +1,82 @@
import QtQuick 2.7
import Qt5Compat.GraphicalEffects
import QtGraphicalEffects 1.0
import SddmComponents 2.0
Item
{
id: itemRoot
opacity: computedDistance
opacity: distance
width: parent.width
height: userName == "" ? userLoginText.height + 14 : userNameText.height + userLoginText.height - 4
property bool hover: false
property bool hoverEnabled: true
transform: Scale
{
origin.x: itemRoot.height + 12
xScale: computedDistance
yScale: computedDistance
origin.x: 80
xScale: distance
yScale: distance
}
property real distance: 1.0
readonly property real computedDistance: Math.sin(Math.PI / 2 * distance)
property string userName: ""
property string userLogin: ""
property string userAvatar: "icons/no_avatar.svg"
Rectangle
{
width: itemRoot.height
height: itemRoot.height
color: ( hoverEnabled && hover ? colors.iconBgHover : colors.iconBg )
}
Image
{
id: profilePicture
source: userAvatar
sourceSize.width: itemRoot.height - 8
sourceSize.height: itemRoot.height - 8
sourceSize.width: 60
sourceSize.height: 60
x: 4
y: 4
}
Rectangle
{
x: itemRoot.height + 2
y: 0
width: parent.width - itemRoot.height - 2
height: itemRoot.height
color: ( hoverEnabled && hover ? colors.textBgHover : colors.textBg )
width: 68
height: 68
color: ( hoverEnabled && hover ? colors.iconBgHover : colors.iconBg )
}
Text
{
id: userNameText
text: userName
color: ( hoverEnabled && hover ? colors.textHover : colors.text )
font: fonts.listItemMed
font
{
family: config.font
pointSize: 28
bold: true
}
elide: Text.ElideRight
x: itemRoot.height + 12
x: 80
y: 0
width: itemRoot.width - itemRoot.height - 26
}
Text
{
id: userLoginText
text: userLogin
color: ( hoverEnabled && hover ? (userName == "" ? colors.textHover : colors.textDimmedHover ) : (userName == "" ? colors.text : colors.textDimmed ) )
y: userName == "" ? 7 : userNameText.height * 0.8
font: userName == "" ? fonts.listItemBig : fonts.listItemSub
x: itemRoot.height + 12
y: userName == "" ? 6 : 36
font
{
family: config.font
pointSize: userName == "" ? 36 : 20
bold: userName == ""
}
x: 80
}
elide: Text.ElideRight
width: itemRoot.width - itemRoot.height - 26
Rectangle
{
x: 70
y: 0
width: parent.width - 70
height: 68
color: ( hoverEnabled && hover ? colors.textBgHover : colors.textBg )
}
}

View file

@ -1,15 +1,12 @@
import QtQuick 2.7
import Qt5Compat.GraphicalEffects
import QtGraphicalEffects 1.0
import SddmComponents 2.0
import "slice"
Rectangle
{
id: root
color: colors.background
property variant geometry: screenModel.geometry(screenModel.primary)
//property bool virtualkeyboard: bool(config.virtualkeyboard)
state: "stateUsers"
states:
@ -59,26 +56,7 @@ Rectangle
}
]
function bool(str) {
if (str === null || str === undefined)
return false;
str = str.toLowerCase();
if (str === "false" || str === "no")
return false;
else if (str === "true" || str === "yes")
return true;
return Boolean(Number(str).valueOf()).valueOf();
}
function not_null(str) {
return !(str === null || str === undefined);
}
TextConstants { id: localeText }
Debug { id: debug }
function bgFillMode() {
@ -113,7 +91,6 @@ Rectangle
}
ColorScheme { id: colors }
FontScheme { id: fonts }
Item
{
@ -121,7 +98,7 @@ Rectangle
x: 0
y: 0
width: root.width
height: Math.max(buttonPagePower.height, buttonPageSessions.height, buttonPageUsers.height) + 10
height: 35
SlicedButton
{
@ -129,14 +106,12 @@ Rectangle
x: 5
y: 5
skewLeft: 0
text: debug.hostName ? debug.hostName : "Hostname"
hasLeftSlice: false
text: sddm.hostName ? sddm.hostName : "Hostname"
enabled: debug.canPowerOff || debug.canReboot || debug.canSuspend || debug.canHibernate || debug.canHybridSleep
enabled: sddm.canPowerOff || sddm.canReboot || sddm.canSuspend || sddm.canHibernate || sddm.canHybridSleep
onClicked: if (enabled) root.state = "statePower"
font: fonts.slicesTop
}
SlicedButton
@ -148,8 +123,6 @@ Rectangle
text: pageSessions.currentSessionName
onClicked: root.state = "stateSessions"
font: fonts.slicesTop
}
SlicedButton
@ -161,8 +134,6 @@ Rectangle
text: pageUsers.currentUserLogin
onClicked: root.state = "stateUsers"
font: fonts.slicesTop
}
}
@ -172,7 +143,7 @@ Rectangle
x: 0
y: areaTop.height
width: root.width
height: root.height - areaTop.height - areaBottom.height
height: root.height - (areaTop.height * 2)
PagePower
{
@ -180,6 +151,9 @@ Rectangle
width: areaMain.width
height: areaMain.height
Keys.onTabPressed: { root.state = "stateSessions" }
Keys.onBacktabPressed: { root.state = "stateUsers" }
Behavior on x { NumberAnimation { duration: 150 } }
}
@ -189,6 +163,15 @@ Rectangle
width: areaMain.width
height: areaMain.height
Keys.onTabPressed: { root.state = "stateUsers" }
Keys.onBacktabPressed:
{
if (buttonPagePower.enabled)
root.state = "statePower"
else
root.state = "stateSessions"
}
Behavior on x { NumberAnimation { duration: 150 } }
onSelectedIndexChanged: pageUsers.selectedSessionIndex = selectedIndex
@ -201,85 +184,63 @@ Rectangle
id: pageUsers
width: areaMain.width
height: areaMain.height
y: inputPanel.visible && inputPanel.y != areaMain.height + areaBottom.height ? -150 : 0
Keys.onTabPressed:
{
if (buttonPagePower.enabled)
root.state = "statePower"
else
root.state = "stateSessions"
}
Keys.onBacktabPressed: { root.state = "stateSessions" }
Behavior on x { NumberAnimation { duration: 150 } }
Behavior on y { NumberAnimation { duration: 150 } }
onLockNav: areaTop.enabled = false
onUnlockNav: areaTop.enabled = true
}
Loader {
id: inputPanel
source: "slice/VirtualKeyboard.qml"
width: areaMain.width
y: areaMain.height - 350 - areaBottom.height
Behavior on y { NumberAnimation { duration: 150 } }
//visible: virtualkeyboard
visible: false
}
}
Item
{
id: areaBottom
x: 0
y: root.height - height
y: areaTop.height + areaMain.height
width: root.width
height: Math.max(
buttonCapsLock.height,
buttonNumLock.height,
buttonKeyboardLayout.height,
buttonWeekday.height,
buttonDate.height,
buttonTime.height
) + 10
height: 35
SlicedButton
{
id: buttonCapsLock
x: 5
y: areaBottom.height - height - 5
y: 5
skewLeft: 0
hasLeftSlice: false
text: "Caps Lock"
highlighted: keyboard.capsLock
onClicked: keyboard.capsLock = !keyboard.capsLock
font: fonts.slicesBottomLeft
}
SlicedButton
{
id: buttonNumLock
x: buttonCapsLock.x + buttonCapsLock.widthPartial + 3
y: areaBottom.height - height - 5
y: 5
text: "Num Lock"
highlighted: keyboard.numLock
onClicked: keyboard.numLock = !keyboard.numLock
font: fonts.slicesBottomLeft
}
SlicedButton
{
id: buttonKeyboardLayout
x: buttonNumLock.x + buttonNumLock.widthPartial + 3
y: areaBottom.height - height - 5
y: 5
text: keyboard.layouts[keyboard.currentLayout].longName
onClicked: {
var newId = keyboard.currentLayout+1;
if (newId >= keyboard.layouts.length)
newId = 0;
keyboard.currentLayout = newId;
}
font: fonts.slicesBottomLeft
}
Item
@ -291,51 +252,42 @@ Rectangle
SlicedButton
{
id: buttonWeekday
enabled: false
x: 5
y: areaBottom.height - height - 5
y: 5
function updateTime()
{
text = new Date().toLocaleString(Qt.locale(),
"dddd")
}
font: fonts.slicesBottomRight
}
SlicedButton
{
id: buttonDate
enabled: false
x: buttonWeekday.x + buttonWeekday.widthPartial + 3
y: areaBottom.height - height - 5
y: 5
function updateTime()
{
text = new Date().toLocaleString(Qt.locale(),
"dd.MM.yyyy")
}
font: fonts.slicesBottomRight
}
SlicedButton
{
id: buttonTime
enabled: false
x: buttonDate.x + buttonDate.widthPartial + 3
y: areaBottom.height - height - 5
y: 5
skewRight: 0
hasRightSlice: false
function updateTime()
{
text = new Date().toLocaleString(Qt.locale(),
"hh:mm:ss")
}
font: fonts.slicesBottomRight
}
}
@ -371,14 +323,14 @@ Rectangle
switch (root.state)
{
case "statePower":
if (wheel.angleDelta.y < 0)
if (wheel.pixelDelta.y < 0)
pagePower.scroll_up()
else
pagePower.scroll_down()
break
case "stateSessions":
if (wheel.angleDelta.y < 0)
if (wheel.pixelDelta.y < 0)
pageSessions.scroll_up()
else
pageSessions.scroll_down()
@ -387,7 +339,7 @@ Rectangle
case "stateUsers":
if (!pageUsers.hasLoginShown)
{
if (wheel.angleDelta.y < 0)
if (wheel.pixelDelta.y < 0)
pageUsers.scroll_up()
else
pageUsers.scroll_down()
@ -396,44 +348,5 @@ Rectangle
}
}
}
function nextScreen() {
switch(root.state)
{
case "statePower":
root.state = "stateSessions";
break;
case "stateSessions":
root.state = "stateUsers";
break;
case "stateUsers":
root.state = (buttonPagePower.enabled) ? "statePower" : "stateSessions";
break;
}
}
function previousScreen() {
switch(root.state)
{
case "statePower":
root.state = "stateUsers";
break;
case "stateSessions":
root.state = (buttonPagePower.enabled) ? "statePower" : "stateUsers";
break;
case "stateUsers":
root.state = "stateSessions";
break;
}
}
Keys.onTabPressed: nextScreen()
Keys.onBacktabPressed: previousScreen()
Keys.onLeftPressed: previousScreen()
Keys.onRightPressed: nextScreen()
}

View file

@ -1,5 +1,5 @@
import QtQuick 2.7
import Qt5Compat.GraphicalEffects
import QtGraphicalEffects 1.0
import SddmComponents 2.0
import QtQuick.Layouts 1.3
@ -10,11 +10,11 @@ Item
property int selectedIndex:
{
if (debug.canPowerOff) return 0
else if (debug.canReboot) return 1
else if (debug.canSuspend) return 2
else if (debug.canHibernate) return 3
else if (debug.canHybridSleep) return 4
if (sddm.canPowerOff) return 0
else if (sddm.canReboot) return 1
else if (sddm.canSuspend) return 2
else if (sddm.canHibernate) return 3
else if (sddm.canHybridSleep) return 4
else return 0
}
@ -64,7 +64,7 @@ Item
Layout.alignment: Qt.AlignVCenter
Layout.minimumHeight: 48
visible: debug.canPowerOff
visible: sddm.canPowerOff
onEntered: selectedIndex = 0
onClicked: { selectedIndex = 0; execute() }
}
@ -80,7 +80,7 @@ Item
Layout.alignment: Qt.AlignVCenter
Layout.minimumHeight: 48
visible: debug.canReboot
visible: sddm.canReboot
onEntered: selectedIndex = 1
onClicked: { selectedIndex = 1; execute() }
@ -98,7 +98,7 @@ Item
Layout.alignment: Qt.AlignVCenter
Layout.minimumHeight: 48
visible: debug.canSuspend
visible: sddm.canSuspend
onEntered: selectedIndex = 2
onClicked: { selectedIndex = 2; execute() }
@ -115,7 +115,7 @@ Item
Layout.alignment: Qt.AlignVCenter
Layout.minimumHeight: 48
visible: debug.canHibernate
visible: sddm.canHibernate
onEntered: selectedIndex = 3
onClicked: { selectedIndex = 3; execute() }
@ -133,7 +133,7 @@ Item
Layout.alignment: Qt.AlignVCenter
Layout.minimumHeight: 48
visible: debug.canHybridSleep
visible: sddm.canHybridSleep
onEntered: selectedIndex = 4
onClicked: { selectedIndex = 4; execute() }
@ -168,23 +168,23 @@ Item
switch (result)
{
case 0:
if (debug.canPowerOff) actionFound = true
if (sddm.canPowerOff) actionFound = true
break
case 1:
if (debug.canReboot) actionFound = true
if (sddm.canReboot) actionFound = true
break
case 2:
if (debug.canSuspend) actionFound = true
if (sddm.canSuspend) actionFound = true
break
case 3:
if (debug.canHibernate) actionFound = true
if (sddm.canHibernate) actionFound = true
break
case 4:
if (debug.canHybridSleep) actionFound = true
if (sddm.canHybridSleep) actionFound = true
break
}
@ -211,23 +211,23 @@ Item
switch (result)
{
case 0:
if (debug.canPowerOff) actionFound = true
if (sddm.canPowerOff) actionFound = true
break
case 1:
if (debug.canReboot) actionFound = true
if (sddm.canReboot) actionFound = true
break
case 2:
if (debug.canSuspend) actionFound = true
if (sddm.canSuspend) actionFound = true
break
case 3:
if (debug.canHibernate) actionFound = true
if (sddm.canHibernate) actionFound = true
break
case 4:
if (debug.canHybridSleep) actionFound = true
if (sddm.canHybridSleep) actionFound = true
break
}

View file

@ -10,7 +10,6 @@ Item
property int scrollRepeat: 0
property string currentUserLogin: get_login(0)
property bool hasLoginShown: true
property bool manual: bool(config.manual)
signal lockNav()
signal unlockNav()
@ -68,12 +67,8 @@ Item
onFocusChanged:
{
if (focus && hasLoginShown) {
if (manual)
loginField.forceActiveFocus()
else
passwordField.forceActiveFocus()
}
if (focus && hasLoginShown)
passwordField.forceActiveFocus()
}
Item
@ -192,11 +187,10 @@ Item
LoopListUserItem
{
id: middleItem
y: hasLoginShown ? pageRoot.height / 2.3 - (middleItem.height / 2 + passwordFieldBg.height + progressBar.height + 2 + buttonUserLogin.height) / 2 : pageRoot.height / 2.3
y: hasLoginShown ? pageRoot.height / 2.3 - 40 : pageRoot.height / 2.3
userName: get_name(0)
userLogin: get_login(0)
userAvatar: get_avatar(0)
visible: !manual
}
LoopListUserItem
@ -229,178 +223,150 @@ Item
userAvatar: get_avatar(3)
}
Item {
id: loginControls
y: manual ? middleItem.y : middleItem.y + middleItem.height + 2
TextInput
{
id: passwordField
x: 10
y: hasLoginShown ? pageRoot.height / 2.3 + 37 : pageRoot.height / 2.3 + 62
width: parent.width - 20
height: 25
opacity: hasLoginShown ? 1 : 0
color: colors.inputText
selectionColor: colors.inputSelectionBg
selectedTextColor: colors.inputSelectionText
echoMode: TextInput.Password
clip: true
selectByMouse: true
font
{
family: config.font
bold: true
pointSize: 18
}
Component.onCompleted: forceActiveFocus()
}
Text
{
id: passwordFieldPlaceholder
x: passwordField.x
y: passwordField.y
width: passwordField.width
opacity: hasLoginShown ? 1 : 0
visible: passwordField.text.length <= 0
color: colors.inputPlaceholderText
font
{
family: config.font
bold: true
pointSize: 18
}
text: localeText.password
}
Rectangle {
id: passwordFieldBg
y: hasLoginShown ? pageRoot.height / 2.3 + 30 : pageRoot.height / 2.3 + 55
width: parent.width
height: 40
opacity: hasLoginShown ? 1 : 0
color: colors.inputBg
}
Rectangle
Rectangle
{
id: progressBar
y: hasLoginShown ? pageRoot.height / 2.3 + 70 : pageRoot.height / 2.3 + 105
width: parent.width
height: 2
opacity: hasLoginShown ? 1 : 0
color: colors.progressBar
}
Rectangle
{
id: progressBarBg
y: progressBar.y
width: parent.width
height: 2
opacity: 0
color: colors.progressBarBg
}
Rectangle
{
id: progressBarSlider1
x: 0
y: progressBar.y
width: parent.width / 5
height: 2
opacity: 0
color: colors.progressBarSlider
}
Rectangle
{
id: progressBarSlider2
x: parent.width
y: progressBar.y
width: 0
height: 2
opacity: 0
color: colors.progressBarSlider
}
SlicedButton
{
id: buttonUserLogin
x: userListContainer.width - widthFull
y: hasLoginShown ? pageRoot.height / 2.3 + 74 : pageRoot.height / 2.3 + 109
paddingTop: 2
highlighted: true
opacity: hasLoginShown ? 1 : 0
text: localeText.login
onClicked: select_or_login()
}
SlicedButton
{
id: buttonUserBack
x: userListContainer.width - widthFull - buttonUserLogin.widthPartial - 3
y: hasLoginShown ? pageRoot.height / 2.3 + 74 : pageRoot.height / 2.3 + 109
paddingTop: 2
opacity: hasLoginShown ? 1 : 0
text: qsTr("Back")
onClicked: back_to_selection()
}
Text
{
id: errorMessage
text: localeText.loginFailed
anchors.horizontalCenter: parent.horizontalCenter
y: pageRoot.height / 4.7
opacity: 0
color: colors.errorText
font
{
id: loginFieldBg
y: 0
width: parent.width
height: Math.max(fonts.input.pointSize, fonts.placeholder.pointSize) + 20
opacity: hasLoginShown && manual ? 1 : 0
color: colors.inputBg
family: config.font
bold: true
pointSize: 18
}
TextInput
{
id: loginField
x: 10
y: (loginFieldBg.height - height) / 2 + loginFieldBg.y
width: parent.width - 20
opacity: hasLoginShown && manual ? 1 : 0
color: colors.inputText
selectionColor: colors.inputSelectionBg
selectedTextColor: colors.inputSelectionText
clip: true
selectByMouse: true
font: fonts.loginInput
Component.onCompleted: if (manual) forceActiveFocus()
Keys.onTabPressed: passwordField.forceActiveFocus()
}
Text
{
id: loginFieldPlaceholder
x: loginField.x
y: (loginFieldBg.height - height) / 2 + loginFieldBg.y
width: loginField.width
opacity: hasLoginShown && manual ? 1 : 0
visible: loginField.text.length <= 0
color: colors.inputPlaceholderText
font: fonts.placeholder
text: localeText.userName
}
Rectangle
{
id: passwordFieldBg
y: manual ? loginFieldBg.y + loginFieldBg.height + 2 : 0
width: parent.width
height: Math.max(fonts.input.pointSize, fonts.placeholder.pointSize) + 20
opacity: hasLoginShown ? 1 : 0
color: colors.inputBg
}
TextInput
{
id: passwordField
x: 10
y: (passwordFieldBg.height - height) / 2 + passwordFieldBg.y
width: parent.width - 20
opacity: hasLoginShown ? 1 : 0
color: colors.inputText
selectionColor: colors.inputSelectionBg
selectedTextColor: colors.inputSelectionText
echoMode: TextInput.Password
clip: true
selectByMouse: true
font: fonts.input
Component.onCompleted: forceActiveFocus()
Keys.onBacktabPressed: { if (manual) loginField.forceActiveFocus(); else event.accepted = false; }
}
Text
{
id: passwordFieldPlaceholder
x: passwordField.x
y: (passwordFieldBg.height - height) / 2 + passwordFieldBg.y
width: passwordField.width
opacity: hasLoginShown ? 1 : 0
visible: passwordField.text.length <= 0
color: colors.inputPlaceholderText
font: fonts.placeholder
text: localeText.password
}
Rectangle
{
id: progressBar
y: passwordFieldBg.y + passwordFieldBg.height
width: parent.width
height: 2
opacity: hasLoginShown ? 1 : 0
color: colors.progressBar
}
Rectangle
{
id: progressBarBg
y: progressBar.y
width: parent.width
height: 2
opacity: 0
color: colors.progressBarBg
}
Rectangle
{
id: progressBarSlider1
x: 0
y: progressBar.y
width: parent.width / 5
height: 2
opacity: 0
color: colors.progressBarSlider
}
Rectangle
{
id: progressBarSlider2
x: parent.width
y: progressBar.y
width: 0
height: 2
opacity: 0
color: colors.progressBarSlider
}
SlicedButton
{
id: buttonUserLogin
x: userListContainer.width - widthFull
y: progressBar.y + progressBar.height + 2
paddingTop: 2
highlighted: true
opacity: hasLoginShown ? 1 : 0
text: localeText.login
onClicked: select_or_login()
font: fonts.slicesLoginButtons
}
SlicedButton
{
id: buttonUserBack
x: userListContainer.width - widthFull - buttonUserLogin.widthPartial - 3
y: buttonUserLogin.y
paddingTop: 2
opacity: hasLoginShown ? 1 : 0
visible: !manual
text: qsTr("Back")
onClicked: back_to_selection()
font: fonts.slicesLoginButtons
}
Behavior on opacity { NumberAnimation { duration: userListContainer.scrollDuration } }
}
@ -417,22 +383,6 @@ Item
Behavior on opacity { NumberAnimation { duration: userListContainer.scrollDuration } }
}
Text
{
id: errorMessage
text: localeText.loginFailed
anchors.horizontalCenter: parent.horizontalCenter
y: pageRoot.height / 4.7
opacity: 0
color: colors.errorText
font: fonts.error
Behavior on opacity { NumberAnimation { duration: userListContainer.scrollDuration } }
}
ParallelAnimation
{
id: progressBarLoop
@ -478,11 +428,8 @@ Item
NumberAnimation { target: botMidItem; property: "distance"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: botFarItem; property: "distance"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: middleItem; property: "y"; to: pageRoot.height / 2.3 - (middleItem.height / 2 + passwordFieldBg.height + progressBar.height + 2 + buttonUserLogin.height) / 2; duration: userListContainer.scrollDuration }
NumberAnimation { target: middleItem; property: "y"; to: pageRoot.height / 2.3 - 40; duration: userListContainer.scrollDuration }
NumberAnimation { target: loginField; property: "opacity"; to: 1; duration: userListContainer.scrollDuration }
NumberAnimation { target: loginFieldPlaceholder; property: "opacity"; to: 1; duration: userListContainer.scrollDuration }
NumberAnimation { target: loginFieldBg; property: "opacity"; to: 1; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordField; property: "opacity"; to: 1; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordFieldPlaceholder; property: "opacity"; to: 1; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordFieldBg; property: "opacity"; to: 1; duration: userListContainer.scrollDuration }
@ -490,6 +437,12 @@ Item
NumberAnimation { target: buttonUserBack; property: "opacity"; to: 1; duration: userListContainer.scrollDuration }
NumberAnimation { target: buttonUserLogin; property: "opacity"; to: 1; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordField; property: "y"; to: pageRoot.height / 2.3 + 37; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordFieldBg; property: "y"; to: pageRoot.height / 2.3 + 30; duration: userListContainer.scrollDuration }
NumberAnimation { target: progressBar; property: "y"; to: pageRoot.height / 2.3 + 70; duration: userListContainer.scrollDuration }
NumberAnimation { target: buttonUserBack; property: "y"; to: pageRoot.height / 2.3 + 74; duration: userListContainer.scrollDuration }
NumberAnimation { target: buttonUserLogin; property: "y"; to: pageRoot.height / 2.3 + 74; duration: userListContainer.scrollDuration }
onStopped:
{
hasLoginShown = true
@ -507,9 +460,6 @@ Item
NumberAnimation { target: middleItem; property: "y"; to: pageRoot.height / 2.3; duration: userListContainer.scrollDuration }
NumberAnimation { target: loginField; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: loginFieldPlaceholder; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: loginFieldBg; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordField; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordFieldPlaceholder; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordFieldBg; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
@ -517,6 +467,12 @@ Item
NumberAnimation { target: buttonUserBack; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: buttonUserLogin; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordField; property: "y"; to: pageRoot.height / 2.3 + 62; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordFieldBg; property: "y"; to: pageRoot.height / 2.3 + 55; duration: userListContainer.scrollDuration }
NumberAnimation { target: progressBar; property: "y"; to: pageRoot.height / 2.3 + 105; duration: userListContainer.scrollDuration }
NumberAnimation { target: buttonUserBack; property: "y"; to: pageRoot.height / 2.3 + 109; duration: userListContainer.scrollDuration }
NumberAnimation { target: buttonUserLogin; property: "y"; to: pageRoot.height / 2.3 + 109; duration: userListContainer.scrollDuration }
onStopped:
{
hasLoginShown = false
@ -605,7 +561,7 @@ Item
id: loginEnterAnimation
NumberAnimation { target: passwordField; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordFieldBg; property: "height"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: loginControls; property: "y"; to: pageRoot.height / 2.3 - (middleItem.height / 2 + progressBar.height + 2) / 2; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordFieldBg; property: "y"; to: pageRoot.height / 2.3 + 70; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordFieldPlaceholder; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: buttonUserBack; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: buttonUserLogin; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
@ -622,7 +578,7 @@ Item
id: loginExitAnimation
NumberAnimation { target: passwordField; property: "opacity"; to: 1; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordFieldBg; property: "height"; to: 40; duration: userListContainer.scrollDuration }
NumberAnimation { target: loginControls; property: "y"; to: pageRoot.height / 2.3 - (middleItem.height / 2 + passwordFieldBg.height + progressBar.height + 2 + buttonUserLogin.height) / 2; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordFieldBg; property: "y"; to: pageRoot.height / 2.3 + 30; duration: userListContainer.scrollDuration }
NumberAnimation { target: passwordFieldPlaceholder; property: "opacity"; to: 1; duration: userListContainer.scrollDuration }
NumberAnimation { target: buttonUserBack; property: "opacity"; to: 1; duration: userListContainer.scrollDuration }
NumberAnimation { target: buttonUserLogin; property: "opacity"; to: 1; duration: userListContainer.scrollDuration }
@ -630,7 +586,7 @@ Item
NumberAnimation { target: progressBarSlider1; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: progressBarSlider2; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: progressBarBg; property: "opacity"; to: 0; duration: userListContainer.scrollDuration }
NumberAnimation { target: middleItem; property: "y"; to: pageRoot.height / 2.3 - (middleItem.height / 2 + passwordFieldBg.height + progressBar.height + 2 + buttonUserLogin.height) / 2; duration: userListContainer.scrollDuration }
NumberAnimation { target: middleItem; property: "y"; to: pageRoot.height / 2.3 - 40; duration: userListContainer.scrollDuration }
onStopped:
{
@ -686,16 +642,9 @@ Item
pageRoot.enabled = false
progressBarLoop.start()
loginEnterAnimation.start()
if (debug.loginError)
loginTimeoutTimer.start()
else {
if (manual)
sddm.login(loginField.text, passwordField.text, selectedSessionIndex)
else
sddm.login(currentUserLogin, passwordField.text, selectedSessionIndex)
}
sddm.login(currentUserLogin, passwordField.text, selectedSessionIndex)
}
else if (!manual)
else
{
topFarItem.hoverEnabled = false
topMidItem.hoverEnabled = false
@ -708,7 +657,7 @@ Item
function back_to_selection()
{
if (hasLoginShown && !manual)
if (hasLoginShown)
{
topFarItem.hoverEnabled = true
topMidItem.hoverEnabled = true
@ -721,37 +670,10 @@ Item
}
}
Timer
{
id: loginTimeoutTimer
interval: debug.loginTimeout * 1000
onTriggered: sddm.onLoginFailed()
}
Keys.onUpPressed: {
if (manual && hasLoginShown && passwordField.activeFocus) {
loginField.forceActiveFocus()
} else
scroll_down()
}
Keys.onDownPressed: {
if (manual && hasLoginShown && loginField.activeFocus) {
passwordField.forceActiveFocus()
} else
scroll_up()
}
Keys.onEnterPressed: {
if (hasLoginShown && !passwordField.activeFocus)
passwordField.forceActiveFocus()
else
select_or_login()
}
Keys.onReturnPressed: {
if (hasLoginShown && !passwordField.activeFocus)
passwordField.forceActiveFocus()
else
select_or_login()
}
Keys.onUpPressed: scroll_down()
Keys.onDownPressed: scroll_up()
Keys.onEnterPressed: select_or_login()
Keys.onReturnPressed: select_or_login()
Keys.onEscapePressed: back_to_selection()
}

View file

@ -3,25 +3,20 @@ import QtQuick 2.7
Item
{
id: buttonRoot
height: paddingTop * 2 + buttonText.height
property font font: Qt.font({
family: config.font,
bold: true,
pointSize: 13,
capitalization: Font.AllUppercase,
smooth: false
});
height: 25
property int fontSize: 13
property string text: ""
property bool highlighted: false
property int skewLeft: 15
property int skewRight: 15
property bool hasLeftSlice: true
property bool hasRightSlice: true
readonly property int paddingLeft: Math.max(Math.abs(skewLeft), 5)
property bool highlighted: false
readonly property int skew: 15
readonly property int paddingLeft: hasLeftSlice ? skew : 5
property int paddingTop: 3
readonly property int paddingRight: Math.max(Math.abs(skewRight), 5)
readonly property int paddingRight: hasRightSlice ? skew : 5
readonly property int widthFull: buttonText.width + paddingLeft + paddingRight
readonly property int widthPartial: buttonText.width + paddingLeft
@ -48,7 +43,8 @@ Item
onHighlightedChanged:
{
buttonBg.requestPaint()
buttonBgSliceLeft.requestPaint()
buttonBgSliceRight.requestPaint()
}
onTextChanged:
@ -64,7 +60,19 @@ Item
name: "idle"
PropertyChanges
{
target: buttonBg;
target: buttonBgSliceLeft;
bgColor: highlighted ? bgIdleHighlighted : bgIdle
}
PropertyChanges
{
target: buttonBgCenter;
color: highlighted ? bgIdleHighlighted : bgIdle
}
PropertyChanges
{
target: buttonBgSliceRight;
bgColor: highlighted ? bgIdleHighlighted : bgIdle
}
@ -79,7 +87,19 @@ Item
name: "hover"
PropertyChanges
{
target: buttonBg;
target: buttonBgSliceLeft;
bgColor: highlighted ? bgHoverHighlighted : bgHover
}
PropertyChanges
{
target: buttonBgCenter;
color: highlighted ? bgHoverHighlighted : bgHover
}
PropertyChanges
{
target: buttonBgSliceRight;
bgColor: highlighted ? bgHoverHighlighted : bgHover
}
@ -93,47 +113,96 @@ Item
Canvas
{
id: buttonBg
id: buttonBgSliceLeft
width: widthFull
width: paddingLeft
height: parent.height
property string bgColor: colors.buttonBg
onPaint:
{
var context = getContext("2d");
var context = getContext("2d")
context.clearRect(0, 0, width, height);
context.fillStyle = bgColor
context.beginPath()
context.moveTo(paddingLeft, height);
if (skewLeft > 0) {
context.lineTo(0, height);
context.lineTo(skewLeft, 0);
} else if (skewLeft < 0) {
context.lineTo(Math.abs(skewLeft), height);
context.lineTo(0, 0);
} else {
context.lineTo(0, height);
context.lineTo(0, 0);
if (buttonRoot.hasLeftSlice)
context.moveTo(paddingLeft, 0)
else
{
context.moveTo(0, 0)
context.lineTo(paddingLeft, 0)
}
context.lineTo(widthPartial, 0);
context.lineTo(paddingLeft, height)
context.lineTo(0, height)
context.closePath()
context.fill()
}
if (skewRight > 0) {
context.lineTo(width, 0);
context.lineTo(width-skewRight, height);
} else if (skewRight < 0) {
context.lineTo(width+skewRight, 0);
context.lineTo(width, height);
} else {
context.lineTo(width, 0);
context.lineTo(width, height);
Behavior on x
{
PropertyAnimation { duration: 100 }
}
}
Rectangle
{
id: buttonBgCenter
color: colors.buttonBg
x: paddingLeft
width: buttonText.width
height: parent.height
Behavior on width
{
PropertyAnimation
{
duration: 100
onStopped:
{
buttonRoot.showTextAnimation.start()
}
}
}
context.lineTo(paddingLeft, height);
Behavior on x
{
PropertyAnimation { duration: 100 }
}
}
Canvas
{
id: buttonBgSliceRight
x: widthPartial
width: paddingRight
height: parent.height
property string bgColor: colors.buttonBg
onPaint:
{
var context = getContext("2d")
context.clearRect(0, 0, paddingRight, height);
context.fillStyle = bgColor
context.beginPath()
context.moveTo(0, 0)
context.lineTo(paddingRight, 0)
if (!buttonRoot.hasRightSlice)
context.lineTo(paddingRight, height)
context.lineTo(0, height)
context.closePath()
context.fill()
}
@ -142,14 +211,9 @@ Item
{
PropertyAnimation { duration: 100 }
}
Behavior on width
{
PropertyAnimation { duration: 100 }
}
}
Text
{
id: buttonText
@ -157,9 +221,16 @@ Item
y: paddingTop
color: colors.buttonText
font: buttonRoot.font
font
{
family: config.font
bold: true
pointSize: fontSize
capitalization: Font.AllUppercase
}
text: ""
}
MouseArea
@ -173,13 +244,15 @@ Item
onEntered:
{
buttonRoot.state = "hover"
buttonBg.requestPaint()
buttonBgSliceLeft.requestPaint()
buttonBgSliceRight.requestPaint()
}
onExited:
{
buttonRoot.state = "idle"
buttonBg.requestPaint()
buttonBgSliceLeft.requestPaint()
buttonBgSliceRight.requestPaint()
}
onClicked: buttonRoot.clicked()

View file

@ -1,7 +0,0 @@
import QtQuick 2.7
import QtQuick.VirtualKeyboard 2.1
InputPanel {
id: inputPanel
width: parent.width
}

View file

@ -2,12 +2,11 @@
Name=Slice
Description=Simple SDDM theme.
Author=RadRussianRus
Copyright=(c) 2020, RadRussianRus
Copyright=(c) 2018, RadRussianRus
License=CC-BY-SA
Type=sddm-theme
Screenshot=screenshot.png
Website=https://github.com/RadRussianRus/sddm-slice
Version=1.5.1
Website=https://github.com/RadRussianRus/slice-sddm
Version=1.0
MainScript=Main.qml
TranslationsDirectory=translations
ConfigFile=theme.conf
ConfigFile=theme.conf

View file

@ -6,5 +6,4 @@ parallax_bg_shift=20
color_bg=#222222
color_main=#dddddd
color_dimmed=#888888
color_contrast=#1f1f1f
manual=false
color_contrast=#1f1f1f

Binary file not shown.

View file

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="nl">
<context>
<name>PagePower</name>
<message>
<source>Suspend</source>
<translation>Pauzestand</translation>
</message>
<message>
<source>Hibernate</source>
<translation>Slaapstand</translation>
</message>
<message>
<source>Hybrid Sleep</source>
<translation>Hybride slaapstand</translation>
</message>
</context>
<context>
<name>PageUsers</name>
<message>
<source>Back</source>
<translation>Terug</translation>
</message>
</context>
</TS>