changed invoke instances with call-to-mem-fun macro

This commit is contained in:
Hane 2023-08-14 18:23:49 +02:00
commit e5eb0878a6
2 changed files with 10 additions and 5 deletions

View file

@ -115,14 +115,16 @@ void OverseerHandler::setEndpointWidgets(std::vector<EndpointWidget*> ews){
void OverseerHandler::updateMuteCallback(uint64_t idx, bool muted){
epwMuteFunc f = &EndpointWidget::updateMute;
std::invoke(f, endpointWidgets.at(idx), muted);
pinvoke_mem_fn(endpointWidgets.at(idx),f)(muted);
//std::invoke(f, endpointWidgets.at(idx), muted);
}
void OverseerHandler::updateMainVolumeCallback(uint64_t idx, float newVal){
//int translatedNewVal = newVal * 100;
log_debugcpp("mainvolcallback float: " << newVal);
epwMainVolumeFunc f = &EndpointWidget::updateMainVolume;
std::invoke(f, endpointWidgets.at(idx), newVal);
pinvoke_mem_fn(endpointWidgets.at(idx),f)(newVal);
//std::invoke(f, endpointWidgets.at(idx), newVal);
}
void OverseerHandler::updateChannelVolumeCallback(uint64_t idx, uint32_t channel, float newVal){
@ -130,13 +132,14 @@ void OverseerHandler::updateChannelVolumeCallback(uint64_t idx, uint32_t channel
log_debugcpp("chanel: " << channel << " volcallback float: " << newVal);
epwChannelVolumeFunc f = &EndpointWidget::updateChannelVolume;
std::invoke(f, endpointWidgets.at(idx), channel, newVal);
//std::invoke(f, endpointWidgets.at(idx), channel, newVal);
pinvoke_mem_fn(endpointWidgets.at(idx),f)(channel, newVal);
//TODO: Soy retrasado
//endpointWidgets.at(idx)->updateChannelVolume(channel, newVal);
}
void OverseerHandler::toggleFrontEvents(uint64_t idx, bool active) {
epwToggleFrontFunc f = &EndpointWidget::toggleFrontEvents;
std::invoke(f, endpointWidgets.at(idx), active);
pinvoke_mem_fn(endpointWidgets.at(idx),f)(active);
//std::invoke(f, , active);
}

View file

@ -1,4 +1,6 @@
#pragma once
#define invoke_mem_fn(object,ptrToMember) ((object).*(ptrToMember))
#define pinvoke_mem_fn(object,ptrToMember) ((object)->*(ptrToMember))
/* #ifndef QTBLESSED */
/* //#define Q_OBJECT */