Code cleaning and comments in our test tab.
1.1 --- a/TestsTab.qml Sun Jun 01 21:15:33 2014 +0200
1.2 +++ b/TestsTab.qml Sun Jun 01 21:34:29 2014 +0200
1.3 @@ -16,11 +16,11 @@
1.4
1.5 //This window is our VFD frame
1.6 Window {
1.7 - //parent: appWindow
1.8 - id: splash
1.9 + id: frameWindow
1.10 color: "transparent"
1.11 - title: "Splash Window"
1.12 + title: "VFD Window"
1.13 modality: Qt.NonModal
1.14 + //Splash screen type do not have any border which is what we want
1.15 flags: Qt.SplashScreen
1.16 //24 FPS
1.17 //property int timeoutInterval: 41
1.18 @@ -29,8 +29,8 @@
1.19 signal timeout
1.20 //! [splash-properties]
1.21 //! [screen-properties]
1.22 - //x: (Screen.width - rectangleScreen.width) / 2
1.23 - //y: (Screen.height - rectangleScreen.height) / 2
1.24 + //Here comes some trick to keep our display frame within our app.
1.25 + //This make sure this window follows our app window.
1.26 x: appWindow.x+appWindow.width-256-13
1.27 y: appWindow.y+appWindow.height-64-30
1.28
1.29 @@ -110,19 +110,19 @@
1.30 //! [timer]
1.31 Timer {
1.32 id: timer
1.33 - interval: splash.timeoutInterval; running: true; repeat: true
1.34 + interval: frameWindow.timeoutInterval; running: true; repeat: true
1.35 property bool doFill: true
1.36 onTriggered: {
1.37 //visible = false
1.38
1.39 var current = new Date();
1.40 - var milliseconds = (current.getTime() - splash.startTime.getTime());
1.41 + var milliseconds = (current.getTime() - frameWindow.startTime.getTime());
1.42
1.43 - splash.frameCounter++;
1.44 - labelFrameCount.text=splash.frameCounter;
1.45 + frameWindow.frameCounter++;
1.46 + labelFrameCount.text=frameWindow.frameCounter;
1.47 labelTime.text=milliseconds/1000;
1.48 - labelTimePerFrame.text=(milliseconds/splash.frameCounter).toFixed(3);
1.49 - labelFps.text=(1000/(milliseconds/splash.frameCounter)).toFixed(0);
1.50 + labelTimePerFrame.text=(milliseconds/frameWindow.frameCounter).toFixed(3);
1.51 + labelFps.text=(1000/(milliseconds/frameWindow.frameCounter)).toFixed(0);
1.52
1.53 if (checkBoxDoClear.checked)
1.54 {
1.55 @@ -143,18 +143,18 @@
1.56 display.clear();
1.57 }
1.58
1.59 - if (splash.frameCounter%2)
1.60 + if (frameWindow.frameCounter%2)
1.61 {
1.62 doFill=!doFill;
1.63 }
1.64 }
1.65 else if (checkBoxOnePixelOnly.checked)
1.66 {
1.67 - display.setPixel(0,0,splash.frameCounter%2);
1.68 + display.setPixel(0,0,frameWindow.frameCounter%2);
1.69 }
1.70 else
1.71 {
1.72 - display.renderWindow(splash);
1.73 + display.renderWindow(frameWindow);
1.74 }
1.75
1.76 if (!checkBoxNoSwapBuffers.checked)
1.77 @@ -164,9 +164,8 @@
1.78
1.79 }
1.80
1.81 -
1.82 -
1.83 - splash.timeout();
1.84 + //Signal our timeout
1.85 + frameWindow.timeout();
1.86 }
1.87 }
1.88 //! [timer]
1.89 @@ -184,7 +183,7 @@
1.90 Button {
1.91 text: qsTr("Render Window")
1.92 onClicked: {
1.93 - display.renderWindow(splash);
1.94 + display.renderWindow(frameWindow);
1.95 display.swapBuffers();
1.96 }
1.97 }
1.98 @@ -192,8 +191,8 @@
1.99 Button {
1.100 text: qsTr("Reset stats")
1.101 onClicked: {
1.102 - splash.startTime = new Date();
1.103 - splash.frameCounter = 0;
1.104 + frameWindow.startTime = new Date();
1.105 + frameWindow.frameCounter = 0;
1.106 }
1.107 }
1.108