code cleanup: refactored ugly window width/scrheight cache
This commit is contained in:
parent
5d179bb91c
commit
b6b7e1c577
2 changed files with 11 additions and 6 deletions
|
|
@ -633,7 +633,16 @@ void EndpointWidget::addSessionWidget(CustomWidgetEvent<SessionHandler*>* ev){
|
|||
uint64_t index = this->sessionWidgets.size();
|
||||
SessionWidget* sw = new SessionWidget(index, ev->payload, this);
|
||||
ev->payload->setFrontIndex(index);
|
||||
sw->calculateSize(currentWidth, currentHeight);
|
||||
//MainWindow* mw = dynamic_cast<MainWindow*>(parent());
|
||||
//TODO: change mainwindow's widget name and subclass qwidget
|
||||
const QWidgetList topLevelWidgets = QApplication::topLevelWidgets();
|
||||
for (QWidget *widget : topLevelWidgets) {
|
||||
if (dynamic_cast<MainWindow*>(widget)) {
|
||||
double widthRatio = ((MainWindow*)widget)->widthRatio;
|
||||
sw->calculateSize(std::abs(this->screen()->geometry().width()) * widthRatio,
|
||||
std::abs(this->screen()->geometry().height()));
|
||||
}
|
||||
}
|
||||
this->widgetLayout->addWidget(sw, row, 0, 1, 4);
|
||||
row++;
|
||||
sessionWidgets.push_back(sw);
|
||||
|
|
@ -740,8 +749,6 @@ void MainWindow::reorderEndpointWidgetCollection() {
|
|||
|
||||
void EndpointWidget::calculateSize(uint64_t width, uint64_t height) {
|
||||
/* og 1080p 120% testing values */
|
||||
this->currentWidth = width;
|
||||
this->currentHeight = height;
|
||||
log_to_file("[EndpointWidget %s sizes]\n", converter.to_bytes(this->getEndpointHandler()->getName()).c_str());
|
||||
log_to_file("Params: {Width: %u Height: %u}\n", width, height);
|
||||
this->mainLabel->setMaximumWidth((int)(width * 0.50) /* 1080p 120%*/);
|
||||
|
|
|
|||
|
|
@ -201,8 +201,6 @@ private:
|
|||
ChannelWidget* cw;
|
||||
std::vector<SessionWidget*> sessionWidgets;
|
||||
QSize minimum;
|
||||
uint64_t currentWidth = 1;
|
||||
uint64_t currentHeight = 1;
|
||||
//std::vector<EndpointHandler*> *ephs;
|
||||
//std::vector<QSlider> *sliders;
|
||||
|
||||
|
|
@ -272,7 +270,7 @@ private:
|
|||
QToolBar *mainMenuBar;
|
||||
QScreen *screen;
|
||||
QSpacerItem* lastRowSpacer;
|
||||
|
||||
friend class EndpointWidget;
|
||||
//public slots:
|
||||
// void setEndpointHandlers(std::vector<EndpointHandler*> *ephs);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue