failed attempt at redrawing

This commit is contained in:
Hane 2023-08-09 15:55:25 +02:00
commit f84ddaef6c
8 changed files with 142 additions and 25 deletions

View file

@ -2,10 +2,13 @@
Overseer OverseerHandler::os;
EndpointHandler::EndpointHandler(Endpoint *ept, QObject *parent) : QObject(parent) {
this->ept = ept;
eptName = QString::fromStdWString(ept->getName());
EndpointHandler::EndpointHandler(Endpoint *ep, EndpointCallback *epc, QObject *parent) : QObject(parent) {
this->ep = ep;
this->epc = epc;
epName = QString::fromStdWString(ept->getName());
ep->setCallback(*epc);
}
/*
* -1 for master volume
*/
@ -33,6 +36,13 @@ bool EndpointHandler::getMute(){
return ept->getMute();
}
EndpointHandler::~EndpointHandler() {
ep->removeCallback(*epc);
delete epc;
delete ep;
}
Overseer* OverseerHandler::getOverseer(){
return &os;
}
@ -41,10 +51,29 @@ OverseerHandler::OverseerHandler(QObject *parent) : QObject(parent) {
}
std::vector<EndpointHandler*>* OverseerHandler::getEndpointHandlers(){
return endpointHandlers;
std::vector<EndpointWidget*>* OverseerHandler::getEndpointWidgets(){
return &endpointWidgets;
}
void OverseerHandler::setEndpointHandlers(std::vector<EndpointHandler*> *ephs){
this->endpointHandlers = ephs;
void OverseerHandler::parseExternalEndpointCallback(EndpointCallback *fEpc, PAUDIO_VOLUME_NOTIFICATION_DATA pNotify){
log_debugcpp("parsing in da ovasiar");
for (uint64_t i = 0; i < endpointWidgets.size(); i++){
if(endpointWidgets.at(i)->eph->epc == fEpc) {
endpointWidgets.at(i)->muteButton->setText(endpointWidgets.at(i)->eph->getMute() ? STRING_UNMUTE : STRING_MUTE);
break;
}
}
/*
* connect(mainSlider, &QSlider::valueChanged, [this](int newValue){this->eph->setValue(ENDPOINT_MASTER_VOLUME, newValue); });
* connect(leftChannelSlider, &QSlider::valueChanged, [this](int newValue){ this->eph->setValue(ENDPOINT_LEFT_CHANNEL_VOLUME, newValue); this->leftChannelLabel->setText(QString::number(newValue)); });
* connect(rightChannelSlider, &QSlider::valueChanged, [this](int newValue){ this->eph->setValue(ENDPOINT_RIGHT_CHANNEL_VOLUME, newValue); this->rightChannelLabel->setText(QString::number(newValue)); });
* connect(muteButton, &QPushButton::clicked, [this](bool clicked){ log_debugcpp("cliqui" << clicked << "cloqui"); this->eph->setMute(); this->muteButton->setText(this->eph->getMute() ? STRING_UNMUTE : STRING_MUTE); });
* log_debugcpp("ENDPOINT_WIDGETED");
*/
}
void OverseerHandler::setEndpointWidgets(std::vector<EndpointWidget*> ews){
this->endpointWidgets = ews;
}