-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenumaker.js
130 lines (127 loc) · 3.58 KB
/
menumaker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
const {Menu, BrowserWindow, ipcMain} = require('electron')
const {logs,logs_error, logs_debug} = require('./utils/logConfig')
const { autoUpdater, cwd } = require('./utils/utilities')
const Store = require('electron-store');
const store = new Store({ name: 'electronWindowIds'})
const path = require('path')
const fs = require('fs')
const links = {
dashboard: async function() {
store.set('currentPage','dashboard')
ipcMain.emit('changePage','change')
BrowserWindow.fromId(1).loadURL(`file://${path.join(cwd, 'renderers/dashboard/dashboard.html')}`)
},
joyview: async function() {
store.set('currentPage','joyview')
ipcMain.emit('changePage','change')
BrowserWindow.fromId(1).loadURL(`file://${path.join(cwd, 'renderers/joyview/joyview.html')}`)
},
getbuffer: async function() {
store.set('currentPage','getbuffer')
ipcMain.emit('changePage','change')
BrowserWindow.fromId(1).loadURL(`file://${path.join(cwd, 'renderers/getbuffer/getbuffer.html')}`)
},
checkForUpdates: async function() {
try {
// ipcMain.emit('changePage','change')
autoUpdater()
}
catch (e) {
logs_error(e)
}
}
}
const template = [
// {
// label: 'Dashboard',
// click: ()=>{links.dashboard();}
// },
// {
// label: 'Friends',
// click: ()=>{links.friends();}
// },
// {
// label: 'Information',
// // click: ()=>{links.statistics();}
// submenu: [
// {
// label: 'Statistics',
// click: ()=>{links.statistics()}
// },
// {
// label: 'Engineer Progress',
// click: ()=>{links.engineerProgress()}
// }
// ]
// },
{
label: 'Dashboard',
// click: ()=>{links.statistics();}
click: ()=>{links.dashboard()}
// submenu: [
// {
// label: 'Sampling',
// click: ()=>{links.sampling()}
// },
// // {
// // label: 'Test',
// // click: ()=>{links.test()}
// // }
// ]
},
{
label: 'Joystick Viewer',
// click: ()=>{links.statistics();}
click: ()=>{links.joyview()}
// submenu: [
// {
// label: 'Sampling',
// click: ()=>{links.sampling()}
// },
// // {
// // label: 'Test',
// // click: ()=>{links.test()}
// // }
// ]
},
{
label: 'Get Buffer',
// click: ()=>{links.statistics();}
click: ()=>{links.getbuffer()}
// submenu: [
// {
// label: 'Sampling',
// click: ()=>{links.sampling()}
// },
// // {
// // label: 'Test',
// // click: ()=>{links.test()}
// // }
// ]
},
{
label: 'About',
submenu: [
{
label: 'Check for Updates',
click: ()=>{links.checkForUpdates()}
},
]
},
// {
// label: 'Logs',
// click: ()=>{links.logs()}
// },
// {
// label: 'Test',
// click: ()=>{links.test()}
// }
]
const contextMenu = [
{
label: 'Test',
// click: ()=>{links.test()}
}
]
module.exports.mainMenu = Menu.buildFromTemplate(template)
module.exports.rightClickMenu = Menu.buildFromTemplate(contextMenu)