Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Commit

Permalink
chore: re-order settings, implement missing functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sircharlo committed Jun 15, 2024
1 parent c6a7065 commit 8ac6c25
Show file tree
Hide file tree
Showing 18 changed files with 263 additions and 196 deletions.
14 changes: 14 additions & 0 deletions .vscode/i18n-ally-reviews.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Review comments generated by i18n-ally. Please commit this file.

reviews:
autoStartMusic:
locales:
en-US:
comments:
- user:
name: Olivier Savignac
email: sircharlo@gmail.com
id: CzFh4-s2naOGW4eTXNs-f
type: approve
comment: ''
time: '2024-06-15T18:19:27.506Z'
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,8 @@
"&\n currentSettings.congregationName) ||\n $t('titles.profileSelection')\n }}\n ",
"&\n currentSettings ",
"Meeting Media Manager"
]
],
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
}
}
7 changes: 7 additions & 0 deletions public/obs-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src-electron/electron-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ function createWindow() {
});
enable(mediaWindow.webContents);
}
mainWindow.loadURL(process.env.APP_URL + '?page=congregation-selector');
mainWindow.loadURL(
process.env.APP_URL + '?page=initial-congregation-selector',
);
mediaWindow.loadURL(process.env.APP_URL + '?page=media-player');
}

