wip: window size = default endpoints

This commit is contained in:
Hane 2024-04-17 16:00:01 +02:00
commit 76d0afe672
2 changed files with 19 additions and 15 deletions

View file

@ -248,7 +248,7 @@ Endpoint::Endpoint(IMMDevice* ep, uint64_t idx){
* Only shows most relevant flag according to MS, i.e. 0110 sends 0010 * Only shows most relevant flag according to MS, i.e. 0110 sends 0010
*/ */
//todo: preguntitas owindows dword no es uint32_t even tho mingw mingas //todo: preguntitas owindows dword no es uint32_t even tho mingw mingas
if(FAILED(endpoint->GetState(&this->endpointState))) {exit(-1);}; if(FAILED(endpoint->GetState(&this->endpointState))) {exit(-2);};
if(this->endpointState == EndpointState::ENDPOINT_ACTIVE) { if(this->endpointState == EndpointState::ENDPOINT_ACTIVE) {
activateEndpointVolume(); activateEndpointVolume();
@ -282,10 +282,6 @@ Endpoint::Endpoint(IMMDevice* ep, uint64_t idx){
} }
} }
/*
* Endpoint::Endpoint(IMMDevice* endpoint) : Endpoint(endpoint, 0) {};
*/
void Endpoint::activateEndpointSessions() { void Endpoint::activateEndpointSessions() {
//sessionManager; //sessionManager;
if (FAILED(endpoint->Activate(__uuidof(IAudioSessionManager2), CLSCTX_ALL, NULL, (void**) &sessionManager))) { log_wdebugcpp(L"sesionbros..."); return; } if (FAILED(endpoint->Activate(__uuidof(IAudioSessionManager2), CLSCTX_ALL, NULL, (void**) &sessionManager))) { log_wdebugcpp(L"sesionbros..."); return; }
@ -421,7 +417,7 @@ Roles Endpoint::getRoles(){
} }
void Endpoint::setRoles(Roles role){ void Endpoint::setRoles(Roles role){
//otro exe momento //todo: otro exe momento
STARTUPINFOEXW startupConfig; STARTUPINFOEXW startupConfig;
PROCESS_INFORMATION processInfo; PROCESS_INFORMATION processInfo;
SecureZeroMemory(&startupConfig, sizeof(STARTUPINFOEXW)); SecureZeroMemory(&startupConfig, sizeof(STARTUPINFOEXW));
@ -648,6 +644,7 @@ void Overseer::reloadEndpoints(Flows flow) {
captureDevices.at(j)->assignRoles((Roles)(1 << i)); captureDevices.at(j)->assignRoles((Roles)(1 << i));
} }
} }
} }
} }
} }

View file

@ -104,10 +104,10 @@ void MainWindow::compose() {
*/ */
uint64_t windowHeight = 0; uint64_t windowHeight = 0;
int left = 0, top = 0, right = 0, bottom = 0; int left = 0, top = 0, right = 0, bottom = 0;
for (auto *epw : this->ews) { for (int i = 0; i < 2; i++) {
if (!epw) continue; if (!ews[i]) continue;
epw->layout()->getContentsMargins(&left, &top, &right, &bottom); ews[i]->layout()->getContentsMargins(&left, &top, &right, &bottom);
windowHeight += epw->sizeHint().height(); windowHeight += ews[i]->sizeHint().height();
windowHeight += top; windowHeight += top;
windowHeight += bottom; windowHeight += bottom;
} }
@ -806,17 +806,24 @@ void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason) {
} }
void MainWindow::reloadEndpointWidgets() { void MainWindow::reloadEndpointWidgets() {
size_t i = 0; size_t i = 2;
ews.resize(2);
//widgetLayout->addItem(&lastRowSpacer, i++, 0); //widgetLayout->addItem(&lastRowSpacer, i++, 0);
for (size_t epwIndex = 0; i < (osh->getPlaybackEndpointHandlers().size()); i++) { for (size_t epwIndex = 0; i < (osh->getPlaybackEndpointHandlers().size()); i++) {
if (osh->getPlaybackEndpointHandlers().at(i)->getState() == EndpointState::ENDPOINT_ACTIVE){ if (osh->getPlaybackEndpointHandlers().at(i)->getState() == EndpointState::ENDPOINT_ACTIVE){
log_debugcpp("EPWidget creation"); log_debugcpp("EPWidget creation");
//osh->getPlaybackEndpointHandlers().at(i)->getCallbackInfo()->caller = osh->getGuid(); //osh->getPlaybackEndpointHandlers().at(i)->getCallbackInfo()->caller = osh->getGuid();
EndpointWidget *epw = new EndpointWidget(epwIndex, osh->getPlaybackEndpointHandlers().at(i), widget); EndpointWidget *epw = new EndpointWidget(epwIndex, osh->getPlaybackEndpointHandlers().at(i), widget);
if ((epw->getEndpointHandler()->getRoles() & Roles::ROLE_ALL) ||
(epw->getEndpointHandler()->getRoles() & Roles::ROLE_MULTIMEDIA))
{ ews[0] = epw; widgetLayout->addWidget(epw, 0, 0); }
else if (epw->getEndpointHandler()->getRoles() & Roles::ROLE_CONSOLE)
{ ews[0] = epw; widgetLayout->addWidget(epw, 1, 0); }
else {
epwIndex++; epwIndex++;
//alfinal estoes solopara inicializarlmao //alfinal estoes solopara inicializarlmao
ews.push_back(epw); ews.push_back(epw);
widgetLayout->addWidget(epw, i, 0); widgetLayout->addWidget(epw, i, 0); }
} }
} }
//todo:: tas aqui tirao, no me gustas y probablemente yo a ti tampoco //todo:: tas aqui tirao, no me gustas y probablemente yo a ti tampoco