diff --git a/core/electron-libs/core.js b/core/electron-libs/core.js index 2cd10dd2..5fa61cce 100644 --- a/core/electron-libs/core.js +++ b/core/electron-libs/core.js @@ -30,6 +30,7 @@ const processes = []; * @type BrowserWindow */ let mainWindow = null; +let splashWindow = null; async function cleanUpProcesses() { for (const process of processes) { @@ -49,9 +50,14 @@ async function cleanUpProcesses() { } function startService() { + createSplashWindow(); + if (inDevMode()) { global.backendPort = 9091; - windowsManager.createWindow(); + setTimeout(function () { + splashWindow.close(); + windowsManager.createWindow(); + }, 1000); return; } @@ -70,6 +76,7 @@ function startService() { process.stdout.on('data', data => { if (data.includes(`Tomcat started on port(s): ${port}`)) { console.log(`Tomcat is now started on port ${port}`); + splashWindow.close(); windowsManager.createWindow(); } }); @@ -93,6 +100,22 @@ function startService() { }); } +function createSplashWindow() { + splashWindow = new BrowserWindow({ + width: 800, + height: 600, + frame: false, + alwaysOnTop: true, + transparent: true, + }); + + const splashScreenPath = inDevMode() + ? path.join('.', 'electron-libs', 'loading-screen') + : path.join(__dirname, '..', '..', '..', 'loading-screen'); + + splashWindow.loadFile(`${splashScreenPath}${path.sep}splash.html`).catch(() => console.log('Splash screen not found.')); +} + module.exports = { mainWindow, cleanUpProcesses, diff --git a/core/electron-libs/loading-screen/splash.html b/core/electron-libs/loading-screen/splash.html new file mode 100644 index 00000000..54700374 --- /dev/null +++ b/core/electron-libs/loading-screen/splash.html @@ -0,0 +1,74 @@ + + + + +
++ + Loading Aspect Model Editor... +
+ + + diff --git a/core/package.json b/core/package.json index 4e88f52b..5d844ebe 100644 --- a/core/package.json +++ b/core/package.json @@ -37,6 +37,13 @@ "filter": [ "**/*" ] + }, + { + "from": "./electron-libs/loading-screen/", + "to": "loading-screen/", + "filter": [ + "**/*" + ] } ] }, @@ -69,6 +76,13 @@ "filter": [ "**/*" ] + }, + { + "from": "./electron-libs/loading-screen/", + "to": "loading-screen/", + "filter": [ + "**/*" + ] } ] }, @@ -101,6 +115,13 @@ "filter": [ "**/*" ] + }, + { + "from": "./electron-libs/loading-screen/", + "to": "loading-screen/", + "filter": [ + "**/*" + ] } ] },