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

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