Compare commits
2 commits
5b3b50a0d2
...
170d52067b
| Author | SHA1 | Date | |
|---|---|---|---|
| 170d52067b | |||
| 4f637b4397 |
2 changed files with 42 additions and 20 deletions
|
|
@ -91,12 +91,20 @@ void MainWindow::compose() {
|
||||||
screenRes.getCoords(&srx1, &sry1, &srx2, &sry2);
|
screenRes.getCoords(&srx1, &sry1, &srx2, &sry2);
|
||||||
log_debugcpp("(for Percentage) Screen Res: " + std::to_string(srx1) + " " + std::to_string(srx2)+" " + std::to_string(sry1) + " " + std::to_string(sry2));
|
log_debugcpp("(for Percentage) Screen Res: " + std::to_string(srx1) + " " + std::to_string(srx2)+" " + std::to_string(sry1) + " " + std::to_string(sry2));
|
||||||
|
|
||||||
uint64_t windowWidth = (uint64_t)std::abs(srx2) * this->widthRatio;
|
uint64_t windowWidth = (uint64_t)std::abs(screenRes.width()) * this->widthRatio;
|
||||||
uint64_t screenHeight = (uint64_t)std::abs(sry2);
|
uint64_t screenHeight = (uint64_t)std::abs(screenRes.height());
|
||||||
log_debugcpp("Window Width: " + std::to_string(windowWidth));
|
log_debugcpp("Window Width: " + std::to_string(windowWidth));
|
||||||
|
|
||||||
|
this->setAttribute(Qt::WA_DontShowOnScreen, true);
|
||||||
|
this->show();
|
||||||
|
this->widget->layout()->update();
|
||||||
|
this->hide();
|
||||||
|
this->setAttribute(Qt::WA_DontShowOnScreen, false);
|
||||||
|
|
||||||
for (auto *epw : ews) {
|
for (auto *epw : ews) {
|
||||||
if (!epw) continue;
|
if (!epw) continue;
|
||||||
epw->setSize(windowWidth, screenHeight);
|
epw->setSize(windowWidth, screenHeight);
|
||||||
|
log_debugcpp("epw loop");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -110,9 +118,10 @@ void MainWindow::compose() {
|
||||||
windowHeight += ews[i]->sizeHint().height();
|
windowHeight += ews[i]->sizeHint().height();
|
||||||
windowHeight += top;
|
windowHeight += top;
|
||||||
windowHeight += bottom;
|
windowHeight += bottom;
|
||||||
|
log_debugcpp("windowHeight loop: " + std::to_string(windowHeight));
|
||||||
}
|
}
|
||||||
windowHeight += mainMenuBar->height();
|
windowHeight += mainMenuBar->height();
|
||||||
|
log_debugcpp("windowHeight final value: " + std::to_string(windowHeight));
|
||||||
/*
|
/*
|
||||||
* Establishing initial window size and position
|
* Establishing initial window size and position
|
||||||
*/
|
*/
|
||||||
|
|
@ -371,7 +380,7 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent, uint64_t i
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint32_t epChannelCount = eph->getChannelCount();
|
uint32_t epChannelCount = eph->getChannelCount();
|
||||||
if(epChannelCount) {
|
if(epChannelCount > 1) {
|
||||||
cw = new ChannelWidget(epChannelCount, eph, this);
|
cw = new ChannelWidget(epChannelCount, eph, this);
|
||||||
//cw->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
//cw->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
widgetLayout->addWidget(cw, row++, 0, 1, 4 /*colmax*/, Qt::AlignTop);
|
widgetLayout->addWidget(cw, row++, 0, 1, 4 /*colmax*/, Qt::AlignTop);
|
||||||
|
|
@ -560,8 +569,10 @@ void EndpointWidget::setSize(uint64_t width, uint64_t height) {
|
||||||
/* og 1080p 120% testing values */
|
/* og 1080p 120% testing values */
|
||||||
this->mainLabel->setMaximumWidth((int)width * 0.35 /* 1080p 120%*/);
|
this->mainLabel->setMaximumWidth((int)width * 0.35 /* 1080p 120%*/);
|
||||||
this->mainLabel->setMinimumWidth((int)width * 0.35 /* 1080p 120%*/);
|
this->mainLabel->setMinimumWidth((int)width * 0.35 /* 1080p 120%*/);
|
||||||
|
if (cw) {
|
||||||
this->cw->setMinimumSize(QSize(1, height * 0.06));
|
this->cw->setMinimumSize(QSize(1, height * 0.06));
|
||||||
this->cw->setMaximumSize(QSize(QWIDGETSIZE_MAX, height * 0.06));
|
this->cw->setMaximumSize(QSize(QWIDGETSIZE_MAX, height * 0.06));
|
||||||
|
}
|
||||||
for (auto sw : sessionWidgets){
|
for (auto sw : sessionWidgets){
|
||||||
if (sw) sw->setSize(width, height);
|
if (sw) sw->setSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
@ -670,6 +681,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||||
QEvent::registerEventType(CustomQEvent::EndpointDefaultChange);
|
QEvent::registerEventType(CustomQEvent::EndpointDefaultChange);
|
||||||
QEvent::registerEventType(CustomQEvent::SessionWidgetObsolete);
|
QEvent::registerEventType(CustomQEvent::SessionWidgetObsolete);
|
||||||
QEvent::registerEventType(CustomQEvent::SessionWidgetCreated);
|
QEvent::registerEventType(CustomQEvent::SessionWidgetCreated);
|
||||||
|
QEvent::registerEventType(CustomQEvent::RecomposeMainWindow);
|
||||||
;
|
;
|
||||||
/* This spacer provides proper spacing when window vertically > widgets. */
|
/* This spacer provides proper spacing when window vertically > widgets. */
|
||||||
lastRowSpacer = new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
lastRowSpacer = new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||||
|
|
@ -759,10 +771,13 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||||
this->ews[0] = newDef;
|
this->ews[0] = newDef;
|
||||||
QCoreApplication::instance()->postEvent(newDef->getDefaultRolesWidgets().at(Roles::ROLE_ALL), new QEvent((QEvent::Type)CustomQEvent::EndpointDefaultChange));
|
QCoreApplication::instance()->postEvent(newDef->getDefaultRolesWidgets().at(Roles::ROLE_ALL), new QEvent((QEvent::Type)CustomQEvent::EndpointDefaultChange));
|
||||||
} else if ((newDefRoles & Roles::ROLE_MULTIMEDIA) ||
|
} else if ((newDefRoles & Roles::ROLE_MULTIMEDIA) ||
|
||||||
(newDefRoles & Roles::ROLE_CONSOLE)){ newDef->setIndex(0);
|
(newDefRoles & Roles::ROLE_CONSOLE)){
|
||||||
|
newDef->setIndex(0);
|
||||||
this->ews[0] = newDef;
|
this->ews[0] = newDef;
|
||||||
} else if (newDefRoles & Roles::ROLE_COMMUNICATIONS) { newDef->setIndex(1);
|
} else if (newDefRoles & Roles::ROLE_COMMUNICATIONS) {
|
||||||
this->ews[1] = newDef;}
|
newDef->setIndex(1);
|
||||||
|
this->ews[1] = newDef;
|
||||||
|
}
|
||||||
log_debugcpp("newDef new idx: " + std::to_string(newDef->getIndex()));
|
log_debugcpp("newDef new idx: " + std::to_string(newDef->getIndex()));
|
||||||
newDef->getDefaultRolesWidgets().at(role)->blockSignals(false);
|
newDef->getDefaultRolesWidgets().at(role)->blockSignals(false);
|
||||||
|
|
||||||
|
|
@ -774,15 +789,21 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||||
oldDefRoles = oldDef->getEndpointHandler()->getRoles();
|
oldDefRoles = oldDef->getEndpointHandler()->getRoles();
|
||||||
//this->ews[oldDef->getIndex()] = nullptr;
|
//this->ews[oldDef->getIndex()] = nullptr;
|
||||||
if ((oldDefRoles & Roles::ROLE_MULTIMEDIA) &&
|
if ((oldDefRoles & Roles::ROLE_MULTIMEDIA) &&
|
||||||
(oldDefRoles & Roles::ROLE_CONSOLE)) { this-> ews[0] = oldDef;
|
(oldDefRoles & Roles::ROLE_CONSOLE)) {
|
||||||
|
this-> ews[0] = oldDef;
|
||||||
oldDef->setIndex(0);
|
oldDef->setIndex(0);
|
||||||
} else if (oldDefRoles & Roles::ROLE_COMMUNICATIONS) { this-> ews[1] = oldDef;
|
} else if (oldDefRoles & Roles::ROLE_COMMUNICATIONS) {
|
||||||
|
this-> ews[1] = oldDef;
|
||||||
oldDef->setIndex(1);
|
oldDef->setIndex(1);
|
||||||
} else { if (newDefIdx > 1) { this->ews[newDefIdx] = oldDef;
|
} else {
|
||||||
|
if (newDefIdx > 1) {
|
||||||
|
this->ews[newDefIdx] = oldDef;
|
||||||
oldDef->setIndex(newDefIdx);
|
oldDef->setIndex(newDefIdx);
|
||||||
} else { this->ews.push_back(oldDef);
|
} else {
|
||||||
|
this->ews.push_back(oldDef);
|
||||||
oldDef->setIndex(this->ews.size() - 1);
|
oldDef->setIndex(this->ews.size() - 1);
|
||||||
} }
|
}
|
||||||
|
}
|
||||||
log_debugcpp("oldDef new idx: " + std::to_string(oldDef->getIndex()));
|
log_debugcpp("oldDef new idx: " + std::to_string(oldDef->getIndex()));
|
||||||
oldDef->getDefaultRolesWidgets().at(role)->blockSignals(false);
|
oldDef->getDefaultRolesWidgets().at(role)->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,8 @@ enum CustomQEvent {
|
||||||
EndpointWidgetCreated = 1002,
|
EndpointWidgetCreated = 1002,
|
||||||
EndpointDefaultChange = 1003,
|
EndpointDefaultChange = 1003,
|
||||||
SessionWidgetCreated = 1004,
|
SessionWidgetCreated = 1004,
|
||||||
SessionWidgetObsolete = 1005
|
SessionWidgetObsolete = 1005,
|
||||||
|
RecomposeMainWindow = 1006
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue