+ main menu support
+ about info
This commit is contained in:
@@ -116,10 +116,15 @@ body.pg-loaded > .inner {
|
|||||||
#dlgGeneralConfirm .modalBody {
|
#dlgGeneralConfirm .modalBody {
|
||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#dlgDeleteAddressConfirm .modalBody {
|
#dlgDeleteAddressConfirm .modalBody {
|
||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#dlgAboutInfo .modalBody {
|
||||||
|
height: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
#dlgCreateWalletPassword .modalBody,
|
#dlgCreateWalletPassword .modalBody,
|
||||||
#dlgCreateAddressAndName .modalBody {
|
#dlgCreateAddressAndName .modalBody {
|
||||||
height: 200px;
|
height: 200px;
|
||||||
@@ -374,4 +379,14 @@ div.noAddressWrapper {
|
|||||||
|
|
||||||
#btnAddToAddressBook {
|
#btnAddToAddressBook {
|
||||||
margin-right: 3px;
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.infoText {
|
||||||
|
margin: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#aboutInfoWallet {
|
||||||
|
font-size: 1.5em;
|
||||||
|
text-decoration: underline;
|
||||||
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
27
index.html
27
index.html
@@ -108,13 +108,26 @@
|
|||||||
|
|
||||||
<!-- The modal for general confirmation -->
|
<!-- The modal for general confirmation -->
|
||||||
<div id="dlgGeneralConfirm" class="modalDialog" data-iziModal-title="Confirmation" data-iziModal-subtitle="" data-iziModal-icon="icon-home">
|
<div id="dlgGeneralConfirm" class="modalDialog" data-iziModal-title="Confirmation" data-iziModal-subtitle="" data-iziModal-icon="icon-home">
|
||||||
<div class="modalBody">
|
<div class="modalBody">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<span id="txtGeneralConfirm"></span>
|
<span id="txtGeneralConfirm"></span>
|
||||||
</div>
|
|
||||||
<button type="button" class="btn btn-etho btn-dialog-cancel" id="btnGeneralConfirmNo">No</button>
|
|
||||||
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnGeneralConfirmYes">Yes</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
<button type="button" class="btn btn-etho btn-dialog-cancel" id="btnGeneralConfirmNo">No</button>
|
||||||
|
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnGeneralConfirmYes">Yes</button>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</div>
|
||||||
|
|
||||||
|
<!-- The modal for about info -->
|
||||||
|
<div id="dlgAboutInfo" class="modalDialog" data-iziModal-title="About Ether1 Wallet" data-iziModal-icon="icon-home">
|
||||||
|
<div class="modalBody">
|
||||||
|
<div class="aboutInfo">
|
||||||
|
<div class="infoText" id="aboutInfoWallet">Ether1 Wallet</div>
|
||||||
|
<div class="infoText" id="aboutInfoGitHub">GitHub: <a id="urlOpenGitHub" href="https://github.com/taeguscromis/Ether1DesktopWallet">https://github.com/taeguscromis/Ether1DesktopWallet</a></div>
|
||||||
|
<div class="infoText" id="aboutInfoLicence">Made under <a id="urlOpenLicence" href="https://choosealicense.com/licenses/gpl-3.0">GPL v3.0</a> licence</div>
|
||||||
|
<div class="infoText" id="aboutInfoVersion">Version: <span id="versionNumber"></span></div>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnAboutInfoClose">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
10
main.js
10
main.js
@@ -1,5 +1,5 @@
|
|||||||
// Modules to control application life and create native browser window
|
// Modules to control application life and create native browser window
|
||||||
const {app, ipcMain, BrowserWindow} = require('electron');
|
const {app, Menu, ipcMain, BrowserWindow} = require('electron');
|
||||||
const singleInstance = require('single-instance');
|
const singleInstance = require('single-instance');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
@@ -9,7 +9,7 @@ var locker = new singleInstance('Ether1DesktopWallet');
|
|||||||
locker.lock().then(function() {
|
locker.lock().then(function() {
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
let mainWindow
|
mainWindow = null;
|
||||||
|
|
||||||
function createWindow () {
|
function createWindow () {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
@@ -35,7 +35,9 @@ locker.lock().then(function() {
|
|||||||
// in an array if your app supports multi windows, this is the time
|
// in an array if your app supports multi windows, this is the time
|
||||||
// when you should delete the corresponding element.
|
// when you should delete the corresponding element.
|
||||||
mainWindow = null
|
mainWindow = null
|
||||||
})
|
});
|
||||||
|
|
||||||
|
require('./modules/menu.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method will be called when Electron has finished
|
// This method will be called when Electron has finished
|
||||||
@@ -59,7 +61,7 @@ locker.lock().then(function() {
|
|||||||
if (mainWindow === null) {
|
if (mainWindow === null) {
|
||||||
createWindow()
|
createWindow()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// In this file you can include the rest of your app's specific main process
|
// In this file you can include the rest of your app's specific main process
|
||||||
// code. You can also put them in separate files and require them here.
|
// code. You can also put them in separate files and require them here.
|
||||||
|
|||||||
202
modules/menu.js
Normal file
202
modules/menu.js
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
const {app, Menu, ipcMain} = require('electron');
|
||||||
|
const open = require("open");
|
||||||
|
|
||||||
|
const template = [
|
||||||
|
{
|
||||||
|
label: 'File',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label:'Exit',
|
||||||
|
click() {
|
||||||
|
app.quit()
|
||||||
|
} }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Edit',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
role: 'undo'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'redo'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'separator'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'cut'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'copy'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'paste'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'delete'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'selectall'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'View',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Reload',
|
||||||
|
accelerator: 'CmdOrCtrl+R',
|
||||||
|
click (item, focusedWindow) {
|
||||||
|
if (focusedWindow) focusedWindow.reload()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Toggle Developer Tools',
|
||||||
|
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
|
||||||
|
click (item, focusedWindow) {
|
||||||
|
if (focusedWindow) focusedWindow.webContents.toggleDevTools()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'separator'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'resetzoom'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'zoomin'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'zoomout'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'separator'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'togglefullscreen'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'window',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
role: 'minimize'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'close'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'help',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'About Ether1 wallet',
|
||||||
|
click () {
|
||||||
|
var infoData = {};
|
||||||
|
infoData.version = app.getVersion();
|
||||||
|
mainWindow.webContents.send('showAboutDialog', infoData);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Ether1 documentation',
|
||||||
|
click () {
|
||||||
|
open("https://docs.ether1.org");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Report issue on GitHub',
|
||||||
|
click () {
|
||||||
|
open("https://github.com/taeguscromis/Ether1DesktopWallet/issues");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
const name = app.getName()
|
||||||
|
template.unshift({
|
||||||
|
label: name,
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
role: 'about'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'separator'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'services',
|
||||||
|
submenu: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'separator'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'hide'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'hideothers'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'unhide'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'separator'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'quit'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
// Edit menu.
|
||||||
|
template[1].submenu.push(
|
||||||
|
{
|
||||||
|
type: 'separator'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Speech',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
role: 'startspeaking'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'stopspeaking'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
// Window menu.
|
||||||
|
template[3].submenu = [
|
||||||
|
{
|
||||||
|
label: 'Close',
|
||||||
|
accelerator: 'CmdOrCtrl+W',
|
||||||
|
role: 'close'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Minimize',
|
||||||
|
accelerator: 'CmdOrCtrl+M',
|
||||||
|
role: 'minimize'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Zoom',
|
||||||
|
role: 'zoom'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'separator'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Bring All to Front',
|
||||||
|
role: 'front'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
ipcMain.on('openURL', (event, arg) => {
|
||||||
|
open(arg);
|
||||||
|
});
|
||||||
|
|
||||||
|
const menu = Menu.buildFromTemplate(template)
|
||||||
|
Menu.setApplicationMenu(menu)
|
||||||
@@ -49,6 +49,7 @@
|
|||||||
"handlebars": "^4.0.12",
|
"handlebars": "^4.0.12",
|
||||||
"moment": "^2.23.0",
|
"moment": "^2.23.0",
|
||||||
"nedb": "^1.8.0",
|
"nedb": "^1.8.0",
|
||||||
|
"open": "0.0.5",
|
||||||
"single-instance": "0.0.1"
|
"single-instance": "0.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -64,6 +64,23 @@ class MainGUI {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showAboutDialog(infoData) {
|
||||||
|
$("#versionNumber").html(infoData.version);
|
||||||
|
|
||||||
|
// create and open the dialog
|
||||||
|
$("#dlgAboutInfo").iziModal();
|
||||||
|
$('#dlgAboutInfo').iziModal('open');
|
||||||
|
|
||||||
|
$("#urlOpenLicence, #urlOpenGitHub").off("click").on("click", function(even) {
|
||||||
|
event.preventDefault();
|
||||||
|
ipcRenderer.send('openURL', $(this).attr("href"));
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#btnAboutInfoClose").off("click").on("click", function(even) {
|
||||||
|
$('#dlgAboutInfo').iziModal('close');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
renderTemplate(template, data, container) {
|
renderTemplate(template, data, container) {
|
||||||
var template = Handlebars.compile(ipcRenderer.sendSync('getTemplateContent', template));
|
var template = Handlebars.compile(ipcRenderer.sendSync('getTemplateContent', template));
|
||||||
|
|
||||||
@@ -84,6 +101,10 @@ class MainGUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ipcRenderer.on('showAboutDialog', function(event, message) {
|
||||||
|
EthoMainGUI.showAboutDialog(message);
|
||||||
|
});
|
||||||
|
|
||||||
$("#mainNavBtnTransactions").click(function() {
|
$("#mainNavBtnTransactions").click(function() {
|
||||||
EthoTransactions.clearFilter();
|
EthoTransactions.clearFilter();
|
||||||
EthoMainGUI.changeAppState("transactions");
|
EthoMainGUI.changeAppState("transactions");
|
||||||
|
|||||||
Reference in New Issue
Block a user