uuh... peak?

This commit is contained in:
Hane 2023-09-12 17:51:28 +02:00
commit f92df42995
2 changed files with 34 additions and 26 deletions

View file

@ -172,6 +172,7 @@ EndpointWidget::EndpointWidget(uint64_t idx, EndpointHandler* eph, QWidget *pare
//memcpy(osh->callbackInfo[idx]->caller, osh->getGuid(), sizeof(NGuid));
//TODO: el default = objcopy frees?
//Todo: like fr pregunta
eph->getCallbackInfo()->caller = osh->getGuid();
mainSlider->blockSignals(false);
muteButton->blockSignals(false);
@ -213,7 +214,7 @@ void MainWindow::removeEndpointWidget(EndpointWidgetEvent<uint64_t>* ev){
//delete ews.at(index);
while ((i + 1) < ews.size()) {
ews.at(i) = ews.at(i + 1);
ews.at(i)->updateFrontIndex(i);
ews.at(i)->setIndex(i);
i++;
}
ews.pop_back();
@ -272,20 +273,26 @@ EndpointHandler* EndpointWidget::getEndpointHandler(){
return this->eph;
}
void EndpointWidget::updateFrontIndex(uint64_t index){
this->idx = index;
this->eph->setFrontVisibilityInfo(EndpointState::ENDPOINT_ACTIVE, index);
}
/*
* void EndpointWidget::updateFrontIndex(uint64_t index){
* this->idx = index;
* }
*/
void EndpointWidget::setIndex(uint64_t idx){
this->idx = idx;
this->eph->setFrontVisibilityInfo(EndpointState::ENDPOINT_ACTIVE, this->idx);
}
uint64_t EndpointWidget::getIndex(){
return idx;
}
std::map<Roles, ExtendedCheckBox*> EndpointWidget::getDefaultRolesWidgets() {
return defaultRolesCheckBoxes;
}
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
// setWindowState(Qt::WindowFullScreen);
// setCentralWidget(centralWidget);
@ -335,16 +342,16 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
*/
if (epw->getEndpointHandler()->getId() == endpointId) {
//not necessary to keep endpointState flags up to date right now, but updating it will allow for later config files / profiles
epw->defaultRolesCheckBoxes.at(role)->blockSignals(true);
epw->getDefaultRolesWidgets().at(role)->blockSignals(true);
epw->getEndpointHandler()->assignRoles(role);
epw->defaultRolesCheckBoxes.at(role)->blockSignals(false);
QCoreApplication::instance()->postEvent(epw->defaultRolesCheckBoxes.at(role), new QEvent((QEvent::Type)CustomQEvent::EndpointDefaultChange));
epw->getDefaultRolesWidgets().at(role)->blockSignals(false);
QCoreApplication::instance()->postEvent(epw->getDefaultRolesWidgets().at(role), new QEvent((QEvent::Type)CustomQEvent::EndpointDefaultChange));
//epw->defaultRolesCheckBoxes.at(role)->postEnableChange();
/*
* And were you THE default?
*/
if (epw->getEndpointHandler()->getRoles() == Roles::ROLE_ALL) {
QCoreApplication::instance()->postEvent(epw->defaultRolesCheckBoxes.at(Roles::ROLE_ALL), new QEvent((QEvent::Type)CustomQEvent::EndpointDefaultChange));
QCoreApplication::instance()->postEvent(epw->getDefaultRolesWidgets().at(Roles::ROLE_ALL), new QEvent((QEvent::Type)CustomQEvent::EndpointDefaultChange));
}
/*
* Are you the dethroned king?
@ -354,14 +361,14 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
* And were you THE default up until now?
*/
if (epw->getEndpointHandler()->getRoles() == Roles::ROLE_ALL) {
QCoreApplication::instance()->postEvent(epw->defaultRolesCheckBoxes.at(Roles::ROLE_ALL), new QEvent((QEvent::Type)CustomQEvent::EndpointDefaultChange));
QCoreApplication::instance()->postEvent(epw->getDefaultRolesWidgets().at(Roles::ROLE_ALL), new QEvent((QEvent::Type)CustomQEvent::EndpointDefaultChange));
}
epw->defaultRolesCheckBoxes.at(role)->blockSignals(true);
epw->getDefaultRolesWidgets().at(role)->blockSignals(true);
//Same as before. ini-san will come...
epw->getEndpointHandler()->removeRoles(role);
epw->defaultRolesCheckBoxes.at(role)->blockSignals(false);
QCoreApplication::instance()->postEvent(epw->defaultRolesCheckBoxes.at(role), new QEvent((QEvent::Type)CustomQEvent::EndpointDefaultChange));
epw->getDefaultRolesWidgets().at(role)->blockSignals(false);
QCoreApplication::instance()->postEvent(epw->getDefaultRolesWidgets().at(role), new QEvent((QEvent::Type)CustomQEvent::EndpointDefaultChange));
}
}