sl@0: import QtQuick 2.2 sl@0: import QtQuick.Controls 1.2 sl@15: import QtQuick.Window 2.1 sl@15: import MiniDisplay 1.0 sl@15: import QtQuick.Layouts 1.1 sl@15: sl@0: sl@0: Item { sl@17: id: testTab sl@15: //width: 100 sl@15: //height: 62 sl@0: //SystemPalette { id: palette } sl@0: clip: true sl@15: //anchors.fill:parent sl@0: sl@15: sl@18: //This window is our VFD frame sl@15: Window { sl@15: //parent: appWindow sl@15: id: splash sl@15: color: "transparent" sl@15: title: "Splash Window" sl@15: modality: Qt.NonModal sl@15: flags: Qt.SplashScreen sl@21: //24 FPS sl@21: //property int timeoutInterval: 41 sl@21: //32 FPS sl@21: property int timeoutInterval: 33 sl@15: signal timeout sl@15: //! [splash-properties] sl@15: //! [screen-properties] sl@17: //x: (Screen.width - rectangleScreen.width) / 2 sl@17: //y: (Screen.height - rectangleScreen.height) / 2 sl@17: x: appWindow.x+appWindow.width-256-13 sl@17: y: appWindow.y+appWindow.height-64-30 sl@17: sl@15: //! [screen-properties] sl@15: width: rectangleScreen.width sl@15: height: rectangleScreen.height sl@15: property int frameCounter:0; sl@15: property var startTime:new Date(); sl@15: sl@15: Rectangle { sl@15: id: rectangleScreen sl@15: anchors.centerIn: parent sl@15: width: 256 sl@15: height: 64 sl@15: color: "white" sl@15: border.width:1 sl@15: border.color: "black" sl@15: smooth: false sl@15: } sl@15: sl@16: GridLayout { sl@15: anchors.fill:parent sl@15: anchors.margins: 6 sl@16: //spacing: 4 sl@16: columns: 4 sl@16: sl@16: Label { sl@16: text: "Frames:" sl@16: antialiasing: false sl@16: } sl@16: sl@16: Label { sl@16: text: "Time (s):" sl@16: antialiasing: false sl@16: } sl@16: sl@16: Label { sl@16: text: "Time/Frame (ms):" sl@16: antialiasing: false sl@16: } sl@16: sl@16: Label { sl@16: text: "FPS:" sl@16: antialiasing: false sl@16: } sl@15: sl@15: Label { sl@15: id: labelFrameCount sl@15: text: "Frame Count" sl@15: antialiasing: false sl@15: } sl@15: sl@15: Label { sl@15: id: labelTime sl@15: text: "Time" sl@15: antialiasing: false sl@15: } sl@15: sl@16: Label { sl@16: id: labelTimePerFrame sl@16: text: "Time/Frame" sl@16: antialiasing: false sl@16: } sl@16: sl@16: Label { sl@16: id: labelFps sl@16: text: "FPS" sl@16: antialiasing: false sl@16: } sl@16: sl@15: } sl@15: sl@15: sl@15: sl@15: sl@15: sl@15: //! [timer] sl@15: Timer { sl@16: id: timer sl@15: interval: splash.timeoutInterval; running: true; repeat: true sl@15: onTriggered: { sl@15: //visible = false sl@15: sl@15: var current = new Date(); sl@16: var milliseconds = (current.getTime() - splash.startTime.getTime()); sl@15: sl@15: splash.frameCounter++; sl@15: labelFrameCount.text=splash.frameCounter; sl@16: labelTime.text=milliseconds/1000; sl@16: labelTimePerFrame.text=(milliseconds/splash.frameCounter).toFixed(3); sl@16: labelFps.text=(1000/(milliseconds/splash.frameCounter)).toFixed(0); sl@16: sl@16: if (checkBoxDoClear.checked) sl@16: { sl@16: display.clear(); sl@16: } sl@16: sl@16: if (checkBoxRenderToDisplay.checked) sl@16: { sl@16: if (checkBoxFillOnly.checked) sl@16: { sl@21: //Trying to make it a worth case scenario for our frame diff algo sl@21: (splash.frameCounter%3?display.fill():display.clear()); sl@16: } sl@16: else if (checkBoxOnePixelOnly.checked) sl@16: { sl@18: display.setPixel(0,0,splash.frameCounter%2); sl@16: } sl@16: else sl@16: { sl@16: display.renderWindow(splash); sl@16: } sl@16: sl@16: if (!checkBoxNoSwapBuffers.checked) sl@16: { sl@16: display.swapBuffers(); sl@16: } sl@16: sl@16: } sl@16: sl@16: sl@16: sl@16: splash.timeout(); sl@15: } sl@15: } sl@15: //! [timer] sl@15: Component.onCompleted: { sl@15: visible = true sl@15: } sl@15: sl@15: } sl@15: sl@15: Column { sl@15: anchors.fill: parent sl@15: anchors.margins: 8 sl@15: spacing: 8 sl@15: sl@15: Button { sl@15: text: qsTr("Render Window") sl@15: onClicked: { sl@15: display.renderWindow(splash); sl@15: display.swapBuffers(); sl@15: } sl@15: } sl@16: sl@16: Button { sl@16: text: qsTr("Reset stats") sl@16: onClicked: { sl@16: splash.startTime = new Date(); sl@16: splash.frameCounter = 0; sl@16: } sl@16: } sl@16: sl@16: CheckBox { sl@16: text: qsTr("Run timer") sl@16: checked: true sl@16: onCheckedChanged: { sl@16: (checked?timer.start():timer.stop()) sl@16: } sl@16: } sl@16: sl@16: CheckBox { sl@16: id: checkBoxDoClear sl@16: text: qsTr("Do clear") sl@16: checked: true sl@16: } sl@16: sl@16: CheckBox { sl@16: id: checkBoxRenderToDisplay sl@16: text: qsTr("Render to display") sl@16: checked: true sl@16: } sl@16: sl@16: CheckBox { sl@16: id: checkBoxFillOnly sl@21: text: qsTr("Only fill and clear") sl@16: checked: false sl@16: } sl@16: sl@16: CheckBox { sl@16: id: checkBoxNoSwapBuffers sl@16: text: qsTr("No swap buffers") sl@16: checked: false sl@16: } sl@16: sl@16: CheckBox { sl@16: id: checkBoxOnePixelOnly sl@16: text: qsTr("One pixel only") sl@16: checked: false sl@16: } sl@18: sl@18: CheckBox { sl@18: //id: checkBoxOnePixelOnly sl@18: text: qsTr("Off-Screen") sl@18: checked: true sl@18: onCheckedChanged: {display.offScreenMode = checked;} sl@18: } sl@15: } sl@0: }