Skip to content

Commit

Permalink
update with score
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Aug 8, 2018
1 parent e037878 commit ac225c3
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 48 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ qt5_add_resources(QRCS "${CMAKE_CURRENT_SOURCE_DIR}/resources/Tutorial.qrc")

# Creation of the library
add_library(${PROJECT_NAME} ${SRCS} ${HDRS} ${QRCS})
score_moc_headers(${PROJECT_NAME} score_addon_tutorial.hpp)

# Code generation
score_generate_command_list_file(${PROJECT_NAME} "${HDRS}")
Expand Down
6 changes: 4 additions & 2 deletions Tutorial/Process/Executor/TutorialProcessExecutor.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "TutorialProcessExecutor.hpp"
#include <Tutorial/Process/TutorialProcessModel.hpp>
#include <Process/ExecutionContext.hpp>
#include <ossia/dataflow/port.hpp>
#include <ossia/network/base/node.hpp>

namespace Tutorial
{
Expand All @@ -26,7 +28,7 @@ class tutorial_node final :
{
if(auto p = n->get_parameter())
{
f.insert(*p, ossia::tvalue{1.234f});
f.insert(*p, ossia::typed_value{1.234f});
}
}

Expand Down Expand Up @@ -72,7 +74,7 @@ class tutorial_node final :

ProcessExecutorComponent::ProcessExecutorComponent(
Tutorial::ProcessModel& element,
const Engine::Execution::Context& ctx,
const Execution::Context& ctx,
const Id<score::Component>& id,
QObject* parent):
ProcessComponent_T{element, ctx, id, "TutorialExecutorComponent", parent}
Expand Down
10 changes: 5 additions & 5 deletions Tutorial/Process/Executor/TutorialProcessExecutor.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include <Engine/Executor/ProcessComponent.hpp>
#include <Process/Execution/ProcessComponent.hpp>

#include <ossia/dataflow/graph_node.hpp>
#include <ossia/dataflow/node_process.hpp>
Expand All @@ -12,28 +12,28 @@ class DeviceList;
* These classes provide execution components to a process.
* I.E. what happens once the score plays.
*
* Please refer to the Engine::Execution documentation.
* Please refer to the Execution documentation.
*/
namespace Tutorial
{
class ProcessModel;

//! Component and bridge between the GUI / Edition thread and the execution thread.
class ProcessExecutorComponent final :
public Engine::Execution::ProcessComponent_T<
public Execution::ProcessComponent_T<
Tutorial::ProcessModel, ossia::node_process>
{
COMPONENT_METADATA("4797971b-54cd-43e5-8514-e2e941303d1a")
public:
ProcessExecutorComponent(
ProcessModel& element,
const Engine::Execution::Context& ctx,
const Execution::Context& ctx,
const Id<score::Component>& id,
QObject* parent);
};


using ProcessExecutorComponentFactory =
Engine::Execution::ProcessComponentFactory_T<ProcessExecutorComponent>;
Execution::ProcessComponentFactory_T<ProcessExecutorComponent>;

}
41 changes: 23 additions & 18 deletions Tutorial/Process/Layer/TutorialProcessView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,33 @@ TutorialView::TutorialView(
{
this->setFlag(QGraphicsItem::ItemClipsToShape, true);
this->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
auto widget = new QQuickWidget(QUrl("qrc:///TutorialProcess.qml"));
widget->setClearColor(QColor("#19456B"));
widget->setResizeMode(QQuickWidget::ResizeMode::SizeRootObjectToView);

auto subw = new QGraphicsProxyWidget{this};
subw->setWidget(widget);
m_widget = new QQuickWidget(QUrl("qrc:///TutorialProcess.qml"));
m_widget->setClearColor(QColor("#19456B"));
m_widget->setResizeMode(QQuickWidget::ResizeMode::SizeRootObjectToView);

connect(this, &LayerView::heightChanged, this, [=] {
subw->setGeometry(QRectF{0, 50, this->width(), this->height() - 100});
widget->setMinimumSize((int)width(), (int)height() - 100);
widget->setMaximumSize((int)width(), (int)height() - 100);
widget->update();
});
connect(this, &LayerView::widthChanged, this, [=] {
subw->setGeometry(QRectF{0, 50, this->width(), this->height() - 100});
widget->setMinimumSize((int)width(), (int)height() - 100);
widget->setMaximumSize((int)width(), (int)height() - 100);
widget->update();
});
subw->update();
m_proxy = new QGraphicsProxyWidget{this};
m_proxy->setWidget(m_widget);

m_proxy->update();
}


void TutorialView::heightChanged(qreal h)
{
m_proxy->setGeometry(QRectF{0, 50, this->width(), this->height() - 100});
m_widget->setMinimumSize((int)width(), (int)height() - 100);
m_widget->setMaximumSize((int)width(), (int)height() - 100);
m_widget->update();
}

void TutorialView::widthChanged(qreal w)
{
m_proxy->setGeometry(QRectF{0, 50, this->width(), this->height() - 100});
m_widget->setMinimumSize((int)width(), (int)height() - 100);
m_widget->setMaximumSize((int)width(), (int)height() - 100);
m_widget->update();
}
void TutorialView::setText(const QString& txt)
{
m_text = txt;
Expand Down
6 changes: 6 additions & 0 deletions Tutorial/Process/Layer/TutorialProcessView.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once
#include <Process/LayerView.hpp>

class QQuickWidget;
class QGraphicsProxyWidget;
namespace Tutorial
{
//! The View should only handle painting, and forwarding of
Expand All @@ -21,7 +23,11 @@ class TutorialView final
void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;

void heightChanged(qreal h) override;
void widthChanged(qreal w) override;
QString m_text;
QQuickWidget* m_widget{};
QGraphicsProxyWidget* m_proxy{};

};
}
6 changes: 3 additions & 3 deletions Tutorial/Process/LocalTree/TutorialProcessLocalTree.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "TutorialProcessLocalTree.hpp"
#include <Tutorial/Process/TutorialProcessModel.hpp>
#include <Engine/LocalTree/Property.hpp>
#include <LocalTree/Property.hpp>

namespace Tutorial
{
Expand All @@ -9,9 +9,9 @@ LocalTreeProcessComponent::LocalTreeProcessComponent(
const Id<score::Component>& id,
ossia::net::node_base& parent,
Tutorial::ProcessModel& proc,
Engine::LocalTree::DocumentPlugin& sys,
LocalTree::DocumentPlugin& sys,
QObject* parent_obj):
Engine::LocalTree::ProcessComponent_T<Tutorial::ProcessModel>{parent, proc, sys, id, "TutorialComponent", parent_obj}
LocalTree::ProcessComponent_T<Tutorial::ProcessModel>{parent, proc, sys, id, "TutorialComponent", parent_obj}
{
add<ProcessModel::p_bananas>(proc);
}
Expand Down
12 changes: 6 additions & 6 deletions Tutorial/Process/LocalTree/TutorialProcessLocalTree.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include <Engine/LocalTree/Scenario/ProcessComponent.hpp>
#include <Engine/LocalTree/LocalTreeComponent.hpp>
#include <LocalTree/Scenario/ProcessComponent.hpp>
#include <LocalTree/LocalTreeComponent.hpp>

namespace Tutorial
{
Expand All @@ -9,7 +9,7 @@ class ProcessModel;
//! This component displays informations about an object in the Device Explorer,
//! in the left panel.
class LocalTreeProcessComponent :
public Engine::LocalTree::ProcessComponent_T<ProcessModel>
public LocalTree::ProcessComponent_T<ProcessModel>
{
COMPONENT_METADATA("b387ed01-831a-487d-8686-42094813f2a7")

Expand All @@ -18,14 +18,14 @@ class LocalTreeProcessComponent :
const Id<score::Component>& id,
ossia::net::node_base& parent,
Tutorial::ProcessModel& scenario,
Engine::LocalTree::DocumentPlugin& doc,
LocalTree::DocumentPlugin& doc,
QObject* parent_obj);

~LocalTreeProcessComponent() override;

private:
std::unique_ptr<Engine::LocalTree::BaseProperty> m_bananaProperty;
std::unique_ptr<LocalTree::BaseProperty> m_bananaProperty;
};

using LocalTreeProcessComponentFactory = Engine::LocalTree::ProcessComponentFactory_T<LocalTreeProcessComponent>;
using LocalTreeProcessComponentFactory = LocalTree::ProcessComponentFactory_T<LocalTreeProcessComponent>;
}
7 changes: 5 additions & 2 deletions score_addon_tutorial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ score_addon_tutorial::factories(
Tutorial::LayerFactory>,
FW<Process::InspectorWidgetDelegateFactory,
Tutorial::InspectorFactory>,
FW<Engine::Execution::ProcessComponentFactory,
FW<Execution::ProcessComponentFactory,
Tutorial::ProcessExecutorComponentFactory>,
FW<Engine::LocalTree::ProcessComponentFactory,
FW<LocalTree::ProcessComponentFactory,
Tutorial::LocalTreeProcessComponentFactory>,
FW<score::DocumentPluginFactory,
Tutorial::DocumentPluginFactory>,
Expand Down Expand Up @@ -175,3 +175,6 @@ score_addon_tutorial::make_commands()

return cmds;
}

#include <score/plugins/PluginInstances.hpp>
SCORE_EXPORT_PLUGIN(score_addon_tutorial)
11 changes: 0 additions & 11 deletions score_addon_tutorial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,12 @@
* one aims to give an overview of all the possibilities.
*/
class score_addon_tutorial final :
public QObject,
public score::Plugin_QtInterface,
public score::FactoryInterface_QtInterface,
public score::FactoryList_QtInterface,
public score::ApplicationPlugin_QtInterface,
public score::CommandFactory_QtInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID FactoryInterface_QtInterface_iid)
Q_INTERFACES(
score::Plugin_QtInterface
score::FactoryInterface_QtInterface
score::FactoryList_QtInterface
score::ApplicationPlugin_QtInterface
score::CommandFactory_QtInterface
)

// Version, and unique identifier for the plug-in.
// The uuid can be generated with "uuidgen" on linux or OS X.
SCORE_PLUGIN_METADATA(1, "e8601d50-e29e-4437-8c65-fcee42655a0b")
Expand Down

0 comments on commit ac225c3

Please sign in to comment.