Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/wasm remote 2 #1288

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Conversation

Toine-ddt
Copy link

No description provided.

.gitmodules Outdated
@@ -44,3 +44,6 @@
[submodule "3rdparty/hap"]
path = 3rdparty/hap
url = https://github.com/Vidvox/hap
[submodule "3rdparty/qml-remote"]
path = 3rdparty/qml-remote
url = https://github.com/ossia/qml-remote.git
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's remove that part, we don't want this as a submodule

@@ -25,6 +25,7 @@ set(HDRS
"RemoteControl/DocumentPlugin.hpp"
"i-score-remote/RemoteApplication.hpp"
"score_plugin_remotecontrol.hpp"
"RemoteControl/Http_server.hpp"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you name that file HttpServer in line with the rest of score ?

"${CMAKE_CURRENT_SOURCE_DIR}/score_plugin_remotecontrol.cpp"
)

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/RemoteControl/build-wasm/ DESTINATION ${CMAKE_BINARY_DIR}/src/plugins/score-plugin-remotecontrol/CMakeFiles/score_plugin_remotecontrol.dir/RemoteControl/build-wasm/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we won't need that: the remote's .wasm file is not supposed to be built as part of score but in a different repo which will be in the package manager

@@ -10,5 +11,6 @@ class ApplicationPlugin final : public score::GUIApplicationPlugin

protected:
void on_createdDocument(score::Document& doc) override;
Http_server m_server;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpServer

{
auto const address2 = net::ip::make_address("0.0.0.0");
auto const port = static_cast<unsigned short>(std::atoi("8080"));
auto const m_docRoot = std::make_shared<std::string>("./src/plugins/score-plugin-remotecontrol/CMakeFiles/score_plugin_remotecontrol.dir/RemoteControl/build-wasm/");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line only works on the build computer.
instead we have to look for it in the user library which is where it will be installed on the user's computer:

#include <Library/LibrarySettings.hpp>
#include <score/application/ApplicationContext.hpp>

QString chemin_vers_dossier_packages = score::AppContext().settings<Library::Settings::Model>().getPackagesPath();

{
try
{
auto const address2 = net::ip::make_address("0.0.0.0");
auto const port = static_cast<unsigned short>(std::atoi("8080"));
auto const m_docRoot = std::make_shared<std::string>("./src/plugins/score-plugin-remotecontrol/CMakeFiles/score_plugin_remotecontrol.dir/RemoteControl/build-wasm/");
// auto const m_docRoot = std::make_shared<std::string>("./src/plugins/score-plugin-remotecontrol/CMakeFiles/score_plugin_remotecontrol.dir/RemoteControl/build-wasm/");
std::string packagesPath = score::AppContext().settings<Library::Settings::Model>().getPackagesPath().toUtf8().constData();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getPackagesPath().toStdString() :-)

auto const m_docRoot = std::make_shared<std::string>("./src/plugins/score-plugin-remotecontrol/CMakeFiles/score_plugin_remotecontrol.dir/RemoteControl/build-wasm/");
// auto const m_docRoot = std::make_shared<std::string>("./src/plugins/score-plugin-remotecontrol/CMakeFiles/score_plugin_remotecontrol.dir/RemoteControl/build-wasm/");
std::string packagesPath = score::AppContext().settings<Library::Settings::Model>().getPackagesPath().toUtf8().constData();
QDebug << "packagesPath :" << packagesPath;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the QDebug anymore (.. does that compile ? it's supposed to be qDebug())

{
try
{
auto const address2 = net::ip::make_address("0.0.0.0");
auto const port = static_cast<unsigned short>(std::atoi("8080"));
auto const m_docRoot = std::make_shared<std::string>("./src/plugins/score-plugin-remotecontrol/CMakeFiles/score_plugin_remotecontrol.dir/RemoteControl/build-wasm/");
// auto const m_docRoot = std::make_shared<std::string>("./src/plugins/score-plugin-remotecontrol/CMakeFiles/score_plugin_remotecontrol.dir/RemoteControl/build-wasm/");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comment can go

@@ -148,5 +150,6 @@ class Http_server

std::thread m_serverThread;
int m_listenSocket{};
std::string buildWasmPath;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_ prefix for members

@Toine-ddt
Copy link
Author

done @jcelerier

ApplicationPlugin::~ApplicationPlugin()
{
std::remove((m_server.m_buildWasmPath + "remote.html").c_str());
std::rename((m_server.m_buildWasmPath + "remote.html~").c_str(), (m_server.m_buildWasmPath + "remote.html").c_str());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... what is happening here ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants