Showing the changes to interface/src/scripting/ScreenshareScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -79,6 +79,8 @@ void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZon · 78 unmodified lines | |||
| 79 | QFileInfo screenshareExecutable(SCREENSHARE_EXE_PATH); | 79 | QFileInfo screenshareExecutable(SCREENSHARE_EXE_PATH); |
| 80 | if (!screenshareExecutable.exists() || !screenshareExecutable.isFile()) { | 80 | if (!screenshareExecutable.exists() || !screenshareExecutable.isFile()) { |
| 81 | qDebug() << "Screenshare executable doesn't exist at" << SCREENSHARE_EXE_PATH; | 81 | qDebug() << "Screenshare executable doesn't exist at" << SCREENSHARE_EXE_PATH; |
| 82 | stopScreenshare(); | ||
| 83 | emit screenshareError(); | ||
| 82 | return; | 84 | return; |
| 83 | } | 85 | } |
| 84 | } | 86 | } |
| @@ -115,6 +117,7 @@ void ScreenshareScriptingInterface::stopScreenshare() { · 30 unmodified lines | |||
| 115 | 117 | ||
| 116 | if (_screenshareProcess && _screenshareProcess->state() != QProcess::NotRunning) { | 118 | if (_screenshareProcess && _screenshareProcess->state() != QProcess::NotRunning) { |
| 117 | _screenshareProcess->terminate(); | 119 | _screenshareProcess->terminate(); |
| 120 | emit screenshareProcessTerminated(); | ||
| 118 | } | 121 | } |
| 119 | 122 | ||
| 120 | if (!_screenshareViewerLocalWebEntityUUID.isNull()) { | 123 | if (!_screenshareViewerLocalWebEntityUUID.isNull()) { |
| @@ -138,8 +141,10 @@ void ScreenshareScriptingInterface::handleSuccessfulScreenshareInfoGet(QNetworkR · 17 unmodified lines | |||
| 138 | QJsonDocument answerJSONObject = QJsonDocument::fromJson(answerByteArray); | 141 | QJsonDocument answerJSONObject = QJsonDocument::fromJson(answerByteArray); |
| 139 | 142 | ||
| 140 | QString status = answerJSONObject["status"].toString(); | 143 | QString status = answerJSONObject["status"].toString(); |
| 141 | if (status == "fail") { | 144 | if (status != "success") { |
| 142 | qDebug() << "\n\n MN HERE: SCREENSHARE REPLY FAIL"; | 145 | qDebug() << "\n\n MN HERE: SCREENSHARE REPLY FAIL"; |
| 146 | stopScreenshare(); | ||
| 147 | emit screenshareError(); | ||
| 143 | return; | 148 | return; |
| 144 | } | 149 | } |
| 145 | 150 | ||
| @@ -148,6 +153,13 @@ void ScreenshareScriptingInterface::handleSuccessfulScreenshareInfoGet(QNetworkR · 2 unmodified lines | |||
| 148 | _sessionID = answerJSONObject["sessionID"].toString(); | 153 | _sessionID = answerJSONObject["sessionID"].toString(); |
| 149 | qDebug() << "token:" << _token << " projectAPIKey:" << _projectAPIKey << " sessionID: " << _sessionID; | 154 | qDebug() << "token:" << _token << " projectAPIKey:" << _projectAPIKey << " sessionID: " << _sessionID; |
| 150 | 155 | ||
| 156 | if (_token.isEmpty() || _projectAPIKey.isEmpty() || _sessionID.isEmpty()) { | ||
| 157 | qDebug() << "Not all Screen Share information was retrieved from the backend. Stopping..."; | ||
| 158 | stopScreenshare(); | ||
| 159 | emit screenshareError(); | ||
| 160 | return; | ||
| 161 | } | ||
| 162 | |||
| 151 | if (_isPresenter) { | 163 | if (_isPresenter) { |
| 152 | QStringList arguments; | 164 | QStringList arguments; |
| 153 | arguments << " "; | 165 | arguments << " "; |
| @@ -164,7 +176,6 @@ void ScreenshareScriptingInterface::handleSuccessfulScreenshareInfoGet(QNetworkR · 10 unmodified lines | |||
| 164 | connect(_screenshareProcess.get(), QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), | 176 | connect(_screenshareProcess.get(), QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), |
| 165 | [=](int exitCode, QProcess::ExitStatus exitStatus) { | 177 | [=](int exitCode, QProcess::ExitStatus exitStatus) { |
| 166 | qDebug() << "ZRF QProcess::finished. `exitCode`:" << exitCode << "`exitStatus`:" << exitStatus; | 178 | qDebug() << "ZRF QProcess::finished. `exitCode`:" << exitCode << "`exitStatus`:" << exitStatus; |
| 167 | emit screenshareStopped(); | ||
| 168 | stopScreenshare(); | 179 | stopScreenshare(); |
| 169 | }); | 180 | }); |
| 170 | 181 | ||
| @@ -172,11 +183,15 @@ void ScreenshareScriptingInterface::handleSuccessfulScreenshareInfoGet(QNetworkR · 1 unmodified line | |||
| 172 | } | 183 | } |
| 173 | 184 | ||
| 174 | if (!_screenshareViewerLocalWebEntityUUID.isNull()) { | 185 | if (!_screenshareViewerLocalWebEntityUUID.isNull()) { |
| 186 | stopScreenshare(); | ||
| 187 | emit screenshareError(); | ||
| 175 | return; | 188 | return; |
| 176 | } | 189 | } |
| 177 | 190 | ||
| 178 | auto esi = DependencyManager::get<EntityScriptingInterface>(); | 191 | auto esi = DependencyManager::get<EntityScriptingInterface>(); |
| 179 | if (!esi) { | 192 | if (!esi) { |
| 193 | stopScreenshare(); | ||
| 194 | emit screenshareError(); | ||
| 180 | return; | 195 | return; |
| 181 | } | 196 | } |
| 182 | 197 | ||
| @@ -200,6 +215,8 @@ void ScreenshareScriptingInterface::handleSuccessfulScreenshareInfoGet(QNetworkR · 17 unmodified lines | |||
| 200 | 215 | ||
| 201 | void ScreenshareScriptingInterface::handleFailedScreenshareInfoGet(QNetworkReply* reply) { | 216 | void ScreenshareScriptingInterface::handleFailedScreenshareInfoGet(QNetworkReply* reply) { |
| 202 | qDebug() << "\n\n MN HERE: handleFailedScreenshareInfoGet():" << reply->readAll(); | 217 | qDebug() << "\n\n MN HERE: handleFailedScreenshareInfoGet():" << reply->readAll(); |
| 218 | stopScreenshare(); | ||
| 219 | emit screenshareError(); | ||
| 203 | } | 220 | } |
| 204 | 221 | ||
| 205 | void ScreenshareScriptingInterface::onWebEventReceived(const QUuid& entityID, const QVariant& message) { | 222 | void ScreenshareScriptingInterface::onWebEventReceived(const QUuid& entityID, const QVariant& message) { |