History

FB11511 - position of log windows should be persistent between invocations of interface

Alexander Ivash committed 8 years ago

Commit 1ed7d161 parent 579d9a83 files · +49 −4Browse files

Showing the changes to scripts/developer/debugging/debugWindow.js (1 of 3 files). Show all

Unified · Split

scripts/developer/debugging/debugWindow.js+34−3
@@ -22,14 +22,37 @@ if (scripts.length >= 2) { · 21 unmodified lines
22// Set up the qml ui22// Set up the qml ui
23var qml = Script.resolvePath('debugWindow.qml');23var qml = Script.resolvePath('debugWindow.qml');
24 24
25var HMD_DEBUG_WINDOW_GEOMETRY_KEY = 'hmdDebugWindowGeometry';
26var hmdDebugWindowGeometryValue = Settings.getValue(HMD_DEBUG_WINDOW_GEOMETRY_KEY)
27
28var windowWidth = 400;
29var windowHeight = 900;
30
31var hasPosition = false;
32var windowX = 0;
33var windowY = 0;
34
35if (hmdDebugWindowGeometryValue !== '') {
36 var geometry = JSON.parse(hmdDebugWindowGeometryValue);
37
38 windowWidth = geometry.width
39 windowHeight = geometry.height
40 windowX = geometry.x
41 windowY = geometry.y
42 hasPosition = true;
43}
44
25var window = new OverlayWindow({45var window = new OverlayWindow({
26 title: 'Debug Window',46 title: 'Debug Window',
27 source: qml,47 source: qml,
28 width: 400, height: 900,48 width: windowWidth, height: windowHeight,
29});49});
30 50
31window.setPosition(25, 50);51if (hasPosition) {
32window.closed.connect(function() { Script.stop(); });52 window.setPosition(windowX, windowY);
53}
54
55window.closed.connect(function () { Script.stop(); });
33 56
34var getFormattedDate = function() {57var getFormattedDate = function() {
35 var date = new Date();58 var date = new Date();
@@ -65,6 +88,14 @@ ScriptDiscoveryService.clearDebugWindow.connect(function() { · 29 unmodified lines
65});88});
66 89
67Script.scriptEnding.connect(function () {90Script.scriptEnding.connect(function () {
91 var geometry = JSON.stringify({
92 x: window.position.x,
93 y: window.position.y,
94 width: window.size.x,
95 height: window.size.y
96 })
97
98 Settings.setValue(HMD_DEBUG_WINDOW_GEOMETRY_KEY, geometry);
68 window.close();99 window.close();
69})100})
70 101