Various cleanup and CR

This commit is contained in:
Zach Fox 2019-11-14 15:45:52 -08:00
parent e21ee20ff8
commit 5229b0c0f3
6 changed files with 24 additions and 46 deletions

View file

@ -889,10 +889,6 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
DependencyManager::set<ScriptCache>(); DependencyManager::set<ScriptCache>();
DependencyManager::set<SoundCache>(); DependencyManager::set<SoundCache>();
DependencyManager::set<SoundCacheScriptingInterface>(); DependencyManager::set<SoundCacheScriptingInterface>();
#ifdef HAVE_DDE
DependencyManager::set<DdeFaceTracker>();
#endif
DependencyManager::set<AudioClient>(); DependencyManager::set<AudioClient>();
DependencyManager::set<AudioScope>(); DependencyManager::set<AudioScope>();
DependencyManager::set<DeferredLightingEffect>(); DependencyManager::set<DeferredLightingEffect>();

View file

@ -22,10 +22,10 @@
class ScreenshareScriptingInterface : public QObject, public Dependency { class ScreenshareScriptingInterface : public QObject, public Dependency {
Q_OBJECT Q_OBJECT
public: public:
ScreenshareScriptingInterface(); ScreenshareScriptingInterface();
~ScreenshareScriptingInterface(); ~ScreenshareScriptingInterface();
Q_INVOKABLE void startScreenshare(const QUuid& screenshareZoneID, const QUuid& smartboardEntityID, const bool& isPresenter = false); Q_INVOKABLE void startScreenshare(const QUuid& screenshareZoneID, const QUuid& smartboardEntityID, const bool& isPresenter = false);
Q_INVOKABLE void stopScreenshare(); Q_INVOKABLE void stopScreenshare();
signals: signals:

View file

@ -1,5 +1,4 @@
<!-- <!--
screenshareApp.html screenshareApp.html
Created by Milad Nazeri, Rebecca Stankus, and Zach Fox 2019/11/13 Created by Milad Nazeri, Rebecca Stankus, and Zach Fox 2019/11/13
@ -7,7 +6,6 @@ Copyright 2019 High Fidelity, Inc.
Distributed under the Apache License, Version 2.0. Distributed under the Apache License, Version 2.0.
See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
--> -->
<html> <html>
@ -23,26 +21,13 @@ See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.
<div id="select_screen"> <div id="select_screen">
<div class="scrollbar" id="style-1"> <div class="scrollbar" id="style-1">
<div class="force-overflow"> <div class="force-overflow">
<div id="selects"> <div id="selects">
<!-- <div class="box"> -->
<!-- <div class="heading"> -->
<!-- <div class="circle"></div> -->
<!-- <span class=" abel">Screen 1</span> -->
<!-- </div> heading -->
<!-- <div class="image"> -->
<!-- </div> -->
<!-- </div> box -->
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div id="confirmation_screen" style="display: none;"> <div id="confirmation_screen" style="display: none;">
<div id="share_pick"> <div id="share_pick">
</div> <!-- share_pick --> </div> <!-- share_pick -->
<div id="confirmation_text" style="color: white;"> <div id="confirmation_text" style="color: white;">
<p> <p>

View file

@ -18,7 +18,7 @@ function handleError(error) {
// When an application is picked, make sure we clear out the previous pick, toggle the page, // When an application is picked, make sure we clear out the previous pick, toggle the page,
// and add the correct source // and add the correct source
let currentScreensharePickID = ""; let currentScreensharePickID = "";
function screensharePicked(id){ function screensharePicked(id) {
currentScreensharePickID = id; currentScreensharePickID = id;
document.getElementById("share_pick").innerHTML = ""; document.getElementById("share_pick").innerHTML = "";
togglePage(); togglePage();
@ -28,8 +28,8 @@ function screensharePicked(id){
// Once we have confirmed that we want to share, prepare the tokbox publishing initiating // Once we have confirmed that we want to share, prepare the tokbox publishing initiating
// and toggle back to the selects page // and toggle back to the selects page
function screenConfirmed(isConfirmed){ function screenConfirmed(isConfirmed) {
document.getElementById("selects").innerHTML=""; document.getElementById("selects").innerHTML = "";
if (isConfirmed === true){ if (isConfirmed === true){
onAccessApproved(currentScreensharePickID); onAccessApproved(currentScreensharePickID);
} }
@ -72,7 +72,7 @@ function addSource(source, type) {
// Get the html created from the source. Alter slightly depending on whether this source // Get the html created from the source. Alter slightly depending on whether this source
// is on the selects screen, or the confirmation screen. Mainly removing highlighting. // is on the selects screen, or the confirmation screen. Mainly removing highlighting.
// If there is an app Icon, then add it. // If there is an app Icon, then add it.
function renderSourceHTML(source){ function renderSourceHTML(source) {
let type = currentPage === "confirmationPage" ? "share_pick" : "selects"; let type = currentPage === "confirmationPage" ? "share_pick" : "selects";
let sourceBody = document.createElement('div') let sourceBody = document.createElement('div')
let thumbnail = source.thumbnail.toDataURL(); let thumbnail = source.thumbnail.toDataURL();
@ -101,7 +101,7 @@ function renderSourceHTML(source){
// Separate out the screenshares and applications // Separate out the screenshares and applications
// Make sure the screens are labeled in order // Make sure the screens are labeled in order
// Concact the two arrays back together and return // Concact the two arrays back together and return
function sortSources(){ function sortSources() {
let screenSources = []; let screenSources = [];
let applicationSources = []; let applicationSources = [];
// Difference with Mac selects: // Difference with Mac selects:
@ -112,19 +112,19 @@ function sortSources(){
} else { } else {
applicationSources.push(source) applicationSources.push(source)
} }
}) });
screenSources.sort( (a, b) => { screenSources.sort((a, b) => {
let aNumber = a.name.replace(/[^\d]/, ""); let aNumber = a.name.replace(/[^\d]/, "");
let bNumber = b.name.replace(/[^\d]/, ""); let bNumber = b.name.replace(/[^\d]/, "");
return aNumber - bNumber; return aNumber - bNumber;
}) });
let finalSources = [...screenSources, ...applicationSources]; let finalSources = [...screenSources, ...applicationSources];
return finalSources; return finalSources;
} }
// Setup sorting the selection array, add individual sources, and update the sourceMap // Setup sorting the selection array, add individual sources, and update the sourceMap
function addSources(){ function addSources() {
screenshareSourceArray = sortSources(); screenshareSourceArray = sortSources();
for (let i = 0; i < screenshareSourceArray.length; i++) { for (let i = 0; i < screenshareSourceArray.length; i++) {
addSource(screenshareSourceArray[i], "selects"); addSource(screenshareSourceArray[i], "selects");
@ -158,6 +158,7 @@ function showSources() {
console.log("Error getting sources", error); console.log("Error getting sources", error);
} }
for (let source of sources) { for (let source of sources) {
// change this to a regex - thanks milad
if (source.name.indexOf(SCREENSHARE_TITLE) > -1){ if (source.name.indexOf(SCREENSHARE_TITLE) > -1){
continue; continue;
} }
@ -171,7 +172,7 @@ function showSources() {
// Stop the localstream and end the tokrok publishing // Stop the localstream and end the tokrok publishing
let localStream; let localStream;
function stopSharing(){ function stopSharing() {
desktopSharing = false; desktopSharing = false;
if (localStream) { if (localStream) {
@ -191,7 +192,7 @@ function gotStream(stream) {
stream.onended = () => { stream.onended = () => {
if (desktopSharing) { if (desktopSharing) {
toggle(); togglePage();
} }
}; };
} }
@ -243,7 +244,7 @@ function initializeTokboxSession() {
// Init the tokbox publisher with our newly created stream // Init the tokbox publisher with our newly created stream
var publisher; var publisher;
function startTokboxPublisher(stream){ function startTokboxPublisher(stream) {
publisher = document.createElement("div"); publisher = document.createElement("div");
var publisherOptions = { var publisherOptions = {
videoSource: stream.getVideoTracks()[0], videoSource: stream.getVideoTracks()[0],
@ -269,7 +270,7 @@ function startTokboxPublisher(stream){
// Kills the streaming being sent to tokbox // Kills the streaming being sent to tokbox
function stopTokBoxPublisher(){ function stopTokBoxPublisher() {
publisher.destroy(); publisher.destroy();
} }
@ -280,18 +281,18 @@ let projectAPIKey;
let sessionID; let sessionID;
let token; let token;
let session; let session;
ipcRenderer.on('connectionInfo', function(event, message){ ipcRenderer.on('connectionInfo', function(event, message) {
const connectionInfo = JSON.parse(message); const connectionInfo = JSON.parse(message);
projectAPIKey = connectionInfo.projectAPIKey; projectAPIKey = connectionInfo.projectAPIKey;
sessionID = connectionInfo.sessionID; sessionID = connectionInfo.sessionID;
token = connectionInfo.token; token = connectionInfo.token;
initializeTokboxSession(); initializeTokboxSession();
}) });
// Show the initial sources after the dom has loaded // Show the initial sources after the dom has loaded
// Sources come from electron.desktopCapturer // Sources come from electron.desktopCapturer
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", () => {
showSources(); showSources();
}) });

View file

@ -11,7 +11,7 @@ const {app, BrowserWindow, ipcMain} = require('electron');
const gotTheLock = app.requestSingleInstanceLock() const gotTheLock = app.requestSingleInstanceLock()
const argv = require('yargs').argv; const argv = require('yargs').argv;
// ./screenshare.exe --userName=miladN ...
const connectionInfo = { const connectionInfo = {
token: argv.token || "token", token: argv.token || "token",
projectAPIKey: argv.projectAPIKey || "projectAPIKey", projectAPIKey: argv.projectAPIKey || "projectAPIKey",
@ -19,7 +19,7 @@ const connectionInfo = {
} }
// Mac and Pc need slightly different width and height sizes. // Mac and PC need slightly different width and height sizes.
const osType = require('os').type(); const osType = require('os').type();
let width; let width;
let height; let height;
@ -33,9 +33,9 @@ if (osType == "Darwin" || osType == "Linux") {
if (!gotTheLock) { if (!gotTheLock) {
console.log("Another instance of the screenshare is already running - this instance will quit."); console.log("Another instance of the screenshare is already running - this instance will quit.");
app.exit(0); app.exit(0);
return; return;
} }
let window; let window;

View file

@ -1,10 +1,6 @@
body { body {
background-color: black; background-color: black;
box-sizing: border-box; box-sizing: border-box;
/* display: -webkit-flex; */
/* -webkit-justify-content: center; */
/* -webkit-align-items: center; */
/* -webkit-flex-direction: column; */
font-family: "Graphik"; font-family: "Graphik";
margin: 0px 22px 10px 22px; margin: 0px 22px 10px 22px;
} }