+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());
+}
+
+