mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
show splash screen for smoother startup
This commit is contained in:
parent
0fdcc40511
commit
232c10bf5f
27
gui/main.js
27
gui/main.js
|
@ -168,10 +168,26 @@ let data = null;
|
||||||
let logViewer = null;
|
let logViewer = null;
|
||||||
var daemonProcess = null;
|
var daemonProcess = null;
|
||||||
|
|
||||||
|
|
||||||
|
// create a splash screen
|
||||||
|
function createSplashScreen(){
|
||||||
|
splashScreen = new BrowserWindow({
|
||||||
|
height: 250,
|
||||||
|
width: 250,
|
||||||
|
transparent: true,
|
||||||
|
frame: false,
|
||||||
|
alwaysOnTop: true
|
||||||
|
});
|
||||||
|
splashScreen.loadFile('src/splash.html');
|
||||||
|
splashScreen.center();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
win = new BrowserWindow({
|
win = new BrowserWindow({
|
||||||
width: config.screen_width,
|
width: config.screen_width,
|
||||||
height: config.screen_height,
|
height: config.screen_height,
|
||||||
|
show: false,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
icon: 'src/img/icon.png',
|
icon: 'src/img/icon.png',
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
@ -285,8 +301,19 @@ function createWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
|
|
||||||
|
// show splash screen
|
||||||
|
createSplashScreen();
|
||||||
|
|
||||||
|
// create main window
|
||||||
createWindow();
|
createWindow();
|
||||||
|
|
||||||
|
// wait some time, then close splash screen and show main windows
|
||||||
|
setTimeout(function() {
|
||||||
|
splashScreen.close();
|
||||||
|
win.show();
|
||||||
|
}, 3000);
|
||||||
|
|
||||||
// start daemon by checking os
|
// start daemon by checking os
|
||||||
mainLog.info('Starting freedata-daemon binary');
|
mainLog.info('Starting freedata-daemon binary');
|
||||||
|
|
||||||
|
|
10
gui/src/splash.html
Normal file
10
gui/src/splash.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<img src="./img/icon_cube_border.png" width="100%" height="100%">
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
Reference in a new issue