Get Interface to look in the proper directories

This commit is contained in:
Zach Fox 2019-10-31 08:57:06 -07:00
parent 82c75e9a92
commit 1e24df3f71
8 changed files with 380 additions and 353 deletions

View file

@ -158,7 +158,7 @@ macro(SET_PACKAGING_PARAMETERS)
endif()
set(CONSOLE_INSTALL_APP_PATH "${CONSOLE_INSTALL_DIR}/${CONSOLE_EXEC_NAME}")
set(SCREENSHARE_EXEC_NAME "HiFiScreenshare.app")
set(SCREENSHARE_EXEC_NAME "hifi-screenshare.app")
set(SCREENSHARE_INSTALL_APP_PATH "${SCREENSHARE_INSTALL_DIR}/${SCREENSHARE_EXEC_NAME}")
set(CONSOLE_APP_CONTENTS "${CONSOLE_INSTALL_APP_PATH}/Contents")
@ -174,7 +174,7 @@ macro(SET_PACKAGING_PARAMETERS)
else ()
if (WIN32)
set(CONSOLE_INSTALL_DIR "server-console")
set(SCREENSHARE_INSTALL_DIR "screenshare")
set(SCREENSHARE_INSTALL_DIR "hifi-screenshare")
set(NITPICK_INSTALL_DIR "nitpick")
else ()
set(CONSOLE_INSTALL_DIR ".")

View file

