wip: fixed wrong index for epw creation

This commit is contained in:
Hane 2024-04-24 02:03:07 +02:00
commit 4756a00156
4 changed files with 32 additions and 14 deletions

View file

@ -104,6 +104,11 @@ void MainWindow::compose() {
if (!epw) continue;
epw->calculateSize(windowWidth, screenHeight);
log_debugcpp("epw loop");
log_debugcpp("epw roles: " + std::to_string(epw->getEndpointHandler()->getRoles()));
//std::bitset<sizeof(uint8_t)> content =
print_as_binary(8, uint8_t, (epw->getEndpointHandler()->getRoles()));
//log_debugcpp(content);
varToBitset<sizeof(uint8_t), uint8_t>(epw->getEndpointHandler()->getRoles());
}
/*
@ -120,7 +125,11 @@ void MainWindow::compose() {
log_debugcpp("windowHeight loop: " + std::to_string(windowHeight));
}
windowHeight += mainMenuBar->height();
log_debugcpp("windowHeight final value: " + std::to_string(windowHeight));
log_debugcpp("windowHeight final value: " + std::to_string(windowHeight));
//Undoing scrolling
scrollArea->verticalScrollBar()->setValue(0);
/*
* Establishing initial window size and position
*/
@ -310,6 +319,7 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent, uint64_t i
row = 0;
this->idx = idx;
this->eph = eph;
//todo: sussy
this->eph->setState(EndpointState::ENDPOINT_ACTIVE, idx);
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
@ -573,8 +583,8 @@ void MainWindow::reorderEndpointWidgetCollection() {
void EndpointWidget::calculateSize(uint64_t width, uint64_t height) {
/* og 1080p 120% testing values */
this->mainLabel->setMaximumWidth((int)width * 0.35 /* 1080p 120%*/);
this->mainLabel->setMinimumWidth((int)width * 0.35 /* 1080p 120%*/);
this->mainLabel->setMaximumWidth((int)width * 0.50 /* 1080p 120%*/);
this->mainLabel->setMinimumWidth((int)width * 0.50 /* 1080p 120%*/);
if (cw) {
this->cw->setMinimumSize(QSize(1, height * 0.06));
this->cw->setMaximumSize(QSize(QWIDGETSIZE_MAX, height * 0.06));
@ -674,6 +684,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
//todo: ratio
setWindowFlags(Qt::Window | Qt::MSWindowsFixedSizeDialogHint);
setWindowFlags(Qt::FramelessWindowHint | Qt::ToolTip);
setAttribute(Qt::WA_TranslucentBackground);
setStyleSheet("background-color: rgba(255,182,193,90%);");
setWindowTitle(STRING_TITLE);
connect(qApp, &QGuiApplication::applicationStateChanged, this, [=](Qt::ApplicationState state){
if(state == Qt::ApplicationState::ApplicationInactive) hide();
@ -851,14 +863,18 @@ void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason) {
}
void MainWindow::reloadEndpointWidgets() {
size_t i = 2;
size_t i = 0;
ews.resize(2);
//widgetLayout->addItem(&lastRowSpacer, i++, 0);
//todo: -log flag
//std::wofstream log("log.txt");
for (size_t epwIndex = 2; 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(osh->getPlaybackEndpointHandlers().at(i), widget);
log_wdebugcpp(L"epw name: " + epw->getEndpointHandler()->getName());
if ((epw->getEndpointHandler()->getRoles() == Roles::ROLE_ALL) ||
(epw->getEndpointHandler()->getRoles() & Roles::ROLE_MULTIMEDIA))
{ ews[0] = epw; widgetLayout->addWidget(epw, 0, 0); epw->setIndex(0); }