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
40 40
41static const EntityTypes::EntityType LOCAL_SCREENSHARE_WEB_ENTITY_TYPE = EntityTypes::Web;41static const EntityTypes::EntityType LOCAL_SCREENSHARE_WEB_ENTITY_TYPE = EntityTypes::Web;
42static const uint8_t LOCAL_SCREENSHARE_WEB_ENTITY_FPS = 30;42static 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.
43static const glm::vec3 LOCAL_SCREENSHARE_WEB_ENTITY_LOCAL_POSITION(0.0f, -0.0862f, 0.0711f);45static const glm::vec3 LOCAL_SCREENSHARE_WEB_ENTITY_LOCAL_POSITION(0.0f, -0.0862f, 0.0711f);
46static const glm::vec3 LOCAL_SCREENSHARE_WEB_ENTITY_DIMENSIONS(4.0419f, 2.2735f, 0.0100f);
44static const QString LOCAL_SCREENSHARE_WEB_ENTITY_URL =47static const QString LOCAL_SCREENSHARE_WEB_ENTITY_URL =
45 "https://hifi-content.s3.amazonaws.com/Experiences/Releases/usefulUtilities/smartBoard/screenshareViewer/screenshareClient.html";48 "https://hifi-content.s3.amazonaws.com/Experiences/Releases/usefulUtilities/smartBoard/screenshareViewer/screenshareClient.html";
46static const glm::vec3 LOCAL_SCREENSHARE_WEB_ENTITY_DIMENSIONS(4.0419f, 2.2735f, 0.0100f);
47QString token;49QString token;
48QString apiKey;50QString projectAPIKey;
49QString sessionID;51QString sessionID;
50void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZoneID,52void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZoneID,
51 const QUuid& smartboardEntityID,53 const QUuid& smartboardEntityID,
@@ -91,15 +93,16 @@ void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZon · 39 unmodified lines
91 QJsonDocument answerJSONObject = QJsonDocument::fromJson(answerByteArray);93 QJsonDocument answerJSONObject = QJsonDocument::fromJson(answerByteArray);
92 94
93 token = answerJSONObject["token"].toString();95 token = answerJSONObject["token"].toString();
94 apiKey = answerJSONObject["apiKey"].toString();96 projectAPIKey = answerJSONObject["projectAPIKey"].toString();
95 sessionID = answerJSONObject["sessionId"].toString(); // hifi-test has Id camel-case. Change for metaverse. 97 sessionID = answerJSONObject["sessionID"].toString(); // hifi-test has Id camel-case. Change for metaverse.
96 qDebug() << "token:" << token << " apiKey:" << apiKey << " sessionID: " << sessionID;98 qDebug() << "token:" << token << " projectAPIKey:" << projectAPIKey << " sessionID: " << sessionID;
97 99
98 if (isPresenter) {100 if (isPresenter) {
99 QStringList arguments;101 QStringList arguments;
100 arguments << "--token=" + token;102 arguments << " ";
101 arguments << "--apiKey=" + apiKey;103 arguments << "--token=" + token << " ";
102 arguments << "--sessionID=" + sessionID;104 arguments << "--projectAPIKey=" + projectAPIKey << " ";
105 arguments << "--sessionID=" + sessionID << " ";
103 106
104 connect(_screenshareProcess.get(), &QProcess::errorOccurred,107 connect(_screenshareProcess.get(), &QProcess::errorOccurred,
105 [=](QProcess::ProcessError error) { qDebug() << "ZRF QProcess::errorOccurred. `error`:" << error; });108 [=](QProcess::ProcessError error) { qDebug() << "ZRF QProcess::errorOccurred. `error`:" << error; });
@@ -171,23 +174,15 @@ void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZon · 65 unmodified lines
171 responseObject.insert("method", "receiveConnectionInfo");174 responseObject.insert("method", "receiveConnectionInfo");
172 QJsonObject responseObjectData;175 QJsonObject responseObjectData;
173 responseObjectData.insert("token", token);176 responseObjectData.insert("token", token);
174 responseObjectData.insert("projectAPIKey", apiKey);177 responseObjectData.insert("projectAPIKey", projectAPIKey);
175 responseObjectData.insert("sessionID", sessionID);178 responseObjectData.insert("sessionID", sessionID);
176 responseObject.insert("data", responseObjectData);179 responseObject.insert("data", responseObjectData);
177 180
178 qDebug() << "ZRF HERE! Inside `webEventReceived(). `responseObject.toVariantMap()`:"181 qDebug() << "ZRF HERE! Inside `webEventReceived(). `responseObject.toVariantMap()`:"
179 << responseObject.toVariantMap();182 << responseObject.toVariantMap();
180 183
181 // Attempt 1, we receive the eventBridge message, but this won't send a message
182 // to that js
183 auto esi = DependencyManager::get<EntityScriptingInterface>();184 auto esi = DependencyManager::get<EntityScriptingInterface>();
184 esi->emitScriptEvent(_screenshareViewerLocalWebEntityUUID, responseObject.toVariantMap());185 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());
191 }186 }
192 }187 }
193 });188 });