Skip to content

Commit

Permalink
[ui] Refactor the way copy/paste is handled
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Feb 13, 2022
1 parent 4bf9c3c commit e423691
Show file tree
Hide file tree
Showing 27 changed files with 422 additions and 243 deletions.
67 changes: 67 additions & 0 deletions ci/wasm-qt6.build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash -eux

export SCORE_DIR=$PWD

mkdir -p /build || true
chown -R $(whoami) /build
cd /build

export QT=/opt/ossia-sdk-wasm/qt5

source /opt/ossia-sdk-wasm/emsdk/emsdk_env.sh
export CC=$(which emcc)
export CXX=$(which em++)

cmake -GNinja $SCORE_DIR \
-DCMAKE_C_FLAGS="-O3 -g0" \
-DCMAKE_CXX_FLAGS="-O3 -g0" \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_UNITY_BUILD=1 \
-DCMAKE_TOOLCHAIN_FILE=/opt/ossia-sdk-wasm/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \
-DOSSIA_PCH=0 \
-DSCORE_PCH=0 \
-DQt6_DIR=$QT/lib/cmake/Qt6 \
-DQt6Core_DIR=$QT/lib/cmake/Qt6Core \
-DQt6DeviceDiscoverySupport_DIR=$QT/lib/cmake/Qt6DeviceDiscoverySupport \
-DQt6EdidSupport_DIR=$QT/lib/cmake/Qt6EdidSupport \
-DQt6EglSupport_DIR=$QT/lib/cmake/Qt6EglSupport \
-DQt6EventDispatcherSupport_DIR=$QT/lib/cmake/Qt6EventDispatcherSupport \
-DQt6FbSupport_DIR=$QT/lib/cmake/Qt6FbSupport \
-DQt6FontDatabaseSupport_DIR=$QT/lib/cmake/Qt6FontDatabaseSupport \
-DQt6Gui_DIR=$QT/lib/cmake/Qt6Gui \
-DQt6Multimedia_DIR=$QT/lib/cmake/Qt6Multimedia \
-DQt6MultimediaQuick_DIR=$QT/lib/cmake/Qt6MultimediaQuick \
-DQt6MultimediaWidgets_DIR=$QT/lib/cmake/Qt6MultimediaWidgets \
-DQt6Network_DIR=$QT/lib/cmake/Qt6Network \
-DQt6OpenGL_DIR=$QT/lib/cmake/Qt6OpenGL \
-DQt6OpenGLExtensions_DIR=$QT/lib/cmake/Qt6OpenGLExtensions \
-DQt6PlatformCompositorSupport_DIR=$QT/lib/cmake/Qt6PlatformCompositorSupport \
-DQt6Qml_DIR=$QT/lib/cmake/Qt6Qml \
-DQt6QmlDevTools_DIR=$QT/lib/cmake/Qt6QmlDevTools \
-DQt6QmlImportScanner_DIR=$QT/lib/cmake/Qt6QmlImportScanner \
-DQt6QmlModels_DIR=$QT/lib/cmake/Qt6QmlModels \
-DQt6Quick_DIR=$QT/lib/cmake/Qt6Quick \
-DQt6QuickCompiler_DIR=$QT/lib/cmake/Qt6QuickCompiler \
-DQt6QuickParticles_DIR=$QT/lib/cmake/Qt6QuickParticles \
-DQt6QuickShapes_DIR=$QT/lib/cmake/Qt6QuickShapes \
-DQt6QuickWidgets_DIR=$QT/lib/cmake/Qt6QuickWidgets \
-DQt6ServiceSupport_DIR=$QT/lib/cmake/Qt6ServiceSupport \
-DQt6ThemeSupport_DIR=$QT/lib/cmake/Qt6ThemeSupport \
-DQt6WebSockets_DIR=$QT/lib/cmake/Qt6WebSockets \
-DQt6Widgets_DIR=$QT/lib/cmake/Qt6Widgets \
-DQt6Xml_DIR=$QT/lib/cmake/Qt6Xml \
-DQt6Zlib_DIR=$QT/lib/cmake/Qt6Zlib


cmake --build .
~/libs/qt6-wasm/qtbase/bin/qt-cmake -GNinja $SCORE_DIR \
-DCMAKE_C_FLAGS="-O3 -g0" \
-DCMAKE_CXX_FLAGS="-O3 -g0" \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_UNITY_BUILD=1 \
-DQT_VERSION="Qt6;6.3" \
-DOSSIA_PCH=0 \
-DSCORE_PCH=0

