Added debug mode
This commit is contained in:
parent
24fcb0140b
commit
207943bc0b
4 changed files with 94 additions and 22 deletions
20
README.md
20
README.md
|
|
@ -23,6 +23,26 @@ Create file `theme.conf.user` in theme folder. See `slice/theme.conf` for refere
|
||||||
* `bg_mode` - background image fill mode. Can be either `aspect`, `fill`, `tile` or `none`. Defaults to `aspect`.
|
* `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`.
|
* `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`.
|
||||||
|
|
||||||
|
### Debug mode options
|
||||||
|
|
||||||
|
Since "Power" screen can't be viewed in greeter because it depends on `sddm.*` properties, 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").
|
||||||
|
|
||||||
|
#### String options
|
||||||
|
|
||||||
|
* `debug_hostname` - sets `sddm.hostName`.
|
||||||
|
|
||||||
|
|
||||||
### Color scheme
|
### Color scheme
|
||||||
|
|
||||||
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):
|
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):
|
||||||
|
|
|
||||||
37
slice/Debug.qml
Normal file
37
slice/Debug.qml
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
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 string hostName: debugstr(config.debug_hostname, sddm.hostName)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -56,7 +56,22 @@ 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();
|
||||||
|
}
|
||||||
|
|
||||||
TextConstants { id: localeText }
|
TextConstants { id: localeText }
|
||||||
|
Debug { id: debug }
|
||||||
|
|
||||||
function bgFillMode() {
|
function bgFillMode() {
|
||||||
|
|
||||||
|
|
@ -107,9 +122,9 @@ Rectangle
|
||||||
y: 5
|
y: 5
|
||||||
|
|
||||||
hasLeftSlice: false
|
hasLeftSlice: false
|
||||||
text: sddm.hostName ? sddm.hostName : "Hostname"
|
text: debug.hostName ? debug.hostName : "Hostname"
|
||||||
|
|
||||||
enabled: sddm.canPowerOff || sddm.canReboot || sddm.canSuspend || sddm.canHibernate || sddm.canHybridSleep
|
enabled: debug.canPowerOff || debug.canReboot || debug.canSuspend || debug.canHibernate || debug.canHybridSleep
|
||||||
|
|
||||||
onClicked: if (enabled) root.state = "statePower"
|
onClicked: if (enabled) root.state = "statePower"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@ Item
|
||||||
|
|
||||||
property int selectedIndex:
|
property int selectedIndex:
|
||||||
{
|
{
|
||||||
if (sddm.canPowerOff) return 0
|
if (debug.canPowerOff) return 0
|
||||||
else if (sddm.canReboot) return 1
|
else if (debug.canReboot) return 1
|
||||||
else if (sddm.canSuspend) return 2
|
else if (debug.canSuspend) return 2
|
||||||
else if (sddm.canHibernate) return 3
|
else if (debug.canHibernate) return 3
|
||||||
else if (sddm.canHybridSleep) return 4
|
else if (debug.canHybridSleep) return 4
|
||||||
else return 0
|
else return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ Item
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.minimumHeight: 48
|
Layout.minimumHeight: 48
|
||||||
|
|
||||||
visible: sddm.canPowerOff
|
visible: debug.canPowerOff
|
||||||
onEntered: selectedIndex = 0
|
onEntered: selectedIndex = 0
|
||||||
onClicked: { selectedIndex = 0; execute() }
|
onClicked: { selectedIndex = 0; execute() }
|
||||||
}
|
}
|
||||||
|
|
@ -80,7 +80,7 @@ Item
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.minimumHeight: 48
|
Layout.minimumHeight: 48
|
||||||
|
|
||||||
visible: sddm.canReboot
|
visible: debug.canReboot
|
||||||
|
|
||||||
onEntered: selectedIndex = 1
|
onEntered: selectedIndex = 1
|
||||||
onClicked: { selectedIndex = 1; execute() }
|
onClicked: { selectedIndex = 1; execute() }
|
||||||
|
|
@ -98,7 +98,7 @@ Item
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.minimumHeight: 48
|
Layout.minimumHeight: 48
|
||||||
|
|
||||||
visible: sddm.canSuspend
|
visible: debug.canSuspend
|
||||||
|
|
||||||
onEntered: selectedIndex = 2
|
onEntered: selectedIndex = 2
|
||||||
onClicked: { selectedIndex = 2; execute() }
|
onClicked: { selectedIndex = 2; execute() }
|
||||||
|
|
@ -115,7 +115,7 @@ Item
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.minimumHeight: 48
|
Layout.minimumHeight: 48
|
||||||
|
|
||||||
visible: sddm.canHibernate
|
visible: debug.canHibernate
|
||||||
|
|
||||||
onEntered: selectedIndex = 3
|
onEntered: selectedIndex = 3
|
||||||
onClicked: { selectedIndex = 3; execute() }
|
onClicked: { selectedIndex = 3; execute() }
|
||||||
|
|
@ -133,7 +133,7 @@ Item
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.minimumHeight: 48
|
Layout.minimumHeight: 48
|
||||||
|
|
||||||
visible: sddm.canHybridSleep
|
visible: debug.canHybridSleep
|
||||||
|
|
||||||
onEntered: selectedIndex = 4
|
onEntered: selectedIndex = 4
|
||||||
onClicked: { selectedIndex = 4; execute() }
|
onClicked: { selectedIndex = 4; execute() }
|
||||||
|
|
@ -168,23 +168,23 @@ Item
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if (sddm.canPowerOff) actionFound = true
|
if (debug.canPowerOff) actionFound = true
|
||||||
break
|
break
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
if (sddm.canReboot) actionFound = true
|
if (debug.canReboot) actionFound = true
|
||||||
break
|
break
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if (sddm.canSuspend) actionFound = true
|
if (debug.canSuspend) actionFound = true
|
||||||
break
|
break
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
if (sddm.canHibernate) actionFound = true
|
if (debug.canHibernate) actionFound = true
|
||||||
break
|
break
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
if (sddm.canHybridSleep) actionFound = true
|
if (debug.canHybridSleep) actionFound = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,23 +211,23 @@ Item
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if (sddm.canPowerOff) actionFound = true
|
if (debug.canPowerOff) actionFound = true
|
||||||
break
|
break
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
if (sddm.canReboot) actionFound = true
|
if (debug.canReboot) actionFound = true
|
||||||
break
|
break
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if (sddm.canSuspend) actionFound = true
|
if (debug.canSuspend) actionFound = true
|
||||||
break
|
break
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
if (sddm.canHibernate) actionFound = true
|
if (debug.canHibernate) actionFound = true
|
||||||
break
|
break
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
if (sddm.canHybridSleep) actionFound = true
|
if (debug.canHybridSleep) actionFound = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue