Skip to content

Commit a7a1fdd

Browse files
committed
minor macos fixes
1 parent b926b0a commit a7a1fdd

File tree

3 files changed

+75
-73
lines changed

3 files changed

+75
-73
lines changed

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 - 2024 Alex313031
3+
Copyright (c) 2023 - 2024 Alex313031
44
Copyright (c) 2018 - 2021 Oscar Beaumont
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy

src/main.js

+42-42
Original file line numberDiff line numberDiff line change
@@ -939,53 +939,53 @@ app.on('restart', () => {
939939
// Dialog box asking if user really wants to relaunch app
940940
// Emitted from certain menu items that require an BrowserWindow reload
941941
app.on('relaunch-confirm', () => {
942-
dialog.showMessageBox(mainWindow, {
943-
'type': 'question',
944-
'title': 'Relaunch Confirmation',
945-
'message': 'Are you sure you want to relaunch Quark Player?',
946-
'buttons': [
947-
'Yes',
948-
'No'
949-
]
950-
})
951-
// Dialog returns a promise so let's handle it correctly
952-
.then((result) => {
953-
// Bail if the user pressed "No" or escaped (ESC) from the dialog box
954-
if (result.response !== 0) { return; }
955-
// Testing.
956-
if (result.response === 0) {
957-
//console.log('The "Yes" button was pressed (main process)');
958-
//app.relaunch();
959-
//app.quit();
960-
app.emit('relaunch');
961-
}
962-
})
942+
dialog.showMessageBox(mainWindow, {
943+
'type': 'question',
944+
'title': 'Relaunch Confirmation',
945+
'message': 'Are you sure you want to relaunch Quark Player?',
946+
'buttons': [
947+
'Yes',
948+
'No'
949+
]
950+
})
951+
// Dialog returns a promise so let's handle it correctly
952+
.then((result) => {
953+
// Bail if the user pressed "No" or escaped (ESC) from the dialog box
954+
if (result.response !== 0) { return; }
955+
// Testing.
956+
if (result.response === 0) {
957+
//console.log('The "Yes" button was pressed (main process)');
958+
//app.relaunch();
959+
//app.quit();
960+
app.emit('relaunch');
961+
}
962+
})
963963
});
964964

965965
// Dialog box asking if user really wants to restart app
966966
// Emitted from certain menu items that require an Electron restart
967967
app.on('restart-confirm', () => {
968-
dialog.showMessageBox(mainWindow, {
969-
'type': 'question',
970-
'title': 'Restart Confirmation',
971-
'message': 'Are you sure you want to restart Quark Player?',
972-
'buttons': [
973-
'Yes',
974-
'No'
975-
]
976-
})
977-
// Dialog returns a promise so let's handle it correctly
978-
.then((result) => {
979-
// Bail if the user pressed "No" or escaped (ESC) from the dialog box
980-
if (result.response !== 0) { return; }
981-
// Testing.
982-
if (result.response === 0) {
983-
//console.log('The "Yes" button was pressed (main process)');
984-
//app.relaunch();
985-
//app.quit();
986-
app.emit('restart');
987-
}
988-
})
968+
dialog.showMessageBox(mainWindow, {
969+
'type': 'question',
970+
'title': 'Restart Confirmation',
971+
'message': 'Are you sure you want to restart Quark Player?',
972+
'buttons': [
973+
'Yes',
974+
'No'
975+
]
976+
})
977+
// Dialog returns a promise so let's handle it correctly
978+
.then((result) => {
979+
// Bail if the user pressed "No" or escaped (ESC) from the dialog box
980+
if (result.response !== 0) { return; }
981+
// Testing.
982+
if (result.response === 0) {
983+
//console.log('The "Yes" button was pressed (main process)');
984+
//app.relaunch();
985+
//app.quit();
986+
app.emit('restart');
987+
}
988+
})
989989
});
990990

991991
// Same as the above except used when resetting settings

src/menu.js

+32-30
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,39 @@ module.exports = (store, services, mainWindow, app, defaultUserAgent) => {
9090
return Menu.buildFromTemplate([
9191
{
9292
label: appName,
93+
role: 'appMenu',
9394
submenu: [
95+
{
96+
label: 'About ' + appName,
97+
accelerator: 'Cmd+Alt+A',
98+
acceleratorWorksWhenHidden: false,
99+
visible: isMac ? true : false,
100+
click() {
101+
const aboutWindow = new BrowserWindow({
102+
width: 512,
103+
height: 480,
104+
useContentSize: true,
105+
autoHideMenuBar: true,
106+
skipTaskbar: true,
107+
title: 'About ' + appName,
108+
icon: path.join(__dirname, 'icon64.png'),
109+
webPreferences: {
110+
nodeIntegration: false,
111+
nodeIntegrationInWorker: false,
112+
contextIsolation: false,
113+
sandbox: false,
114+
experimentalFeatures: true,
115+
webviewTag: true,
116+
devTools: true,
117+
preload: path.join(__dirname, 'client-preload.js')
118+
}
119+
});
120+
require('@electron/remote/main').enable(aboutWindow.webContents);
121+
aboutWindow.loadFile('./ui/about.html');
122+
electronLog.info('Opened about.html');
123+
}
124+
},
125+
{ type: 'separator' },
94126
{
95127
label: 'Main Menu',
96128
accelerator: 'CmdOrCtrl+M',
@@ -213,36 +245,6 @@ module.exports = (store, services, mainWindow, app, defaultUserAgent) => {
213245
electronLog.info('Opened help.html');
214246
}
215247
},
216-
{
217-
label: 'About ' + appName,
218-
accelerator: 'Cmd+Alt+A',
219-
acceleratorWorksWhenHidden: false,
220-
visible: isMac ? true : false,
221-
click() {
222-
const aboutWindow = new BrowserWindow({
223-
width: 512,
224-
height: 480,
225-
useContentSize: true,
226-
autoHideMenuBar: true,
227-
skipTaskbar: true,
228-
title: 'About ' + appName,
229-
icon: path.join(__dirname, 'icon64.png'),
230-
webPreferences: {
231-
nodeIntegration: false,
232-
nodeIntegrationInWorker: false,
233-
contextIsolation: false,
234-
sandbox: false,
235-
experimentalFeatures: true,
236-
webviewTag: true,
237-
devTools: true,
238-
preload: path.join(__dirname, 'client-preload.js')
239-
}
240-
});
241-
require('@electron/remote/main').enable(aboutWindow.webContents);
242-
aboutWindow.loadFile('./ui/about.html');
243-
electronLog.info('Opened about.html');
244-
}
245-
},
246248
{ type: 'separator' },
247249
{
248250
label: 'Quit ' + appName,

0 commit comments

Comments
 (0)