mirror of https://github.com/commaai/openpilot.git
ui: cleanup setMainWindow (#28768)
* cleanup * revert that --------- Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
This commit is contained in:
parent
e346839c68
commit
289fd32699
|
@ -1,15 +1,15 @@
|
|||
#include "selfdrive/ui/qt/qt_window.h"
|
||||
|
||||
void setMainWindow(QWidget *w) {
|
||||
const float scale = util::getenv("SCALE", 1.0f);
|
||||
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->setMaximumSize(QSize(2160, 1080));
|
||||
w->setMaximumSize(DEVICE_SCREEN_SIZE);
|
||||
w->resize(sz);
|
||||
} else {
|
||||
const float scale = util::getenv("SCALE", 1.0f);
|
||||
const bool wide = (sz.width() >= WIDE_WIDTH) ^ (getenv("INVERT_WIDTH") != NULL);
|
||||
w->setFixedSize(QSize(wide ? WIDE_WIDTH : 1920, 1080) * scale);
|
||||
w->setFixedSize(DEVICE_SCREEN_SIZE * scale);
|
||||
}
|
||||
w->show();
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "system/hardware/hw.h"
|
||||
|
||||
const QString ASSET_PATH = ":/";
|
||||
|
||||
const int WIDE_WIDTH = 2160;
|
||||
const QSize DEVICE_SCREEN_SIZE = {2160, 1080};
|
||||
|
||||
void setMainWindow(QWidget *w);
|
||||
|
|
Loading…
Reference in New Issue