void CustomTrackView::editGuide(const GenTime &oldPos, const GenTime &pos, const QString &comment)
{
- if (oldPos > GenTime() && pos > GenTime()) {
- // move guide
+ if (comment.isEmpty() && pos < GenTime()) {
+ // Delete guide
+ bool found = false;
for (int i = 0; i < m_guides.count(); i++) {
if (m_guides.at(i)->position() == oldPos) {
- Guide *item = m_guides.at(i);
- item->updateGuide(pos, comment);
+ delete m_guides.takeAt(i);
+ found = true;
break;
}
}
- } else if (pos > GenTime()) addGuide(pos, comment);
- else {
- // remove guide
- bool found = false;
+ if (!found) emit displayMessage(i18n("No guide at cursor time"), ErrorMessage);
+ }
+
+ else if (oldPos >= GenTime()) {
+ // move guide
for (int i = 0; i < m_guides.count(); i++) {
if (m_guides.at(i)->position() == oldPos) {
- delete m_guides.takeAt(i);
- found = true;
+ Guide *item = m_guides.at(i);
+ item->updateGuide(pos, comment);
break;
}
}
- if (!found) emit displayMessage(i18n("No guide at cursor time"), ErrorMessage);
- }
+ } else addGuide(pos, comment);
qSort(m_guides.begin(), m_guides.end(), sortGuidesList);
m_document->syncGuides(m_guides);
}
bool found = false;
for (int i = 0; i < m_guides.count(); i++) {
if (m_guides.at(i)->position() == pos) {
- EditGuideCommand *command = new EditGuideCommand(this, m_guides.at(i)->position(), m_guides.at(i)->label(), GenTime(), QString(), true);
+ EditGuideCommand *command = new EditGuideCommand(this, m_guides.at(i)->position(), m_guides.at(i)->label(), GenTime(-1), QString(), true);
m_commandStack->push(command);
found = true;
break;
void CustomTrackView::slotDeleteTimeLineGuide()
{
if (m_dragGuide == NULL) return;
- EditGuideCommand *command = new EditGuideCommand(this, m_dragGuide->position(), m_dragGuide->label(), GenTime(), QString(), true);
+ EditGuideCommand *command = new EditGuideCommand(this, m_dragGuide->position(), m_dragGuide->label(), GenTime(-1), QString(), true);
m_commandStack->push(command);
}
QUndoCommand *deleteAll = new QUndoCommand();
deleteAll->setText("Delete all guides");
for (int i = 0; i < m_guides.count(); i++) {
- new EditGuideCommand(this, m_guides.at(i)->position(), m_guides.at(i)->label(), GenTime(), QString(), true, deleteAll);
+ new EditGuideCommand(this, m_guides.at(i)->position(), m_guides.at(i)->label(), GenTime(-1), QString(), true, deleteAll);
}
m_commandStack->push(deleteAll);
}