do not use xmpp in settings menu
This commit is contained in:
parent
c50151d85d
commit
fe77846b89
33
app.js
33
app.js
|
@ -40,6 +40,14 @@ function createConference(connection, room) {
|
||||||
room.setDisplayName(nickname);
|
room.setDisplayName(nickname);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setEmail: function (email) {
|
||||||
|
// FIXME room.setEmail
|
||||||
|
},
|
||||||
|
|
||||||
|
setStartMuted: function (audio, video) {
|
||||||
|
// FIXME room.setStartMuted
|
||||||
|
},
|
||||||
|
|
||||||
sendMessage: function (message) {
|
sendMessage: function (message) {
|
||||||
room.sendTextMessage(message);
|
room.sendTextMessage(message);
|
||||||
},
|
},
|
||||||
|
@ -50,6 +58,10 @@ function createConference(connection, room) {
|
||||||
|
|
||||||
localId: function () {
|
localId: function () {
|
||||||
return room.myUserId();
|
return room.myUserId();
|
||||||
|
},
|
||||||
|
|
||||||
|
isLocalId: function (id) {
|
||||||
|
return id === this.localId();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -173,8 +185,8 @@ function initConference(connection, roomName) {
|
||||||
room.on(
|
room.on(
|
||||||
ConferenceEvents.USER_JOINED,
|
ConferenceEvents.USER_JOINED,
|
||||||
function (id) {
|
function (id) {
|
||||||
// FIXME ????
|
// FIXME email???
|
||||||
APP.UI.addUser();
|
APP.UI.addUser(id);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -263,6 +275,23 @@ function init() {
|
||||||
APP.conference.sendMessage(message);
|
APP.conference.sendMessage(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) {
|
||||||
|
APP.translation.setLanguage(language);
|
||||||
|
APP.settings.setLanguage(language);
|
||||||
|
});
|
||||||
|
|
||||||
|
APP.UI.addListener(UIEvents.EMAIL_CHANGED, function (email) {
|
||||||
|
APP.conference.setEmail(email);
|
||||||
|
APP.settings.setEmail(email);
|
||||||
|
});
|
||||||
|
|
||||||
|
APP.UI.addListener(
|
||||||
|
UIEvents.START_MUTED_CHANGED,
|
||||||
|
function (startAudioMuted, startVideoMuted) {
|
||||||
|
APP.conference.setStartMuted(startAudioMuted, startVideoMuted);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
APP.desktopsharing.init();
|
APP.desktopsharing.init();
|
||||||
APP.statistics.start();
|
APP.statistics.start();
|
||||||
APP.connectionquality.init();
|
APP.connectionquality.init();
|
||||||
|
|
|
@ -129,10 +129,10 @@ UI.notifyBridgeDown = function () {
|
||||||
messageHandler.showError("dialog.error", "dialog.bridgeUnavailable");
|
messageHandler.showError("dialog.error", "dialog.bridgeUnavailable");
|
||||||
};
|
};
|
||||||
|
|
||||||
UI.changeDisplayName = function (jid, displayName) {
|
UI.changeDisplayName = function (id, displayName) {
|
||||||
ContactList.onDisplayNameChange(jid, displayName);
|
ContactList.onDisplayNameChange(id, displayName);
|
||||||
SettingsMenu.onDisplayNameChange(jid, displayName);
|
SettingsMenu.onDisplayNameChange(id, displayName);
|
||||||
VideoLayout.onDisplayNameChanged(jid, displayName);
|
VideoLayout.onDisplayNameChanged(id, displayName);
|
||||||
};
|
};
|
||||||
|
|
||||||
UI.initConference = function (jid) {
|
UI.initConference = function (jid) {
|
||||||
|
@ -171,6 +171,10 @@ function registerListeners() {
|
||||||
UI.addListener(UIEvents.FILM_STRIP_TOGGLED, function (isToggled) {
|
UI.addListener(UIEvents.FILM_STRIP_TOGGLED, function (isToggled) {
|
||||||
VideoLayout.onFilmStripToggled(isToggled);
|
VideoLayout.onFilmStripToggled(isToggled);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
UI.addListener(UIEvents.EMAIL_CHANGED, function (email) {
|
||||||
|
Avatar.setUserAvatar(APP.xmpp.myJid(), email);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onResize() {
|
function onResize() {
|
||||||
|
|
|
@ -169,16 +169,15 @@ var ContactList = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onDisplayNameChange: function (peerJid, displayName) {
|
onDisplayNameChange: function (id, displayName) {
|
||||||
if (peerJid === 'localVideoContainer')
|
if (id === 'localVideoContainer') {
|
||||||
peerJid = APP.xmpp.myJid();
|
id = APP.conference.localId();
|
||||||
|
}
|
||||||
|
var contactName = $('#contacts #' + id + '>p');
|
||||||
|
|
||||||
var resourceJid = Strophe.getResourceFromJid(peerJid);
|
if (contactName && displayName && displayName.length > 0) {
|
||||||
|
|
||||||
var contactName = $('#contacts #' + resourceJid + '>p');
|
|
||||||
|
|
||||||
if (contactName && displayName && displayName.length > 0)
|
|
||||||
contactName.html(displayName);
|
contactName.html(displayName);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
userAvatarChanged: function (resourceJid, contactListUrl) {
|
userAvatarChanged: function (resourceJid, contactListUrl) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* global APP, $ */
|
/* global APP, $ */
|
||||||
var Avatar = require("../../avatar/Avatar");
|
|
||||||
var Settings = require("./../../../settings/Settings");
|
var Settings = require("./../../../settings/Settings");
|
||||||
var UIUtil = require("../../util/UIUtil");
|
var UIUtil = require("../../util/UIUtil");
|
||||||
var languages = require("../../../../service/translation/languages");
|
var languages = require("../../../../service/translation/languages");
|
||||||
|
var UIEvents = require("../../../../service/UI/UIEvents");
|
||||||
|
|
||||||
function generateLanguagesSelectBox() {
|
function generateLanguagesSelectBox() {
|
||||||
var currentLang = APP.translation.getCurrentLanguage();
|
var currentLang = APP.translation.getCurrentLanguage();
|
||||||
|
@ -24,7 +24,9 @@ function generateLanguagesSelectBox() {
|
||||||
|
|
||||||
var SettingsMenu = {
|
var SettingsMenu = {
|
||||||
|
|
||||||
init: function () {
|
init: function (emitter) {
|
||||||
|
this.emitter = emitter;
|
||||||
|
|
||||||
var startMutedSelector = $("#startMutedOptions");
|
var startMutedSelector = $("#startMutedOptions");
|
||||||
startMutedSelector.before(generateLanguagesSelectBox());
|
startMutedSelector.before(generateLanguagesSelectBox());
|
||||||
APP.translation.translateElement($("#languages_selectbox"));
|
APP.translation.translateElement($("#languages_selectbox"));
|
||||||
|
@ -36,8 +38,7 @@ var SettingsMenu = {
|
||||||
|
|
||||||
if (APP.conference.isModerator()) {
|
if (APP.conference.isModerator()) {
|
||||||
startMutedSelector.css("display", "block");
|
startMutedSelector.css("display", "block");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
startMutedSelector.css("display", "none");
|
startMutedSelector.css("display", "none");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,43 +62,35 @@ var SettingsMenu = {
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function() {
|
update: function() {
|
||||||
|
// FIXME check if this values really changed:
|
||||||
|
// compare them with Settings etc.
|
||||||
var newDisplayName =
|
var newDisplayName =
|
||||||
UIUtil.escapeHtml($('#setDisplayName').get(0).value);
|
UIUtil.escapeHtml($('#setDisplayName').get(0).value);
|
||||||
var newEmail = UIUtil.escapeHtml($('#setEmail').get(0).value);
|
|
||||||
|
|
||||||
if(newDisplayName) {
|
if (newDisplayName) {
|
||||||
var displayName = Settings.setDisplayName(newDisplayName);
|
this.emitter.emit(UIEvents.NICKNAME_CHANGED, newDisplayName);
|
||||||
APP.xmpp.addToPresence("displayName", displayName, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var language = $("#languages_selectbox").val();
|
var language = $("#languages_selectbox").val();
|
||||||
APP.translation.setLanguage(language);
|
this.emitter.emit(UIEvents.LANG_CHANGED, language);
|
||||||
Settings.setLanguage(language);
|
|
||||||
|
|
||||||
APP.xmpp.addToPresence("email", newEmail);
|
var newEmail = UIUtil.escapeHtml($('#setEmail').get(0).value);
|
||||||
var email = Settings.setEmail(newEmail);
|
this.emitter.emit(UIEvents.EMAIL_CHANGED, newEmail);
|
||||||
|
|
||||||
var startAudioMuted = ($("#startAudioMuted").is(":checked"));
|
var startAudioMuted = ($("#startAudioMuted").is(":checked"));
|
||||||
var startVideoMuted = ($("#startVideoMuted").is(":checked"));
|
var startVideoMuted = ($("#startVideoMuted").is(":checked"));
|
||||||
APP.xmpp.addToPresence("startMuted",
|
this.emitter.emit(
|
||||||
[startAudioMuted, startVideoMuted]);
|
UIEvents.START_MUTED_CHANGED, startAudioMuted, startVideoMuted
|
||||||
|
);
|
||||||
Avatar.setUserAvatar(APP.xmpp.myJid(), email);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isVisible: function() {
|
isVisible: function() {
|
||||||
return $('#settingsmenu').is(':visible');
|
return $('#settingsmenu').is(':visible');
|
||||||
},
|
},
|
||||||
|
|
||||||
setDisplayName: function(newDisplayName) {
|
onDisplayNameChange: function(id, newDisplayName) {
|
||||||
var displayName = Settings.setDisplayName(newDisplayName);
|
if(id === 'localVideoContainer' || APP.conference.isLocalId(id)) {
|
||||||
$('#setDisplayName').get(0).value = displayName;
|
$('#setDisplayName').get(0).value = newDisplayName;
|
||||||
},
|
|
||||||
|
|
||||||
onDisplayNameChange: function(peerJid, newDisplayName) {
|
|
||||||
if(peerJid === 'localVideoContainer' ||
|
|
||||||
peerJid === APP.xmpp.myJid()) {
|
|
||||||
this.setDisplayName(newDisplayName);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeAvatar: function (thumbUrl) {
|
changeAvatar: function (thumbUrl) {
|
||||||
|
|
|
@ -590,16 +590,13 @@ var VideoLayout = (function (my) {
|
||||||
/**
|
/**
|
||||||
* Display name changed.
|
* Display name changed.
|
||||||
*/
|
*/
|
||||||
my.onDisplayNameChanged =
|
my.onDisplayNameChanged = function (id, displayName, status) {
|
||||||
function (jid, displayName, status) {
|
if (id === 'localVideoContainer' ||
|
||||||
if (jid === 'localVideoContainer' ||
|
APP.conference.isLocalId(id)) {
|
||||||
jid === APP.xmpp.myJid()) {
|
|
||||||
localVideoThumbnail.setDisplayName(displayName);
|
localVideoThumbnail.setDisplayName(displayName);
|
||||||
} else {
|
} else {
|
||||||
VideoLayout.ensurePeerContainerExists(jid);
|
VideoLayout.ensurePeerContainerExists(id);
|
||||||
remoteVideos[Strophe.getResourceFromJid(jid)].setDisplayName(
|
remoteVideos[id].setDisplayName(displayName, status);
|
||||||
displayName,
|
|
||||||
status);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,18 @@ var UIEvents = {
|
||||||
* Notifies that local user created text message.
|
* Notifies that local user created text message.
|
||||||
*/
|
*/
|
||||||
MESSAGE_CREATED: "UI.message_created",
|
MESSAGE_CREATED: "UI.message_created",
|
||||||
|
/**
|
||||||
|
* Notifies that local user changed language.
|
||||||
|
*/
|
||||||
|
LANG_CHANGED: "UI.lang_changed",
|
||||||
|
/**
|
||||||
|
* Notifies that local user changed email.
|
||||||
|
*/
|
||||||
|
EMAIL_CHANGED: "UI.email_changed",
|
||||||
|
/**
|
||||||
|
* Notifies that "start muted" settings changed.
|
||||||
|
*/
|
||||||
|
START_MUTED_CHANGED: "UI.start_muted_changed",
|
||||||
/**
|
/**
|
||||||
* Notifies interested parties when the film strip (remote video's panel)
|
* Notifies interested parties when the film strip (remote video's panel)
|
||||||
* is hidden (toggled) or shown (un-toggled).
|
* is hidden (toggled) or shown (un-toggled).
|
||||||
|
|
Loading…
Reference in New Issue