Changeset View
Changeset View
Standalone View
Standalone View
src/timeline2/model/timelineitemmodel.cpp
Context not available. | |||||
70 | if (parent.isValid()) { | 70 | if (parent.isValid()) { | ||
---|---|---|---|---|---|
71 | auto trackId = int(parent.internalId()); | 71 | auto trackId = int(parent.internalId()); | ||
72 | Q_ASSERT(isTrack(trackId)); | 72 | Q_ASSERT(isTrack(trackId)); | ||
73 | qDebug()<<" * ** CHECKING ITEM FOR ROW: "<<row<<", COL: "<<column<<", PARENT TK: "<<parent; | ||||
73 | int clipId = getTrackById_const(trackId)->getClipByRow(row); | 74 | int clipId = getTrackById_const(trackId)->getClipByRow(row); | ||
74 | if (clipId != -1) { | 75 | if (clipId != -1) { | ||
75 | result = createIndex(row, 0, quintptr(clipId)); | 76 | result = createIndex(row, 0, quintptr(clipId)); | ||
Context not available. | |||||
93 | return index(clipIndex, 0, index(trackIndex)); | 94 | return index(clipIndex, 0, index(trackIndex)); | ||
94 | }*/ | 95 | }*/ | ||
95 | 96 | | |||
96 | QModelIndex TimelineItemModel::makeClipIndexFromID(int clipId) const | 97 | const QPersistentModelIndex TimelineItemModel::makeClipIndexFromID(int clipId) const | ||
97 | { | 98 | { | ||
98 | Q_ASSERT(m_allClips.count(clipId) > 0); | 99 | Q_ASSERT(m_allClips.count(clipId) > 0); | ||
99 | int trackId = m_allClips.at(clipId)->getCurrentTrackId(); | 100 | int trackId = m_allClips.at(clipId)->getCurrentTrackId(); | ||
100 | if (trackId == -1) { | 101 | if (trackId == -1) { | ||
101 | // Clip is not inserted in a track | 102 | // Clip is not inserted in a track | ||
102 | return QModelIndex(); | 103 | qDebug()<<"// MAKING IX FROM NOT INSERTED CLIP!!!"; | ||
104 | return QPersistentModelIndex(); | ||||
103 | } | 105 | } | ||
104 | int row = getTrackById_const(trackId)->getRowfromClip(clipId); | 106 | int row = getTrackById_const(trackId)->getRowfromClip(clipId); | ||
105 | return index(row, 0, makeTrackIndexFromID(trackId)); | 107 | return index(row, 0, makeTrackIndexFromID(trackId)); | ||
106 | } | 108 | } | ||
107 | 109 | | |||
108 | QModelIndex TimelineItemModel::makeCompositionIndexFromID(int compoId) const | 110 | const QPersistentModelIndex TimelineItemModel::makeCompositionIndexFromID(int compoId) const | ||
109 | { | 111 | { | ||
110 | Q_ASSERT(m_allCompositions.count(compoId) > 0); | 112 | Q_ASSERT(m_allCompositions.count(compoId) > 0); | ||
111 | int trackId = m_allCompositions.at(compoId)->getCurrentTrackId(); | 113 | int trackId = m_allCompositions.at(compoId)->getCurrentTrackId(); | ||
112 | return index(getTrackById_const(trackId)->getRowfromComposition(compoId), 0, makeTrackIndexFromID(trackId)); | 114 | return index(getTrackById_const(trackId)->getRowfromComposition(compoId), 0, makeTrackIndexFromID(trackId)); | ||
113 | } | 115 | } | ||
114 | 116 | | |||
115 | QModelIndex TimelineItemModel::makeTrackIndexFromID(int trackId) const | 117 | const QPersistentModelIndex TimelineItemModel::makeTrackIndexFromID(int trackId) const | ||
116 | { | 118 | { | ||
117 | // we retrieve iterator | 119 | // we retrieve iterator | ||
118 | Q_ASSERT(m_iteratorTable.count(trackId) > 0); | 120 | Q_ASSERT(m_iteratorTable.count(trackId) > 0); | ||
Context not available. | |||||
124 | QModelIndex TimelineItemModel::parent(const QModelIndex &index) const | 126 | QModelIndex TimelineItemModel::parent(const QModelIndex &index) const | ||
125 | { | 127 | { | ||
126 | READ_LOCK(); | 128 | READ_LOCK(); | ||
127 | // qDebug() << "TimelineItemModel::parent"<< index; | | |||
128 | if (index == QModelIndex()) { | 129 | if (index == QModelIndex()) { | ||
129 | return index; | 130 | return index; | ||
130 | } | 131 | } | ||
131 | const int id = static_cast<int>(index.internalId()); | 132 | const int id = static_cast<int>(index.internalId()); | ||
133 | //qDebug() << "TimelineItemModel::parent from: "<<id<<" = "<< index; | ||||
132 | if (!index.isValid() || isTrack(id)) { | 134 | if (!index.isValid() || isTrack(id)) { | ||
133 | return QModelIndex(); | 135 | return QModelIndex(); | ||
134 | } | 136 | } | ||
Context not available. | |||||
153 | // if it is not a track, it is something invalid | 155 | // if it is not a track, it is something invalid | ||
154 | return 0; | 156 | return 0; | ||
155 | } | 157 | } | ||
158 | qDebug()<<"* ** * * GETTING ROWCOUNT FOR: "<<parent<<" = "<<getTrackClipsCount(id) + getTrackCompositionsCount(id); | ||||
156 | return getTrackClipsCount(id) + getTrackCompositionsCount(id); | 159 | return getTrackClipsCount(id) + getTrackCompositionsCount(id); | ||
157 | } | 160 | } | ||
161 | qDebug()<<"* ** * * GETTING ROWCOUNT FOR TRACKS: "<<getTracksCount(); | ||||
158 | return getTracksCount(); | 162 | return getTracksCount(); | ||
159 | } | 163 | } | ||
160 | 164 | | |||
Context not available. | |||||
169 | QHash<int, QByteArray> roles; | 173 | QHash<int, QByteArray> roles; | ||
170 | roles[NameRole] = "name"; | 174 | roles[NameRole] = "name"; | ||
171 | roles[ResourceRole] = "resource"; | 175 | roles[ResourceRole] = "resource"; | ||
176 | roles[ItemIdRole] = "itemId"; | ||||
172 | roles[ServiceRole] = "mlt_service"; | 177 | roles[ServiceRole] = "mlt_service"; | ||
173 | roles[BinIdRole] = "binId"; | 178 | roles[BinIdRole] = "binId"; | ||
179 | roles[TrackIdRole] = "trackId"; | ||||
174 | roles[IsBlankRole] = "blank"; | 180 | roles[IsBlankRole] = "blank"; | ||
175 | roles[StartRole] = "start"; | 181 | roles[StartRole] = "start"; | ||
176 | roles[DurationRole] = "duration"; | 182 | roles[DurationRole] = "duration"; | ||
Context not available. | |||||
195 | roles[SpeedRole] = "speed"; | 201 | roles[SpeedRole] = "speed"; | ||
196 | roles[HeightRole] = "trackHeight"; | 202 | roles[HeightRole] = "trackHeight"; | ||
197 | roles[TrackTagRole] = "trackTag"; | 203 | roles[TrackTagRole] = "trackTag"; | ||
198 | roles[ItemIdRole] = "item"; | | |||
199 | roles[ItemATrack] = "a_track"; | 204 | roles[ItemATrack] = "a_track"; | ||
200 | roles[HasAudio] = "hasAudio"; | 205 | roles[HasAudio] = "hasAudio"; | ||
201 | roles[CanBeAudioRole] = "canBeAudio"; | 206 | roles[CanBeAudioRole] = "canBeAudio"; | ||
Context not available. | |||||
223 | if (isTrack(id)) { | 228 | if (isTrack(id)) { | ||
224 | return getTrackSortValue(id, KdenliveSettings::audiotracksbelow()); | 229 | return getTrackSortValue(id, KdenliveSettings::audiotracksbelow()); | ||
225 | } | 230 | } | ||
226 | return id; | 231 | return QVariant(); | ||
227 | } | 232 | } | ||
228 | if (isClip(id)) { | 233 | if (isClip(id)) { | ||
229 | // qDebug() << "REQUESTING DATA "<<roleNames()[role]<<index; | 234 | // qDebug() << "REQUESTING DATA "<<roleNames()[role]<<index; | ||
Context not available. | |||||
253 | } | 258 | } | ||
254 | case BinIdRole: | 259 | case BinIdRole: | ||
255 | return clip->binId(); | 260 | return clip->binId(); | ||
261 | case TrackIdRole: | ||||
262 | return clip->getCurrentTrackId(); | ||||
256 | case ServiceRole: | 263 | case ServiceRole: | ||
257 | return clip->getProperty("mlt_service"); | 264 | return clip->getProperty("mlt_service"); | ||
258 | break; | 265 | break; | ||
Context not available. | |||||
360 | return false; | 367 | return false; | ||
361 | case StartRole: | 368 | case StartRole: | ||
362 | return compo->getPosition(); | 369 | return compo->getPosition(); | ||
370 | case TrackIdRole: | ||||
371 | return compo->getCurrentTrackId(); | ||||
363 | case DurationRole: | 372 | case DurationRole: | ||
364 | return compo->getPlaytime(); | 373 | return compo->getPlaytime(); | ||
365 | case GroupedRole: | 374 | case GroupedRole: | ||
Context not available. | |||||
536 | void TimelineItemModel::_beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, | 545 | void TimelineItemModel::_beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, | ||
537 | int destinationChild) | 546 | int destinationChild) | ||
538 | { | 547 | { | ||
539 | beginMoveRows(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild); | 548 | qDebug()<<"===========\nMOVING ROWS: "<<sourceParent<<"(ROW: "<<sourceParent.row()<<") - MOVING: "<<sourceFirst<<", "<<sourceLast<<", TO: "<<destinationParent<<"(ROW: "<<destinationParent.row()<<", DEST:"<<destinationChild<<")"; | ||
549 | qDebug()<<"ROW IN SOURCE: "<<rowCount(sourceParent)<<" / ROW IN DEST: "<<rowCount(destinationParent); | ||||
550 | bool success = beginMoveRows(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild); | ||||
551 | qDebug()<<"MOV SUCCESSFLL: "<<success; | ||||
540 | } | 552 | } | ||
541 | 553 | | |||
542 | void TimelineItemModel::_beginRemoveRows(const QModelIndex &i, int j, int k) | 554 | void TimelineItemModel::_beginRemoveRows(const QModelIndex &i, int j, int k) | ||
Context not available. | |||||
556 | } | 568 | } | ||
557 | void TimelineItemModel::_endMoveRows() | 569 | void TimelineItemModel::_endMoveRows() | ||
558 | { | 570 | { | ||
559 | // qDebug()<<"FORWARDING endRemoveRows"; | 571 | qDebug()<<"FORWARDING endRemoveRows\n++++++++++++++++++++++++++++++++\n+++++++++++++++"; | ||
560 | endMoveRows(); | 572 | endMoveRows(); | ||
561 | } | 573 | } | ||
562 | void TimelineItemModel::_endInsertRows() | 574 | void TimelineItemModel::_endInsertRows() | ||
Context not available. |