diff --git a/selfdrive/ui/qt/maps/map_settings.cc b/selfdrive/ui/qt/maps/map_settings.cc index 770b019023..9df155d62c 100644 --- a/selfdrive/ui/qt/maps/map_settings.cc +++ b/selfdrive/ui/qt/maps/map_settings.cc @@ -4,7 +4,6 @@ #include "selfdrive/common/util.h" #include "selfdrive/ui/qt/util.h" -#include "selfdrive/ui/qt/qt_window.h" #include "selfdrive/ui/qt/request_repeater.h" #include "selfdrive/ui/qt/widgets/controls.h" #include "selfdrive/ui/qt/widgets/scrollview.h" @@ -102,7 +101,7 @@ MapPanel::MapPanel(QWidget* parent) : QWidget(parent) { QLabel *screenshot = new QLabel; QPixmap pm = QPixmap("../assets/navigation/screenshot.png"); - screenshot->setPixmap(pm.scaledToWidth(vwp_w * 0.5, Qt::SmoothTransformation)); + screenshot->setPixmap(pm.scaledToWidth(1080, Qt::SmoothTransformation)); no_prime_layout->addWidget(screenshot, 0, Qt::AlignHCenter); QLabel *signup = new QLabel("Get turn-by-turn directions displayed and more with a comma \nprime subscription. Sign up now: https://connect.comma.ai"); diff --git a/selfdrive/ui/qt/offroad/onboarding.cc b/selfdrive/ui/qt/offroad/onboarding.cc index bc40a1328f..aa03ac63db 100644 --- a/selfdrive/ui/qt/offroad/onboarding.cc +++ b/selfdrive/ui/qt/offroad/onboarding.cc @@ -29,14 +29,17 @@ void TrainingGuide::mouseReleaseEvent(QMouseEvent *e) { if (currentIndex >= (boundingRect.size() - 1)) { emit completedTraining(); } else { - image.load(IMG_PATH + "step" + QString::number(currentIndex) + ".png"); + image.load(img_path + "step" + QString::number(currentIndex) + ".png"); update(); } } void TrainingGuide::showEvent(QShowEvent *event) { + img_path = width() == WIDE_WIDTH ? "../assets/training_wide/" : "../assets/training/"; + boundingRect = width() == WIDE_WIDTH ? boundingRectWide : boundingRectStandard; + currentIndex = 0; - image.load(IMG_PATH + "step0.png"); + image.load(img_path + "step0.png"); } void TrainingGuide::paintEvent(QPaintEvent *event) { diff --git a/selfdrive/ui/qt/offroad/onboarding.h b/selfdrive/ui/qt/offroad/onboarding.h index 291035c952..7ae72649d1 100644 --- a/selfdrive/ui/qt/offroad/onboarding.h +++ b/selfdrive/ui/qt/offroad/onboarding.h @@ -72,8 +72,8 @@ private: QRect(303, 755, 718, 189), }; - const QString IMG_PATH = WIDE_UI ? "../assets/training_wide/" : "../assets/training/"; - const QVector boundingRect = WIDE_UI ? boundingRectWide : boundingRectStandard; + QString img_path; + QVector boundingRect; signals: void completedTraining(); diff --git a/selfdrive/ui/qt/qt_window.h b/selfdrive/ui/qt/qt_window.h index a2dcbb425e..cd1ad928d1 100644 --- a/selfdrive/ui/qt/qt_window.h +++ b/selfdrive/ui/qt/qt_window.h @@ -3,6 +3,7 @@ #include #include +#include #include #ifdef QCOM2 @@ -15,13 +16,14 @@ const QString ASSET_PATH = ":/"; -const bool WIDE_UI = Hardware::TICI() || getenv("WIDE_UI") != nullptr; -const int vwp_w = WIDE_UI ? 2160 : 1920; -const int vwp_h = 1080; +const int WIDE_WIDTH = 2160; inline void setMainWindow(QWidget *w) { + const bool wide = (QGuiApplication::primaryScreen()->size().width() >= WIDE_WIDTH) ^ + (getenv("INVERT_WIDTH") != NULL); const float scale = util::getenv("SCALE", 1.0f); - w->setFixedSize(vwp_w*scale, vwp_h*scale); + + w->setFixedSize(QSize(wide ? WIDE_WIDTH : 1920, 1080) * scale); w->show(); #ifdef QCOM2