Loading...
Searching...
No Matches
ModelMetadata.hpp
1#pragma once
2#include <score/model/ColorReference.hpp>
3#include <score/serialization/VisitorInterface.hpp>
4#include <score/tools/Metadata.hpp>
5
6#include <ossia/detail/flat_map.hpp>
7
8#include <QObject>
9#include <QString>
10#include <QVariantMap>
11#include <qnamespace.h>
12
13#include <score_lib_base_export.h>
14
15#include <verdigris>
16namespace score
17{
21class SCORE_LIB_BASE_EXPORT ModelMetadata : public QObject
22{
23 SCORE_SERIALIZE_FRIENDS
24
25 W_OBJECT(ModelMetadata)
26
27public:
29
30 const QString& getName() const noexcept;
31 const QString& getComment() const noexcept;
32 ColorRef getColor() const noexcept;
33 const QString& getLabel() const noexcept;
34
35 template <typename T>
36 void setInstanceName(const T& t) noexcept
37 {
38 setName(QString("%1.%2").arg(Metadata<PrettyName_k, T>::get()).arg(t.id().val()));
39 m_touchedName = false;
40 }
41
42 bool touchedName() const noexcept;
43 void setName(const QString&) noexcept;
44 void setComment(const QString&) noexcept;
45 void setColor(ColorRef) noexcept;
46 void setLabel(const QString&) noexcept;
47
48 void NameChanged(const QString& arg) E_SIGNAL(SCORE_LIB_BASE_EXPORT, NameChanged, arg)
49 void CommentChanged(const QString& arg)
50 E_SIGNAL(SCORE_LIB_BASE_EXPORT, CommentChanged, arg)
51 void ColorChanged(score::ColorRef arg)
52 E_SIGNAL(SCORE_LIB_BASE_EXPORT, ColorChanged, arg)
53 void LabelChanged(const QString& arg)
54 E_SIGNAL(SCORE_LIB_BASE_EXPORT, LabelChanged, arg)
55 void metadataChanged() E_SIGNAL(SCORE_LIB_BASE_EXPORT, metadataChanged)
56
57 PROPERTY(QString, name READ getName WRITE setName NOTIFY NameChanged)
58 PROPERTY(QString, comment READ getComment WRITE setComment NOTIFY CommentChanged)
59 PROPERTY(ColorRef, color READ getColor WRITE setColor NOTIFY ColorChanged)
60 PROPERTY(QString, label READ getLabel WRITE setLabel NOTIFY LabelChanged)
61
62private:
63 QString m_scriptingName;
64 QString m_comment;
65 ColorRef m_color;
66 QString m_label;
67 bool m_touchedName{};
68};
69}
70
71Q_DECLARE_METATYPE(score::ModelMetadata*)
72W_REGISTER_ARGTYPE(score::ModelMetadata*)
The ModelMetadata class.
Definition ModelMetadata.hpp:22
Base toolkit upon which the software is built.
Definition Application.cpp:90
Static metadata implementation.
Definition lib/score/tools/Metadata.hpp:36
A reference to a color. Used for skinning.
Definition ColorReference.hpp:21