mirror of
				https://github.com/Fabio286/antares.git
				synced 2025-06-05 21:59:22 +02:00 
			
		
		
		
	Moved to electron 9
This commit is contained in:
		| @@ -12,7 +12,7 @@ process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true'; | ||||
| // global reference to mainWindow (necessary to prevent window from being garbage collected) | ||||
| let mainWindow; | ||||
|  | ||||
| function createMainWindow () { | ||||
| async function createMainWindow () { | ||||
|    const icon = require('../renderer/images/logo-32.png'); | ||||
|    const window = new BrowserWindow({ | ||||
|       width: 1600, | ||||
| @@ -24,23 +24,16 @@ function createMainWindow () { | ||||
|       icon: nativeImage.createFromDataURL(icon.default), | ||||
|       webPreferences: { | ||||
|          nodeIntegration: true, | ||||
|          'web-security': false | ||||
|          'web-security': false, | ||||
|          enableRemoteModule: true | ||||
|       }, | ||||
|       frame: false, | ||||
|       backgroundColor: '#1d1d1d' | ||||
|    }); | ||||
|  | ||||
|    if (isDevelopment) | ||||
|       window.loadURL(`http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`); | ||||
|    else { | ||||
|       window.loadURL(formatUrl({ | ||||
|          pathname: path.join(__dirname, 'index.html'), | ||||
|          protocol: 'file', | ||||
|          slashes: true | ||||
|       })); | ||||
|    } | ||||
|  | ||||
|    if (isDevelopment) { | ||||
|       await window.loadURL(`http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`); | ||||
|  | ||||
|       const { default: installExtension, VUEJS_DEVTOOLS } = require('electron-devtools-installer'); | ||||
|       window.webContents.openDevTools(); | ||||
|  | ||||
| @@ -52,6 +45,13 @@ function createMainWindow () { | ||||
|             console.log(err); | ||||
|          }); | ||||
|    } | ||||
|    else { | ||||
|       await window.loadURL(formatUrl({ | ||||
|          pathname: path.join(__dirname, 'index.html'), | ||||
|          protocol: 'file', | ||||
|          slashes: true | ||||
|       })); | ||||
|    } | ||||
|  | ||||
|    window.on('closed', () => { | ||||
|       mainWindow = null; | ||||
|   | ||||
							
								
								
									
										7
									
								
								src/main/ipc-handlers/application.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/main/ipc-handlers/application.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| import { app, ipcMain } from 'electron'; | ||||
|  | ||||
| export default () => { | ||||
|    ipcMain.on('closeApp', () => { | ||||
|       app.exit(); | ||||
|    }); | ||||
| }; | ||||
| @@ -1,6 +1,7 @@ | ||||
| import connection from './connection'; | ||||
| import tables from './tables'; | ||||
| import updates from './updates'; | ||||
| import application from './application'; | ||||
|  | ||||
| const connections = {}; | ||||
|  | ||||
| @@ -8,4 +9,5 @@ export default () => { | ||||
|    connection(connections); | ||||
|    tables(connections); | ||||
|    updates(); | ||||
|    application(); | ||||
| }; | ||||
|   | ||||
| @@ -37,7 +37,7 @@ | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import { remote } from 'electron'; | ||||
| import { remote, ipcRenderer } from 'electron'; | ||||
|  | ||||
| export default { | ||||
|    name: 'TheTitleBar', | ||||
| @@ -56,7 +56,7 @@ export default { | ||||
|    }, | ||||
|    methods: { | ||||
|       closeApp () { | ||||
|          this.w.close(); | ||||
|          ipcRenderer.send('closeApp'); | ||||
|       }, | ||||
|       minimizeApp () { | ||||
|          this.w.minimize(); | ||||
|   | ||||
| @@ -44,14 +44,15 @@ module.exports = { | ||||
|       deleteConnectionCorfirm: 'Confermi l\'eliminazione di', | ||||
|       connectionSuccessfullyMade: 'Connessione avvenuta con successo!', | ||||
|       madeWithJS: 'Fatto con 💛 e JavaScript!', | ||||
|       checkForUpdates: 'Cerca aggiornamenti', | ||||
|       noUpdatesAvailable: 'Nessun aggiornamento disponibile', | ||||
|       checkingForUpdate: 'Controllando gli aggiornamenti', | ||||
|       checkingForUpdate: 'Controllo aggiornamenti in corso', | ||||
|       checkFailure: 'Controllo fallito, riprova più tardi', | ||||
|       updateAvailable: 'Aggiornamento disponibile', | ||||
|       downloadingUpdate: 'Scaricando l\'aggiornamento', | ||||
|       downloadingUpdate: 'Download dell\'aggiornamento', | ||||
|       updateDownloaded: 'Aggiornamento scaricato', | ||||
|       restartToInstall: 'Riavvia Antares per installare l\'aggiornamento', | ||||
|       unableEditFieldWithoutPrimary: 'Impossibile modificare il campo senza una primary key in resultset', | ||||
|       unableEditFieldWithoutPrimary: 'Impossibile modificare il campo senza una primary key nel resultset', | ||||
|       editCell: 'Modifica cella', | ||||
|       deleteRows: 'Elimina riga | Elimina {count} righe', | ||||
|       confirmToDeleteRows: 'Confermi di voler cancellare una riga? | Confermi di voler cancellare {count} righe?' | ||||
|   | ||||
		Reference in New Issue
	
	Block a user