mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
select received files folder
This commit is contained in:
parent
4f589860ad
commit
6971537012
33
gui/main.js
33
gui/main.js
|
@ -1,7 +1,9 @@
|
|||
const {
|
||||
app,
|
||||
BrowserWindow,
|
||||
ipcMain
|
||||
ipcMain,
|
||||
dialog,
|
||||
shell
|
||||
} = require('electron');
|
||||
const { autoUpdater } = require('electron-updater');
|
||||
const path = require('path');
|
||||
|
@ -69,7 +71,8 @@ const configDefaultSettings = '{\
|
|||
"screen_height" : 430,\
|
||||
"screen_width" : 1050,\
|
||||
"update_channel" : "latest",\
|
||||
"beacon_interval" : 5\
|
||||
"beacon_interval" : 5,\
|
||||
"received_files_folder" : "None"\
|
||||
}';
|
||||
|
||||
if (!fs.existsSync(configPath)) {
|
||||
|
@ -100,7 +103,7 @@ sysInfo.info("------------------------------------------ ");
|
|||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
var chatDB = path.join(configFolder, 'chatDB.json')
|
||||
// create chat database file if not exists
|
||||
const configContentChatDB = `
|
||||
|
@ -117,7 +120,7 @@ const configContentChatDB = `
|
|||
if (!fs.existsSync(chatDB)) {
|
||||
fs.writeFileSync(chatDB, configContentChatDB);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
@ -158,6 +161,7 @@ function createWindow() {
|
|||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
enableRemoteModule: false,
|
||||
sandbox: false
|
||||
//https://stackoverflow.com/questions/53390798/opening-new-window-electron/53393655
|
||||
//https://github.com/electron/remote
|
||||
}
|
||||
|
@ -440,14 +444,33 @@ ipcMain.on('request-update-rx-buffer', (event, arg) => {
|
|||
win.webContents.send('action-update-rx-buffer', arg);
|
||||
});
|
||||
|
||||
/*
|
||||
ipcMain.on('request-update-rx-msg-buffer', (event, arg) => {
|
||||
chat.webContents.send('action-update-rx-msg-buffer', arg);
|
||||
});
|
||||
*/
|
||||
ipcMain.on('request-new-msg-received', (event, arg) => {
|
||||
chat.webContents.send('action-new-msg-received', arg);
|
||||
});
|
||||
|
||||
ipcMain.on('request-open-tnc-log', (event) => {
|
||||
logViewer.show();
|
||||
});
|
||||
|
||||
//folder selector
|
||||
ipcMain.on('get-folder-path',(event,data)=>{
|
||||
dialog.showOpenDialog({defaultPath: path.join(__dirname, '../assets/'),
|
||||
buttonLabel: 'Select folder', properties: ['openDirectory']}).then(folderPaths => {
|
||||
win.webContents.send('return-folder-paths', {path: folderPaths,})
|
||||
});
|
||||
});
|
||||
|
||||
//open folder
|
||||
ipcMain.on('open-folder',(event,data)=>{
|
||||
shell.showItemInFolder(data.path)
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// LISTENER FOR UPDATER EVENTS
|
||||
|
@ -515,3 +538,5 @@ autoUpdater.on('error', (error) => {
|
|||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
const path = require('path');
|
||||
const {
|
||||
ipcRenderer
|
||||
} = require('electron');
|
||||
const {ipcRenderer} = require('electron');
|
||||
const sock = require('./sock.js');
|
||||
const daemon = require('./daemon.js');
|
||||
const fs = require('fs');
|
||||
|
@ -30,6 +28,30 @@ setInterval(sock.getMsgRxBuffer, 1000);
|
|||
// WINDOW LISTENER
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
|
||||
document.getElementById('received_files_folder').addEventListener('click', () => {
|
||||
|
||||
ipcRenderer.send('open-folder',{
|
||||
title: 'Title',
|
||||
});
|
||||
|
||||
ipcRenderer.on('return-folder-paths',(event,data)=>{
|
||||
document.getElementById("received_files_folder").value = data.path.filePaths[0]
|
||||
config.received_files_folder = data.path.filePaths[0]
|
||||
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
||||
});
|
||||
})
|
||||
|
||||
document.getElementById('openReceivedFilesFolder').addEventListener('click', () => {
|
||||
|
||||
ipcRenderer.send('open-folder',{
|
||||
path: config.received_files_folder,
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// ENABLE BOOTSTRAP POPOVERS EVERYWHERE
|
||||
// https://getbootstrap.com/docs/5.0/components/popovers/#example-enable-popovers-everywhere
|
||||
|
@ -90,6 +112,10 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||
document.getElementById("fftSwitch").value = config.enable_fft;
|
||||
document.getElementById("500HzModeSwitch").value = config.low_bandwith_mode;
|
||||
|
||||
document.getElementById("received_files_folder").value = config.received_files_folder;
|
||||
|
||||
|
||||
|
||||
if(config.enable_scatter == 'True'){
|
||||
document.getElementById("scatterSwitch").checked = true;
|
||||
} else {
|
||||
|
@ -1139,7 +1165,7 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
|
|||
dataType.appendChild(dataTypeText);
|
||||
}
|
||||
|
||||
console.log(dataTypeText.innerText)
|
||||
|
||||
if (dataTypeText.innerText == 'CQ CQ CQ') {
|
||||
row.classList.add("table-success");
|
||||
|
||||
|
@ -1646,7 +1672,11 @@ ipcRenderer.on('action-update-rx-buffer', (event, arg) => {
|
|||
console.log("appDataFolder:" + appDataFolder);
|
||||
var applicationFolder = path.join(appDataFolder, "FreeDATA");
|
||||
console.log(applicationFolder);
|
||||
var receivedFilesFolder = path.join(applicationFolder, "receivedFiles");
|
||||
//var receivedFilesFolder = path.join(applicationFolder, "receivedFiles");
|
||||
var receivedFilesFolder = path.join(config.received_files_folder);
|
||||
|
||||
|
||||
|
||||
console.log("receivedFilesFolder: " + receivedFilesFolder);
|
||||
// Creates receivedFiles folder if not exists
|
||||
// https://stackoverflow.com/a/13544465
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<!-- Bootstrap CSS -->
|
||||
<link rel="stylesheet" id="bootstrap_theme" href="../node_modules/bootstrap/dist/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
|
||||
|
||||
|
||||
|
||||
<!-- Waterfall CSS -->
|
||||
<link rel="stylesheet" type="text/css" href="waterfall/waterfall.css" />
|
||||
|
@ -60,7 +60,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar" role="toolbar">
|
||||
<button class="btn btn-sm btn-primary me-4 position-relative" id="openRFChat" type="button" data-bs-placement="bottom" data-bs-toggle="tooltip" data-bs-html="false" title="Open the HF chat module. This is currently just a test and not finished, yet!" disabled> <strong>RF Chat</strong>
|
||||
<button class="btn btn-sm btn-primary me-4 position-relative" id="openRFChat" type="button" data-bs-placement="bottom" data-bs-toggle="tooltip" data-bs-html="false" title="Open the HF chat module. This is currently just a test and not finished, yet!"> <strong>RF Chat</strong>
|
||||
<i class="bi bi-chat-left-text-fill" style="font-size: 1rem; color: white;"></i>
|
||||
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">soon</span>
|
||||
</button>
|
||||
|
@ -911,8 +911,11 @@
|
|||
<!------------------------------- RECEIVED FILES SIDEBAR ----------------------->
|
||||
<div class="offcanvas offcanvas-end" tabindex="-1" id="receivedFilesSidebar" aria-labelledby="receivedFilesSidebarLabel">
|
||||
<div class="offcanvas-header p-2">
|
||||
<button class="btn btn-sm btn-primary me-2" id="openReceivedFilesFolder" type="button">
|
||||
<i class="bi bi-folder2-open" style="font-size: 1rem; color: white;"></i>
|
||||
</button>
|
||||
<h5 id="receivedFilesSidebarLabel">
|
||||
Received Files
|
||||
Received Files
|
||||
</h5>
|
||||
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
||||
</div>
|
||||
|
@ -1132,6 +1135,8 @@
|
|||
<script src="waterfall/spectrum.js"></script>
|
||||
<script src="waterfall/spectrogram.js"></script>
|
||||
<!--<script src="waterfall/script.js"></script>-->
|
||||
|
||||
|
||||
<!-- INFO MODAL -->
|
||||
<div class="modal fade" data-bs-backdrop="static" tabindex="-1" id="infoModal">
|
||||
<div class="modal-dialog modal-dialog-scrollable">
|
||||
|
@ -1179,7 +1184,12 @@
|
|||
<option value="alpha">alpha</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="input-group input-group-sm mb-1">
|
||||
<label class="input-group-text" for="inputGroupFile02">Received files folder</label>
|
||||
<input type="text" class="form-control" id="received_files_folder">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue