From 8a1291bc2584d4eceb121ce1dba1b95f119e8db1 Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Fri, 12 Feb 2021 15:59:49 +0100 Subject: [PATCH] Can now open the client view from amadeus, remove the 'reload-queue' manual event request --- instance/main.js | 2 -- main.js | 29 ++++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/instance/main.js b/instance/main.js index c970288..14b6975 100644 --- a/instance/main.js +++ b/instance/main.js @@ -19,7 +19,6 @@ const buttonList = [ [ 'right', `<i class="fas fa-compass"></i>`, 'openKurisu', 'Kurisu in a new page' ], [ 'right', `<i class="fas fa-user-friends"></i>`, 'openUserView', 'Open client view' ], [ 'right', `<i class="fas fa-music"></i>`, 'openMdtView', 'Open metadata view' ], - [ 'right', `<i class="fas fa-sync-alt"></i>`, 'reloadQueue', 'Reload the queue' ], [ 'right', `<i class="fas fa-window-close"></i>`, 'closeButton', 'Quit Amadeus' ], ]; @@ -85,7 +84,6 @@ window.onload = () => { addIpcToButton('openKurisu', ['toggle-kurisu']); addIpcToButton('openUserView', ['toggle-client-view']); - addIpcToButton('reloadQueue', ['reload-queue-request']); setTimeout(() => ipcRenderer.send('reload-queue-request'), 1000); setInterval(() => ipcRenderer.send('verify-queue-reloaded-request'), 50); diff --git a/main.js b/main.js index db53eeb..a6966b5 100644 --- a/main.js +++ b/main.js @@ -75,6 +75,8 @@ function createInstanceWindow() { win = new BrowserWindow({ width: 1280, height: 720, + minWidth: 1200, + minHeight: 360, hasShadow: false, frame: false, menuBarVisible: true, @@ -87,6 +89,26 @@ function createInstanceWindow() { win.loadFile('instance/index.html'); } +function createUserViewWindow() { + /* User view window */ + const uv = new BrowserWindow({ + width: 720, + title: 'Kurisu', + height: 360, + frame: false, + parent: win, + webPreferences: { + nodeIntegration: true, + worldSafeExecuteJavaScript: true, + contextIsolation: true, + }, + }); + uv.loadURL(`http://localhost:${config.clientport}/`); + uv.once('ready-to-show', () => { + uv.show(); + }); +} + function createKurisuWindow() { /* Kurisu window */ const kurisu = new BrowserWindow({ @@ -162,10 +184,15 @@ app.on('ready', () => { ***************/ ipcMain.on('toggle-kurisu', (event, arg) => { - logger.debug('main', 'Toggle kurisu view'); + logger.debug('main', 'Open kurisu view'); createKurisuWindow(); }); +ipcMain.on('toggle-client-view', (event, arg) => { + logger.debug('main', 'Open client view'); + createUserViewWindow(); +}); + /********************************* * Messages from the main window * *********************************/ -- GitLab