3 #include <Process/Dataflow/ControlWidgets.hpp>
5 #include <Media/MediaFileHandle.hpp>
7 #include <score_plugin_media_export.h>
10 struct WaveformComputer;
17 ,
public QGraphicsItem
27 void pressed() E_SIGNAL(SCORE_PLUGIN_MEDIA_EXPORT, pressed);
28 void dropped(QString filename) E_SIGNAL(SCORE_PLUGIN_MEDIA_EXPORT, dropped, filename);
31 const QString& text()
const noexcept {
return m_string; }
32 void setFile(
const QString& s);
33 QRectF boundingRect()
const override;
36 void on_finishedDecoding();
37 void mousePressEvent(QGraphicsSceneMouseEvent* event)
override;
38 void mouseMoveEvent(QGraphicsSceneMouseEvent* event)
override;
39 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
override;
41 void dragEnterEvent(QGraphicsSceneDragDropEvent* event)
override;
42 void dragMoveEvent(QGraphicsSceneDragDropEvent* event)
override;
43 void dragLeaveEvent(QGraphicsSceneDragDropEvent* event)
override;
44 void dropEvent(QGraphicsSceneDragDropEvent* event)
override;
46 void paint(QPainter* painter,
const QStyleOptionGraphicsItem* option, QWidget* widget)
50 std::shared_ptr<Media::AudioFile> m_file;
51 QVector<QImage*> m_images;
61 template <
typename T,
typename Control_T>
64 QGraphicsItem* parent, QObject* context)
67 auto on_open = [&inlet, &ctx] {
69 = QFileDialog::getOpenFileName(
nullptr,
"Open File", {}, inlet.filters());
70 if(filename.isEmpty())
74 .submit<WidgetFactory::SetControlValue<Control_T>>(
75 inlet, filename.toStdString());
77 auto on_set = [&inlet, &ctx](
const QString& filename) {
78 if(filename.isEmpty())
82 .submit<WidgetFactory::SetControlValue<Control_T>>(
83 inlet, filename.toStdString());
85 QObject::connect(bt, &score::QGraphicsWaveformButton::pressed, &inlet, on_open);
86 QObject::connect(bt, &score::QGraphicsWaveformButton::dropped, &inlet, on_set);
87 auto set = [=](
const ossia::value& val) {
88 auto str = QString::fromStdString(ossia::convert<std::string>(val));
99 QObject::connect(&inlet, &Control_T::valueChanged, bt, set);
The CommandDispatcher class.
Definition: CommandDispatcher.hpp:13
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: DocumentContext.hpp:18