Showing the changes to interface/src/scripting/ScreenshareScriptingInterface.cpp (1 of 4 files). Show all
Unified · Split
| @@ -9,12 +9,14 @@ · 8 unmodified lines | |||
| 9 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | 9 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html |
| 10 | // | 10 | // |
| 11 | 11 | ||
| 12 | #include "ScreenshareScriptingInterface.h" | 12 | #include <QCoreApplication> |
| 13 | #include <QThread> | ||
| 14 | #include <QDesktopServices> | 13 | #include <QDesktopServices> |
| 14 | #include <QThread> | ||
| 15 | #include <QUrl> | 15 | #include <QUrl> |
| 16 | #include <QCoreApplication> | ||
| 17 | 16 | ||
| 17 | #include <AddressManager.h> | ||
| 18 | |||
| 19 | #include "ScreenshareScriptingInterface.h" | ||
| 18 | 20 | ||
| 19 | ScreenshareScriptingInterface::ScreenshareScriptingInterface() { | 21 | ScreenshareScriptingInterface::ScreenshareScriptingInterface() { |
| 20 | }; | 22 | }; |
| @@ -23,16 +25,11 @@ ScreenshareScriptingInterface::~ScreenshareScriptingInterface() { · 2 unmodified lines | |||
| 23 | stopScreenshare(); | 25 | stopScreenshare(); |
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | void ScreenshareScriptingInterface::startScreenshare(QString displayName, QString userName, QString token, QString sessionID, QString apiKey) { | 28 | void ScreenshareScriptingInterface::startScreenshare(const QString& roomName) { |
| 27 | if (QThread::currentThread() != thread()) { | 29 | if (QThread::currentThread() != thread()) { |
| 28 | // We must start a new QProcess from the main thread. | 30 | // We must start a new QProcess from the main thread. |
| 29 | QMetaObject::invokeMethod( | 31 | QMetaObject::invokeMethod( |
| 30 | this, "startScreenshare", | 32 | this, "startScreenshare" |
| 31 | Q_ARG(QString, displayName), | ||
| 32 | Q_ARG(QString, userName), | ||
| 33 | Q_ARG(QString, token), | ||
| 34 | Q_ARG(QString, sessionID), | ||
| 35 | Q_ARG(QString, apiKey) | ||
| 36 | ); | 33 | ); |
| 37 | return; | 34 | return; |
| 38 | } | 35 | } |
| @@ -50,14 +47,15 @@ void ScreenshareScriptingInterface::startScreenshare(QString displayName, QStrin · 11 unmodified lines | |||
| 50 | return; | 47 | return; |
| 51 | } | 48 | } |
| 52 | 49 | ||
| 53 | if (displayName.isEmpty() || userName.isEmpty() || token.isEmpty() || sessionID.isEmpty() || apiKey.isEmpty()) { | 50 | QUuid currentDomainID = DependencyManager::get<AddressManager>()->getDomainID(); |
| 54 | qDebug() << "Screenshare executable can't launch without connection info."; | 51 | |
| 55 | return; | 52 | // Make HTTP GET request to: |
| 56 | } | 53 | // `https://metaverse.highfidelity.com/api/v1/domain/:domain_id/screenshare`, |
| 54 | // passing the Domain ID that the user is connected to, as well as the `roomName`. | ||
| 55 | // The server will respond with the relevant OpenTok Token, Session ID, and API Key. | ||
| 56 | // Upon error-free response, do the logic below, passing in that info as necessary. | ||
| 57 | 57 | ||
| 58 | QStringList arguments; | 58 | QStringList arguments; |
| 59 | arguments << "--userName=" + userName; | ||
| 60 | arguments << "--displayName=" + displayName; | ||
| 61 | arguments << "--token=" + token; | 59 | arguments << "--token=" + token; |
| 62 | arguments << "--apiKey=" + apiKey; | 60 | arguments << "--apiKey=" + apiKey; |
| 63 | arguments << "--sessionID=" + sessionID; | 61 | arguments << "--sessionID=" + sessionID; |