Commit dbb3b68e authored by Julius Künzel's avatar Julius Künzel Committed by Jean-Baptiste Mardelle

Improve audiomixer layout

parent fcc99570
Pipeline #28624 passed with stage
in 12 minutes and 44 seconds
......@@ -66,6 +66,7 @@ signals:
void purgeCache();
void clearMixers();
void updateRecVolume();
void showEffectStack(int tid);
protected:
std::unordered_map<int, std::shared_ptr<MixerWidget>> m_mixers;
......
......@@ -169,9 +169,17 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
m_volumeSlider->setValue(fromDB(val));
});
m_balanceDial = new QDial(this);
m_balanceDial->setRange(-50, 50);
m_balanceDial->setValue(0);
m_balanceSlider = new QSlider(Qt::Horizontal,this);
m_balanceSlider->setRange(-50, 50);
m_balanceSlider->setValue(0);
m_balanceSlider->setTickPosition(QSlider::TicksBelow);
m_balanceSlider->setTickInterval(50);
m_balanceSlider->setToolTip(i18n("Balance"));
QLabel *labelLeft = new QLabel(i18n("L"), this);
labelLeft->setAlignment(Qt::AlignHCenter);
QLabel *labelRight = new QLabel(i18n("R"), this);
labelLeft->setAlignment(Qt::AlignHCenter);
m_balanceSpin = new QSpinBox(this);
m_balanceSpin->setRange(-50, 50);
......@@ -199,7 +207,7 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
m_balanceFilter = fl;
int val = m_balanceFilter->get_double("start") * 100 - 50;
m_balanceSpin->setValue(val);
m_balanceDial->setValue(val);
m_balanceSlider->setValue(val);
}
}
// Build default filters if not found
......@@ -237,7 +245,7 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
m_muteAction->setActiveIcon(QIcon::fromTheme(QStringLiteral("kdenlive-hide-audio")));
m_muteAction->setInactiveIcon(QIcon::fromTheme(QStringLiteral("kdenlive-show-audio")));
connect(m_balanceDial, &QDial::valueChanged, m_balanceSpin, &QSpinBox::setValue);
connect(m_balanceSlider, &QSlider::valueChanged, m_balanceSpin, &QSpinBox::setValue);
connect(m_muteAction, &KDualAction::activeChangedByUser, this, [&](bool active) {
if (m_tid == -1) {
......@@ -298,6 +306,14 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
});
}
QToolButton *showEffects = new QToolButton(this);
showEffects->setIcon(QIcon::fromTheme("autocorrection"));
showEffects->setToolTip(i18n("Open Effect Stack"));
showEffects->setAutoRaise(true);
connect(showEffects, &QToolButton::clicked, this, [&]() {
emit m_manager->showEffectStack(m_tid);
});
connect(m_volumeSlider, &QSlider::valueChanged, this, [&](int value) {
QSignalBlocker bk(m_volumeSpin);
if (m_recording) {
......@@ -322,8 +338,8 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
}
});
connect(m_balanceSpin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, [&](int value) {
QSignalBlocker bk(m_balanceDial);
m_balanceDial->setValue(value);
QSignalBlocker bk(m_balanceSlider);
m_balanceSlider->setValue(value);
if (m_balanceFilter != nullptr) {
m_balanceFilter->set("start", (value + 50) / 100.);
m_balanceFilter->set("disable", value == 0 ? 1 : 0);
......@@ -349,9 +365,14 @@ void MixerWidget::buildUI(Mlt::Tractor *service, const QString &trackTag)
if (m_record) {
buttonslay->addWidget(m_record);
}
buttonslay->addWidget(showEffects);
lay->addLayout(buttonslay);
lay->addWidget(m_balanceDial);
lay->addWidget(m_balanceSpin);
QGridLayout *balancelay = new QGridLayout;
balancelay->addWidget(m_balanceSlider, 0, 0, 1, 3);
balancelay->addWidget(labelLeft, 1, 0, 1, 1);
balancelay->addWidget(m_balanceSpin, 1, 1, 1, 1);
balancelay->addWidget(labelRight, 1, 2, 1, 1);
lay->addLayout(balancelay);
QHBoxLayout *hlay = new QHBoxLayout;
hlay->addWidget(m_audioMeterWidget.get());
hlay->addWidget(m_volumeSlider);
......@@ -368,7 +389,7 @@ void MixerWidget::mousePressEvent(QMouseEvent *event)
{
if(event->button() == Qt::RightButton) {
QWidget *child = childAt(event->pos());
if (child == m_balanceDial) {
if (child == m_balanceSlider) {
m_balanceSpin->setValue(0);
} else if (child == m_volumeSlider) {
m_volumeSlider->setValue(60);
......@@ -385,7 +406,7 @@ void MixerWidget::setMute(bool mute)
m_volumeSpin->setEnabled(!mute);
m_audioMeterWidget->setEnabled(!mute);
m_balanceSpin->setEnabled(!mute);
m_balanceDial->setEnabled(!mute);
m_balanceSlider->setEnabled(!mute);
updateLabel();
}
......@@ -471,14 +492,14 @@ void MixerWidget::setRecordState(bool recording)
QSignalBlocker bk2(m_volumeSlider);
if (m_recording) {
connect(pCore->getAudioDevice(), &MediaCapture::audioLevels, this, &MixerWidget::gotRecLevels);
m_balanceDial->setEnabled(false);
m_balanceSlider->setEnabled(false);
m_balanceSpin->setEnabled(false);
m_volumeSpin->setRange(0, 100);
m_volumeSpin->setSuffix(QStringLiteral("%"));
m_volumeSpin->setValue(KdenliveSettings::audiocapturevolume());
m_volumeSlider->setValue(KdenliveSettings::audiocapturevolume());
} else {
m_balanceDial->setEnabled(true);
m_balanceSlider->setEnabled(true);
m_balanceSpin->setEnabled(true);
int level = m_levelFilter->get_int("level");
disconnect(pCore->getAudioDevice(), &MediaCapture::audioLevels, this, &MixerWidget::gotRecLevels);
......
......@@ -91,7 +91,7 @@ protected:
int m_channels;
KDualAction *m_muteAction;
QSpinBox *m_balanceSpin;
QDial *m_balanceDial;
QSlider *m_balanceSlider;
QDoubleSpinBox *m_volumeSpin;
int m_maxLevels;
......
......@@ -660,6 +660,7 @@ void TimelineItemModel::buildTrackCompositing(bool rebuild)
field->plant_transition(*transition.get(), 0, trackPos);
if (hasMixer) {
pCore->mixer()->registerTrack((*it)->getId(), (*it)->getTrackService(), getTrackTagById((*it)->getId()));
connect(pCore->mixer(), &MixerManager::showEffectStack, this, &TimelineItemModel::showTrackEffectStack);
}
}
++it;
......
......@@ -119,5 +119,6 @@ protected:
signals:
/** @brief Triggered when a video track visibility changed */
void trackVisibilityChanged();
void showTrackEffectStack(int tid);
};
#endif
......@@ -111,6 +111,13 @@ void TimelineController::setModel(std::shared_ptr<TimelineItemModel> model)
QMetaObject::invokeMethod(m_root, "checkDeletion", Qt::QueuedConnection, Q_ARG(QVariant, id));
}
});
connect(m_model.get(), &TimelineItemModel::showTrackEffectStack, this, [&](int tid) {
if (tid > -1) {
showTrackAsset(tid);
} else {
showMasterEffects();
}
});
connect(m_model.get(), &TimelineItemModel::requestMonitorRefresh, [&]() { pCore->requestMonitorRefresh(); });
connect(m_model.get(), &TimelineModel::invalidateZone, this, &TimelineController::invalidateZone, Qt::DirectConnection);
connect(m_model.get(), &TimelineModel::durationUpdated, this, &TimelineController::checkDuration);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment