History

clean up code

milad committed 7 years ago

Commit 0f605ff1 parent 7cce1533 files · +25 −54Browse files

Showing the changes to interface/src/scripting/ScreenshareScriptingInterface.cpp (1 of 3 files). Show all

Unified · Split

interface/src/scripting/ScreenshareScriptingInterface.cpp+12−17
@@ -40,12 +40,14 @@ ScreenshareScriptingInterface::~ScreenshareScriptingInterface() { · 39 unmodified lines
4040
4141 static const EntityTypes::EntityType LOCAL_SCREENSHARE_WEB_ENTITY_TYPE = EntityTypes::Web;
4242 static const uint8_t LOCAL_SCREENSHARE_WEB_ENTITY_FPS = 30;
43+// This is going to be a good amount of work to make this work dynamically for any screensize.
44+// V1 will have only hardcoded values.
4345 static const glm::vec3 LOCAL_SCREENSHARE_WEB_ENTITY_LOCAL_POSITION(0.0f, -0.0862f, 0.0711f);
46+static const glm::vec3 LOCAL_SCREENSHARE_WEB_ENTITY_DIMENSIONS(4.0419f, 2.2735f, 0.0100f);
4447 static const QString LOCAL_SCREENSHARE_WEB_ENTITY_URL =
4548 "https://hifi-content.s3.amazonaws.com/Experiences/Releases/usefulUtilities/smartBoard/screenshareViewer/screenshareClient.html";
46−static const glm::vec3 LOCAL_SCREENSHARE_WEB_ENTITY_DIMENSIONS(4.0419f, 2.2735f, 0.0100f);
4749 QString token;
48−QString apiKey;
50+QString projectAPIKey;
4951 QString sessionID;
5052 void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZoneID,
5153 const QUuid& smartboardEntityID,
@@ -91,15 +93,16 @@ void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZon · 39 unmodified lines
9193 QJsonDocument answerJSONObject = QJsonDocument::fromJson(answerByteArray);
9294
9395 token = answerJSONObject["token"].toString();
94− apiKey = answerJSONObject["apiKey"].toString();
95− sessionID = answerJSONObject["sessionId"].toString(); // hifi-test has Id camel-case. Change for metaverse.
96− qDebug() << "token:" << token << " apiKey:" << apiKey << " sessionID: " << sessionID;
96+ projectAPIKey = answerJSONObject["projectAPIKey"].toString();
97+ sessionID = answerJSONObject["sessionID"].toString(); // hifi-test has Id camel-case. Change for metaverse.
98+ qDebug() << "token:" << token << " projectAPIKey:" << projectAPIKey << " sessionID: " << sessionID;
9799
98100 if (isPresenter) {
99101 QStringList arguments;
100− arguments << "--token=" + token;
101− arguments << "--apiKey=" + apiKey;
102− arguments << "--sessionID=" + sessionID;
102+ arguments << " ";
103+ arguments << "--token=" + token << " ";
104+ arguments << "--projectAPIKey=" + projectAPIKey << " ";
105+ arguments << "--sessionID=" + sessionID << " ";
103106
104107 connect(_screenshareProcess.get(), &QProcess::errorOccurred,
105108 [=](QProcess::ProcessError error) { qDebug() << "ZRF QProcess::errorOccurred. `error`:" << error; });
@@ -171,23 +174,15 @@ void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZon · 65 unmodified lines
171174 responseObject.insert("method", "receiveConnectionInfo");
172175 QJsonObject responseObjectData;
173176 responseObjectData.insert("token", token);
174− responseObjectData.insert("projectAPIKey", apiKey);
177+ responseObjectData.insert("projectAPIKey", projectAPIKey);
175178 responseObjectData.insert("sessionID", sessionID);
176179 responseObject.insert("data", responseObjectData);
177180
178181 qDebug() << "ZRF HERE! Inside `webEventReceived(). `responseObject.toVariantMap()`:"
179182 << responseObject.toVariantMap();
180183
181− // Attempt 1, we receive the eventBridge message, but this won't send a message
182− // to that js
183184 auto esi = DependencyManager::get<EntityScriptingInterface>();
184185 esi->emitScriptEvent(_screenshareViewerLocalWebEntityUUID, responseObject.toVariantMap());
185−
186− // atempt 2, same outcome
187− //auto entityTreeRenderer = DependencyManager::get<EntityTreeRenderer>();
188− //auto webEntityRenderable =
189− // entityTreeRenderer->renderableForEntityId(_screenshareViewerLocalWebEntityUUID);
190− //webEntityRenderable->emitScriptEvent(responseObject.toVariantMap());
191186 }
192187 }
193188 });