1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-10 02:35:58 +01:00

Add user interface for filter selection.

This commit is contained in:
Juliusz Chroboczek 2021-01-13 13:57:05 +01:00
parent b24bd5c0ed
commit 684c8c5df8
3 changed files with 40 additions and 1 deletions

View file

@ -751,6 +751,12 @@ h1 {
margin-right: 0.4em; margin-right: 0.4em;
} }
#filterselect {
width: 8em;
text-align-last: center;
margin-right: 0.4em;
}
#sendselect { #sendselect {
width: 8em; width: 8em;
text-align-last: center; text-align-last: center;

View file

@ -192,6 +192,13 @@
<fieldset> <fieldset>
<legend>Other Settings</legend> <legend>Other Settings</legend>
<form id="filterform">
<label for="filterselect" class="sidenav-label-first">Filter:</label>
<select id="filterselect" class="select select-inline">
<option value="" selected>none</option>
</select>
</form>
<form id="sendform"> <form id="sendform">
<label for="sendselect" class="sidenav-label-first">Send:</label> <label for="sendselect" class="sidenav-label-first">Send:</label>
<select id="sendselect" class="select select-inline"> <select id="sendselect" class="select select-inline">

View file

@ -203,6 +203,16 @@ function reflectSettings() {
} }
audioselect.value = settings.audio; audioselect.value = settings.audio;
if(settings.hasOwnProperty('filter')) {
getSelectElement('filterselect').value = settings.filter;
} else {
let s = getSelectElement('filterselect').value;
if(s) {
settings.filter = s;
store = true;
}
}
if(settings.hasOwnProperty('request')) { if(settings.hasOwnProperty('request')) {
getSelectElement('requestselect').value = settings.request; getSelectElement('requestselect').value = settings.request;
} else { } else {
@ -482,6 +492,13 @@ document.getElementById('stopvideobutton').onclick = function(e) {
resizePeers(); resizePeers();
}; };
getSelectElement('filterselect').onchange = async function(e) {
if(!(this instanceof HTMLSelectElement))
throw new Error('Unexpected type for this');
updateSettings({filter: this.value});
changePresentation();
};
/** @returns {number} */ /** @returns {number} */
function getMaxVideoThroughput() { function getMaxVideoThroughput() {
let v = getSettings().send; let v = getSettings().send;
@ -941,6 +958,14 @@ let filters = {
}, },
}; };
function addFilters() {
for(let name in filters) {
let f = filters[name];
let d = f.description || name;
addSelectOption(getSelectElement('filterselect'), d, name);
}
}
function isSafari() { function isSafari() {
let ua = navigator.userAgent.toLowerCase(); let ua = navigator.userAgent.toLowerCase();
return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0; return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0;
@ -959,7 +984,7 @@ async function addLocalMedia(id) {
if(settings.filter) { if(settings.filter) {
filter = filters[settings.filter]; filter = filters[settings.filter];
if(!filter) { if(!filter) {
displayWarning(`Unknown filter ${filter}`); displayWarning(`Unknown filter ${settings.filter}`);
} }
} }
@ -2603,6 +2628,7 @@ function start() {
document.getElementById('title').textContent = title; document.getElementById('title').textContent = title;
} }
addFilters();
setMediaChoices(false).then(e => reflectSettings()); setMediaChoices(false).then(e => reflectSettings());
fillLogin(); fillLogin();