17class Scene :
public QObject
20 Q_PROPERTY (QString name READ name WRITE setName NOTIFY nameChanged)
21 Q_PROPERTY (QColor color READ color WRITE setColor NOTIFY colorChanged)
29 arrangement::ArrangerObjectRegistry &object_registry,
31 QObject * parent =
nullptr)
34 utils::make_qobject_unique<
39 ClipSlotList * clipSlots ()
const {
return clip_slot_list_.get (); }
42 QString name ()
const {
return name_; }
43 void setName (
const QString &name);
44 Q_SIGNAL
void nameChanged (
const QString &name);
47 QColor color ()
const {
return color_; }
48 void setColor (
const QColor &color);
49 Q_SIGNAL
void colorChanged (
const QColor &color);
52 auto &clip_slots ()
const {
return clip_slot_list_->clip_slots (); }
55 static constexpr auto kNameKey =
"name"sv;
56 static constexpr auto kColorKey =
"color"sv;
57 static constexpr auto kClipSlotsKey =
"clipSlots"sv;
58 friend void to_json (nlohmann::json &j,
const Scene &scene);
59 friend void from_json (
const nlohmann::json &j, Scene &scene);
67class SceneList :
public QAbstractListModel
75 arrangement::ArrangerObjectRegistry &object_registry,
77 QObject * parent =
nullptr);
81 ScenePtrRole = Qt::UserRole + 1,
86 Q_INVOKABLE
void removeScene (
int index);
87 Q_INVOKABLE
void moveScene (
int fromIndex,
int toIndex);
89 auto &scenes ()
const {
return scenes_; }
95 QHash<int, QByteArray> roleNames ()
const override
97 QHash<int, QByteArray> roles;
98 roles[ScenePtrRole] =
"scene";
101 int rowCount (
const QModelIndex &parent = QModelIndex ())
const override
103 if (parent.isValid ())
105 return static_cast<int> (scenes_.size ());
108 data (
const QModelIndex &index,
int role = Qt::DisplayRole)
const override
110 const auto index_int = index.row ();
111 if (!index.isValid () || index_int >=
static_cast<int> (scenes_.size ()))
114 if (role == ScenePtrRole)
116 return QVariant::fromValue (scenes_.at (index_int).get ());
124 friend void to_json (nlohmann::json &j,
const SceneList &list);
125 friend void from_json (
const nlohmann::json &j, SceneList &list);
128 std::vector<utils::QObjectUniquePtr<Scene>> scenes_;
129 arrangement::ArrangerObjectRegistry &object_registry_;