Skip to content

Commit

Permalink
[core] Allow QT_QPA_PLATFORM=minimal --no-gui to work
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Jan 20, 2024
1 parent 5e89711 commit 059d4f0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <score/tools/ObjectMatches.hpp>

#include <core/application/ApplicationSettings.hpp>
#include <core/presenter/DocumentManager.hpp>

#include <ossia/editor/state/state_element.hpp>
Expand All @@ -31,6 +32,8 @@ PlayContextMenu::PlayContextMenu(
Engine::ApplicationPlugin& plug, const score::GUIApplicationContext& ctx)
: m_ctx{ctx}
{
if(!ctx.applicationSettings.gui)
return;
auto& exec_signals
= m_ctx.guiApplicationPlugin<Scenario::ScenarioApplicationPlugin>().execution();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,43 +113,42 @@ ScenarioApplicationPlugin::ScenarioApplicationPlugin(
if(context.applicationSettings.gui)
{
m_objectActions.setupContextMenu(m_layerCtxMenuManager);
}

{
// Dataflow
m_showCables = new QAction{this};
m_showCables->setCheckable(true);
m_showCables->setChecked(true);
setIcons(
m_showCables, QStringLiteral(":/icons/show_cables_on.png"),
QStringLiteral(":/icons/show_cables_hover.png"),
QStringLiteral(":/icons/show_cables_off.png"),
QStringLiteral(":/icons/show_cables_disabled.png"));
connect(m_showCables, &QAction::toggled, this, [this](bool c) {
auto doc = this->currentDocument();
if(doc)
{
Dataflow::CableItem::g_cables_enabled = c;

ScenarioDocumentPresenter* plug
= score::IDocument::try_get<ScenarioDocumentPresenter>(*doc);
if(plug)
{
// Dataflow
m_showCables = new QAction{this};
m_showCables->setCheckable(true);
m_showCables->setChecked(true);
setIcons(
m_showCables, QStringLiteral(":/icons/show_cables_on.png"),
QStringLiteral(":/icons/show_cables_hover.png"),
QStringLiteral(":/icons/show_cables_off.png"),
QStringLiteral(":/icons/show_cables_disabled.png"));
connect(m_showCables, &QAction::toggled, this, [this](bool c) {
auto doc = this->currentDocument();
if(doc)
{
for(const auto& port : plug->context().dataflow.ports())
{
if(port.second)
port.second->resetPortVisible();
}
Dataflow::CableItem::g_cables_enabled = c;

for(auto& cable : plug->context().dataflow.cables())
ScenarioDocumentPresenter* plug
= score::IDocument::try_get<ScenarioDocumentPresenter>(*doc);
if(plug)
{
if(cable.second)
cable.second->check();
for(const auto& port : plug->context().dataflow.ports())
{
if(port.second)
port.second->resetPortVisible();
}

for(auto& cable : plug->context().dataflow.cables())
{
if(cable.second)
cable.second->check();
}
}
}
}
});
}
});
}

{
// Dataflow
Expand Down Expand Up @@ -226,6 +225,7 @@ ScenarioApplicationPlugin::ScenarioApplicationPlugin(
pres->goUpALevel();
});
}
}
}

void ScenarioApplicationPlugin::initialize()
Expand Down

0 comments on commit 059d4f0

Please sign in to comment.