forked from JackV2020/life
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLifeApp.qml
More file actions
85 lines (57 loc) · 2.55 KB
/
Copy pathLifeApp.qml
File metadata and controls
85 lines (57 loc) · 2.55 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import QtQuick 2.1
import qb.components 1.0
import qb.base 1.0;
App {
property url tileUrl : "LifeTile.qml"
property LifeTile lifeTile
property url lifeScreenUrl : "LifeScreen.qml"
property LifeScreen lifeScreen
property bool keepLifeOnScreen : false
// The next 6 are for some book keeping to put messages on the tile when there is something new
// Calculation is done in LifeScreen.qml where everything happens anyway
property real examplesCount : 0
property real examplesCountPrevious : 0
property real examplesCountNew : 0
property real themesCount : 0
property real themesCountPrevious : 0
property real themesCountNew : 0
// ---------------------------------------- Register the App in the GUI
function init() {
const args = {
thumbCategory : "general",
thumbLabel : "Life",
thumbIcon : "qrc:/tsc/pushon.png",
thumbIconVAlignment : "center",
thumbWeight : 30
}
registry.registerWidget("tile", tileUrl, this, "lifeTile", args);
registry.registerWidget("screen", lifeScreenUrl, this, "lifeScreen");
}
// ------------------------------------- Actions right after APP startup
Component.onCompleted: {
log("App onCompleted Started")
log("App onCompleted Completed")
}
// -------------------- A function to log to the console with timestamps
function log(tolog) {
var now = new Date();
var dateTime = now.getFullYear() + '-' +
('00'+(now.getMonth() + 1) ).slice(-2) + '-' +
('00'+ now.getDate() ).slice(-2) + ' ' +
('00'+ now.getHours() ).slice(-2) + ":" +
('00'+ now.getMinutes() ).slice(-2) + ":" +
('00'+ now.getSeconds() ).slice(-2) + "." +
('000'+now.getMilliseconds() ).slice(-3);
// This is a line with the name of the app in it so I can filter the log
console.log(dateTime+' Life : ' + tolog.toString())
try { logscreen.log( 'Life : ' + tolog.toString() ) }
// catch(e) { console.log(dateTime+' Life : LogScreen not available (yet).') }
catch(e) { var dummy = 0 }
}
// ---------------------------------------------------------------------
function listProperty(item){
for (var p in item)
log(p + " : " + item[p]);
}
// ---------------------------------------------------------------------
}