Browse Source

Fix start core

qortal-ui-dev
AlphaX-Projects 1 year ago committed by GitHub
parent
commit
767101eee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 120
      electron.js

120
electron.js

@ -467,25 +467,26 @@ function checkQortal() {
if (status == true) { if (status == true) {
log.info("Core is running, perfect !") log.info("Core is running, perfect !")
} else { } else {
log.info("Core is not running, starting it !") if (!store.get('askingCore')) {
const dialogOpts = { const dialogOpts = {
type: 'info', type: 'info',
buttons: [i18n.__("electron_translate_13"), i18n.__("electron_translate_14")], buttons: [i18n.__("electron_translate_13"), i18n.__("electron_translate_14")],
title: i18n.__("electron_translate_15"), title: i18n.__("electron_translate_15"),
message: i18n.__("electron_translate_16"), message: i18n.__("electron_translate_16"),
detail: i18n.__("electron_translate_17"), detail: i18n.__("electron_translate_17"),
checkboxLabel: i18n.__("electron_translate_28"), checkboxLabel: i18n.__("electron_translate_28"),
checkboxChecked: false checkboxChecked: false
}
dialog.showMessageBox(dialogOpts).then((returnValue) => {
if (returnValue.response === 0) {
startQortal()
store.set('askingCore', returnValue.checkboxChecked)
} else {
store.set('askingCore', returnValue.checkboxChecked)
return
} }
}) dialog.showMessageBox(dialogOpts).then((returnValue) => {
if (returnValue.response === 0) {
startQortal()
store.set('askingCore', returnValue.checkboxChecked)
} else {
store.set('askingCore', returnValue.checkboxChecked)
return
}
})
}
} }
}) })
} else { } else {
@ -567,24 +568,26 @@ async function removeQortalZip() {
async function checkAndStart() { async function checkAndStart() {
try { try {
const dialogOpts = { if (!store.get('askingCore')) {
type: 'info', const dialogOpts = {
buttons: [i18n.__("electron_translate_13"), i18n.__("electron_translate_14")], type: 'info',
title: i18n.__("electron_translate_15"), buttons: [i18n.__("electron_translate_13"), i18n.__("electron_translate_14")],
message: i18n.__("electron_translate_16"), title: i18n.__("electron_translate_15"),
detail: i18n.__("electron_translate_17"), message: i18n.__("electron_translate_16"),
checkboxLabel: i18n.__("electron_translate_28"), detail: i18n.__("electron_translate_17"),
checkboxChecked: false checkboxLabel: i18n.__("electron_translate_28"),
} checkboxChecked: false
dialog.showMessageBox(dialogOpts).then((returnValue) => {
if (returnValue.response === 0) {
startQortal()
store.set('askingCore', returnValue.checkboxChecked)
} else {
store.set('askingCore', returnValue.checkboxChecked)
return
} }
}) dialog.showMessageBox(dialogOpts).then((returnValue) => {
if (returnValue.response === 0) {
startQortal()
store.set('askingCore', returnValue.checkboxChecked)
} else {
store.set('askingCore', returnValue.checkboxChecked)
return
}
})
}
} catch (err) { } catch (err) {
log.info('Sed error', err) log.info('Sed error', err)
} }
@ -709,16 +712,36 @@ const editMenu = Menu.buildFromTemplate([
}] }]
}, },
{ {
label: "Edit", label: i18n.__("electron_translate_34"),
submenu: [ submenu: [{
{ label: "Undo", accelerator: "CommandOrControl+Z", selector: "undo:" }, label: i18n.__("electron_translate_31"),
{ label: "Redo", accelerator: "CommandOrControl+Shift+Z", selector: "redo:" }, click() {
{ type: "separator" }, const dialogOpts = {
{ label: "Cut", accelerator: "CommandOrControl+X", selector: "cut:" }, type: 'info',
{ label: "Copy", accelerator: "CommandOrControl+C", selector: "copy:" }, noLink: true,
{ label: "Paste", accelerator: "CommandOrControl+V", selector: "paste:" }, buttons: [i18n.__("electron_translate_29"), i18n.__("electron_translate_30")],
{ label: "Select All", accelerator: "CommandOrControl+A", selector: "selectAll:" } title: i18n.__("electron_translate_31"),
] message: i18n.__("electron_translate_32"),
detail: i18n.__("electron_translate_33"),
checkboxLabel: i18n.__("electron_translate_28"),
checkboxChecked: store.get('askingCore')
}
dialog.showMessageBox(dialogOpts).then((returnValue) => {
if (returnValue.response === 0) {
store.set('askingCore', returnValue.checkboxChecked)
} else {
store.set('askingCore', returnValue.checkboxChecked)
return
}
})
}
}]
},
{
label: "Check for update",
click() {
autoUpdater.checkForUpdatesAndNotify()
}
} }
]) ])
@ -897,6 +920,13 @@ if (!isLock) {
} }
}) })
}) })
autoUpdater.on('update-not-available', (event) => {
const noUpdate = new Notification({
title: 'Checking for update',
body: 'No update available, you are on latest version.'
})
noUpdate.show()
})
autoUpdater.on('download-progress', (progressObj) => { autoUpdater.on('download-progress', (progressObj) => {
myWindow.webContents.send('downloadProgress', progressObj) myWindow.webContents.send('downloadProgress', progressObj)
}) })

Loading…
Cancel
Save