correct size on all resolutions
This commit is contained in:
parent
60890cecad
commit
8e93120555
2 changed files with 19 additions and 35 deletions
|
|
@ -282,31 +282,24 @@ 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));
|
||||||
|
|
||||||
dpr = screen->devicePixelRatio();
|
|
||||||
log_to_file("dpr: %f \n", dpr);
|
uint64_t windowWidth = (((uint64_t)std::abs(screenRes.width())) * widthRatio);
|
||||||
uint64_t windowWidth = ((uint64_t)std::abs(screenRes.width()) * widthRatio) * dpr;
|
|
||||||
uint64_t screenHeight = (uint64_t)std::abs(screenRes.height());
|
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));
|
||||||
|
log_to_file("Window Width: %d \n", windowWidth);
|
||||||
|
|
||||||
QFontMetrics fontMetrics = this->fontMetrics();
|
|
||||||
int maxCharWidth = fontMetrics.maxWidth();
|
|
||||||
int charHeight = fontMetrics.height();
|
|
||||||
//QSize QFontMetrics::size(int flags, const QString &text, int tabStops = 0, int *tabArray = nullptr) const
|
|
||||||
|
|
||||||
this->createLayout(new QGridLayout());
|
this->createLayout(new QGridLayout());
|
||||||
//scrollArea->verticalScrollBar()->setMinimumWidth(windowWidth * (widthRatio));
|
this->scrollArea->setMaximumWidth((int)windowWidth);
|
||||||
//scrollArea->verticalScrollBar()->setMaximumWidth(windowWidth * (widthRatio));
|
this->scrollArea->setMinimumWidth((int)windowWidth);
|
||||||
/*
|
this->mainMenuBar->setMinimumWidth((int)windowWidth);
|
||||||
* this->setAttribute(Qt::WA_DontShowOnScreen, true);
|
this->mainMenuBar->setMaximumWidth((int)windowWidth);
|
||||||
* 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->calculateSize(windowWidth, screenHeight);
|
|
||||||
|
epw->calculateSize(windowWidth - scrollArea->verticalScrollBar()->sizeHint().width()
|
||||||
|
- widgetLayout->contentsMargins().left()
|
||||||
|
, screenHeight);
|
||||||
log_debugcpp("epw loop");
|
log_debugcpp("epw loop");
|
||||||
log_debugcpp("epw roles: " + print_as_binary((epw->getEndpointHandler()->getRoles())));
|
log_debugcpp("epw roles: " + print_as_binary((epw->getEndpointHandler()->getRoles())));
|
||||||
//std::bitset<sizeof(uint8_t)> content =
|
//std::bitset<sizeof(uint8_t)> content =
|
||||||
|
|
@ -324,7 +317,6 @@ void MainWindow::compose() {
|
||||||
ews[i]->layout()->getContentsMargins(&left, &top, &right, &bottom);
|
ews[i]->layout()->getContentsMargins(&left, &top, &right, &bottom);
|
||||||
windowHeight += ews[i]->sizeHint().height();
|
windowHeight += ews[i]->sizeHint().height();
|
||||||
windowHeight += top * 3;
|
windowHeight += top * 3;
|
||||||
//windowHeight += bottom;
|
|
||||||
log_debugcpp("windowHeight loop: " + std::to_string(windowHeight));
|
log_debugcpp("windowHeight loop: " + std::to_string(windowHeight));
|
||||||
}
|
}
|
||||||
windowHeight += mainMenuBar->sizeHint().height();
|
windowHeight += mainMenuBar->sizeHint().height();
|
||||||
|
|
@ -522,16 +514,6 @@ ChannelWidget::ChannelWidget(uint32_t channelCount, EndpointHandler* eph, QWidge
|
||||||
this->setLayout(widgetLayout);
|
this->setLayout(widgetLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* QSize ChannelWidget::minimumSizeHint() const {
|
|
||||||
* return minimum;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* void ChannelWidget::setMinimum(QSize minimum) {
|
|
||||||
* this->minimum = minimum;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
|
|
||||||
void ChannelWidget::updateChannel(int channel) {
|
void ChannelWidget::updateChannel(int channel) {
|
||||||
this->channelSliders.at(channel)->blockSignals(true);
|
this->channelSliders.at(channel)->blockSignals(true);
|
||||||
this->channelSliders.at(channel)->setValue((int)((eph->getCallbackInfo()->channelVolumes[channel] + roundingFactor) * 100));
|
this->channelSliders.at(channel)->setValue((int)((eph->getCallbackInfo()->channelVolumes[channel] + roundingFactor) * 100));
|
||||||
|
|
@ -553,6 +535,7 @@ EndpointWidget::EndpointWidget(EndpointHandler* eph, QWidget *parent, uint64_t i
|
||||||
this->eph->setState(EndpointState::ENDPOINT_ACTIVE, idx);
|
this->eph->setState(EndpointState::ENDPOINT_ACTIVE, idx);
|
||||||
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||||
widgetLayout = new QGridLayout(this);
|
widgetLayout = new QGridLayout(this);
|
||||||
|
//this->setContentsMargins(0, 0, 0, 0);
|
||||||
//this->setLayout(widgetLayout);
|
//this->setLayout(widgetLayout);
|
||||||
log_debugcpp("epw main layout parent: " + std::to_string((intptr_t)(widgetLayout->parent())));
|
log_debugcpp("epw main layout parent: " + std::to_string((intptr_t)(widgetLayout->parent())));
|
||||||
if (parent == nullptr) { log_debugcpp("ayooooo?"); }
|
if (parent == nullptr) { log_debugcpp("ayooooo?"); }
|
||||||
|
|
@ -796,7 +779,7 @@ void MainWindow::removeEndpointWidget(CustomWidgetEvent<uint64_t>* ev){
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addEndpointWidget(CustomWidgetEvent<EndpointHandler*>* ev){
|
void MainWindow::addEndpointWidget(CustomWidgetEvent<EndpointHandler*>* ev){
|
||||||
EndpointWidget* epw = new EndpointWidget(ev->payload, widget, this->ews.size());
|
EndpointWidget* epw = new EndpointWidget(ev->payload, containerWidget, this->ews.size());
|
||||||
//epw->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
//epw->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
//this->widgetLayout->addWidget(epw);
|
//this->widgetLayout->addWidget(epw);
|
||||||
ews.push_back(epw);
|
ews.push_back(epw);
|
||||||
|
|
@ -952,7 +935,7 @@ void MainWindow::createLayout(QGridLayout *newLayout) {
|
||||||
log_debugcpp("createLayout");
|
log_debugcpp("createLayout");
|
||||||
widgetLayout->removeItem(lastRowSpacer);
|
widgetLayout->removeItem(lastRowSpacer);
|
||||||
delete this->widgetLayout;
|
delete this->widgetLayout;
|
||||||
widget->setLayout(newLayout);
|
containerWidget->setLayout(newLayout);
|
||||||
this->widgetLayout = newLayout;
|
this->widgetLayout = newLayout;
|
||||||
|
|
||||||
bool areEndpoints = false;
|
bool areEndpoints = false;
|
||||||
|
|
@ -1011,7 +994,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||||
|
|
||||||
ewsUpdateTimer = new QTimer(this);
|
ewsUpdateTimer = new QTimer(this);
|
||||||
recentlyClosedTimer = new QTimer(this);
|
recentlyClosedTimer = new QTimer(this);
|
||||||
widget = new QWidget();
|
containerWidget = new QWidget();
|
||||||
|
//widget->setContentsMargins(0, 0, 0, 0);
|
||||||
widgetLayout = new QGridLayout();
|
widgetLayout = new QGridLayout();
|
||||||
trayIcon = new QSystemTrayIcon();
|
trayIcon = new QSystemTrayIcon();
|
||||||
trayIconMenu = new QMenu();
|
trayIconMenu = new QMenu();
|
||||||
|
|
@ -1032,7 +1016,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||||
*/
|
*/
|
||||||
scrollArea = new QScrollArea(this);
|
scrollArea = new QScrollArea(this);
|
||||||
//widget->setAttribute(Qt::WA_TranslucentBackground);
|
//widget->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
scrollArea->setWidget(widget);
|
scrollArea->setWidget(containerWidget);
|
||||||
scrollArea->setWidgetResizable(true);
|
scrollArea->setWidgetResizable(true);
|
||||||
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
@ -1297,7 +1281,7 @@ void MainWindow::reloadEndpointWidgets() {
|
||||||
if (osh->getPlaybackEndpointHandlers().at(i)->getState() == EndpointState::ENDPOINT_ACTIVE){
|
if (osh->getPlaybackEndpointHandlers().at(i)->getState() == EndpointState::ENDPOINT_ACTIVE){
|
||||||
log_debugcpp("EPWidget creation");
|
log_debugcpp("EPWidget creation");
|
||||||
//osh->getPlaybackEndpointHandlers().at(i)->getCallbackInfo()->caller = osh->getGuid();
|
//osh->getPlaybackEndpointHandlers().at(i)->getCallbackInfo()->caller = osh->getGuid();
|
||||||
EndpointWidget *epw = new EndpointWidget(osh->getPlaybackEndpointHandlers().at(i), widget);
|
EndpointWidget *epw = new EndpointWidget(osh->getPlaybackEndpointHandlers().at(i), containerWidget);
|
||||||
|
|
||||||
log_wdebugcpp(L"epw name: " + epw->getEndpointHandler()->getName());
|
log_wdebugcpp(L"epw name: " + epw->getEndpointHandler()->getName());
|
||||||
if ((epw->getEndpointHandler()->getRoles() == Roles::ROLE_ALL) ||
|
if ((epw->getEndpointHandler()->getRoles() == Roles::ROLE_ALL) ||
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ private:
|
||||||
|
|
||||||
std::vector<EndpointWidget*> ews;
|
std::vector<EndpointWidget*> ews;
|
||||||
std::vector<std::pair<Roles, std::wstring>> roleBucketList;
|
std::vector<std::pair<Roles, std::wstring>> roleBucketList;
|
||||||
QWidget *widget;
|
QWidget *containerWidget;
|
||||||
QGridLayout *widgetLayout;
|
QGridLayout *widgetLayout;
|
||||||
|
|
||||||
QSystemTrayIcon *trayIcon;
|
QSystemTrayIcon *trayIcon;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue