dynamically updated session name

This commit is contained in:
Hane 2024-04-19 13:40:50 +02:00
commit 0880305b23
11 changed files with 51 additions and 36 deletions

View file

@ -79,7 +79,6 @@ QRect MainWindow::setSizePosition(QScreen* screen, int width, int height) {
void MainWindow::compose() {
//We need dynamically added child widgets to expand so that we know their height
/*
* Setting correct widget widths and heights
*/
@ -103,7 +102,7 @@ void MainWindow::compose() {
for (auto *epw : ews) {
if (!epw) continue;
epw->setSize(windowWidth, screenHeight);
epw->calculateSize(windowWidth, screenHeight);
log_debugcpp("epw loop");
}
@ -198,6 +197,8 @@ SessionWidget::SessionWidget(uint64_t idx, SessionHandler* sh, QWidget *parent)
connect(volumePoller, &QTimer::timeout, [this, sh](){
//if (memcmp(osh->callbackInfo[idx]->caller, osh->getGuid(), sizeof(NGuid)) == 0) return; CHECK IF THIS PROGRAM GENERATED THE FUNSIES IS NO LONGER IN USE FOR NOW.
//todo: global + constexpr + ratio
if (sh->getVolumeInfo()->isNameChanged)
mainLabel->setText(QString::fromStdWString(sh->getName()));
const float roundingFactor = 0.005;
mainSlider->blockSignals(true);
muteButton->blockSignals(true);
@ -216,7 +217,7 @@ SessionWidget::SessionWidget(uint64_t idx, SessionHandler* sh, QWidget *parent)
volumePoller->start(10);
}
void SessionWidget::setSize(uint64_t width, uint64_t height) {
void SessionWidget::calculateSize(uint64_t width, uint64_t height) {
/* og 1080p 120% testing values */
this->mainLabel->setMaximumWidth((int)(width * 0.30) /*1/16ish 1080p*/);
this->mainLabel->setMinimumWidth((int)(width * 0.30) /*1/16ish 1080p*/);
@ -565,7 +566,7 @@ void MainWindow::reorderEndpointWidgetCollection() {
ews.resize(firstNullPosition + 1);
}
void EndpointWidget::setSize(uint64_t width, uint64_t height) {
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%*/);
@ -574,7 +575,7 @@ void EndpointWidget::setSize(uint64_t width, uint64_t height) {
this->cw->setMaximumSize(QSize(QWIDGETSIZE_MAX, height * 0.06));
}
for (auto sw : sessionWidgets){
if (sw) sw->setSize(width, height);
if (sw) sw->calculateSize(width, height);
}
}
@ -745,8 +746,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
* Set of function callback definitons for EndpointSituationCallback
*/
osh->setChangeFrontDefaultsFunction([this](Roles role, std::wstring endpointId) {
//Sigh... I hope to get this right when librole is done...
EndpointWidget *newDef = nullptr, *oldDef = nullptr;
for (int i = 0; i < ews.size(); i++) {
for (uint64_t i = 0; i < ews.size(); i++) {
auto epw = this->ews.at(i);
if (!epw) continue;
if (epw->getEndpointHandler()->getId() == endpointId) {