+void HeaderTrack::mouseDoubleClickEvent(QMouseEvent* event)
+{
+ if (track_number->hasFocus()) {
+ track_number->clearFocus();
+ return;
+ }
+ emit configTrack(m_index);
+ QWidget::mouseDoubleClickEvent(event);
+}
+
+//virtual
+void HeaderTrack::dropEvent(QDropEvent * event)
+{
+ const QString effects = QString::fromUtf8(event->mimeData()->data("kdenlive/effectslist"));
+ QDomDocument doc;
+ doc.setContent(effects, true);
+ QDomElement e = doc.documentElement();
+ if (e.tagName() == "effectgroup") {
+ // dropped an effect group
+ QDomNodeList effectlist = e.elementsByTagName("effect");
+ for (int i = 0; i < effectlist.count(); ++i) {
+ effectlist.at(i).toElement().removeAttribute("kdenlive_ix");
+ }
+ } else {
+ // single effect dropped
+ e.removeAttribute("kdenlive_ix");
+ }
+ emit selectTrack(m_index);
+ emit addTrackEffect(e, m_index);
+ /*if (scene() && !scene()->views().isEmpty()) {
+ event->accept();
+ CustomTrackView *view = (CustomTrackView *) scene()->views()[0];
+ if (view) view->slotAddEffect(e, m_info.startPos, track());
+ }*/
+}
+
+//virtual
+void HeaderTrack::dragEnterEvent(QDragEnterEvent *event)
+{
+ if (buttonLock->isChecked()) {
+ event->setAccepted(false);
+ } else {
+ if (event->mimeData()->hasFormat("kdenlive/effectslist")) {
+ const QString effects = QString::fromUtf8(event->mimeData()->data("kdenlive/effectslist"));
+ QDomDocument doc;
+ doc.setContent(effects, true);
+ if (doc.documentElement().attribute("id") != "speed") {
+ event->setAccepted(true);
+ }
+ }
+ }
+}
+
+void HeaderTrack::setSelectedIndex(int ix)
+{
+ if (m_index == ix) {
+ m_isSelected = true;
+ setBackgroundRole(QPalette::Button);
+ setAutoFillBackground(true);
+ } else if (m_type != VIDEOTRACK) {
+ m_isSelected = false;
+ setAutoFillBackground(false);
+ } else {
+ m_isSelected = false;
+ setBackgroundRole(QPalette::AlternateBase);
+ }
+ update();
+}
+
+void HeaderTrack::adjustSize(int height)
+{
+ // Don't show track buttons if size is too small
+ bool smallTracks = height < 40;
+ if (m_type == VIDEOTRACK)
+ buttonVideo->setHidden(smallTracks);
+ buttonAudio->setHidden(smallTracks);
+ buttonLock->setHidden(smallTracks);
+ setFixedHeight(height);
+}
+
+void HeaderTrack::switchVideo()
+{
+ if (buttonVideo->isChecked())
+ buttonVideo->setIcon(KIcon("kdenlive-hide-video"));
+ else
+ buttonVideo->setIcon(KIcon("kdenlive-show-video"));
+ emit switchTrackVideo(m_index);
+}
+
+void HeaderTrack::switchAudio()
+{
+ if (buttonAudio->isChecked())
+ buttonAudio->setIcon(KIcon("kdenlive-hide-audio"));
+ else
+ buttonAudio->setIcon(KIcon("kdenlive-show-audio"));
+ emit switchTrackAudio(m_index);
+}
+
+void HeaderTrack::switchLock(bool emitSignal)
+{
+ if (buttonLock->isChecked())
+ buttonLock->setIcon(KIcon("kdenlive-lock"));
+ else
+ buttonLock->setIcon(KIcon("kdenlive-unlock"));
+ if (emitSignal)
+ emit switchTrackLock(m_index);
+}
+
+void HeaderTrack::setLock(bool lock)
+{
+ buttonLock->setChecked(lock);
+ switchLock(false);
+}
+
+void HeaderTrack::slotDeleteTrack()
+{
+ QTimer::singleShot(500, this, SLOT(deleteTrack()));
+}
+
+void HeaderTrack::slotRenameTrack()
+{
+ if (m_name != track_number->text()) emit renameTrack(m_index, track_number->text());
+}
+
+