Expand Down
11 changes: 11 additions & 0 deletions src-electron/electron-preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,16 @@ contextBridge.exposeInMainWorld('electronApi', {
});
},
path,
setMediaWindowPosition: (x: number, y: number) => {
const mediaWindow = getMediaWindow();
if (mediaWindow) {
mediaWindow.setPosition(x, y);
}
},
setautoStartAtLogin: (value: boolean) => {
app.setLoginItemSettings({
openAtLogin: value,
});
},
toggleMediaWindow,
});
24 changes: 15 additions & 9 deletions src/components/media/MusicButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import { storeToRefs } from 'pinia';
import { date } from 'quasar';
import { getFileUrl, getPublicationDirectoryContents } from 'src/helpers/fs';
import { formatTime } from 'src/helpers/mediaPlayback';
import { computed, ref } from 'vue';
import { computed, onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useCurrentStateStore } from '../../stores/current-state';
Expand Down Expand Up @@ -129,7 +129,8 @@ const getNextSongUrl = () => {
function playMusic() {
if (!musicPlayer.value || !musicPlayerSource.value) return;
musicPlayer.value.volume = 1;
musicPlayer.value.volume =
(getSettingValue('musicVolume') as number) / 100 ?? 1;
musicPlayerSource.value.src = getNextSongUrl();
musicPlayer.value.load();
musicPlayer.value.play().then(() => {
Expand Down Expand Up @@ -158,16 +159,24 @@ function playMusic() {
};
}
const meetingDay = ref(false);
onMounted(() => {
meetingDay.value = !!selectedDateObject.value?.meeting;
if (currentSettings.value?.autoStartMusic && meetingDay.value) {
playMusic();
}
});
/**
* Calculates the remaining time before the meeting starts based on the selected meeting day and start time settings.
*
* @return {string|null} The remaining time in hours and minutes, optionally formatted, or null if there is no meeting day selected.
*/
const remainingTimeBeforeMeetingStart = (formatted?: boolean) => {
const meetingDay = selectedDateObject.value.meeting;
if (meetingDay) {
if (meetingDay.value) {
const now = new Date();
const weMeeting = meetingDay === 'we';
const weMeeting = selectedDateObject.value?.meeting === 'we';
const meetingStartTime = weMeeting
? (getSettingValue('weStartTime') as string)
: (getSettingValue('mwStartTime') as string);
Expand All @@ -192,10 +201,7 @@ const remainingTimeBeforeMeetingStart = (formatted?: boolean) => {
const musicRemainingTime = computed(() => {
if (!musicPlayer.value) return '..:..';
if (musicStopping.value) return ref(t('music.stopping')).value;
if (
selectedDateObject.value.meeting &&
timeRemainingBeforeMusicStop.value > 0
)
if (meetingDay.value && timeRemainingBeforeMusicStop.value > 0)
return formatTime(timeRemainingBeforeMusicStop.value);
return currentSongRemainingTime.value;
});
Expand Down
32 changes: 6 additions & 26 deletions src/components/media/ObsStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,16 @@
rounded
v-if="currentSettings.obsEnable"
>
<q-icon>
<q-tooltip v-if="obsMessage">{{ $t(obsMessage) }}</q-tooltip>
<q-icon size="sm">
<svg
height="48"
viewBox="0 0 24 24"
width="48"
viewBox="0 0 50 50"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<rect height="48" opacity="0" stroke="none" width="48" />

<g transform="matrix(0.77 0 0 0.77 12 12)">
<path
d="M 16 3 C 8.82 3 3 8.82 3 16 C 3 23.18 8.82 29 16 29 C 23.18 29 29 23.18 29 16 C 29 8.82 23.18 3 16 3 z M 16 5 C 22.065 5 27 9.935 27 16 C 27 16.50788 26.953696 17.004343 26.886719 17.494141 C 26.520485 15.461275 25.274395 13.591986 23.345703 12.513672 C 22.376703 11.970672 21.336969 11.691672 20.292969 11.638672 C 19.860969 12.439672 19.2195 13.106594 18.4375 13.558594 C 17.6665 14.003594 16.772547 14.236313 15.810547 14.195312 C 15.431547 14.179312 15.048359 14.140687 14.693359 14.054688 C 12.637359 13.471687 11.129344 11.587609 11.152344 9.3496094 C 11.168648 7.7089655 12.014884 6.24578 13.277344 5.3554688 C 14.149701 5.1321017 15.059033 5 16 5 z M 11.707031 5.8730469 C 9.9593818 7.197907 8.8307222 9.3171916 8.8632812 11.662109 C 8.8772812 12.773109 9.1568125 13.814141 9.6328125 14.744141 C 10.541813 14.718141 11.442609 14.938625 12.224609 15.390625 C 12.995609 15.835625 13.643844 16.494656 14.089844 17.347656 C 14.264844 17.682656 14.414625 18.00575 14.515625 18.34375 C 15.060625 20.42675 14.182703 22.696734 12.220703 23.802734 C 11.169801 24.395897 9.974626 24.559981 8.8574219 24.347656 C 6.501292 22.328555 5 19.338626 5 16 C 5 11.457453 7.768964 7.5491323 11.707031 5.8730469 z M 21.886719 14.984375 C 22.677699 15.005146 23.474953 15.220719 24.205078 15.652344 C 25.487851 16.409673 26.310364 17.684901 26.556641 19.064453 C 25.225431 23.641945 21.000983 27 16 27 C 14.008698 27 12.144256 26.46055 10.53125 25.53125 C 12.146679 25.801922 13.865799 25.524862 15.369141 24.628906 C 16.324141 24.060906 17.084344 23.300828 17.652344 22.423828 C 17.175344 21.649828 16.917969 20.759469 16.917969 19.855469 C 16.917969 18.965469 17.163688 18.073719 17.679688 17.261719 C 17.881688 16.942719 18.071594 16.662109 18.308594 16.412109 C 19.265469 15.455859 20.568418 14.949756 21.886719 14.984375 z"
stroke-linecap="round"
style="
stroke: none;
stroke-width: 1;
stroke-dasharray: none;
stroke-linecap: butt;
stroke-dashoffset: 0;
stroke-linejoin: miter;
stroke-miterlimit: 4;
fill-rule: nonzero;
opacity: 1;
"
transform=" translate(-16, -16)"
/>
</g>
<path
d="M25,2C12.317,2,2,12.317,2,25s10.317,23,23,23s23-10.317,23-23S37.683,2,25,2z M43.765,34.373 c1.267-3.719-0.131-8.03-3.567-10.23c-4.024-2.576-9.374-1.401-11.95,2.623h0c-1.854,2.896-1.756,6.474-0.061,9.215 c-1.009,1.556-2.369,2.917-4.07,3.931c-5.4,3.22-12.356,1.952-16.225-2.779c-0.186-0.262-0.367-0.527-0.541-0.797 c2.62,3.273,7.404,4.213,11.166,2.09c4.161-2.348,5.631-7.625,3.283-11.786v0c-1.618-2.867-4.627-4.456-7.703-4.399 c-0.994-1.792-1.563-3.852-1.563-6.047c0-5.482,3.537-10.119,8.448-11.8c0.36-0.07,0.728-0.116,1.094-0.168 c-3.321,1.208-5.698,4.384-5.698,8.123c0,4.778,3.873,8.651,8.651,8.651c3.179,0,5.949-1.719,7.453-4.274 c2.197,0.015,4.417,0.594,6.427,1.825c5.056,3.094,7.173,9.294,5.39,14.713C44.137,33.643,43.948,34.007,43.765,34.373z"
/>
</svg>
<q-tooltip v-if="obsMessage">{{ $t(obsMessage) }}</q-tooltip>
</q-icon>
<q-badge
:color="
Expand Down
Loading

0 comments on commit 8ac6c25

Please sign in to comment.