4 changes: 2 additions & 2 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ set(HEADERS
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/Skin.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/path/ObjectIdentifier.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/path/ObjectPath.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/ObjectRemover.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/ObjectEditor.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/path/Path.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/path/PathDebug.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/path/PathSerialization.hpp"
Expand Down Expand Up @@ -402,7 +402,7 @@ set(SRCS
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/IdentifiedObjectAbstract.cpp"

"${CMAKE_CURRENT_SOURCE_DIR}/score/model/path/ObjectPath.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/ObjectRemover.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/ObjectEditor.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/ModelMetadata.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/Skin.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/score/model/ColorReference.cpp"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/application/ApplicationInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static void loadDefaultPlugins(
#if defined(SCORE_SERIALIZABLE_COMPONENTS)
r.registerFactory(std::make_unique<SerializableComponentFactoryList>());
#endif
r.registerFactory(std::make_unique<ObjectRemoverList>());
r.registerFactory(std::make_unique<ObjectEditorList>());
auto panels = std::make_unique<PanelDelegateFactoryList>();
panels->insert(std::make_unique<UndoPanelDelegateFactory>());
panels->insert(std::make_unique<MessagesPanelDelegateFactory>());
Expand Down
7 changes: 7 additions & 0 deletions src/lib/score/model/ObjectEditor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <score/model/ObjectRemover.hpp>

namespace score
{
ObjectEditor::~ObjectEditor() { }
ObjectEditorList::~ObjectEditorList() { }
}
29 changes: 29 additions & 0 deletions src/lib/score/model/ObjectEditor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once
#include <score/plugins/Interface.hpp>
#include <score/plugins/InterfaceList.hpp>
#include <score/selection/Selection.hpp>

class QMimeData;
namespace score
{
struct DocumentContext;
// TODO do it for curve, c.f. CurvePresenter::removeSelection
struct SCORE_LIB_BASE_EXPORT ObjectEditor : public score::InterfaceBase
{
SCORE_INTERFACE(ObjectEditor, "12951ea1-ffb0-4f77-8a3a-bf28ccb60a2e")
public:
virtual ~ObjectEditor() override;

virtual bool copy(JSONReader& r, const Selection& s, const score::DocumentContext& ctx) = 0;
virtual bool paste(QPoint pos, const QMimeData& mime, const score::DocumentContext& ctx) = 0;
virtual bool remove(const Selection& s, const score::DocumentContext& ctx) = 0;
};

class SCORE_LIB_BASE_EXPORT ObjectEditorList final
: public score::InterfaceList<ObjectEditor>
{
public:
virtual ~ObjectEditorList() override;
};

}
7 changes: 0 additions & 7 deletions src/lib/score/model/ObjectRemover.cpp

This file was deleted.

27 changes: 0 additions & 27 deletions src/lib/score/model/ObjectRemover.hpp

This file was deleted.

5 changes: 0 additions & 5 deletions src/plugins/score-lib-process/Process/LayerPresenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ const ProcessModel& LayerPresenter::model() const noexcept
return m_process;
}

const Id<Process::ProcessModel>& LayerPresenter::modelId() const noexcept
{
return m_process.id();
}

void LayerPresenter::fillContextMenu(
QMenu&,
QPoint pos,
Expand Down
1 change: 0 additions & 1 deletion src/plugins/score-lib-process/Process/LayerPresenter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class SCORE_LIB_PROCESS_EXPORT LayerPresenter : public QObject
virtual void parentGeometryChanged() = 0;

const ProcessModel& model() const noexcept;
const Id<ProcessModel>& modelId() const noexcept;

virtual void fillContextMenu(
QMenu&,
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/score-plugin-midi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set(HEADER_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/Midi/MidiNoteView.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Midi/MidiExecutor.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Midi/MidiStyle.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Midi/MidiNoteRemover.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Midi/MidiNoteEditor.hpp"


Patternist/PatternModel.hpp
Expand Down Expand Up @@ -56,7 +56,7 @@ set(SOURCE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/Midi/MidiNoteView.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Midi/MidiNote.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Midi/MidiExecutor.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Midi/MidiNoteRemover.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Midi/MidiNoteEditor.cpp"

Patternist/PatternModel.cpp
Patternist/PatternView.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,19 @@
#include <score/document/DocumentContext.hpp>
namespace Midi
{
bool NoteRemover::remove(const Selection& s, const score::DocumentContext& ctx)
bool NoteEditor::copy(JSONReader& r, const Selection& s, const score::DocumentContext& ctx)
{
SCORE_TODO;
return true;
}

bool NoteEditor::paste(QPoint pos, const QMimeData& mime, const score::DocumentContext& ctx)
{
SCORE_TODO;
return true;
}

bool NoteEditor::remove(const Selection& s, const score::DocumentContext& ctx)
{
if (!s.empty())
{
Expand Down
15 changes: 15 additions & 0 deletions src/plugins/score-plugin-midi/Midi/MidiNoteEditor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include <score/model/ObjectRemover.hpp>

namespace Midi
{
class NoteEditor : public score::ObjectEditor
{
SCORE_CONCRETE("94325561-b73b-4593-a4ef-46c7e2100078")

bool copy(JSONReader& r, const Selection& s, const score::DocumentContext& ctx) override;
bool paste(QPoint pos, const QMimeData& mime, const score::DocumentContext& ctx) override;
bool remove(const Selection& s, const score::DocumentContext& ctx) override;
};
}
12 changes: 0 additions & 12 deletions src/plugins/score-plugin-midi/Midi/MidiNoteRemover.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion src/plugins/score-plugin-midi/score_plugin_midi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ score_plugin_midi::factories(
FW<Inspector::InspectorWidgetFactory,
Midi::InspectorFactory,
Patternist::InspectorFactory>,
FW<score::ObjectRemover, Midi::NoteRemover>>(ctx, key);
FW<score::ObjectEditor, Midi::NoteEditor>>(ctx, key);
}

std::pair<const CommandGroupKey, CommandGeneratorMap>
Expand Down
12 changes: 12 additions & 0 deletions src/plugins/score-plugin-nodal/Nodal/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ void Model::ancestorTempoChanged()
n.ancestorTempoChanged();
}

bool NodeRemover::copy(JSONReader& r, const Selection& s, const score::DocumentContext& ctx)
{
SCORE_TODO;
return true;
}

bool NodeRemover::paste(QPoint pos, const QMimeData& mime, const score::DocumentContext& ctx)
{
SCORE_TODO;
return true;
}

bool NodeRemover::remove(const Selection& s, const score::DocumentContext& ctx)
{
if (s.size() == 1)
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/score-plugin-nodal/Nodal/Process.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ class Model final : public Process::ProcessModel

using ProcessFactory = Process::ProcessFactory_T<Nodal::Model>;

class NodeRemover : public score::ObjectRemover
class NodeRemover : public score::ObjectEditor
{
SCORE_CONCRETE("5e1c7e92-5beb-4313-92c8-f690089ff340")

bool copy(JSONReader& r, const Selection& s, const score::DocumentContext& ctx) override;
bool paste(QPoint pos, const QMimeData& mime, const score::DocumentContext& ctx) override;
bool remove(const Selection& s, const score::DocumentContext& ctx) override;
};
}
2 changes: 1 addition & 1 deletion src/plugins/score-plugin-nodal/score_plugin_nodal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ score_plugin_nodal::factories(
FW<Process::LayerFactory, Nodal::LayerFactory>,
FW<Execution::ProcessComponentFactory,
Nodal::ProcessExecutorComponentFactory>,
FW<score::ObjectRemover, Nodal::NodeRemover>
FW<score::ObjectEditor, Nodal::NodeRemover>
//, FW<score::PanelDelegateFactory, Nodal::PanelDelegateFactory>
//, FW<LocalTree::ProcessComponentFactory,
// Nodal::LocalTreeProcessComponentFactory>
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/score-plugin-scenario/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ set(HDRS
"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/Commands/TimeSync/TriggerCommandFactory/TriggerCommandFactoryList.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/DialogWidget/AddProcessDialog.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/DialogWidget/MessageTreeView.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/Document/ScenarioRemover.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/Document/ScenarioEditor.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/Document/BaseScenario/BaseElementContext.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/Document/BaseScenario/BaseScenarioContainer.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/Document/BaseScenario/BaseScenario.hpp"
Expand Down Expand Up @@ -485,6 +485,7 @@ set(SRCS ${SRCS}
"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/Document/Graph.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/Document/BaseScenario/BaseScenario.cpp"

"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/Document/ScenarioEditor.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/Document/ScenarioDocument/CentralNodalDisplay.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/Document/ScenarioDocument/CentralIntervalDisplay.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Scenario/Document/ScenarioDocument/ProcessFocusManager.cpp"
Expand Down
Loading

0 comments on commit e423691

Please sign in to comment.