Skip to content

Commit

Permalink
Merge pull request #49 from vassbo/dev
Browse files Browse the repository at this point in the history
⏱ Timers
  • Loading branch information
vassbo authored Aug 20, 2022
2 parents 550fabe + ec61f86 commit f275e6b
Show file tree
Hide file tree
Showing 64 changed files with 1,080 additions and 459 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "freeshow",
"version": "0.5.2",
"version": "0.5.3",
"private": true,
"main": "build/electron/index.js",
"description": "An application for showing song lyrics and more for free!",
Expand Down
24 changes: 22 additions & 2 deletions public/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
"overlays": "Overlays",
"audio": "Audio",
"to_start": "Go to start",
"nextTimer": "Next slide timer"
"nextTimer": "Next slide timer",
"lock": "Lock",
"unlock": "Unlock"
},
"clear": {
"all": "Clear all",
Expand Down Expand Up @@ -399,7 +401,9 @@
"selectAll": "Select all",
"force_outputs": "Force outputs",
"toggle_output": "Toggle output",
"move_to_front": "Move to front"
"move_to_front": "Move to front",
"lock_to_output": "Lock to output",
"toggle_clock": "Toggle clock"
},
"tools": {
"notes": "Notes",
Expand Down Expand Up @@ -473,6 +477,22 @@
"groove": "Groove",
"ridge": "Ridge"
},
"timer": {
"from_to": "From start to end",
"to_time": "Towards a time",
"to_event": "Time until event",
"counter": "Countdown",
"time": "Time",
"seconds": "Seconds",
"from": "From",
"to": "To",
"preview": "Preview",
"clock": "Clock",
"event": "Event",
"no_events": "There are no upcomming events",
"edit": "Edit",
"create": "Create"
},
"draw": {
"focus": "Focus",
"pointer": "Pointer",
Expand Down
26 changes: 23 additions & 3 deletions public/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
"overlays": "Capas",
"audio": "Audio",
"to_start": "Iniciar",
"nextTimer": "Temporizador de siguiente diapositiva"
"nextTimer": "Temporizador de siguiente diapositiva",
"lock": "Lock",
"unlock": "Unlock"
},
"clear": {
"all": "Borrar todo",
Expand Down Expand Up @@ -399,7 +401,9 @@
"selectAll": "Seleccionar todo",
"force_outputs": "Force outputs",
"toggle_output": "Toggle output",
"move_to_front": "Move to front"
"move_to_front": "Move to front",
"lock_to_output": "Lock to output",
"toggle_clock": "Toggle clock"
},
"tools": {
"notes": "Notas",
Expand Down Expand Up @@ -473,6 +477,22 @@
"groove": "Ranura",
"ridge": "Cresta"
},
"timer": {
"from_to": "From start to end",
"to_time": "Towards a time",
"to_event": "Time until event",
"counter": "Countdown",
"time": "Hora",
"seconds": "Seconds",
"from": "From",
"to": "To",
"preview": "Vista previa",
"clock": "Clock",
"event": "Nuevo evento",
"no_events": "There are no upcomming events",
"edit": "Editar",
"create": "Create"
},
"draw": {
"focus": "Enfoque",
"pointer": "Puntero",
Expand Down Expand Up @@ -571,7 +591,7 @@
},
"calendar": {
"type": "Type",
"event": "Event",
"event": "Nuevo evento",
"show": "Schedule show",
"name": "Nombre",
"color": "Color",
Expand Down
26 changes: 23 additions & 3 deletions public/lang/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
"overlays": "Overlegg",
"audio": "Lyd",
"to_start": "Gå til start",
"nextTimer": "Tid til neste lysbilde"
"nextTimer": "Tid til neste lysbilde",
"lock": "Lås",
"unlock": "Lås opp"
},
"clear": {
"all": "Fjern alt",
Expand Down Expand Up @@ -396,10 +398,12 @@
"changeIcon": "Endre ikon",
"changeGroup": "Endre gruppe",
"createNew": "Lag ny",
"selectAll": "Marker alt",
"selectAll": "Merk alt",
"force_outputs": "Tving visning av skjermer",
"toggle_output": "Veksle utgangsskjerm",
"move_to_front": "Flytt fremst"
"move_to_front": "Flytt fremst",
"lock_to_output": "Lås til utgang",
"toggle_clock": "Veksle klokke"
},
"tools": {
"notes": "Notater",
Expand Down Expand Up @@ -473,6 +477,22 @@
"groove": "Riller",
"ridge": "Rygg"
},
"timer": {
"from_to": "Fra start til slutt",
"to_time": "Til et klokkeslett",
"to_event": "Tid til arrangement",
"counter": "Nedtelling",
"time": "Tid",
"seconds": "Sekunder",
"from": "Fra",
"to": "Til",
"preview": "Forhåndsvisning",
"clock": "Klokke",
"event": "Hendelse",
"no_events": "Det er ingen fremtidige arrangement",
"edit": "Rediger",
"create": "Opprett"
},
"draw": {
"focus": "Fokus",
"pointer": "Peker",
Expand Down
28 changes: 24 additions & 4 deletions public/lang/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
"overlays": "Prekryvy",
"audio": "Audio",
"to_start": "Prejsť a začiatok",
"nextTimer": "Časovač ďalšieho snímku"
"nextTimer": "Časovač ďalšieho snímku",
"lock": "Lock",
"unlock": "Unlock"
},
"clear": {
"all": "Vyčistiť všetko",
Expand Down Expand Up @@ -399,7 +401,9 @@
"selectAll": "Vybrať všetky",
"force_outputs": "Force outputs",
"toggle_output": "Toggle output",
"move_to_front": "Move to front"
"move_to_front": "Move to front",
"lock_to_output": "Lock to output",
"toggle_clock": "Toggle clock"
},
"tools": {
"notes": "Poznámky",
Expand Down Expand Up @@ -473,6 +477,22 @@
"groove": "Ryha",
"ridge": "Vryp"
},
"timer": {
"from_to": "From start to end",
"to_time": "Towards a time",
"to_event": "Time until event",
"counter": "Countdown",
"time": "Čas",
"seconds": "Seconds",
"from": "From",
"to": "To",
"preview": "Náhľad",
"clock": "Clock",
"event": "Nová udalosť",
"no_events": "There are no upcomming events",
"edit": "Upraviť",
"create": "Create"
},
"draw": {
"focus": "Focus",
"pointer": "Pointer",
Expand All @@ -498,7 +518,7 @@
"next_slide_text": "Text aktuálneho snímku",
"next_slide": "Ďalší snímok",
"next_slide_notes": "Poznámky ďalšieho snímku",
"time": "Time",
"time": "Čas",
"system_clock": "Systémové hodiny",
"video_time": "Video čas",
"video_countdown": "Video odpočet",
Expand Down Expand Up @@ -571,7 +591,7 @@
},
"calendar": {
"type": "Type",
"event": "Event",
"event": "Nová udalosť",
"show": "Schedule show",
"name": "Názov",
"color": "Farba",
Expand Down
5 changes: 2 additions & 3 deletions src/electron/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ const createWindow = () => {
})

