From 5f86ae2995cad6044c1c8fe3ebf98e5085658a90 Mon Sep 17 00:00:00 2001 From: LawnCable Date: Sun, 20 May 2018 20:51:35 -0400 Subject: social buttons and debug btn --- src/main/status.ts | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/main/status.ts (limited to 'src/main/status.ts') diff --git a/src/main/status.ts b/src/main/status.ts new file mode 100644 index 0000000..ffd6551 --- /dev/null +++ b/src/main/status.ts @@ -0,0 +1,47 @@ +import { mainWindow } from '../main'; + +type STATUS = { + progress:number, + activity:string, + playing:boolean, +} + +const status:STATUS = { + progress:null, + activity:null, + playing:false, //Is manaplus starting or started +} + +export namespace Status { + export function setProgress(value: number){ + status.progress=value; + updateStatus(); + } + export function removeProgress(){ + status.progress=null; + updateStatus(); + } + export function setActivity(value: string){ + status.activity=value; + updateStatus(); + } + export function setPlaying(value: boolean){ + status.playing=value; + updateStatus(); + } + export function getStatus():STATUS{ + return status; + } +} + +function updateStatus(){ + + if(status.progress==null || status.progress<0) + mainWindow.setProgressBar(-1); + else if(status.progress>100) + mainWindow.setProgressBar(2); + else + mainWindow.setProgressBar(status.progress/100); + + mainWindow.webContents.send('status-update', status); +} -- cgit v1.2.3-70-g09d2