mirror of https://github.com/DJ2LS/FreeDATA
Merge pull request #387 from DJ2LS/qm-385
This commit is contained in:
commit
2136d6174c
|
@ -95,7 +95,8 @@ const configDefaultSettings =
|
||||||
"shared_folder_path" : ".", \
|
"shared_folder_path" : ".", \
|
||||||
"enable_request_profile" : "True", \
|
"enable_request_profile" : "True", \
|
||||||
"enable_request_shared_folder" : "False", \
|
"enable_request_shared_folder" : "False", \
|
||||||
"tx_delay" : 0 \
|
"tx_delay" : 0, \
|
||||||
|
"auto_start": 0 \
|
||||||
}';
|
}';
|
||||||
|
|
||||||
if (!fs.existsSync(configPath)) {
|
if (!fs.existsSync(configPath)) {
|
||||||
|
@ -950,6 +951,7 @@ ipcMain.on("request-check-rigctld", (event, data) => {
|
||||||
rigctld_connection_state = true;
|
rigctld_connection_state = true;
|
||||||
Data["state"] =
|
Data["state"] =
|
||||||
"connection possible - (" + data.ip + ":" + data.port + ")";
|
"connection possible - (" + data.ip + ":" + data.port + ")";
|
||||||
|
Data["active"] = true;
|
||||||
if (win !== null && win !== "" && typeof win != "undefined") {
|
if (win !== null && win !== "" && typeof win != "undefined") {
|
||||||
// try catch for being sure we have a clean app close
|
// try catch for being sure we have a clean app close
|
||||||
try {
|
try {
|
||||||
|
@ -963,6 +965,7 @@ ipcMain.on("request-check-rigctld", (event, data) => {
|
||||||
rigctld_connection.on("error", function () {
|
rigctld_connection.on("error", function () {
|
||||||
rigctld_connection_state = false;
|
rigctld_connection_state = false;
|
||||||
Data["state"] = "unknown/stopped - (" + data.ip + ":" + data.port + ")";
|
Data["state"] = "unknown/stopped - (" + data.ip + ":" + data.port + ")";
|
||||||
|
Data["active"] = false;
|
||||||
if (win !== null && win !== "" && typeof win != "undefined") {
|
if (win !== null && win !== "" && typeof win != "undefined") {
|
||||||
// try catch for being sure we have a clean app close
|
// try catch for being sure we have a clean app close
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -336,6 +336,13 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("autoTuneSwitch").checked = false;
|
document.getElementById("autoTuneSwitch").checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.auto_start == 1) {
|
||||||
|
document.getElementById("AutoStartSwitch").checked = true;
|
||||||
|
} else {
|
||||||
|
document.getElementById("AutoStartSwitch").checked = false;
|
||||||
|
}
|
||||||
|
|
||||||
// theme selector
|
// theme selector
|
||||||
changeGuiDesign(config.theme);
|
changeGuiDesign(config.theme);
|
||||||
|
|
||||||
|
@ -577,7 +584,24 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
.addEventListener("click", () => {
|
.addEventListener("click", () => {
|
||||||
hamlib_params();
|
hamlib_params();
|
||||||
let rigctld = document.getElementById("hamlib_rigctld_path").value;
|
let rigctld = document.getElementById("hamlib_rigctld_path").value;
|
||||||
rigctld += " " + document.getElementById("hamlib_rigctld_command").value;
|
|
||||||
|
//Escape spaces in executable file
|
||||||
|
switch (os.platform().toLowerCase()) {
|
||||||
|
case "darwin":
|
||||||
|
case "linux":
|
||||||
|
rigctld = rigctld.replace(" ", "\\ ");
|
||||||
|
break;
|
||||||
|
case "win32":
|
||||||
|
case "win64":
|
||||||
|
if (rigctld.indexOf(" ") > -1) rigctld = '"' + rigctld + '"';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log("Unhandled OS Platform: ", os.platform());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
rigctld +=
|
||||||
|
" " + document.getElementById("hamlib_rigctld_command").value + " -vv";
|
||||||
document.getElementById("btnHamlibCopyCommandBi").classList =
|
document.getElementById("btnHamlibCopyCommandBi").classList =
|
||||||
"bi bi-clipboard2-check-fill";
|
"bi bi-clipboard2-check-fill";
|
||||||
clipboard.writeText(rigctld);
|
clipboard.writeText(rigctld);
|
||||||
|
@ -1064,6 +1088,8 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
||||||
FD.saveConfig(config, configPath);
|
FD.saveConfig(config, configPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Handle change of fancy graphics
|
||||||
document.getElementById("GraphicsSwitch").addEventListener("click", () => {
|
document.getElementById("GraphicsSwitch").addEventListener("click", () => {
|
||||||
if (document.getElementById("GraphicsSwitch").checked == true) {
|
if (document.getElementById("GraphicsSwitch").checked == true) {
|
||||||
config.high_graphics = "True";
|
config.high_graphics = "True";
|
||||||
|
@ -1075,6 +1101,17 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
set_CPU_mode();
|
set_CPU_mode();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Handle change of Auto-start settings
|
||||||
|
document.getElementById("AutoStartSwitch").addEventListener("click", () => {
|
||||||
|
if (document.getElementById("AutoStartSwitch").checked == true) {
|
||||||
|
config.auto_start = "1";
|
||||||
|
} else {
|
||||||
|
config.auto_start = "0";
|
||||||
|
}
|
||||||
|
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
||||||
|
FD.saveConfig(config, configPath);
|
||||||
|
});
|
||||||
|
|
||||||
// enable fsk Switch clicked
|
// enable fsk Switch clicked
|
||||||
document.getElementById("fskModeSwitch").addEventListener("click", () => {
|
document.getElementById("fskModeSwitch").addEventListener("click", () => {
|
||||||
if (document.getElementById("fskModeSwitch").checked == true) {
|
if (document.getElementById("fskModeSwitch").checked == true) {
|
||||||
|
@ -2286,6 +2323,7 @@ function updateHeardStations(arg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var populateSerial = false;
|
||||||
ipcRenderer.on("action-update-daemon-state", (event, arg) => {
|
ipcRenderer.on("action-update-daemon-state", (event, arg) => {
|
||||||
/*
|
/*
|
||||||
// deactivetd RAM und CPU view so we dont get errors. We need to find a new place for this feature
|
// deactivetd RAM und CPU view so we dont get errors. We need to find a new place for this feature
|
||||||
|
@ -2322,93 +2360,90 @@ ipcRenderer.on("action-update-daemon-state", (event, arg) => {
|
||||||
document.getElementById("node_version").className = "btn btn-sm btn-success";
|
document.getElementById("node_version").className = "btn btn-sm btn-success";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// UPDATE AUDIO INPUT
|
if (arg.tnc_running_state != "stopped" && populateSerial == true) return;
|
||||||
if (arg.tnc_running_state == "stopped") {
|
|
||||||
if (
|
|
||||||
document.getElementById("audio_input_selectbox").length !=
|
|
||||||
arg.input_devices.length
|
|
||||||
) {
|
|
||||||
document.getElementById("audio_input_selectbox").innerHTML = "";
|
|
||||||
for (i = 0; i < arg.input_devices.length; i++) {
|
|
||||||
var option = document.createElement("option");
|
|
||||||
option.text = arg.input_devices[i]["name"];
|
|
||||||
option.value = arg.input_devices[i]["id"];
|
|
||||||
// set device from config if available
|
|
||||||
|
|
||||||
if (config.rx_audio == option.text) {
|
|
||||||
option.setAttribute("selected", true);
|
|
||||||
}
|
|
||||||
document.getElementById("audio_input_selectbox").add(option);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// UPDATE AUDIO OUTPUT
|
|
||||||
if (arg.tnc_running_state == "stopped") {
|
|
||||||
if (
|
|
||||||
document.getElementById("audio_output_selectbox").length !=
|
|
||||||
arg.output_devices.length
|
|
||||||
) {
|
|
||||||
document.getElementById("audio_output_selectbox").innerHTML = "";
|
|
||||||
for (i = 0; i < arg.output_devices.length; i++) {
|
|
||||||
var option = document.createElement("option");
|
|
||||||
option.text = arg.output_devices[i]["name"];
|
|
||||||
option.value = arg.output_devices[i]["id"];
|
|
||||||
// set device from config if available
|
|
||||||
if (config.tx_audio == option.text) {
|
|
||||||
option.setAttribute("selected", true);
|
|
||||||
}
|
|
||||||
document.getElementById("audio_output_selectbox").add(option);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// UPDATE SERIAL DEVICES
|
// UPDATE SERIAL DEVICES
|
||||||
if (arg.tnc_running_state == "stopped") {
|
if (
|
||||||
if (
|
document.getElementById("hamlib_deviceport").length !=
|
||||||
document.getElementById("hamlib_deviceport").length !=
|
arg.serial_devices.length
|
||||||
arg.serial_devices.length
|
) {
|
||||||
) {
|
document.getElementById("hamlib_deviceport").innerHTML = "";
|
||||||
document.getElementById("hamlib_deviceport").innerHTML = "";
|
var ignore = document.createElement("option");
|
||||||
var ignore = document.createElement("option");
|
ignore.text = "-- ignore --";
|
||||||
ignore.text = "-- ignore --";
|
ignore.value = "ignore";
|
||||||
ignore.value = "ignore";
|
document.getElementById("hamlib_deviceport").add(ignore);
|
||||||
document.getElementById("hamlib_deviceport").add(ignore);
|
for (i = 0; i < arg.serial_devices.length; i++) {
|
||||||
for (i = 0; i < arg.serial_devices.length; i++) {
|
var option = document.createElement("option");
|
||||||
var option = document.createElement("option");
|
option.text =
|
||||||
option.text =
|
arg.serial_devices[i]["port"] +
|
||||||
arg.serial_devices[i]["port"] +
|
" -- " +
|
||||||
" -- " +
|
arg.serial_devices[i]["description"];
|
||||||
arg.serial_devices[i]["description"];
|
option.value = arg.serial_devices[i]["port"];
|
||||||
option.value = arg.serial_devices[i]["port"];
|
document.getElementById("hamlib_deviceport").add(option);
|
||||||
document.getElementById("hamlib_deviceport").add(option);
|
}
|
||||||
}
|
// set device from config if available
|
||||||
|
document.getElementById("hamlib_deviceport").value =
|
||||||
|
config.hamlib_deviceport;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
document.getElementById("hamlib_ptt_port").length !=
|
||||||
|
arg.serial_devices.length
|
||||||
|
) {
|
||||||
|
document.getElementById("hamlib_ptt_port").innerHTML = "";
|
||||||
|
var ignore = document.createElement("option");
|
||||||
|
ignore.text = "-- ignore --";
|
||||||
|
ignore.value = "ignore";
|
||||||
|
document.getElementById("hamlib_ptt_port").add(ignore);
|
||||||
|
for (i = 0; i < arg.serial_devices.length; i++) {
|
||||||
|
var option = document.createElement("option");
|
||||||
|
option.text =
|
||||||
|
arg.serial_devices[i]["port"] +
|
||||||
|
" -- " +
|
||||||
|
arg.serial_devices[i]["description"];
|
||||||
|
option.value = arg.serial_devices[i]["port"];
|
||||||
|
document.getElementById("hamlib_ptt_port").add(option);
|
||||||
|
}
|
||||||
|
// set device from config if available
|
||||||
|
document.getElementById("hamlib_ptt_port").value = config.hamlib_ptt_port;
|
||||||
|
}
|
||||||
|
//Serial devices are updated on first pass
|
||||||
|
populateSerial = true;
|
||||||
|
if (arg.tnc_running_state != "stopped") return;
|
||||||
|
|
||||||
|
// UPDATE AUDIO INPUT
|
||||||
|
if (
|
||||||
|
document.getElementById("audio_input_selectbox").length !=
|
||||||
|
arg.input_devices.length
|
||||||
|
) {
|
||||||
|
document.getElementById("audio_input_selectbox").innerHTML = "";
|
||||||
|
for (i = 0; i < arg.input_devices.length; i++) {
|
||||||
|
var option = document.createElement("option");
|
||||||
|
option.text = arg.input_devices[i]["name"];
|
||||||
|
option.value = arg.input_devices[i]["id"];
|
||||||
// set device from config if available
|
// set device from config if available
|
||||||
document.getElementById("hamlib_deviceport").value =
|
|
||||||
config.hamlib_deviceport;
|
if (config.rx_audio == option.text) {
|
||||||
|
option.setAttribute("selected", true);
|
||||||
|
}
|
||||||
|
document.getElementById("audio_input_selectbox").add(option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg.tnc_running_state == "stopped") {
|
// UPDATE AUDIO OUTPUT
|
||||||
if (
|
if (
|
||||||
document.getElementById("hamlib_ptt_port").length !=
|
document.getElementById("audio_output_selectbox").length !=
|
||||||
arg.serial_devices.length
|
arg.output_devices.length
|
||||||
) {
|
) {
|
||||||
document.getElementById("hamlib_ptt_port").innerHTML = "";
|
document.getElementById("audio_output_selectbox").innerHTML = "";
|
||||||
var ignore = document.createElement("option");
|
for (i = 0; i < arg.output_devices.length; i++) {
|
||||||
ignore.text = "-- ignore --";
|
var option = document.createElement("option");
|
||||||
ignore.value = "ignore";
|
option.text = arg.output_devices[i]["name"];
|
||||||
document.getElementById("hamlib_ptt_port").add(ignore);
|
option.value = arg.output_devices[i]["id"];
|
||||||
for (i = 0; i < arg.serial_devices.length; i++) {
|
|
||||||
var option = document.createElement("option");
|
|
||||||
option.text =
|
|
||||||
arg.serial_devices[i]["port"] +
|
|
||||||
" -- " +
|
|
||||||
arg.serial_devices[i]["description"];
|
|
||||||
option.value = arg.serial_devices[i]["port"];
|
|
||||||
document.getElementById("hamlib_ptt_port").add(option);
|
|
||||||
}
|
|
||||||
// set device from config if available
|
// set device from config if available
|
||||||
document.getElementById("hamlib_ptt_port").value = config.hamlib_ptt_port;
|
if (config.tx_audio == option.text) {
|
||||||
|
option.setAttribute("selected", true);
|
||||||
|
}
|
||||||
|
document.getElementById("audio_output_selectbox").add(option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -3164,6 +3199,7 @@ function set_setting_switch(setting_switch, enable_object, state) {
|
||||||
enable_setting(setting_switch, enable_object);
|
enable_setting(setting_switch, enable_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var rigctldActive = false;
|
||||||
setInterval(checkRigctld, 500);
|
setInterval(checkRigctld, 500);
|
||||||
function checkRigctld() {
|
function checkRigctld() {
|
||||||
var rigctld_ip = document.getElementById("hamlib_rigctld_ip").value;
|
var rigctld_ip = document.getElementById("hamlib_rigctld_ip").value;
|
||||||
|
@ -3182,6 +3218,7 @@ function checkRigctld() {
|
||||||
|
|
||||||
ipcRenderer.on("action-check-rigctld", (event, data) => {
|
ipcRenderer.on("action-check-rigctld", (event, data) => {
|
||||||
document.getElementById("hamlib_rigctld_status").value = data["state"];
|
document.getElementById("hamlib_rigctld_status").value = data["state"];
|
||||||
|
rigctldActive = data["active"];
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcRenderer.on("action-set-app-version", (event, data) => {
|
ipcRenderer.on("action-set-app-version", (event, data) => {
|
||||||
|
@ -3421,4 +3458,20 @@ function changeGuiDesign(design) {
|
||||||
|
|
||||||
//update path to css file
|
//update path to css file
|
||||||
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
||||||
|
|
||||||
|
function autostart() {
|
||||||
|
//Auto start stuff if option is enabled
|
||||||
|
if (config.auto_start == 1) {
|
||||||
|
//Start rigctld if radiocontrol is in correct mode and is not active
|
||||||
|
if (config.radiocontrol == "rigctld" && rigctldActive == false) {
|
||||||
|
//console.log("Autostarting rigctld");
|
||||||
|
document.getElementById("hamlib_rigctld_start").click();
|
||||||
|
}
|
||||||
|
//Now start TNC
|
||||||
|
document.getElementById("startTNC").click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
autostart();
|
||||||
|
}, 1250);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1781,8 +1781,25 @@
|
||||||
<option value="alpha">alpha</option>
|
<option value="alpha">alpha</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="input-group input-group-sm mb-1">
|
||||||
|
<label class="input-group-text w-50"
|
||||||
|
>Auto-start TNC/rigctld</label
|
||||||
|
>
|
||||||
|
<label class="input-group-text w-50">
|
||||||
|
<div class="form-check form-switch form-check-inline">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
id="AutoStartSwitch"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="AutoStartSwitch"
|
||||||
|
>Start on launch</label
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Chat tab contents -->
|
||||||
<div
|
<div
|
||||||
class="tab-pane"
|
class="tab-pane"
|
||||||
id="chat"
|
id="chat"
|
||||||
|
@ -1873,6 +1890,7 @@
|
||||||
class="btn btn-outline-secondary"
|
class="btn btn-outline-secondary"
|
||||||
type="button"
|
type="button"
|
||||||
id="btnHamlibCopyCommand"
|
id="btnHamlibCopyCommand"
|
||||||
|
title="Copy exe and arguments to clipboard to run in terminal for troubleshooting"
|
||||||
>
|
>
|
||||||
<i id="btnHamlibCopyCommandBi" class="bi bi-clipboard"></i>
|
<i id="btnHamlibCopyCommandBi" class="bi bi-clipboard"></i>
|
||||||
</button>
|
</button>
|
||||||
|
@ -2605,8 +2623,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<div class="badge text-bg-danger">
|
<div class="badge text-bg-danger">
|
||||||
<i class="bi bi-shield-exclamation"></i> These options may
|
<i class="bi bi-shield-exclamation"></i> These options are
|
||||||
not work and are for experienced users only!
|
experimental and may not work as expected.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue