Add warning screen when downloading base tune

This commit is contained in:
Josh Stewart 2021-07-27 11:21:44 +10:00
parent be35b5a883
commit 0b66b23864
5 changed files with 88 additions and 9 deletions

View File

@ -2375,6 +2375,13 @@ input, select, textarea {
background: #022b3a;
}
.select5 option {
color: #ffffff;
background: #022b3a;
padding-top: 4px;
padding-left: 4px;
}
.select1 {
height: 1.75em;
width: 12em;
@ -2732,7 +2739,7 @@ input, select, textarea {
width: 100%;
}
@media screen and (max-width: 480px) {
@media screen and (max-width: 380px) {
ul.actions:not(.fixed) {
-moz-flex-direction: column;
@ -2867,6 +2874,15 @@ input, select, textarea {
}
/* Modal dialog centering */
.modal {
padding-left: 8px;
padding-right: 8px;
display: flex;
justify-content: center;
text-align: center;
}
/* Section/Article */
section.special, article.special {
@ -3270,12 +3286,18 @@ input, select, textarea {
.wrapper.style4 {
background-color: #022b3a;
background-color: #3e4094;
}
.wrapper.style4-alt {
background-color: #022b3a;
}
.wrapper.style5 {
background-color: #022b3a;
background-color: #bd2d2d;
}
.wrapper.fullscreen {
display: -moz-flex;
display: -webkit-flex;

View File

@ -11,9 +11,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="assets/css/main.css" />
<script src="renderer.js">
</script>
<script src="renderer.js" ></script>
</head>
<body>
@ -156,12 +154,12 @@
</p>
<p>
Available Tunes
<select name="basetunes" class="select4" id="basetunesSelect" size="10" width="20" onChange="refreshBasetunesDescription()"></select>
<select name="basetunes" class="select5" id="basetunesSelect" size="10" width="20" onChange="refreshBasetunesDescription()"></select>
<div class="features major" >
<div id="tuneDetailsText" style="padding-left: 0.9em; padding-right: 0.9em; padding-top: 0.1em; overflow-y: auto; height: 17vh;"></div>
</div>
<ul class="actions">
<li><input type='button' id="btnDownloadBasetune" value="Download tune" onclick="downloadBasetune();" /></li>
<li><input type='button' id="btnDownloadBasetune" value="Download tune" onclick="showBasetuneWarning();" /></li>
</ul>
</p>
</div>

View File

@ -14,7 +14,8 @@ var avrdudeIsRunning = false;
var teensyLoaderIsRunning = false;
var teensyLoaderErr = ""
function createWindow () {
function createWindow ()
{
// Create the browser window.
win = new BrowserWindow({
width: 800,
@ -56,8 +57,6 @@ function createWindow () {
});
}
//Required for newer versions of Electron to work with serialport
app.allowRendererProcessReuse = false

View File

@ -430,8 +430,33 @@ function downloadIni()
}
function showBasetuneWarning()
{
let mainWindow = remote.BrowserWindow.getFocusedWindow();
warningWindow = new remote.BrowserWindow({ width: 550, height: 330, modal: true, parent: mainWindow, show: false })
warningWindow.loadURL(`file://${__dirname}/warning.html?board=` + "test");
warningWindow.once('ready-to-show', () => {
warningWindow.show();
})
warningWindow.on('close', () => {
warningWindow = null;
downloadBasetune();
});
}
function downloadBasetune()
{
console.log("downloading");
let dialogWindow = remote.BrowserWindow.getFocussedWindow(); //Close the warning dialog
dialogWindow.close();
let mainWindow = remote.BrowserWindow.getAllWindows()[0]; //Close the warning dialog
mainWindow.focus();
var basetuneSelect = document.getElementById('basetunesSelect');
var basetuneOption = basetuneSelect.options[basetuneSelect.selectedIndex];
//var version = document.getElementById('versionsSelect');

35
warning.html Normal file
View File

@ -0,0 +1,35 @@
<html>
<link rel="stylesheet" href="assets/css/main.css" />
<script>
function updateBoard()
{
board = (location.search.split('board=')[1]||'').split('&')[0]
document.getElementById("tuneBoard").innerHTML = board;
}
</script>
<body onload="updateBoard()">
<!-- Choose Version -->
<section id="loader" class="wrapper style5 fullscreen fade-up" style="padding: 0; margin: 0;">
<!--<h1>Firmware Loader</h1>-->
<div class="inner" style="padding: 0; margin: 0;">
<p><h1 class="modal" style="margin: 0;">WARNING</h1></p>
</div>
<div class="features major modal" style="margin-left: 15px; margin-right: 15px; padding-top: 1; padding-bottom: 1; margin-bottom: 8px;">
<div style="padding-left: .9em; padding-right: 0.9em; overflow-y: auto; ">
<p style="margin-bottom: 5;">Base tunes are intended as a starting point ONLY. They will require changes in order to work correctly with your engine</p>
<center><span class="icon fa-exclamation major" style="margin: 0; justify-content: center;" id="warningIcon"></span></center>
<p >Take note of the board that has been selected in this tune: <span style="font-weight: bold;" id="tuneBoard"></span></p>
</div>
</div>
<ul class="actions modal">
<li><input type='button' id="btnDownloadConfirm" value="Download" onclick="window.close();" /></li>
</ul>
</section>
</body>
</html>