Changeset View
Changeset View
Standalone View
Standalone View
src/timeline2/model/timelineitemmodel.cpp
Context not available. | |||||
93 | return index(clipIndex, 0, index(trackIndex)); | 93 | return index(clipIndex, 0, index(trackIndex)); | ||
---|---|---|---|---|---|
94 | }*/ | 94 | }*/ | ||
95 | 95 | | |||
96 | QModelIndex TimelineItemModel::makeClipIndexFromID(int clipId) const | 96 | const QModelIndex TimelineItemModel::makeClipIndexFromID(int clipId) const | ||
97 | { | 97 | { | ||
98 | Q_ASSERT(m_allClips.count(clipId) > 0); | 98 | Q_ASSERT(m_allClips.count(clipId) > 0); | ||
99 | int trackId = m_allClips.at(clipId)->getCurrentTrackId(); | 99 | int trackId = m_allClips.at(clipId)->getCurrentTrackId(); | ||
Context not available. | |||||
105 | return index(row, 0, makeTrackIndexFromID(trackId)); | 105 | return index(row, 0, makeTrackIndexFromID(trackId)); | ||
106 | } | 106 | } | ||
107 | 107 | | |||
108 | QModelIndex TimelineItemModel::makeCompositionIndexFromID(int compoId) const | 108 | const QModelIndex TimelineItemModel::makeCompositionIndexFromID(int compoId) const | ||
109 | { | 109 | { | ||
110 | Q_ASSERT(m_allCompositions.count(compoId) > 0); | 110 | Q_ASSERT(m_allCompositions.count(compoId) > 0); | ||
111 | int trackId = m_allCompositions.at(compoId)->getCurrentTrackId(); | 111 | int trackId = m_allCompositions.at(compoId)->getCurrentTrackId(); | ||
112 | return index(getTrackById_const(trackId)->getRowfromComposition(compoId), 0, makeTrackIndexFromID(trackId)); | 112 | return index(getTrackById_const(trackId)->getRowfromComposition(compoId), 0, makeTrackIndexFromID(trackId)); | ||
113 | } | 113 | } | ||
114 | 114 | | |||
115 | QModelIndex TimelineItemModel::makeTrackIndexFromID(int trackId) const | 115 | const QModelIndex TimelineItemModel::makeTrackIndexFromID(int trackId) const | ||
116 | { | 116 | { | ||
117 | // we retrieve iterator | 117 | // we retrieve iterator | ||
118 | Q_ASSERT(m_iteratorTable.count(trackId) > 0); | 118 | Q_ASSERT(m_iteratorTable.count(trackId) > 0); | ||
Context not available. | |||||
124 | QModelIndex TimelineItemModel::parent(const QModelIndex &index) const | 124 | QModelIndex TimelineItemModel::parent(const QModelIndex &index) const | ||
125 | { | 125 | { | ||
126 | READ_LOCK(); | 126 | READ_LOCK(); | ||
127 | // qDebug() << "TimelineItemModel::parent"<< index; | | |||
128 | if (index == QModelIndex()) { | 127 | if (index == QModelIndex()) { | ||
129 | return index; | 128 | return index; | ||
130 | } | 129 | } | ||
131 | const int id = static_cast<int>(index.internalId()); | 130 | const int id = static_cast<int>(index.internalId()); | ||
131 | //qDebug() << "TimelineItemModel::parent from: "<<id<<" = "<< index; | ||||
132 | if (!index.isValid() || isTrack(id)) { | 132 | if (!index.isValid() || isTrack(id)) { | ||
133 | return QModelIndex(); | 133 | return QModelIndex(); | ||
134 | } | 134 | } | ||
Context not available. | |||||
169 | QHash<int, QByteArray> roles; | 169 | QHash<int, QByteArray> roles; | ||
170 | roles[NameRole] = "name"; | 170 | roles[NameRole] = "name"; | ||
171 | roles[ResourceRole] = "resource"; | 171 | roles[ResourceRole] = "resource"; | ||
172 | roles[ItemIdRole] = "itemId"; | ||||
172 | roles[ServiceRole] = "mlt_service"; | 173 | roles[ServiceRole] = "mlt_service"; | ||
173 | roles[BinIdRole] = "binId"; | 174 | roles[BinIdRole] = "binId"; | ||
175 | roles[TrackIdRole] = "trackId"; | ||||
174 | roles[IsBlankRole] = "blank"; | 176 | roles[IsBlankRole] = "blank"; | ||
175 | roles[StartRole] = "start"; | 177 | roles[StartRole] = "start"; | ||
176 | roles[DurationRole] = "duration"; | 178 | roles[DurationRole] = "duration"; | ||
Context not available. | |||||
195 | roles[SpeedRole] = "speed"; | 197 | roles[SpeedRole] = "speed"; | ||
196 | roles[HeightRole] = "trackHeight"; | 198 | roles[HeightRole] = "trackHeight"; | ||
197 | roles[TrackTagRole] = "trackTag"; | 199 | roles[TrackTagRole] = "trackTag"; | ||
198 | roles[ItemIdRole] = "item"; | | |||
199 | roles[ItemATrack] = "a_track"; | 200 | roles[ItemATrack] = "a_track"; | ||
200 | roles[HasAudio] = "hasAudio"; | 201 | roles[HasAudio] = "hasAudio"; | ||
201 | roles[CanBeAudioRole] = "canBeAudio"; | 202 | roles[CanBeAudioRole] = "canBeAudio"; | ||
Context not available. | |||||
223 | if (isTrack(id)) { | 224 | if (isTrack(id)) { | ||
224 | return getTrackSortValue(id, KdenliveSettings::audiotracksbelow()); | 225 | return getTrackSortValue(id, KdenliveSettings::audiotracksbelow()); | ||
225 | } | 226 | } | ||
226 | return id; | 227 | return QVariant(); | ||
227 | } | 228 | } | ||
228 | if (isClip(id)) { | 229 | if (isClip(id)) { | ||
229 | // qDebug() << "REQUESTING DATA "<<roleNames()[role]<<index; | 230 | // qDebug() << "REQUESTING DATA "<<roleNames()[role]<<index; | ||
Context not available. | |||||
253 | } | 254 | } | ||
254 | case BinIdRole: | 255 | case BinIdRole: | ||
255 | return clip->binId(); | 256 | return clip->binId(); | ||
257 | case TrackIdRole: | ||||
258 | return clip->getCurrentTrackId(); | ||||
256 | case ServiceRole: | 259 | case ServiceRole: | ||
257 | return clip->getProperty("mlt_service"); | 260 | return clip->getProperty("mlt_service"); | ||
258 | break; | 261 | break; | ||
Context not available. | |||||
360 | return false; | 363 | return false; | ||
361 | case StartRole: | 364 | case StartRole: | ||
362 | return compo->getPosition(); | 365 | return compo->getPosition(); | ||
366 | case TrackIdRole: | ||||
367 | return compo->getCurrentTrackId(); | ||||
363 | case DurationRole: | 368 | case DurationRole: | ||
364 | return compo->getPlaytime(); | 369 | return compo->getPlaytime(); | ||
365 | case GroupedRole: | 370 | case GroupedRole: | ||
Context not available. | |||||
556 | } | 561 | } | ||
557 | void TimelineItemModel::_endMoveRows() | 562 | void TimelineItemModel::_endMoveRows() | ||
558 | { | 563 | { | ||
559 | // qDebug()<<"FORWARDING endRemoveRows"; | | |||
560 | endMoveRows(); | 564 | endMoveRows(); | ||
561 | } | 565 | } | ||
562 | void TimelineItemModel::_endInsertRows() | 566 | void TimelineItemModel::_endInsertRows() | ||
Context not available. |