@ -21,7 +21,7 @@ ScreenshareScriptingInterface::ScreenshareScriptingInterface() {
};
void ScreenshareScriptingInterface::startScreenshare(QString displayName, QString userName, QString token, QString sessionID, QString apiKey, QString fileLocation) {
void ScreenshareScriptingInterface::startScreenshare(QString displayName, QString userName, QString token, QString sessionID, QString apiKey) {
if (QThread::currentThread() != thread()) {
// We must start a new QProcess from the main thread.
QMetaObject::invokeMethod(
@ -30,14 +30,19 @@ void ScreenshareScriptingInterface::startScreenshare(QString displayName, QStrin
Q_ARG(QString, userName),
Q_ARG(QString, token),
Q_ARG(QString, sessionID),
Q_ARG(QString, apiKey),
Q_ARG(QString, fileLocation)
Q_ARG(QString, apiKey)
);
return;
}
qDebug() << "ZRF: Inside startScreenshare(). `SCREENSHARE_EXE_PATH`:" << SCREENSHARE_EXE_PATH;
QFileInfo screenshareExecutable(SCREENSHARE_EXE_PATH);
if (!screenshareExecutable.exists() || !screenshareExecutable.isFile()) {
qDebug() << "Screenshare executable doesn't exist at" << SCREENSHARE_EXE_PATH;
return;
}
if (displayName.isEmpty() || userName.isEmpty() || token.isEmpty() || sessionID.isEmpty() || apiKey.isEmpty()) {
qDebug() << "Screenshare executable can't launch without connection info.";
return;
@ -65,6 +70,6 @@ void ScreenshareScriptingInterface::startScreenshare(QString displayName, QStrin
// Note for Milad:
// We'll have to have equivalent lines of code for MacOS.
#ifdef Q_OS_WIN
electronProcess->start(fileLocation, arguments);
electronProcess->start(SCREENSHARE_EXE_PATH, arguments);
#endif
};

View file

@ -2,18 +2,36 @@
#define hifi_ScreenshareScriptingInterface_h
#include <QObject>
#include <DependencyManager.h>
#include <PathUtils.h>
class ScreenshareScriptingInterface : public QObject, public Dependency {
Q_OBJECT
public:
ScreenshareScriptingInterface();
// This is a note for Milad:
// The value of this `SCREENSHARE_EXE_PATH` string will have to be changed based on the operating system we're using.
// The binary should probably be stored in a path like this one.
const QString SCREENSHARE_EXE_PATH{ "C:\\hifi\\hiFi\\screenshare\\screenshare-win32-x64\\screenshare.exe" };
Q_INVOKABLE void startScreenshare(QString displayName, QString userName, QString token, QString sessionID, QString apiKey, QString fileLocation);
#if DEV_BUILD
#ifdef Q_OS_WIN
const QString SCREENSHARE_EXE_PATH{ PathUtils::projectRootPath() + "/hifi-screenshare-win32-x64/hifi-screenshare.exe" };
#elif defined(Q_OS_MAC)
const QString SCREENSHARE_EXE_PATH{ PathUtils::projectRootPath() + "/screenshare-darwin-x64/hifi-screenshare.app" };
#else
// This path won't exist on other platforms, so the Screenshare Scripting Interface will exit early when invoked.
const QString SCREENSHARE_EXE_PATH{ PathUtils::projectRootPath() + "/screenshare/hifi-screenshare" };
#endif
#else
#ifdef Q_OS_WIN
const QString SCREENSHARE_EXE_PATH{ QCoreApplication::applicationDirPath() + "/hifi-screenshare/hifi-screenshare.exe" };
#elif defined(Q_OS_MAC)
const QString SCREENSHARE_EXE_PATH{ QCoreApplication::applicationDirPath() + "/hifi-screenshare/hifi-screenshare.app" };
#else
// This path won't exist on other platforms, so the Screenshare Scripting Interface will exit early when invoked.
const QString SCREENSHARE_EXE_PATH{ QCoreApplication::applicationDirPath() + "/hifi-screenshare/hifi-screenshare" };
#endif
#endif
Q_INVOKABLE void startScreenshare(QString displayName, QString userName, QString token, QString sessionID, QString apiKey);
};
#endif // hifi_ScreenshareScriptingInterface_h

View file

@ -1,2 +1,3 @@
screenshare-*/
hifi-screenshare-*/
hifi-screenshare*.zip
screenshare*.zip

View file

@ -1,4 +1,5 @@
set(TARGET_NAME screenshare)
add_custom_target(${TARGET_NAME}-npm-install
COMMAND npm install
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@ -13,7 +14,7 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "screenshare")
set_target_properties(${TARGET_NAME}-npm-install PROPERTIES FOLDER "hidden/screenshare")
if (WIN32)
set(PACKAGED_SCREENSHARE_FOLDER "screenshare-win32-x64")
set(PACKAGED_SCREENSHARE_FOLDER "hifi-screenshare-win32-x64")
set(SCREENSHARE_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_SCREENSHARE_FOLDER}")
install(
DIRECTORY "${SCREENSHARE_DESTINATION}/"
@ -23,7 +24,7 @@ if (WIN32)
set(EXECUTABLE_PATH "${SCREENSHARE_DESTINATION}/${SCREENSHARE_EXEC_NAME}")
optional_win_executable_signing()
elseif (APPLE)
set(PACKAGED_SCREENSHARE_FOLDER "screenshare-darwin-x64/${SCREENSHARE_EXEC_NAME}")
set(PACKAGED_SCREENSHARE_FOLDER "hifi-screenshare-darwin-x64/${SCREENSHARE_EXEC_NAME}")
install(
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_SCREENSHARE_FOLDER}"
USE_SOURCE_PERMISSIONS
@ -31,4 +32,6 @@ elseif (APPLE)
)
endif()
set_target_properties(${TARGET_NAME} PROPERTIES EXCLUDE_FROM_ALL FALSE EXCLUDE_FROM_DEFAULT_BUILD FALSE)
# Don't build the Screenshare Electron app when building the `ALL_BUILD` target.
# Don't build the Screenshare Electron app when a user selects "Build Solution" from within Visual Studio.
set_target_properties(${TARGET_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE)

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
var packager = require('electron-packager');
var options = {
dir: __dirname,
name: "screenshare",
name: "hifi-screenshare",
version: "0.1.0",
overwrite: true,
prune: true,

View file

@ -1,7 +1,7 @@
var packager = require('electron-packager');
var options = {
dir: __dirname,
name: "screenshare",
name: "hifi-screenshare",
version: "0.1.0",
overwrite: true,
prune: true,
@ -9,7 +9,7 @@ var options = {
platform: "darwin",
CompanyName: "High Fidelity, Inc.",
FileDescription: "High Fidelity Screenshare",
OriginalFilename: "screenshare.exe",
OriginalFilename: "hifi-screenshare.app",
ignore: "electron-packager|README.md|CMakeLists.txt|packager.js|.gitignore"
};