Remove frontend header from contclasses

This commit is contained in:
Phireh 2023-08-14 20:10:59 +02:00 committed by Hane
commit 5bb37eb9fd
5 changed files with 57 additions and 43 deletions

View file

@ -74,11 +74,11 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent) : QWidget(
void EndpointWidget::updateMute(bool muted){
log_debugcpp("cliqui callboqui cloqui");
//TODO: Here to diagnose slider visuals locking when playing DJ with external volume bar. Functionality is restored when mute checkbox is clicked.
//this->muteButton->blockSignals(true);
this->muteButton->blockSignals(true);
//this->eph->setMute(osh->getGuid(), muted);
this->muteButton->setChecked(eph->getMute() ? true : false);
this->muteButton->setChecked(muted);
this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
//this->muteButton->blockSignals(false);
this->muteButton->blockSignals(false);
}
void EndpointWidget::updateMute(int checked){
@ -107,14 +107,23 @@ void EndpointWidget::updateMainVolume(float newValue){
}
void EndpointWidget::updateChannelVolume(uint32_t channel, float newValue){
int newVal = newValue * 100;
log_debugcpp("chanel: " << channel << " volcallback int: " << newVal);
//TODO: Above
//this->channelSliders.at(channel)->blockSignals(true);
if(this->channelSliders.at(channel)->value() != newVal) {
this->channelSliders.at(channel)->setValue(newVal);
this->channelLabels.at(channel)->setText(QString::number((int)(newValue * 100)));
this->blockSignals(true);
if (channel == (uint32_t)AudioChannel::CHANNEL_MAIN) {
updateMainVolume(newValue);
} else {
int newVal = newValue * 100;
log_debugcpp("chanel: " << channel << " volcallback int: " << newVal);
//TODO: Above
//this->channelSliders.at(channel)->blockSignals(true);
for (size_t i = 0; i < sizeof(uint32_t) * 8; ++i) {
if ((channel << i & 1) && this->channelSliders.at(channel)->value() != newVal) {
this->channelSliders.at(channel)->setValue(newVal);
this->channelLabels.at(channel)->setText(QString::number((int)(newValue * 100)));
}
}
}
this->blockSignals(false);
//this->channelSliders.at(channel)->blockSignals(false);
}
@ -160,8 +169,18 @@ void MainWindow::reloadEndpointWidgets() {
}
osh->setEndpointWidgets(ews);
layout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), i, 0);
osh->setFrontVolumeCallback([this](uint64_t device, uint32_t channel, float value) {
if (device < ews.size())
ews[device]->updateChannelVolume(channel, value);
});
osh->setFrontMuteCallback([this](uint64_t device, bool muted) {
if (device < ews.size())
ews[device]->updateMute(muted);
});
}
//#include "qtclosemwh.h"
/*