allow track muting
This commit is contained in:
@@ -53,7 +53,7 @@ void TrackView::ConnectTrackList(TrackList *list)
|
||||
|
||||
if (list_ != nullptr) {
|
||||
foreach (TrackOutput* track, list_->Tracks()) {
|
||||
splitter_->Insert(track->Index(), track->GetTrackHeight(), new TrackViewItem(track->GetTrackName()));
|
||||
splitter_->Insert(track->Index(), track->GetTrackHeight(), new TrackViewItem(track));
|
||||
}
|
||||
|
||||
connect(list_, SIGNAL(TrackHeightChanged(int, int)), splitter_, SLOT(SetTrackHeight(int, int)));
|
||||
@@ -86,7 +86,7 @@ void TrackView::TrackHeightChanged(int index, int height)
|
||||
|
||||
void TrackView::InsertTrack(TrackOutput *track)
|
||||
{
|
||||
splitter_->Insert(track->Index(), track->GetTrackHeight(), new TrackViewItem(track->GetTrackName()));
|
||||
splitter_->Insert(track->Index(), track->GetTrackHeight(), new TrackViewItem(track));
|
||||
}
|
||||
|
||||
void TrackView::RemoveTrack(TrackOutput *track)
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include <QPainter>
|
||||
#include <QtMath>
|
||||
|
||||
TrackViewItem::TrackViewItem(const QString& name, Qt::Alignment alignment, QWidget *parent) :
|
||||
TrackViewItem::TrackViewItem(TrackOutput* track, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
alignment_(alignment)
|
||||
track_(track)
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
layout->setSpacing(0);
|
||||
@@ -17,7 +17,7 @@ TrackViewItem::TrackViewItem(const QString& name, Qt::Alignment alignment, QWidg
|
||||
stack_ = new QStackedWidget();
|
||||
layout->addWidget(stack_);
|
||||
|
||||
label_ = new ClickableLabel(name);
|
||||
label_ = new ClickableLabel(track_->GetTrackName());
|
||||
connect(label_, SIGNAL(MouseDoubleClicked()), this, SLOT(LabelClicked()));
|
||||
stack_->addWidget(label_);
|
||||
|
||||
@@ -27,6 +27,7 @@ TrackViewItem::TrackViewItem(const QString& name, Qt::Alignment alignment, QWidg
|
||||
stack_->addWidget(line_edit_);
|
||||
|
||||
mute_button_ = CreateMSLButton(tr("M"), Qt::red);
|
||||
connect(mute_button_, SIGNAL(toggled(bool)), track_, SLOT(SetMuted(bool)));
|
||||
layout->addWidget(mute_button_);
|
||||
|
||||
solo_button_ = CreateMSLButton(tr("S"), Qt::yellow);
|
||||
@@ -66,7 +67,7 @@ void TrackViewItem::LineEditConfirmed()
|
||||
QString line_edit_str = line_edit_->text();
|
||||
if (!line_edit_str.isEmpty()) {
|
||||
label_->setText(line_edit_str);
|
||||
emit NameChanged(line_edit_str);
|
||||
track_->SetTrackName(line_edit_str);
|
||||
}
|
||||
|
||||
stack_->setCurrentWidget(label_);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <QStackedWidget>
|
||||
#include <QWidget>
|
||||
|
||||
#include "node/output/track/track.h"
|
||||
#include "widget/clickablelabel/clickablelabel.h"
|
||||
#include "widget/focusablelineedit/focusablelineedit.h"
|
||||
|
||||
@@ -12,18 +13,12 @@ class TrackViewItem : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrackViewItem(const QString& name,
|
||||
Qt::Alignment alignment = Qt::AlignTop,
|
||||
TrackViewItem(TrackOutput* track,
|
||||
QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void NameChanged(const QString& name);
|
||||
|
||||
private:
|
||||
QPushButton* CreateMSLButton(const QString &text, const QColor &checked_color) const;
|
||||
|
||||
Qt::Alignment alignment_;
|
||||
|
||||
QStackedWidget* stack_;
|
||||
|
||||
ClickableLabel* label_;
|
||||
@@ -33,6 +28,8 @@ private:
|
||||
QPushButton* solo_button_;
|
||||
QPushButton* lock_button_;
|
||||
|
||||
TrackOutput* track_;
|
||||
|
||||
private slots:
|
||||
void LabelClicked();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user