// app.asar/build/~electron/public/index.html
console.log(`file://${join(__dirname, "..", "..", "public", "index.html")}`)
const url: string = isProd ? `file://${join(__dirname, "..", "..", "public", "index.html")}` : "http://localhost:3000"

mainWindow.loadURL(url).catch((err) => {
Expand Down Expand Up @@ -525,8 +524,8 @@ ipcMain.on(READ_FOLDER, (_e, folderPath: string) => {
}
if (stat) {
// const [extension] = name.match(/\.[0-9a-z]+$/i) || [""]
// const extension = path.extname(filePath).substring(1)
const extension = name.substring(name.lastIndexOf(".") + 1)
const extension = path.extname(pathToFile).substring(1)
// const extension = name.substring(name.lastIndexOf(".") + 1)
files.push({ path: pathToFile, name, folder: stat.isDirectory(), extension: extension, stat })
}
}
Expand Down
1 change: 1 addition & 0 deletions src/electron/utils/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const defaultSettings: { [key in SaveListSettings]: any } = {
live: { enabled: true, activeSubTab: null },
},
drawer: { height: 300, stored: null },
timers: {},
language: null,
labelsDisabled: false,
groupNumbers: true,
Expand Down
38 changes: 21 additions & 17 deletions src/electron/utils/menuTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,37 @@ export function template(lang: any): any {
{ label: lang.actions?.redo || "Redo", accelerator: "CmdOrCtrl+Y", click: () => mc("redo") },
{ type: "separator" },
// { label: lang.actions?.cut || "Cut", role: "cut" },
{ label: lang.actions?.copy || "Copy", role: "copy" },
{ label: lang.actions?.paste || "Paste", role: "paste" },
{ label: lang.actions?.copy || "Copy", accelerator: "CmdOrCtrl+C", click: () => mc("copy") },
{ label: lang.actions?.paste || "Paste", accelerator: "CmdOrCtrl+V", click: () => mc("paste") },
...(isMac
? [
{ label: lang.actions?.pasteAndMatchStyle || "Paste And Match Style", role: "pasteAndMatchStyle" },
{ label: lang.actions?.delete || "Delete", role: "delete" },
{ label: lang.actions?.selectAll || "Select All", role: "selectAll" },
{ type: "separator" },
{
label: lang.actions?.speech || "Speech",
submenu: [
{ label: lang.actions?.startSpeaking || "Start Speaking", role: "startSpeaking" },
{ label: lang.actions?.stopSpeaking || "Stop Speaking", role: "stopSpeaking" },
],
},
// { label: lang.actions?.pasteAndMatchStyle || "Paste And Match Style", role: "pasteAndMatchStyle", click: () => mc("paste") },
{ label: lang.actions?.delete || "Delete", click: () => mc("delete") },
{ label: lang.actions?.selectAll || "Select All", accelerator: "CmdOrCtrl+A", click: () => mc("selectAll") },
// { type: "separator" },
// {
// label: lang.actions?.speech || "Speech",
// submenu: [
// { label: lang.actions?.startSpeaking || "Start Speaking", role: "startSpeaking" },
// { label: lang.actions?.stopSpeaking || "Stop Speaking", role: "stopSpeaking" },
// ],
// },
]
: [{ label: lang.actions?.delete || "delete", role: "Delete" }, { type: "separator" }, { label: lang.actions?.selectAll || "Select All", role: "selectAll" }]),
: [
{ label: lang.actions?.delete || "delete", click: () => mc("delete") },
{ type: "separator" },
{ label: lang.actions?.selectAll || "Select All", accelerator: "CmdOrCtrl+A", click: () => mc("selectAll") },
]),
],
},
{
label: lang.titlebar?.view || "View",
submenu: [
...(isProd ? [] : [{ role: "reload" }, { role: "toggleDevTools" }, { type: "separator" }]),
{ label: lang.actions?.fullscreen || "Toggle Fullscreen", role: "togglefullscreen" },
{ label: lang.actions?.resetZoom || "Reset Zoom", role: "resetZoom" },
{ label: lang.actions?.zoomIn || "Zoom In", role: "zoomIn" },
{ label: lang.actions?.zoomOut || "Zoom Out", role: "zoomOut" },
// { label: lang.actions?.resetZoom || "Reset Zoom", role: "resetZoom" },
// { label: lang.actions?.zoomIn || "Zoom In", role: "zoomIn" },
// { label: lang.actions?.zoomOut || "Zoom Out", role: "zoomOut" },
],
},
{
Expand Down
7 changes: 6 additions & 1 deletion src/electron/utils/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ export function updateOutput(data: any) {
export function removeOutput(id: string) {
if (!outputWindows[id]) return
// close window
outputWindows[id].close()
try {
outputWindows[id].close()
} catch (error) {
console.log(error)
}

delete outputWindows[id]
// send to app ?
}
Expand Down
12 changes: 9 additions & 3 deletions src/frontend/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import { redo, undo } from "./components/helpers/history"
import { getActiveOutputs, getResolution, isOutCleared } from "./components/helpers/output"
import { _show } from "./components/helpers/shows"
import { startTimer } from "./components/helpers/timerTick"
import MenuBar from "./components/main/MenuBar.svelte"
import Popup from "./components/main/Popup.svelte"
import Top from "./components/main/Top.svelte"
Expand All @@ -30,7 +31,6 @@
import Projects from "./components/show/Projects.svelte"
import Show from "./components/show/Show.svelte"
import ShowTools from "./components/show/ShowTools.svelte"
import TimerInterval from "./components/show/tools/TimerInterval.svelte"
import { getStyleResolution } from "./components/slide/getStyleResolution"
import Shows from "./components/stage/Shows.svelte"
import StageShow from "./components/stage/StageShow.svelte"
Expand All @@ -43,6 +43,7 @@
activePopup,
activeShow,
activeStage,
activeTimers,
currentWindow,
drawer,
os,
Expand Down Expand Up @@ -148,7 +149,7 @@
}
function keydown(e: any) {
if ($currentWindow === "output" || document.activeElement?.classList.contains("edit")) return
if ($currentWindow === "output") return
if (e.ctrlKey || e.metaKey) {
if (document.activeElement === document.body && Object.keys(drawerMenus).includes((e.key - 1).toString())) {
activeDrawerTab.set(drawerMenus[e.key - 1])
Expand All @@ -157,13 +158,16 @@
return
}
if (document.activeElement?.classList.contains("edit") && ["a", "c", "v", "z", "y", "Z"].includes(e.key)) return
if (ctrlKeys[e.key]) {
e.preventDefault()
ctrlKeys[e.key](e)
}
return
}
if (document.activeElement?.classList.contains("edit") && e.key !== "Escape") return
if (document.activeElement === document.body && Object.keys(menus).includes((e.key - 1).toString())) activePage.set(menus[e.key - 1])
if (keys[e.key]) {
Expand All @@ -172,6 +176,9 @@
}
}
// countdown timer tick
$: if ($activeTimers.length) startTimer()
function hideDisplay(ctrlKey: boolean = true) {
if (!ctrlKey) return
outputDisplay.set(false)
Expand Down Expand Up @@ -213,7 +220,6 @@
{:else}
<ContextMenu />
<Popup />
<TimerInterval />

<div class="column">
<Top />
Expand Down
Loading

0 comments on commit f275e6b

Please sign in to comment.