Commit 100744b4 authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Add a splash screen in case testbench UI is long to create

parent 83ec9823
......@@ -210,6 +210,7 @@ Project {
"import/QtCAN/CanTestBench.2/StringValueDisplay.qml",
"import/QtCAN/CanTestBench.2/TicksJauge.qml",
"import/QtCAN/CanTestBench.2/qmldir",
"splash_testbench.qml",
"ui_testBench.qml",
]
}
......
......@@ -19,7 +19,7 @@ int main (int argc, char * argv []) {
CanDriverWrapper::registerQmlTypes (&engine);
SharedObject::registerQmlTypes (&engine);
Manager::instance ().qmlEngine = &engine;
engine.load (QUrl ("qrc:///ui_testBench.qml"));
engine.load (QUrl ("qrc:///splash_testbench.qml"));
const QList<QObject *> rootObjects = engine.rootObjects ();
if (!rootObjects.isEmpty ()) {
const QStringList argsList = app.arguments ().mid (1);
......
import QtQuick 2.1;
import QtQuick.Window 2.1;
import QtQmlTricks.UiElements 2.0;
import QtQmlTricks.SmartDataModels 2.0;
import QtCAN.CanTestBench 2.0;
import QtCAN.Utils 2.0;
import "components";
Window {
title: "Virtual Testbench - Qt CAN 2.0";
color: Style.colorWindow;
width: 1280;
height: 800;
visible: true;
visibility: Window.Maximized;
minimumWidth: 1280;
minimumHeight: 640;
onVisibleChanged: {
if (!visible) {
Qt.quit ();
}
}
Component.onDestruction: { Qt.quit (); }
WindowIconHelper {
iconPath: ":/vcan_testbench_logo.svg";
}
Item {
states: State {
when: (Style !== null);
PropertyChanges {
target: Style;
useDarkTheme: Shared.rememberTheme;
spacingSmall: 4;
spacingNormal: 6;
spacingBig: 16;
themeFadeTime: 0;
fontSizeNormal: 15;
onUseDarkThemeChanged: { Shared.rememberTheme = useDarkTheme; }
}
}
}
Loader {
id: loader;
active: false;
asynchronous: false;
source: "ui_testBench.qml";
anchors.fill: parent;
}
Rectangle {
id: splash;
color: Style.colorWindow;
anchors.fill: parent;
Column {
spacing: (Style.spacingBig * 2);
anchors.centerIn: parent;
Image {
anchors.horizontalCenter: parent.horizontalCenter;
onStatusChanged: {
if (status === Image.Ready) {
timer.start ();
}
}
SvgIconHelper on source {
icon: "qrc:///vcan_testbench_logo.svg";
size: 256;
color: Style.colorNone;
}
}
TextLabel {
text: title;
font.pixelSize: (Style.fontSizeTitle * 3);
anchors.horizontalCenter: parent.horizontalCenter;
}
}
}
Timer {
id: timer;
repeat: false;
running: false;
interval: 1;
onTriggered: {
loader.active = true;
splash.visible = false;
}
}
}
......@@ -6,17 +6,8 @@ import QtCAN.CanTestBench 2.0;
import QtCAN.Utils 2.0;
import "components";
Window {
Item {
id: window;
title: "Virtual Testbench - Qt CAN 2.0";
color: Style.colorWindow;
width: 1280;
height: 800;
visible: true;
visibility: Window.Maximized;
minimumWidth: 1280;
minimumHeight: 640;
Component.onDestruction: { Qt.quit (); }
onNetworkChanged: {
Shared.currentNode = null;
Shared.highlightIO = null;
......@@ -61,11 +52,6 @@ Window {
}
}
}
onVisibleChanged: {
if (!visible) {
Qt.quit ();
}
}
readonly property NetworkDefinition network : (Shared.manager.hasValidNetwork
? Shared.manager.currentNetwork
......@@ -83,9 +69,6 @@ Window {
});
}
WindowIconHelper {
iconPath: ":/vcan_testbench_logo.svg";
}
QtObject {
property Window subWinCodeEditor : WindowCodeEditor { id: windowEditor; }
}
......@@ -126,22 +109,6 @@ Window {
}
}
}
Item {
states: State {
when: (Style !== null);
PropertyChanges {
target: Style;
useDarkTheme: Shared.rememberTheme;
spacingSmall: 4;
spacingNormal: 6;
spacingBig: 16;
themeFadeTime: 0;
fontSizeNormal: 15;
onUseDarkThemeChanged: { Shared.rememberTheme = useDarkTheme; }
}
}
}
ToolBar {
id: toolBar;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment