Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Prepare support for clip markers in timeline

parent ea03e79c
......@@ -163,6 +163,7 @@ QHash<int, QByteArray> TimelineItemModel::roleNames() const
roles[IsBlankRole] = "blank";
roles[StartRole] = "start";
roles[DurationRole] = "duration";
roles[MarkersRole] = "markers";
roles[InPointRole] = "in";
roles[OutPointRole] = "out";
roles[FramerateRole] = "fps";
......@@ -223,6 +224,11 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const
return QVariant();
case IsBlankRole: //probably useless
return false;
case MarkersRole: {
QVariantList markersList;
markersList << QStringLiteral("10") << QStringLiteral("Marker 1") << QStringLiteral("50") << QStringLiteral("M2");
return markersList;
}
case StartRole:
return clip->getPosition();
case DurationRole:
......
......@@ -70,6 +70,7 @@ public:
IsBlankRole, /// clip only
StartRole, /// clip only
BinIdRole, /// clip only
MarkersRole, /// clip only
DurationRole,
InPointRole, /// clip only
OutPointRole, /// clip only
......
......@@ -39,6 +39,7 @@ Rectangle {
property bool isTransition: false
property bool grouped: false
property var audioLevels
property var markers : []
property int fadeIn: 0
property int fadeOut: 0
property int binId: 0
......@@ -228,6 +229,45 @@ Rectangle {
color: 'black'
}
Repeater {
model: markers.length / 2
delegate:
Item {
anchors.fill: parent
Rectangle {
id: markerBase
width: 1 // modelDa
height: parent.height
x: markers[2 * modelData - clipRoot.inPoint] * timeScale;
color: 'red'
}
Rectangle {
opacity: 0.7
x: markerBase.x
radius: 2
width: mlabel.width + 4
height: mlabel.height
anchors {
bottom: parent.verticalCenter
}
color: 'red'
}
Text {
id: mlabel
text: markers[2 * modelData + 1]
visible: !isBlank && !isTransition
font.pixelSize: root.baseUnit
x: markerBase.x
anchors {
bottom: parent.verticalCenter
topMargin: parent.border.width + 1
leftMargin: parent.border.width + 1
}
color: 'white'
}
}
}
states: [
State {
name: 'normal'
......
......@@ -65,6 +65,7 @@ Column{
isAudio: false //model.audio
isTransition: false //model.isTransition
audioLevels: model.audioLevels
markers: model.markers
width: model.duration * timeScale
height: parent.height
modelStart: model.start
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment