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 | 9 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html |
| 10 | 10 | // |
| 11 | 11 | |
| 12 | −#include "ScreenshareScriptingInterface.h" | |
| 13 | −#include <QThread> | |
| 12 | +#include <QCoreApplication> | |
| 14 | 13 | #include <QDesktopServices> |
| 14 | +#include <QThread> | |
| 15 | 15 | #include <QUrl> |
| 16 | −#include <QCoreApplication> | |
| 17 | 16 | |
| 17 | +#include <AddressManager.h> | |
| 18 | + | |
| 19 | +#include "ScreenshareScriptingInterface.h" | |
| 18 | 20 | |
| 19 | 21 | ScreenshareScriptingInterface::ScreenshareScriptingInterface() { |
| 20 | 22 | }; |
| @@ -23,16 +25,11 @@ ScreenshareScriptingInterface::~ScreenshareScriptingInterface() { · 2 unmodified lines | ||
| 23 | 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 | 29 | if (QThread::currentThread() != thread()) { |
| 28 | 30 | // We must start a new QProcess from the main thread. |
| 29 | 31 | QMetaObject::invokeMethod( |
| 30 | − 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) | |
| 32 | + this, "startScreenshare" | |
| 36 | 33 | ); |
| 37 | 34 | return; |
| 38 | 35 | } |
| @@ -50,14 +47,15 @@ void ScreenshareScriptingInterface::startScreenshare(QString displayName, QStrin · 11 unmodified lines | ||
| 50 | 47 | return; |
| 51 | 48 | } |
| 52 | 49 | |
| 53 | − if (displayName.isEmpty() || userName.isEmpty() || token.isEmpty() || sessionID.isEmpty() || apiKey.isEmpty()) { | |
| 54 | − qDebug() << "Screenshare executable can't launch without connection info."; | |
| 55 | − return; | |
| 56 | − } | |
| 50 | + QUuid currentDomainID = DependencyManager::get<AddressManager>()->getDomainID(); | |
| 51 | + | |
| 52 | + // Make HTTP GET request to: | |
| 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 | 58 | QStringList arguments; |
| 59 | − arguments << "--userName=" + userName; | |
| 60 | − arguments << "--displayName=" + displayName; | |
| 61 | 59 | arguments << "--token=" + token; |
| 62 | 60 | arguments << "--apiKey=" + apiKey; |
| 63 | 61 | arguments << "--sessionID=" + sessionID; |