mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
Expanded error catching and comments
This commit is contained in:
+66
-52
@@ -27,7 +27,6 @@ language_option.addEventListener('change', (e) => {
|
||||
console.log("Error in the language_option change listener in the renderer.js");
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
stepButtons.forEach(btn => {
|
||||
@@ -36,7 +35,7 @@ stepButtons.forEach(btn => {
|
||||
const step = parseInt(btn.dataset.step);
|
||||
showStep(step);
|
||||
} catch (error) {
|
||||
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -46,7 +45,7 @@ prevBtn.addEventListener("click", () => {
|
||||
try {
|
||||
if (currentStep > 1) showStep(currentStep - 1);
|
||||
} catch (error) {
|
||||
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -55,7 +54,7 @@ nextBtn.addEventListener("click", () => {
|
||||
try {
|
||||
if (currentStep < totalSteps) showStep(currentStep + 1);
|
||||
} catch (error) {
|
||||
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -73,7 +72,6 @@ uploadContainer.addEventListener("dragover", (e) => {
|
||||
} catch (error) {
|
||||
console.log("Error in renderer.js dragover listener function")
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//listener for when a file get dropped on the drag&drop field
|
||||
@@ -91,12 +89,11 @@ uploadContainer.addEventListener("drop", (e) => {
|
||||
} else {
|
||||
alert('The given file is not compatible. These are the available types: [".mp4", ".mov", ".avi", ".mkv"].');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log("Error in renderer.js with the listerner for the drop function");
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//listener for the file explorer search when something got selected
|
||||
videoUpload.addEventListener("change", () => {
|
||||
@@ -133,9 +130,7 @@ Listeners for Step 3
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//Checkboxlistener so that only one can be selected at a time
|
||||
//Checkboxlistener so that only one checkbox can be selected at a time
|
||||
docFormat.addEventListener("change", (e) => {
|
||||
try {
|
||||
if (docFormat.checked) {
|
||||
@@ -145,9 +140,10 @@ docFormat.addEventListener("change", (e) => {
|
||||
docFormatCustom.checked = false;
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
console.log(error)
|
||||
}
|
||||
});
|
||||
//Checkboxlistener so that only one checkbox can be selected at a time
|
||||
docFormatSummary1.addEventListener("change", (e) => {
|
||||
try {
|
||||
if (docFormatSummary1.checked) {
|
||||
@@ -157,9 +153,10 @@ docFormatSummary1.addEventListener("change", (e) => {
|
||||
docFormatCustom.checked = false;
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
console.log(error)
|
||||
}
|
||||
});
|
||||
//Checkboxlistener so that only one checkbox can be selected at a time
|
||||
docFormatSummary2.addEventListener("change", (e) => {
|
||||
try {
|
||||
if (docFormatSummary2.checked) {
|
||||
@@ -169,9 +166,10 @@ docFormatSummary2.addEventListener("change", (e) => {
|
||||
docFormatCustom.checked = false;
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
console.log(error)
|
||||
}
|
||||
});
|
||||
//Checkboxlistener so that only one checkbox can be selected at a time
|
||||
docFormatSummary3.addEventListener("change", (e) => {
|
||||
try {
|
||||
if (docFormatSummary3.checked) {
|
||||
@@ -181,9 +179,10 @@ docFormatSummary3.addEventListener("change", (e) => {
|
||||
docFormatCustom.checked = false;
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
console.log(error)
|
||||
}
|
||||
});
|
||||
//Checkboxlistener so that only one checkbox can be selected at a time
|
||||
docFormatCustom.addEventListener("change", (e) => {
|
||||
try {
|
||||
if (docFormatCustom.checked) {
|
||||
@@ -193,7 +192,7 @@ docFormatCustom.addEventListener("change", (e) => {
|
||||
docFormat.checked = false;
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
console.log(error)
|
||||
}
|
||||
});
|
||||
|
||||
@@ -202,19 +201,25 @@ docFormatCustom.addEventListener("change", (e) => {
|
||||
Listeners for Step 4
|
||||
|
||||
*/
|
||||
//Functions the the displayed progress in the progressbar can be changed out of the main process
|
||||
|
||||
//Functions for the displayed progress in the progressbar so it can be changed out of the main process
|
||||
window.electron.progress((event, arg) => {
|
||||
if (arg.curstep == 1) {
|
||||
setCircleOne();
|
||||
} else if (arg.curstep == 2) {
|
||||
setCircleZwo();
|
||||
} else if (arg.curstep == 3) {
|
||||
setCircleThree();
|
||||
} else if (arg.curstep == 4) {
|
||||
setCircleFour();
|
||||
try {
|
||||
if (arg.curstep == 1) {
|
||||
setCircleOne();
|
||||
} else if (arg.curstep == 2) {
|
||||
setCircleZwo();
|
||||
} else if (arg.curstep == 3) {
|
||||
setCircleThree();
|
||||
} else if (arg.curstep == 4) {
|
||||
setCircleFour();
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
});
|
||||
|
||||
//All for are for setting the corresponding progress section to green (or red)
|
||||
function setCircleOne() {
|
||||
try {
|
||||
if (document.getElementById("box1").style.backgroundColor == "green") {
|
||||
@@ -223,8 +228,8 @@ function setCircleOne() {
|
||||
document.getElementById("box1").style.backgroundColor = "green";
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
};
|
||||
function setCircleZwo() {
|
||||
try {
|
||||
@@ -234,9 +239,8 @@ function setCircleZwo() {
|
||||
document.getElementById("box2").style.backgroundColor = "green";
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
};
|
||||
function setCircleThree() {
|
||||
try {
|
||||
@@ -246,9 +250,8 @@ function setCircleThree() {
|
||||
document.getElementById("box3").style.backgroundColor = "green";
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
};
|
||||
function setCircleFour() {
|
||||
try {
|
||||
@@ -258,7 +261,7 @@ function setCircleFour() {
|
||||
document.getElementById("box4").style.backgroundColor = "green";
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
console.log(error)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -268,53 +271,64 @@ Listeners for Step 5
|
||||
|
||||
*/
|
||||
|
||||
//Speaker change listener
|
||||
//Speaker change listener, changes the previewed audio snippet
|
||||
cur_speaker.addEventListener("change", (e) => {
|
||||
try {
|
||||
document.getElementById("speakerAudioViewer").src = speakerAudios[document.getElementById("cur_speaker").value].src;
|
||||
} catch (error) {
|
||||
|
||||
console.log(error)
|
||||
}
|
||||
});
|
||||
|
||||
//Function so the main process can give the gui a json with the speakers and their audio
|
||||
window.audios.speakerAudios((event, arg) => {
|
||||
loadSpeakerOptions(arg);
|
||||
setSpeakerAudiosValue(arg);
|
||||
try {
|
||||
loadSpeakerOptions(arg);
|
||||
setSpeakerAudiosValue(arg);
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Listeners for the costum documents section
|
||||
|
||||
*/
|
||||
|
||||
//Listener for closing the custom document section again
|
||||
goBackBtn.addEventListener("click", () => {
|
||||
showCD();
|
||||
try {
|
||||
showCD();
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
});
|
||||
|
||||
// dokumente speichern
|
||||
//Listener for the save button in the custom document section
|
||||
generateBtn.addEventListener("click", () => {
|
||||
const name = docName.value.trim();
|
||||
const content = document.getElementById("prompt").value.trim();
|
||||
if (!name || !content) {
|
||||
result.textContent = "Bitte Dokumentname und Prompt ausfüllen.";
|
||||
try {
|
||||
const name = docName.value.trim();
|
||||
const content = document.getElementById("prompt").value.trim();
|
||||
if (!name || !content) {
|
||||
result.textContent = "Bitte Dokumentname und Prompt ausfüllen.";
|
||||
setTimeout(() => {
|
||||
result.textContent = "";
|
||||
}, 3000);
|
||||
return;
|
||||
}
|
||||
window.api.saveTxtFile(name, content).then();
|
||||
result.textContent = "Dokument erfolgreich gespeichert!";
|
||||
setTimeout(() => {
|
||||
result.textContent = "";
|
||||
}, 3000);
|
||||
return;
|
||||
reloadDocuments();
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
window.api.saveTxtFile(name, content).then();
|
||||
result.textContent = "Dokument erfolgreich gespeichert!";
|
||||
setTimeout(() => {
|
||||
result.textContent = "";
|
||||
}, 3000);
|
||||
reloadDocuments();
|
||||
|
||||
});
|
||||
|
||||
// dokumente löschen
|
||||
//Used for deleting documents in the costum document section
|
||||
deleteBtn.addEventListener("click", () => {
|
||||
try {
|
||||
const name = docName.value.trim();
|
||||
@@ -351,7 +365,7 @@ window.api.getTxtFiles().then(files => {
|
||||
}
|
||||
});
|
||||
|
||||
//content anzeigen
|
||||
//Shows the content inside the big textarea inside the costume dokument section
|
||||
existingDocs.addEventListener("change", async () => {
|
||||
try {
|
||||
const existingDocsed = existingDocs.value;
|
||||
|
||||
Reference in New Issue
Block a user