3 #include <QStylePainter>
11 #include "kdenlivesettings.h"
12 #include "headertrack.h"
14 HeaderTrack::HeaderTrack(int index, TrackInfo info, QWidget *parent)
15 : QWidget(parent), m_index(index), m_type(info.type) {
16 setFixedHeight(KdenliveSettings::trackheight());
18 view.track_number->setText(QString::number(m_index));
19 if (m_type == VIDEOTRACK) {
20 view.frame->setBackgroundRole(QPalette::AlternateBase);
21 view.frame->setAutoFillBackground(true);
22 view.buttonVideo->setIcon(KIcon("kdenlive-show-video"));
24 view.buttonVideo->setHidden(true);
26 view.buttonAudio->setIcon(KIcon("kdenlive-show-audio"));
27 view.buttonVideo->setChecked(!info.isBlind);
28 view.buttonAudio->setChecked(!info.isMute);
29 connect(view.buttonVideo, SIGNAL(clicked()), this, SLOT(switchVideo()));
30 connect(view.buttonAudio, SIGNAL(clicked()), this, SLOT(switchAudio()));
33 void HeaderTrack::switchVideo() {
34 emit switchTrackVideo(m_index);
37 void HeaderTrack::switchAudio() {
38 emit switchTrackAudio(m_index);
42 /*void HeaderTrack::paintEvent(QPaintEvent *e) {
43 QRect region = e->rect();
44 region.setTopLeft(QPoint(region.left() + 1, region.top() + 1));
45 region.setBottomRight(QPoint(region.right() - 1, region.bottom() - 1));
46 QPainter painter(this);
47 if (m_type == AUDIOTRACK) painter.fillRect(region, QBrush(QColor(240, 240, 255)));
48 else painter.fillRect(region, QBrush(QColor(255, 255, 255)));
49 painter.drawText(region, Qt::AlignCenter, m_label);
53 #include "headertrack.moc"