diff --git a/selfdrive/ui/qt/offroad/settings.cc b/selfdrive/ui/qt/offroad/settings.cc index 1d86c5b616..c79e2f2972 100644 --- a/selfdrive/ui/qt/offroad/settings.cc +++ b/selfdrive/ui/qt/offroad/settings.cc @@ -19,9 +19,8 @@ #include "widgets/toggle.hpp" #include "widgets/offroad_alerts.hpp" -#include "common/params.h" -#include "common/util.h" - +#include "selfdrive/common/params.h" +#include "selfdrive/common/util.h" #include "selfdrive/hardware/hw.h" QFrame* horizontal_line(QWidget* parent = 0){ @@ -45,17 +44,19 @@ QWidget* labelWidget(QString labelName, QString labelContent){ ParamsToggle::ParamsToggle(QString param, QString title, QString description, QString icon_path, QWidget *parent): QFrame(parent) , param(param) { QHBoxLayout *layout = new QHBoxLayout; + layout->setMargin(0); layout->setSpacing(50); // Parameter image + const int img_size = 80; if (icon_path.length()) { QPixmap pix(icon_path); QLabel *icon = new QLabel(); - icon->setPixmap(pix.scaledToWidth(80, Qt::SmoothTransformation)); + icon->setPixmap(pix.scaledToWidth(img_size, Qt::SmoothTransformation)); icon->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); layout->addWidget(icon); } else { - layout->addSpacing(80); + layout->addSpacing(img_size); } // Name of the parameter diff --git a/selfdrive/ui/qt/widgets/drive_stats.cc b/selfdrive/ui/qt/widgets/drive_stats.cc index efb58c2b1f..1c2af95a9a 100644 --- a/selfdrive/ui/qt/widgets/drive_stats.cc +++ b/selfdrive/ui/qt/widgets/drive_stats.cc @@ -25,6 +25,7 @@ void clearLayouts(QLayout* layout) { QLayout* build_stat(QString name, int stat) { QVBoxLayout* layout = new QVBoxLayout; + layout->setMargin(0); QLabel* metric = new QLabel(QString("%1").arg(stat)); metric->setStyleSheet(R"( @@ -64,6 +65,7 @@ void DriveStats::parseResponse(QString response) { auto week = json["week"].toObject(); QGridLayout* gl = new QGridLayout(); + gl->setMargin(0); int all_distance = all["distance"].toDouble() * (metric ? MILE_TO_KM : 1); gl->addWidget(new QLabel("ALL TIME"), 0, 0, 1, 3); @@ -84,6 +86,7 @@ void DriveStats::parseResponse(QString response) { DriveStats::DriveStats(QWidget* parent) : QWidget(parent) { vlayout = new QVBoxLayout(this); + vlayout->setMargin(0); setLayout(vlayout); setStyleSheet(R"( QLabel { @@ -92,6 +95,7 @@ DriveStats::DriveStats(QWidget* parent) : QWidget(parent) { } )"); + // TODO: do we really need to update this frequently? QString dongleId = QString::fromStdString(Params().get("DongleId")); QString url = "https://api.commadotai.com/v1.1/devices/" + dongleId + "/stats"; RequestRepeater* repeater = new RequestRepeater(this, url, 13);