-
Notifications
You must be signed in to change notification settings - Fork 21
/
Screen.qml
39 lines (33 loc) · 1.2 KB
/
Screen.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// defines various actions and registers their triggers
import QtQuick 2.0
Item {
id : screen
property bool keepScreenOn : false
property var screenInstance : null
onKeepScreenOnChanged : {
if (screenInstance != null) {
screenInstance.suspend = keepScreenOn
if (keepScreenOn) {
rWin.log.info("screen blanking enabled")
} else {
rWin.log.info("screen blanking disabled")
}
}
}
Component.onCompleted : {
initScreen()
}
function initScreen() {
// the screen control module might not be available on
// all platforms so we need to handle import failure
// (real conditional imports would be nice, wouldn't they ;))
// TODO: handle also other platforms than Sailfish OS
var sailfishScreenInstance = rWin.loadQMLFile("sailfish_specific/SailfishScreen.qml", {}, true)
if (sailfishScreenInstance) {
rWin.log.info("Screen: screen blanking control initialized")
screen.screenInstance = sailfishScreenInstance
} else {
rWin.log.info("Screen: screen blanking control is not available")
}
}
}