mirror of
https://github.com/stagehacks/Cue-View.git
synced 2026-08-18 20:13:57 +00:00
Initial prettify
This commit is contained in:
@@ -2,7 +2,8 @@ const { app, BrowserWindow, Menu } = require('electron');
|
||||
const path = require('path');
|
||||
|
||||
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
|
||||
if (require('electron-squirrel-startup')) { // eslint-disable-line global-require
|
||||
if (require('electron-squirrel-startup')) {
|
||||
// eslint-disable-line global-require
|
||||
app.quit();
|
||||
}
|
||||
|
||||
@@ -10,12 +11,10 @@ if (require('electron-squirrel-startup')) {
|
||||
app.quit();
|
||||
}
|
||||
|
||||
|
||||
var menu;
|
||||
let mainWindow;
|
||||
|
||||
const createWindow = () => {
|
||||
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1500,
|
||||
height: 900,
|
||||
@@ -24,45 +23,37 @@ const createWindow = () => {
|
||||
frame: false,
|
||||
show: false,
|
||||
//backgroundColor: "#333333",
|
||||
vibrancy: "window",
|
||||
visualEffectState: "followWindow",
|
||||
vibrancy: 'window',
|
||||
visualEffectState: 'followWindow',
|
||||
webPreferences: {
|
||||
//enableRemoteModule: true,
|
||||
contextIsolation: false,
|
||||
nodeIntegration: true,
|
||||
preload: path.join(__dirname, 'preload.js')
|
||||
}
|
||||
preload: path.join(__dirname, 'preload.js'),
|
||||
},
|
||||
});
|
||||
|
||||
mainWindow.loadFile('index.html');
|
||||
|
||||
mainWindow.on('ready-to-show', () => {
|
||||
mainWindow.show();
|
||||
mainWindow.show();
|
||||
});
|
||||
|
||||
if(process.defaultApp){
|
||||
if (process.defaultApp) {
|
||||
mainWindow.webContents.openDevTools();
|
||||
}
|
||||
|
||||
|
||||
menu = Menu.buildFromTemplate(menuTemplate);
|
||||
Menu.setApplicationMenu(menu);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
createWindow();
|
||||
|
||||
app.on('activate', function () {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
||||
});
|
||||
});
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
@@ -70,9 +61,7 @@ app.on('window-all-closed', () => {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
const { ipcMain } = require('electron')
|
||||
const { ipcMain } = require('electron');
|
||||
ipcMain.on('enableDeviceDropdown', (event, arg) => {
|
||||
menu.getMenuItemById('devicePin').enabled = true;
|
||||
menu.getMenuItemById('deviceDelete').enabled = true;
|
||||
@@ -89,107 +78,109 @@ ipcMain.on('disableSearchAll', (event, arg) => {
|
||||
menu.getMenuItemById('deviceSearch').enabled = false;
|
||||
});
|
||||
|
||||
ipcMain.on('setDevicePin', function(event, arg){
|
||||
ipcMain.on('setDevicePin', function (event, arg) {
|
||||
menu.getMenuItemById('devicePin').checked = arg;
|
||||
})
|
||||
});
|
||||
|
||||
const isMac = process.platform === 'darwin'
|
||||
const isMac = process.platform === 'darwin';
|
||||
|
||||
const menuTemplate = [
|
||||
{ role: 'appMenu' },
|
||||
{
|
||||
label: "File",
|
||||
label: 'File',
|
||||
submenu: [
|
||||
{
|
||||
label: "Clear Saved Data",
|
||||
id: "resetViews",
|
||||
click: function(menuItem, window, event){
|
||||
mainWindow.webContents.send("resetViews");
|
||||
|
||||
}
|
||||
label: 'Clear Saved Data',
|
||||
id: 'resetViews',
|
||||
click: function (menuItem, window, event) {
|
||||
mainWindow.webContents.send('resetViews');
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Reload App",
|
||||
role: "reload"
|
||||
label: 'Reload App',
|
||||
role: 'reload',
|
||||
},
|
||||
{
|
||||
type: "separator"
|
||||
type: 'separator',
|
||||
},
|
||||
isMac ? { role: 'close' } : { role: 'quit' },
|
||||
]
|
||||
],
|
||||
},
|
||||
{ role: 'editMenu' },
|
||||
{
|
||||
label: "View",
|
||||
label: 'View',
|
||||
submenu: [
|
||||
{ role: 'togglefullscreen' },
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: "Arrangement 1",
|
||||
accelerator: "CommandOrControl+1",
|
||||
id: "window1",
|
||||
label: 'Arrangement 1',
|
||||
accelerator: 'CommandOrControl+1',
|
||||
id: 'window1',
|
||||
enabled: true,
|
||||
click: function(menuItem, window, event){
|
||||
mainWindow.webContents.send("doSlots1");
|
||||
}
|
||||
click: function (menuItem, window, event) {
|
||||
mainWindow.webContents.send('doSlots1');
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Arrangement 2",
|
||||
accelerator: "CommandOrControl+2",
|
||||
id: "window2",
|
||||
label: 'Arrangement 2',
|
||||
accelerator: 'CommandOrControl+2',
|
||||
id: 'window2',
|
||||
enabled: true,
|
||||
click: function(menuItem, window, event){
|
||||
mainWindow.webContents.send("doSlots2");
|
||||
}
|
||||
click: function (menuItem, window, event) {
|
||||
mainWindow.webContents.send('doSlots2');
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Arrangement 3",
|
||||
accelerator: "CommandOrControl+3",
|
||||
id: "window3",
|
||||
label: 'Arrangement 3',
|
||||
accelerator: 'CommandOrControl+3',
|
||||
id: 'window3',
|
||||
enabled: true,
|
||||
click: function(menuItem, window, event){
|
||||
mainWindow.webContents.send("doSlots3");
|
||||
}
|
||||
click: function (menuItem, window, event) {
|
||||
mainWindow.webContents.send('doSlots3');
|
||||
},
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{ role: 'toggleDevTools' }
|
||||
]
|
||||
{ role: 'toggleDevTools' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "Device",
|
||||
label: 'Device',
|
||||
submenu: [
|
||||
{
|
||||
label: "Search for Devices",
|
||||
accelerator: "CommandOrControl+F",
|
||||
id: "deviceSearch",
|
||||
label: 'Search for Devices',
|
||||
accelerator: 'CommandOrControl+F',
|
||||
id: 'deviceSearch',
|
||||
enabled: true,
|
||||
click: function(menuItem, window, event){
|
||||
mainWindow.webContents.send("doSearch");
|
||||
}
|
||||
click: function (menuItem, window, event) {
|
||||
mainWindow.webContents.send('doSearch');
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "separator"
|
||||
type: 'separator',
|
||||
},
|
||||
{
|
||||
label: "Pinned",
|
||||
type: "checkbox",
|
||||
label: 'Pinned',
|
||||
type: 'checkbox',
|
||||
checked: true,
|
||||
accelerator: "CommandOrControl+P",
|
||||
id: "devicePin",
|
||||
accelerator: 'CommandOrControl+P',
|
||||
id: 'devicePin',
|
||||
enabled: false,
|
||||
click: function(menuItem, window, event){
|
||||
mainWindow.webContents.send("setActiveDevicePinned", menuItem.checked);
|
||||
}
|
||||
click: function (menuItem, window, event) {
|
||||
mainWindow.webContents.send(
|
||||
'setActiveDevicePinned',
|
||||
menuItem.checked
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Delete",
|
||||
accelerator: "CommandOrControl+Backspace",
|
||||
id: "deviceDelete",
|
||||
label: 'Delete',
|
||||
accelerator: 'CommandOrControl+Backspace',
|
||||
id: 'deviceDelete',
|
||||
enabled: false,
|
||||
click: function(menuItem, window, event){
|
||||
mainWindow.webContents.send("doDelete");
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
click: function (menuItem, window, event) {
|
||||
mainWindow.webContents.send('doDelete');
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user