ui: cleanup setMainWindow (#28768)

* cleanup

* revert that

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 289fd32699
beeps
Dean Lee 2 years ago committed by GitHub
parent a0d705d113
commit 9caed10c23
  1. 10
      selfdrive/ui/qt/qt_window.cc
  2. 3
      selfdrive/ui/qt/qt_window.h

@ -1,15 +1,15 @@
#include "selfdrive/ui/qt/qt_window.h" #include "selfdrive/ui/qt/qt_window.h"
void setMainWindow(QWidget *w) { void setMainWindow(QWidget *w) {
const float scale = util::getenv("SCALE", 1.0f);
const QSize sz = QGuiApplication::primaryScreen()->size(); const QSize sz = QGuiApplication::primaryScreen()->size();
if (Hardware::PC() && sz.width() <= 1920 && sz.height() <= 1080 && getenv("SCALE") == nullptr) {
if (Hardware::PC() && scale == 1.0 && !(sz - DEVICE_SCREEN_SIZE).isValid()) {
w->setMinimumSize(QSize(640, 480)); // allow resize smaller than fullscreen w->setMinimumSize(QSize(640, 480)); // allow resize smaller than fullscreen
w->setMaximumSize(QSize(2160, 1080)); w->setMaximumSize(DEVICE_SCREEN_SIZE);
w->resize(sz); w->resize(sz);
} else { } else {
const float scale = util::getenv("SCALE", 1.0f); w->setFixedSize(DEVICE_SCREEN_SIZE * scale);
const bool wide = (sz.width() >= WIDE_WIDTH) ^ (getenv("INVERT_WIDTH") != NULL);
w->setFixedSize(QSize(wide ? WIDE_WIDTH : 1920, 1080) * scale);
} }
w->show(); w->show();

@ -15,7 +15,6 @@
#include "system/hardware/hw.h" #include "system/hardware/hw.h"
const QString ASSET_PATH = ":/"; const QString ASSET_PATH = ":/";
const QSize DEVICE_SCREEN_SIZE = {2160, 1080};
const int WIDE_WIDTH = 2160;
void setMainWindow(QWidget *w); void setMainWindow(QWidget *w);

Loading…
Cancel
Save