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