mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-23 15:02:06 +08:00
UI widgets: remove unnecessary setLayout (#21232)
* remove setlayout * remove setLayout * space * Update selfdrive/ui/qt/maps/map.cc Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
This commit is contained in:
@@ -16,17 +16,17 @@
|
||||
// HomeWindow: the container for the offroad and onroad UIs
|
||||
|
||||
HomeWindow::HomeWindow(QWidget* parent) : QWidget(parent) {
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
QHBoxLayout *main_layout = new QHBoxLayout(this);
|
||||
main_layout->setMargin(0);
|
||||
main_layout->setSpacing(0);
|
||||
|
||||
sidebar = new Sidebar(this);
|
||||
layout->addWidget(sidebar);
|
||||
main_layout->addWidget(sidebar);
|
||||
QObject::connect(this, &HomeWindow::update, sidebar, &Sidebar::updateState);
|
||||
QObject::connect(sidebar, &Sidebar::openSettings, this, &HomeWindow::openSettings);
|
||||
|
||||
slayout = new QStackedLayout();
|
||||
layout->addLayout(slayout);
|
||||
main_layout->addLayout(slayout);
|
||||
|
||||
onroad = new OnroadWindow(this);
|
||||
slayout->addWidget(onroad);
|
||||
@@ -43,8 +43,6 @@ HomeWindow::HomeWindow(QWidget* parent) : QWidget(parent) {
|
||||
showDriverView(false);
|
||||
});
|
||||
slayout->addWidget(driver_view);
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void HomeWindow::offroadTransition(bool offroad) {
|
||||
@@ -88,7 +86,7 @@ void HomeWindow::mousePressEvent(QMouseEvent* e) {
|
||||
// OffroadHome: the offroad home page
|
||||
|
||||
OffroadHome::OffroadHome(QWidget* parent) : QFrame(parent) {
|
||||
QVBoxLayout* main_layout = new QVBoxLayout();
|
||||
QVBoxLayout* main_layout = new QVBoxLayout(this);
|
||||
main_layout->setMargin(50);
|
||||
|
||||
// top header
|
||||
@@ -140,7 +138,6 @@ OffroadHome::OffroadHome(QWidget* parent) : QFrame(parent) {
|
||||
QObject::connect(timer, &QTimer::timeout, this, &OffroadHome::refresh);
|
||||
timer->start(10 * 1000);
|
||||
|
||||
setLayout(main_layout);
|
||||
setStyleSheet(R"(
|
||||
OffroadHome {
|
||||
background-color: black;
|
||||
|
||||
+13
-16
@@ -441,18 +441,19 @@ void MapWindow::offroadTransition(bool offroad) {
|
||||
}
|
||||
|
||||
MapInstructions::MapInstructions(QWidget * parent) : QWidget(parent) {
|
||||
QHBoxLayout *layout_outer = new QHBoxLayout;
|
||||
layout_outer->setContentsMargins(11, 50, 11, 11);
|
||||
QHBoxLayout *main_layout = new QHBoxLayout(this);
|
||||
main_layout->setContentsMargins(11, 50, 11, 11);
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
icon_01 = new QLabel;
|
||||
layout->addWidget(icon_01);
|
||||
layout->addStretch();
|
||||
layout_outer->addLayout(layout);
|
||||
main_layout->addLayout(layout);
|
||||
}
|
||||
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
QWidget *w = new QWidget;
|
||||
QVBoxLayout *layout = new QVBoxLayout(w);
|
||||
|
||||
distance = new QLabel;
|
||||
distance->setStyleSheet(R"(font-size: 75px; )");
|
||||
@@ -471,12 +472,9 @@ MapInstructions::MapInstructions(QWidget * parent) : QWidget(parent) {
|
||||
lane_layout = new QHBoxLayout;
|
||||
layout->addLayout(lane_layout);
|
||||
|
||||
QWidget * w = new QWidget;
|
||||
w->setLayout(layout);
|
||||
layout_outer->addWidget(w);
|
||||
main_layout->addWidget(w);
|
||||
}
|
||||
|
||||
setLayout(layout_outer);
|
||||
setStyleSheet(R"(
|
||||
* {
|
||||
color: white;
|
||||
@@ -608,8 +606,8 @@ void MapInstructions::updateInstructions(QMap<QString, QVariant> banner, bool fu
|
||||
}
|
||||
|
||||
MapETA::MapETA(QWidget * parent) : QWidget(parent) {
|
||||
QHBoxLayout *layout_outer = new QHBoxLayout;
|
||||
layout_outer->setContentsMargins(20, 25, 20, 25);
|
||||
QHBoxLayout *main_layout = new QHBoxLayout(this);
|
||||
main_layout->setContentsMargins(20, 25, 20, 25);
|
||||
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
@@ -623,9 +621,9 @@ MapETA::MapETA(QWidget * parent) : QWidget(parent) {
|
||||
layout->addWidget(eta);
|
||||
layout->addWidget(eta_unit);
|
||||
layout->addStretch();
|
||||
layout_outer->addLayout(layout);
|
||||
main_layout->addLayout(layout);
|
||||
}
|
||||
layout_outer->addSpacing(30);
|
||||
main_layout->addSpacing(30);
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
time = new QLabel;
|
||||
@@ -638,9 +636,9 @@ MapETA::MapETA(QWidget * parent) : QWidget(parent) {
|
||||
layout->addWidget(time);
|
||||
layout->addWidget(time_unit);
|
||||
layout->addStretch();
|
||||
layout_outer->addLayout(layout);
|
||||
main_layout->addLayout(layout);
|
||||
}
|
||||
layout_outer->addSpacing(30);
|
||||
main_layout->addSpacing(30);
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
distance = new QLabel;
|
||||
@@ -652,10 +650,9 @@ MapETA::MapETA(QWidget * parent) : QWidget(parent) {
|
||||
layout->addWidget(distance);
|
||||
layout->addWidget(distance_unit);
|
||||
layout->addStretch();
|
||||
layout_outer->addLayout(layout);
|
||||
main_layout->addLayout(layout);
|
||||
}
|
||||
|
||||
setLayout(layout_outer);
|
||||
setStyleSheet(R"(
|
||||
* {
|
||||
color: white;
|
||||
|
||||
@@ -4,17 +4,16 @@
|
||||
|
||||
|
||||
MapPanel::MapPanel(QWidget* parent) : QWidget(parent) {
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||
Params params = Params();
|
||||
|
||||
QString dongle = QString::fromStdString(params.get("DongleId", false));
|
||||
// TODO: Add buttons for home/work shortcuts
|
||||
|
||||
layout->addWidget(new ParamControl("NavSettingTime24h",
|
||||
main_layout->addWidget(new ParamControl("NavSettingTime24h",
|
||||
"Show ETA in 24h format",
|
||||
"Use 24h format instead of am/pm",
|
||||
"",
|
||||
this));
|
||||
layout->addStretch();
|
||||
setLayout(layout);
|
||||
}
|
||||
main_layout->addStretch();
|
||||
}
|
||||
|
||||
@@ -24,14 +24,13 @@ void NetworkStrengthWidget::paintEvent(QPaintEvent* event) {
|
||||
// Networking functions
|
||||
|
||||
Networking::Networking(QWidget* parent, bool show_advanced) : QWidget(parent), show_advanced(show_advanced) {
|
||||
s = new QStackedLayout;
|
||||
main_layout = new QStackedLayout(this);
|
||||
|
||||
QLabel* warning = new QLabel("Network manager is inactive!");
|
||||
warning->setAlignment(Qt::AlignCenter);
|
||||
warning->setStyleSheet(R"(font-size: 65px;)");
|
||||
|
||||
s->addWidget(warning);
|
||||
setLayout(s);
|
||||
main_layout->addWidget(warning);
|
||||
|
||||
QTimer* timer = new QTimer(this);
|
||||
QObject::connect(timer, &QTimer::timeout, this, &Networking::refresh);
|
||||
@@ -49,13 +48,13 @@ void Networking::attemptInitialization() {
|
||||
|
||||
connect(wifi, &WifiManager::wrongPassword, this, &Networking::wrongPassword);
|
||||
|
||||
QVBoxLayout* vlayout = new QVBoxLayout;
|
||||
|
||||
QWidget* wifiScreen = new QWidget(this);
|
||||
QVBoxLayout* vlayout = new QVBoxLayout(wifiScreen);
|
||||
if (show_advanced) {
|
||||
QPushButton* advancedSettings = new QPushButton("Advanced");
|
||||
advancedSettings->setStyleSheet("margin-right: 30px;");
|
||||
advancedSettings->setFixedSize(350, 100);
|
||||
connect(advancedSettings, &QPushButton::released, [=]() { s->setCurrentWidget(an); });
|
||||
connect(advancedSettings, &QPushButton::released, [=]() { main_layout->setCurrentWidget(an); });
|
||||
vlayout->addSpacing(10);
|
||||
vlayout->addWidget(advancedSettings, 0, Qt::AlignRight);
|
||||
vlayout->addSpacing(10);
|
||||
@@ -65,13 +64,11 @@ void Networking::attemptInitialization() {
|
||||
connect(wifiWidget, &WifiUI::connectToNetwork, this, &Networking::connectToNetwork);
|
||||
vlayout->addWidget(new ScrollView(wifiWidget, this), 1);
|
||||
|
||||
QWidget* wifiScreen = new QWidget(this);
|
||||
wifiScreen->setLayout(vlayout);
|
||||
s->addWidget(wifiScreen);
|
||||
main_layout->addWidget(wifiScreen);
|
||||
|
||||
an = new AdvancedNetworking(this, wifi);
|
||||
connect(an, &AdvancedNetworking::backPress, [=]() { s->setCurrentWidget(wifiScreen); });
|
||||
s->addWidget(an);
|
||||
connect(an, &AdvancedNetworking::backPress, [=]() { main_layout->setCurrentWidget(wifiScreen); });
|
||||
main_layout->addWidget(an);
|
||||
|
||||
setStyleSheet(R"(
|
||||
QPushButton {
|
||||
@@ -88,7 +85,7 @@ void Networking::attemptInitialization() {
|
||||
background-color: #222222;
|
||||
}
|
||||
)");
|
||||
s->setCurrentWidget(wifiScreen);
|
||||
main_layout->setCurrentWidget(wifiScreen);
|
||||
ui_setup_complete = true;
|
||||
}
|
||||
|
||||
@@ -129,21 +126,21 @@ void Networking::wrongPassword(const QString &ssid) {
|
||||
|
||||
AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWidget(parent), wifi(wifi) {
|
||||
|
||||
QVBoxLayout* vlayout = new QVBoxLayout;
|
||||
vlayout->setMargin(40);
|
||||
vlayout->setSpacing(20);
|
||||
QVBoxLayout* main_layout = new QVBoxLayout(this);
|
||||
main_layout->setMargin(40);
|
||||
main_layout->setSpacing(20);
|
||||
|
||||
// Back button
|
||||
QPushButton* back = new QPushButton("Back");
|
||||
back->setFixedSize(500, 100);
|
||||
connect(back, &QPushButton::released, [=]() { emit backPress(); });
|
||||
vlayout->addWidget(back, 0, Qt::AlignLeft);
|
||||
main_layout->addWidget(back, 0, Qt::AlignLeft);
|
||||
|
||||
// Enable tethering layout
|
||||
ToggleControl *tetheringToggle = new ToggleControl("Enable Tethering", "", "", wifi->tetheringEnabled());
|
||||
vlayout->addWidget(tetheringToggle);
|
||||
main_layout->addWidget(tetheringToggle);
|
||||
QObject::connect(tetheringToggle, &ToggleControl::toggleFlipped, this, &AdvancedNetworking::toggleTethering);
|
||||
vlayout->addWidget(horizontal_line(), 0);
|
||||
main_layout->addWidget(horizontal_line(), 0);
|
||||
|
||||
// Change tethering password
|
||||
editPasswordButton = new ButtonControl("Tethering Password", "EDIT", "", [=]() {
|
||||
@@ -152,21 +149,20 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid
|
||||
wifi->changeTetheringPassword(pass);
|
||||
}
|
||||
});
|
||||
vlayout->addWidget(editPasswordButton, 0);
|
||||
vlayout->addWidget(horizontal_line(), 0);
|
||||
main_layout->addWidget(editPasswordButton, 0);
|
||||
main_layout->addWidget(horizontal_line(), 0);
|
||||
|
||||
// IP address
|
||||
ipLabel = new LabelControl("IP Address", wifi->ipv4_address);
|
||||
vlayout->addWidget(ipLabel, 0);
|
||||
vlayout->addWidget(horizontal_line(), 0);
|
||||
main_layout->addWidget(ipLabel, 0);
|
||||
main_layout->addWidget(horizontal_line(), 0);
|
||||
|
||||
// SSH keys
|
||||
vlayout->addWidget(new SshToggle());
|
||||
vlayout->addWidget(horizontal_line(), 0);
|
||||
vlayout->addWidget(new SshControl());
|
||||
main_layout->addWidget(new SshToggle());
|
||||
main_layout->addWidget(horizontal_line(), 0);
|
||||
main_layout->addWidget(new SshControl());
|
||||
|
||||
vlayout->addStretch(1);
|
||||
setLayout(vlayout);
|
||||
main_layout->addStretch(1);
|
||||
}
|
||||
|
||||
void AdvancedNetworking::refresh() {
|
||||
@@ -187,21 +183,19 @@ void AdvancedNetworking::toggleTethering(bool enable) {
|
||||
// WifiUI functions
|
||||
|
||||
WifiUI::WifiUI(QWidget *parent, WifiManager* wifi) : QWidget(parent), wifi(wifi) {
|
||||
vlayout = new QVBoxLayout;
|
||||
main_layout = new QVBoxLayout(this);
|
||||
|
||||
// Scan on startup
|
||||
QLabel *scanning = new QLabel("Scanning for networks");
|
||||
scanning->setStyleSheet(R"(font-size: 65px;)");
|
||||
vlayout->addWidget(scanning, 0, Qt::AlignCenter);
|
||||
vlayout->setSpacing(25);
|
||||
|
||||
setLayout(vlayout);
|
||||
main_layout->addWidget(scanning, 0, Qt::AlignCenter);
|
||||
main_layout->setSpacing(25);
|
||||
}
|
||||
|
||||
void WifiUI::refresh() {
|
||||
wifi->request_scan();
|
||||
wifi->refreshNetworks();
|
||||
clearLayout(vlayout);
|
||||
clearLayout(main_layout);
|
||||
|
||||
connectButtons = new QButtonGroup(this); // TODO check if this is a leak
|
||||
QObject::connect(connectButtons, qOverload<QAbstractButton*>(&QButtonGroup::buttonClicked), this, &WifiUI::handleButton);
|
||||
@@ -227,14 +221,14 @@ void WifiUI::refresh() {
|
||||
|
||||
connectButtons->addButton(btn, i);
|
||||
|
||||
vlayout->addLayout(hlayout, 1);
|
||||
main_layout->addLayout(hlayout, 1);
|
||||
// Don't add the last horizontal line
|
||||
if (i+1 < wifi->seen_networks.size()) {
|
||||
vlayout->addWidget(horizontal_line(), 0);
|
||||
main_layout->addWidget(horizontal_line(), 0);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
vlayout->addStretch(3);
|
||||
main_layout->addStretch(3);
|
||||
}
|
||||
|
||||
void WifiUI::handleButton(QAbstractButton* button) {
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
|
||||
private:
|
||||
WifiManager *wifi = nullptr;
|
||||
QVBoxLayout *vlayout;
|
||||
QVBoxLayout* main_layout;
|
||||
|
||||
QButtonGroup *connectButtons;
|
||||
bool tetheringEnabled;
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
explicit Networking(QWidget* parent = 0, bool show_advanced = true);
|
||||
|
||||
private:
|
||||
QStackedLayout* s = nullptr; // nm_warning, wifiScreen, advanced
|
||||
QStackedLayout* main_layout = nullptr; // nm_warning, wifiScreen, advanced
|
||||
QWidget* wifiScreen = nullptr;
|
||||
AdvancedNetworking* an = nullptr;
|
||||
bool ui_setup_complete = false;
|
||||
|
||||
@@ -58,7 +58,7 @@ void TermsPage::showEvent(QShowEvent *event) {
|
||||
return;
|
||||
}
|
||||
|
||||
QVBoxLayout *main_layout = new QVBoxLayout;
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||
main_layout->setMargin(40);
|
||||
main_layout->setSpacing(40);
|
||||
|
||||
@@ -93,7 +93,6 @@ void TermsPage::showEvent(QShowEvent *event) {
|
||||
buttons->addWidget(accept_btn);
|
||||
QObject::connect(accept_btn, &QPushButton::released, this, &TermsPage::acceptedTerms);
|
||||
|
||||
setLayout(main_layout);
|
||||
setStyleSheet(R"(
|
||||
QPushButton {
|
||||
padding: 50px;
|
||||
@@ -115,7 +114,7 @@ void DeclinePage::showEvent(QShowEvent *event) {
|
||||
return;
|
||||
}
|
||||
|
||||
QVBoxLayout *main_layout = new QVBoxLayout;
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||
main_layout->setMargin(40);
|
||||
main_layout->setSpacing(40);
|
||||
|
||||
@@ -143,7 +142,6 @@ void DeclinePage::showEvent(QShowEvent *event) {
|
||||
}
|
||||
});
|
||||
|
||||
setLayout(main_layout);
|
||||
setStyleSheet(R"(
|
||||
QPushButton {
|
||||
padding: 50px;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "selfdrive/ui/qt/util.h"
|
||||
|
||||
TogglesPanel::TogglesPanel(QWidget *parent) : QWidget(parent) {
|
||||
QVBoxLayout *toggles_list = new QVBoxLayout();
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||
|
||||
QList<ParamControl*> toggles;
|
||||
|
||||
@@ -93,25 +93,23 @@ TogglesPanel::TogglesPanel(QWidget *parent) : QWidget(parent) {
|
||||
record_toggle->setEnabled(!record_lock);
|
||||
|
||||
for(ParamControl *toggle : toggles) {
|
||||
if(toggles_list->count() != 0) {
|
||||
toggles_list->addWidget(horizontal_line());
|
||||
if(main_layout->count() != 0) {
|
||||
main_layout->addWidget(horizontal_line());
|
||||
}
|
||||
toggles_list->addWidget(toggle);
|
||||
main_layout->addWidget(toggle);
|
||||
}
|
||||
|
||||
setLayout(toggles_list);
|
||||
}
|
||||
|
||||
DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
|
||||
QVBoxLayout *device_layout = new QVBoxLayout;
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||
Params params = Params();
|
||||
|
||||
QString dongle = QString::fromStdString(params.get("DongleId", false));
|
||||
device_layout->addWidget(new LabelControl("Dongle ID", dongle));
|
||||
device_layout->addWidget(horizontal_line());
|
||||
main_layout->addWidget(new LabelControl("Dongle ID", dongle));
|
||||
main_layout->addWidget(horizontal_line());
|
||||
|
||||
QString serial = QString::fromStdString(params.get("HardwareSerial", false));
|
||||
device_layout->addWidget(new LabelControl("Serial", serial));
|
||||
main_layout->addWidget(new LabelControl("Serial", serial));
|
||||
|
||||
// offroad-only buttons
|
||||
QList<ButtonControl*> offroad_btns;
|
||||
@@ -164,9 +162,9 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
|
||||
}, "", this));
|
||||
|
||||
for(auto &btn : offroad_btns) {
|
||||
device_layout->addWidget(horizontal_line());
|
||||
main_layout->addWidget(horizontal_line());
|
||||
QObject::connect(parent, SIGNAL(offroadTransition(bool)), btn, SLOT(setEnabled(bool)));
|
||||
device_layout->addWidget(btn);
|
||||
main_layout->addWidget(btn);
|
||||
}
|
||||
|
||||
// power buttons
|
||||
@@ -190,9 +188,8 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
|
||||
}
|
||||
});
|
||||
|
||||
device_layout->addLayout(power_layout);
|
||||
main_layout->addLayout(power_layout);
|
||||
|
||||
setLayout(device_layout);
|
||||
setStyleSheet(R"(
|
||||
QPushButton {
|
||||
padding: 0;
|
||||
@@ -204,8 +201,7 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
|
||||
}
|
||||
|
||||
SoftwarePanel::SoftwarePanel(QWidget* parent) : QWidget(parent) {
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||
setLayout(main_layout);
|
||||
setLayout(new QVBoxLayout());
|
||||
setStyleSheet(R"(QLabel {font-size: 50px;})");
|
||||
|
||||
fs_watch = new QFileSystemWatcher(this);
|
||||
@@ -286,7 +282,8 @@ void SoftwarePanel::updateLabels() {
|
||||
|
||||
QWidget * network_panel(QWidget * parent) {
|
||||
#ifdef QCOM
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
QWidget *w = new QWidget(parent);
|
||||
QVBoxLayout *layout = new QVBoxLayout(w);
|
||||
layout->setSpacing(30);
|
||||
|
||||
// wifi + tethering buttons
|
||||
@@ -304,9 +301,6 @@ QWidget * network_panel(QWidget * parent) {
|
||||
layout->addWidget(new SshControl());
|
||||
|
||||
layout->addStretch(1);
|
||||
|
||||
QWidget *w = new QWidget(parent);
|
||||
w->setLayout(layout);
|
||||
#else
|
||||
Networking *w = new Networking(parent);
|
||||
#endif
|
||||
@@ -324,7 +318,8 @@ void SettingsWindow::showEvent(QShowEvent *event) {
|
||||
SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
|
||||
|
||||
// setup two main layouts
|
||||
QVBoxLayout *sidebar_layout = new QVBoxLayout();
|
||||
sidebar_widget = new QWidget;
|
||||
QVBoxLayout *sidebar_layout = new QVBoxLayout(sidebar_widget);
|
||||
sidebar_layout->setMargin(0);
|
||||
panel_widget = new QStackedWidget();
|
||||
panel_widget->setStyleSheet(R"(
|
||||
@@ -400,15 +395,12 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
|
||||
sidebar_layout->setContentsMargins(50, 50, 100, 50);
|
||||
|
||||
// main settings layout, sidebar + main panel
|
||||
QHBoxLayout *settings_layout = new QHBoxLayout();
|
||||
QHBoxLayout *main_layout = new QHBoxLayout(this);
|
||||
|
||||
sidebar_widget = new QWidget;
|
||||
sidebar_widget->setLayout(sidebar_layout);
|
||||
sidebar_widget->setFixedWidth(500);
|
||||
settings_layout->addWidget(sidebar_widget);
|
||||
settings_layout->addWidget(panel_widget);
|
||||
main_layout->addWidget(sidebar_widget);
|
||||
main_layout->addWidget(panel_widget);
|
||||
|
||||
setLayout(settings_layout);
|
||||
setStyleSheet(R"(
|
||||
* {
|
||||
color: white;
|
||||
|
||||
@@ -12,34 +12,31 @@
|
||||
#endif
|
||||
|
||||
OnroadWindow::OnroadWindow(QWidget *parent) : QWidget(parent) {
|
||||
layout = new QStackedLayout(this);
|
||||
layout->setStackingMode(QStackedLayout::StackAll);
|
||||
main_layout = new QStackedLayout(this);
|
||||
main_layout->setStackingMode(QStackedLayout::StackAll);
|
||||
|
||||
// old UI on bottom
|
||||
nvg = new NvgWindow(this);
|
||||
QObject::connect(this, &OnroadWindow::update, nvg, &NvgWindow::update);
|
||||
|
||||
split = new QHBoxLayout();
|
||||
QWidget * split_wrapper = new QWidget;
|
||||
split = new QHBoxLayout(split_wrapper);
|
||||
split->setContentsMargins(0, 0, 0, 0);
|
||||
split->setSpacing(0);
|
||||
split->addWidget(nvg);
|
||||
|
||||
|
||||
QWidget * split_wrapper = new QWidget;
|
||||
split_wrapper->setLayout(split);
|
||||
layout->addWidget(split_wrapper);
|
||||
main_layout->addWidget(split_wrapper);
|
||||
|
||||
alerts = new OnroadAlerts(this);
|
||||
alerts->setAttribute(Qt::WA_TransparentForMouseEvents, true);
|
||||
QObject::connect(this, &OnroadWindow::update, alerts, &OnroadAlerts::updateState);
|
||||
QObject::connect(this, &OnroadWindow::offroadTransitionSignal, alerts, &OnroadAlerts::offroadTransition);
|
||||
QObject::connect(this, &OnroadWindow::offroadTransitionSignal, this, &OnroadWindow::offroadTransition);
|
||||
layout->addWidget(alerts);
|
||||
main_layout->addWidget(alerts);
|
||||
|
||||
// setup stacking order
|
||||
alerts->raise();
|
||||
|
||||
setLayout(layout);
|
||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
private:
|
||||
OnroadAlerts *alerts;
|
||||
NvgWindow *nvg;
|
||||
QStackedLayout *layout;
|
||||
QStackedLayout *main_layout;
|
||||
QHBoxLayout* split;
|
||||
|
||||
signals:
|
||||
|
||||
@@ -31,21 +31,21 @@ int main(int argc, char *argv[]) {
|
||||
QWidget window;
|
||||
setMainWindow(&window);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(125, 125, 125, 125);
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(&window);
|
||||
main_layout->setContentsMargins(125, 125, 125, 125);
|
||||
|
||||
QLabel *title = new QLabel("System Reset");
|
||||
title->setStyleSheet(R"(
|
||||
font-weight: 500;
|
||||
font-size: 100px;
|
||||
)");
|
||||
layout->addWidget(title, 0, Qt::AlignTop);
|
||||
main_layout->addWidget(title, 0, Qt::AlignTop);
|
||||
|
||||
QLabel *body = new QLabel("System reset triggered. Press confirm to erase all content and settings. Press cancel to resume boot.");
|
||||
body->setWordWrap(true);
|
||||
body->setAlignment(Qt::AlignCenter);
|
||||
body->setStyleSheet("font-size: 65px;");
|
||||
layout->addWidget(body, 1, Qt::AlignCenter);
|
||||
main_layout->addWidget(body, 1, Qt::AlignCenter);
|
||||
|
||||
QHBoxLayout *btn_layout = new QHBoxLayout();
|
||||
|
||||
@@ -74,9 +74,8 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
});
|
||||
|
||||
layout->addLayout(btn_layout);
|
||||
main_layout->addLayout(btn_layout);
|
||||
|
||||
window.setLayout(layout);
|
||||
window.setStyleSheet(R"(
|
||||
* {
|
||||
color: white;
|
||||
|
||||
@@ -56,7 +56,9 @@ QLabel * title_label(QString text) {
|
||||
}
|
||||
|
||||
QWidget * Setup::build_page(QString title, QWidget *content, bool next, bool prev) {
|
||||
QVBoxLayout *main_layout = new QVBoxLayout();
|
||||
QWidget *widget = new QWidget();
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(widget);
|
||||
|
||||
main_layout->setMargin(50);
|
||||
main_layout->addWidget(title_label(title), 0, Qt::AlignLeft | Qt::AlignTop);
|
||||
|
||||
@@ -77,9 +79,6 @@ QWidget * Setup::build_page(QString title, QWidget *content, bool next, bool pre
|
||||
}
|
||||
|
||||
main_layout->addLayout(nav_layout, 0);
|
||||
|
||||
QWidget *widget = new QWidget();
|
||||
widget->setLayout(main_layout);
|
||||
return widget;
|
||||
}
|
||||
|
||||
@@ -96,7 +95,8 @@ QWidget * Setup::network_setup() {
|
||||
}
|
||||
|
||||
QWidget * Setup::software_selection() {
|
||||
QVBoxLayout *main_layout = new QVBoxLayout();
|
||||
QWidget *widget = new QWidget();
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(widget);
|
||||
|
||||
QPushButton *dashcam_btn = new QPushButton("Dashcam");
|
||||
main_layout->addWidget(dashcam_btn);
|
||||
@@ -114,23 +114,19 @@ QWidget * Setup::software_selection() {
|
||||
this->download(input_url);
|
||||
}
|
||||
});
|
||||
|
||||
QWidget *widget = new QWidget();
|
||||
widget->setLayout(main_layout);
|
||||
return build_page("Choose Software", widget, false, true);
|
||||
}
|
||||
|
||||
QWidget * Setup::downloading() {
|
||||
QVBoxLayout *main_layout = new QVBoxLayout();
|
||||
main_layout->addWidget(title_label("Downloading..."), 0, Qt::AlignCenter);
|
||||
|
||||
QWidget *widget = new QWidget();
|
||||
widget->setLayout(main_layout);
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(widget);
|
||||
main_layout->addWidget(title_label("Downloading..."), 0, Qt::AlignCenter);
|
||||
return widget;
|
||||
}
|
||||
|
||||
QWidget * Setup::download_failed() {
|
||||
QVBoxLayout *main_layout = new QVBoxLayout();
|
||||
QWidget *widget = new QWidget();
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(widget);
|
||||
main_layout->setContentsMargins(50, 50, 50, 50);
|
||||
main_layout->addWidget(title_label("Download Failed"), 0, Qt::AlignLeft | Qt::AlignTop);
|
||||
|
||||
@@ -157,9 +153,6 @@ QWidget * Setup::download_failed() {
|
||||
});
|
||||
|
||||
main_layout->addLayout(nav_layout, 0);
|
||||
|
||||
QWidget *widget = new QWidget();
|
||||
widget->setLayout(main_layout);
|
||||
return widget;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ void WifiSetup::finish() {
|
||||
}
|
||||
|
||||
WifiSetup::WifiSetup(QWidget *parent) : QWidget(parent) {
|
||||
QHBoxLayout *main_layout = new QHBoxLayout();
|
||||
QHBoxLayout *main_layout = new QHBoxLayout(this);
|
||||
|
||||
QPushButton *finish_btn = new QPushButton("Exit");
|
||||
finish_btn->setFixedSize(400, 200);
|
||||
@@ -29,10 +29,9 @@ WifiSetup::WifiSetup(QWidget *parent) : QWidget(parent) {
|
||||
QWidget* n = new Networking(this, true);
|
||||
|
||||
// Next 5 lines to keep the same stylesheet on the networking widget
|
||||
QLayout* backgroundLayout = new QVBoxLayout();
|
||||
backgroundLayout->addWidget(n);
|
||||
QWidget* q = new QWidget();
|
||||
q->setLayout(backgroundLayout);
|
||||
QLayout* backgroundLayout = new QVBoxLayout(q);
|
||||
backgroundLayout->addWidget(n);
|
||||
q->setStyleSheet(R"(
|
||||
* {
|
||||
background-color: #292929;
|
||||
@@ -40,7 +39,6 @@ WifiSetup::WifiSetup(QWidget *parent) : QWidget(parent) {
|
||||
)");
|
||||
main_layout->addWidget(q, 1);
|
||||
|
||||
setLayout(main_layout);
|
||||
setStyleSheet(R"(
|
||||
* {
|
||||
background-color: black;
|
||||
|
||||
@@ -54,7 +54,7 @@ void TrackWidget::paintEvent(QPaintEvent *event) {
|
||||
// Spinner
|
||||
|
||||
Spinner::Spinner(QWidget *parent) : QWidget(parent) {
|
||||
QGridLayout *main_layout = new QGridLayout();
|
||||
QGridLayout *main_layout = new QGridLayout(this);
|
||||
main_layout->setSpacing(0);
|
||||
main_layout->setMargin(200);
|
||||
|
||||
@@ -71,7 +71,6 @@ Spinner::Spinner(QWidget *parent) : QWidget(parent) {
|
||||
progress_bar->setFixedHeight(20);
|
||||
main_layout->addWidget(progress_bar, 1, 0, Qt::AlignHCenter);
|
||||
|
||||
setLayout(main_layout);
|
||||
setStyleSheet(R"(
|
||||
Spinner {
|
||||
background-color: black;
|
||||
|
||||
@@ -17,15 +17,15 @@ int main(int argc, char *argv[]) {
|
||||
Hardware::set_display_power(true);
|
||||
Hardware::set_brightness(65);
|
||||
|
||||
QGridLayout *layout = new QGridLayout;
|
||||
layout->setMargin(50);
|
||||
QGridLayout *main_layout = new QGridLayout(&window);
|
||||
main_layout->setMargin(50);
|
||||
|
||||
QLabel *label = new QLabel(argv[1]);
|
||||
label->setWordWrap(true);
|
||||
label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
|
||||
ScrollView *scroll = new ScrollView(label);
|
||||
scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
layout->addWidget(scroll, 0, 0, Qt::AlignTop);
|
||||
main_layout->addWidget(scroll, 0, 0, Qt::AlignTop);
|
||||
|
||||
// Scroll to the bottom
|
||||
QObject::connect(scroll->verticalScrollBar(), &QAbstractSlider::rangeChanged, [=]() {
|
||||
@@ -42,9 +42,8 @@ int main(int argc, char *argv[]) {
|
||||
btn->setText("Exit");
|
||||
QObject::connect(btn, &QPushButton::released, &a, &QApplication::quit);
|
||||
#endif
|
||||
layout->addWidget(btn, 0, 0, Qt::AlignRight | Qt::AlignBottom);
|
||||
main_layout->addWidget(btn, 0, 0, Qt::AlignRight | Qt::AlignBottom);
|
||||
|
||||
window.setLayout(layout);
|
||||
window.setStyleSheet(R"(
|
||||
* {
|
||||
outline: none;
|
||||
|
||||
@@ -15,8 +15,8 @@ QFrame *horizontal_line(QWidget *parent) {
|
||||
}
|
||||
|
||||
AbstractControl::AbstractControl(const QString &title, const QString &desc, const QString &icon, QWidget *parent) : QFrame(parent) {
|
||||
QVBoxLayout *vlayout = new QVBoxLayout();
|
||||
vlayout->setMargin(0);
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||
main_layout->setMargin(0);
|
||||
|
||||
hlayout = new QHBoxLayout;
|
||||
hlayout->setMargin(0);
|
||||
@@ -36,7 +36,7 @@ AbstractControl::AbstractControl(const QString &title, const QString &desc, cons
|
||||
title_label->setStyleSheet("font-size: 50px; font-weight: 400; text-align: left;");
|
||||
hlayout->addWidget(title_label);
|
||||
|
||||
vlayout->addLayout(hlayout);
|
||||
main_layout->addLayout(hlayout);
|
||||
|
||||
// description
|
||||
if (!desc.isEmpty()) {
|
||||
@@ -45,7 +45,7 @@ AbstractControl::AbstractControl(const QString &title, const QString &desc, cons
|
||||
description->setStyleSheet("font-size: 40px; color:grey");
|
||||
description->setWordWrap(true);
|
||||
description->setVisible(false);
|
||||
vlayout->addWidget(description);
|
||||
main_layout->addWidget(description);
|
||||
|
||||
connect(title_label, &QPushButton::clicked, [=]() {
|
||||
if (!description->isVisible()) {
|
||||
@@ -55,7 +55,6 @@ AbstractControl::AbstractControl(const QString &title, const QString &desc, cons
|
||||
});
|
||||
}
|
||||
|
||||
setLayout(vlayout);
|
||||
setStyleSheet("background-color: transparent;");
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,5 @@ DriveStats::DriveStats(QWidget* parent) : QWidget(parent) {
|
||||
RequestRepeater *repeater = new RequestRepeater(this, url, "ApiCache_DriveStats", 30);
|
||||
QObject::connect(repeater, &RequestRepeater::receivedResponse, this, &DriveStats::parseResponse);
|
||||
|
||||
setLayout(gl);
|
||||
setStyleSheet(R"(QLabel {font-size: 48px; font-weight: 500;})");
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include "selfdrive/hardware/hw.h"
|
||||
|
||||
InputDialog::InputDialog(const QString &prompt_text, QWidget *parent) : QDialog(parent) {
|
||||
layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(50, 50, 50, 50);
|
||||
layout->setSpacing(20);
|
||||
main_layout = new QVBoxLayout(this);
|
||||
main_layout->setContentsMargins(50, 50, 50, 50);
|
||||
main_layout->setSpacing(20);
|
||||
|
||||
// build header
|
||||
QHBoxLayout *header_layout = new QHBoxLayout();
|
||||
@@ -30,10 +30,10 @@ InputDialog::InputDialog(const QString &prompt_text, QWidget *parent) : QDialog(
|
||||
QObject::connect(cancel_btn, &QPushButton::released, this, &InputDialog::reject);
|
||||
QObject::connect(cancel_btn, &QPushButton::released, this, &InputDialog::cancel);
|
||||
|
||||
layout->addLayout(header_layout);
|
||||
main_layout->addLayout(header_layout);
|
||||
|
||||
// text box
|
||||
layout->addSpacing(20);
|
||||
main_layout->addSpacing(20);
|
||||
line = new QLineEdit();
|
||||
line->setStyleSheet(R"(
|
||||
border: none;
|
||||
@@ -42,11 +42,11 @@ InputDialog::InputDialog(const QString &prompt_text, QWidget *parent) : QDialog(
|
||||
font-weight: 500;
|
||||
padding: 10px;
|
||||
)");
|
||||
layout->addWidget(line, 1, Qt::AlignTop);
|
||||
main_layout->addWidget(line, 1, Qt::AlignTop);
|
||||
|
||||
k = new Keyboard(this);
|
||||
QObject::connect(k, &Keyboard::emitButton, this, &InputDialog::handleInput);
|
||||
layout->addWidget(k, 2, Qt::AlignBottom);
|
||||
main_layout->addWidget(k, 2, Qt::AlignBottom);
|
||||
|
||||
setStyleSheet(R"(
|
||||
* {
|
||||
@@ -55,7 +55,6 @@ InputDialog::InputDialog(const QString &prompt_text, QWidget *parent) : QDialog(
|
||||
}
|
||||
)");
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
QString InputDialog::getText(const QString &prompt, int minLength) {
|
||||
@@ -116,20 +115,20 @@ void InputDialog::setMinLength(int length) {
|
||||
ConfirmationDialog::ConfirmationDialog(const QString &prompt_text, const QString &confirm_text, const QString &cancel_text,
|
||||
QWidget *parent):QDialog(parent) {
|
||||
setWindowFlags(Qt::Popup);
|
||||
layout = new QVBoxLayout();
|
||||
layout->setMargin(25);
|
||||
main_layout = new QVBoxLayout(this);
|
||||
main_layout->setMargin(25);
|
||||
|
||||
prompt = new QLabel(prompt_text, this);
|
||||
prompt->setWordWrap(true);
|
||||
prompt->setAlignment(Qt::AlignHCenter);
|
||||
prompt->setStyleSheet(R"(font-size: 55px; font-weight: 400;)");
|
||||
layout->addWidget(prompt, 1, Qt::AlignTop | Qt::AlignHCenter);
|
||||
main_layout->addWidget(prompt, 1, Qt::AlignTop | Qt::AlignHCenter);
|
||||
|
||||
// cancel + confirm buttons
|
||||
QHBoxLayout *btn_layout = new QHBoxLayout();
|
||||
btn_layout->setSpacing(20);
|
||||
btn_layout->addStretch(1);
|
||||
layout->addLayout(btn_layout);
|
||||
main_layout->addLayout(btn_layout);
|
||||
|
||||
if (cancel_text.length()) {
|
||||
QPushButton* cancel_btn = new QPushButton(cancel_text);
|
||||
@@ -158,8 +157,6 @@ ConfirmationDialog::ConfirmationDialog(const QString &prompt_text, const QString
|
||||
background-color: #44444400;
|
||||
}
|
||||
)");
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
bool ConfirmationDialog::alert(const QString &prompt_text, QWidget *parent) {
|
||||
|
||||
@@ -25,7 +25,7 @@ private:
|
||||
QLineEdit *line;
|
||||
Keyboard *k;
|
||||
QLabel *label;
|
||||
QVBoxLayout *layout;
|
||||
QVBoxLayout *main_layout;
|
||||
|
||||
public slots:
|
||||
int exec() override;
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
private:
|
||||
QLabel *prompt;
|
||||
QVBoxLayout *layout;
|
||||
QVBoxLayout *main_layout;
|
||||
|
||||
public slots:
|
||||
int exec() override;
|
||||
|
||||
@@ -11,9 +11,9 @@ const int DEFAULT_STRETCH = 1;
|
||||
const int SPACEBAR_STRETCH = 3;
|
||||
|
||||
KeyboardLayout::KeyboardLayout(QWidget* parent, const std::vector<QVector<QString>>& layout) : QWidget(parent) {
|
||||
QVBoxLayout* vlayout = new QVBoxLayout;
|
||||
vlayout->setMargin(0);
|
||||
vlayout->setSpacing(35);
|
||||
QVBoxLayout* main_layout = new QVBoxLayout(this);
|
||||
main_layout->setMargin(0);
|
||||
main_layout->setSpacing(35);
|
||||
|
||||
QButtonGroup* btn_group = new QButtonGroup(this);
|
||||
QObject::connect(btn_group, SIGNAL(buttonClicked(QAbstractButton*)), parent, SLOT(handleButton(QAbstractButton*)));
|
||||
@@ -22,7 +22,7 @@ KeyboardLayout::KeyboardLayout(QWidget* parent, const std::vector<QVector<QStrin
|
||||
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||
hlayout->setSpacing(25);
|
||||
|
||||
if (vlayout->count() == 1) {
|
||||
if (main_layout->count() == 1) {
|
||||
hlayout->addSpacing(90);
|
||||
}
|
||||
|
||||
@@ -33,11 +33,11 @@ KeyboardLayout::KeyboardLayout(QWidget* parent, const std::vector<QVector<QStrin
|
||||
hlayout->addWidget(btn, p == QString(" ") ? SPACEBAR_STRETCH : DEFAULT_STRETCH);
|
||||
}
|
||||
|
||||
if (vlayout->count() == 1) {
|
||||
if (main_layout->count() == 1) {
|
||||
hlayout->addSpacing(90);
|
||||
}
|
||||
|
||||
vlayout->addLayout(hlayout);
|
||||
main_layout->addLayout(hlayout);
|
||||
}
|
||||
|
||||
setStyleSheet(R"(
|
||||
@@ -56,11 +56,10 @@ KeyboardLayout::KeyboardLayout(QWidget* parent, const std::vector<QVector<QStrin
|
||||
background-color: #000000;
|
||||
}
|
||||
)");
|
||||
setLayout(vlayout);
|
||||
}
|
||||
|
||||
Keyboard::Keyboard(QWidget *parent) : QFrame(parent) {
|
||||
main_layout = new QStackedLayout;
|
||||
main_layout = new QStackedLayout(this);
|
||||
main_layout->setMargin(0);
|
||||
|
||||
// lowercase
|
||||
@@ -99,7 +98,6 @@ Keyboard::Keyboard(QWidget *parent) : QFrame(parent) {
|
||||
};
|
||||
main_layout->addWidget(new KeyboardLayout(this, specials));
|
||||
|
||||
setLayout(main_layout);
|
||||
main_layout->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,15 +9,14 @@
|
||||
#include "selfdrive/hardware/hw.h"
|
||||
|
||||
OffroadAlert::OffroadAlert(QWidget* parent) : QFrame(parent) {
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->setMargin(50);
|
||||
layout->setSpacing(30);
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||
main_layout->setMargin(50);
|
||||
main_layout->setSpacing(30);
|
||||
|
||||
QWidget *alerts_widget = new QWidget(this);
|
||||
alerts_layout = new QVBoxLayout;
|
||||
alerts_layout = new QVBoxLayout(alerts_widget);
|
||||
alerts_layout->setMargin(0);
|
||||
alerts_layout->setSpacing(30);
|
||||
alerts_widget->setLayout(alerts_layout);
|
||||
alerts_widget->setStyleSheet("background-color: transparent;");
|
||||
|
||||
// release notes
|
||||
@@ -27,14 +26,14 @@ OffroadAlert::OffroadAlert(QWidget* parent) : QFrame(parent) {
|
||||
releaseNotes.setAlignment(Qt::AlignTop);
|
||||
|
||||
releaseNotesScroll = new ScrollView(&releaseNotes, this);
|
||||
layout->addWidget(releaseNotesScroll);
|
||||
main_layout->addWidget(releaseNotesScroll);
|
||||
|
||||
alertsScroll = new ScrollView(alerts_widget, this);
|
||||
layout->addWidget(alertsScroll);
|
||||
main_layout->addWidget(alertsScroll);
|
||||
|
||||
// bottom footer, dismiss + reboot buttons
|
||||
QHBoxLayout *footer_layout = new QHBoxLayout();
|
||||
layout->addLayout(footer_layout);
|
||||
main_layout->addLayout(footer_layout);
|
||||
|
||||
QPushButton *dismiss_btn = new QPushButton("Dismiss");
|
||||
dismiss_btn->setFixedSize(400, 125);
|
||||
@@ -47,7 +46,6 @@ OffroadAlert::OffroadAlert(QWidget* parent) : QFrame(parent) {
|
||||
footer_layout->addWidget(&rebootBtn, 0, Qt::AlignBottom | Qt::AlignRight);
|
||||
QObject::connect(&rebootBtn, &QPushButton::released, [=]() { Hardware::reboot(); });
|
||||
|
||||
setLayout(layout);
|
||||
setStyleSheet(R"(
|
||||
* {
|
||||
font-size: 48px;
|
||||
|
||||
@@ -18,9 +18,8 @@ using qrcodegen::QrCode;
|
||||
PairingQRWidget::PairingQRWidget(QWidget* parent) : QWidget(parent) {
|
||||
qrCode = new QLabel;
|
||||
qrCode->setScaledContents(true);
|
||||
QVBoxLayout* v = new QVBoxLayout;
|
||||
v->addWidget(qrCode, 0, Qt::AlignCenter);
|
||||
setLayout(v);
|
||||
QVBoxLayout* main_layout = new QVBoxLayout(this);
|
||||
main_layout->addWidget(qrCode, 0, Qt::AlignCenter);
|
||||
|
||||
QTimer* timer = new QTimer(this);
|
||||
timer->start(30 * 1000);
|
||||
@@ -73,7 +72,7 @@ void PairingQRWidget::updateQrCode(const QString &text) {
|
||||
}
|
||||
|
||||
PrimeUserWidget::PrimeUserWidget(QWidget* parent) : QWidget(parent) {
|
||||
mainLayout = new QVBoxLayout;
|
||||
mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setMargin(30);
|
||||
|
||||
QLabel* commaPrime = new QLabel("COMMA PRIME");
|
||||
@@ -94,7 +93,6 @@ PrimeUserWidget::PrimeUserWidget(QWidget* parent) : QWidget(parent) {
|
||||
points = new QLabel();
|
||||
mainLayout->addWidget(points, 0, Qt::AlignTop);
|
||||
|
||||
setLayout(mainLayout);
|
||||
setStyleSheet(R"(
|
||||
QLabel {
|
||||
font-size: 70px;
|
||||
@@ -132,11 +130,11 @@ void PrimeUserWidget::replyFinished(const QString &response) {
|
||||
}
|
||||
|
||||
PrimeAdWidget::PrimeAdWidget(QWidget* parent) : QWidget(parent) {
|
||||
QVBoxLayout* vlayout = new QVBoxLayout;
|
||||
vlayout->setMargin(30);
|
||||
vlayout->setSpacing(15);
|
||||
QVBoxLayout* main_layout = new QVBoxLayout(this);
|
||||
main_layout->setMargin(30);
|
||||
main_layout->setSpacing(15);
|
||||
|
||||
vlayout->addWidget(new QLabel("Upgrade now"), 1, Qt::AlignTop);
|
||||
main_layout->addWidget(new QLabel("Upgrade now"), 1, Qt::AlignTop);
|
||||
|
||||
QLabel* description = new QLabel("Become a comma prime member at my.comma.ai and get premium features!");
|
||||
description->setStyleSheet(R"(
|
||||
@@ -144,16 +142,14 @@ PrimeAdWidget::PrimeAdWidget(QWidget* parent) : QWidget(parent) {
|
||||
color: #b8b8b8;
|
||||
)");
|
||||
description->setWordWrap(true);
|
||||
vlayout->addWidget(description, 2, Qt::AlignTop);
|
||||
main_layout->addWidget(description, 2, Qt::AlignTop);
|
||||
|
||||
QVector<QString> features = {"✓ REMOTE ACCESS", "✓ 14 DAYS OF STORAGE", "✓ DEVELOPER PERKS"};
|
||||
for (auto &f: features) {
|
||||
QLabel* feature = new QLabel(f);
|
||||
feature->setStyleSheet(R"(font-size: 40px;)");
|
||||
vlayout->addWidget(feature, 0, Qt::AlignBottom);
|
||||
main_layout->addWidget(feature, 0, Qt::AlignBottom);
|
||||
}
|
||||
|
||||
setLayout(vlayout);
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +158,8 @@ SetupWidget::SetupWidget(QWidget* parent) : QFrame(parent) {
|
||||
|
||||
// Unpaired, registration prompt layout
|
||||
|
||||
QVBoxLayout* finishRegistationLayout = new QVBoxLayout;
|
||||
QWidget* finishRegistration = new QWidget;
|
||||
QVBoxLayout* finishRegistationLayout = new QVBoxLayout(finishRegistration);
|
||||
finishRegistationLayout->setMargin(30);
|
||||
|
||||
QLabel* registrationDescription = new QLabel("Pair your device with the comma connect app");
|
||||
@@ -186,13 +183,12 @@ SetupWidget::SetupWidget(QWidget* parent) : QFrame(parent) {
|
||||
finishRegistationLayout->addWidget(finishButton);
|
||||
QObject::connect(finishButton, &QPushButton::released, this, &SetupWidget::showQrCode);
|
||||
|
||||
QWidget* finishRegistration = new QWidget;
|
||||
finishRegistration->setLayout(finishRegistationLayout);
|
||||
mainLayout->addWidget(finishRegistration);
|
||||
|
||||
// Pairing QR code layout
|
||||
|
||||
QVBoxLayout* qrLayout = new QVBoxLayout;
|
||||
QWidget* q = new QWidget;
|
||||
QVBoxLayout* qrLayout = new QVBoxLayout(q);
|
||||
|
||||
qrLayout->addSpacing(30);
|
||||
QLabel* qrLabel = new QLabel("Scan with comma connect!");
|
||||
@@ -206,8 +202,6 @@ SetupWidget::SetupWidget(QWidget* parent) : QFrame(parent) {
|
||||
|
||||
qrLayout->addWidget(new PairingQRWidget, 1);
|
||||
|
||||
QWidget* q = new QWidget;
|
||||
q->setLayout(qrLayout);
|
||||
mainLayout->addWidget(q);
|
||||
|
||||
primeAd = new PrimeAdWidget;
|
||||
@@ -218,9 +212,8 @@ SetupWidget::SetupWidget(QWidget* parent) : QFrame(parent) {
|
||||
|
||||
mainLayout->setCurrentWidget(primeAd);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->addWidget(mainLayout);
|
||||
setLayout(layout);
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||
main_layout->addWidget(mainLayout);
|
||||
|
||||
setStyleSheet(R"(
|
||||
SetupWidget {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "selfdrive/hardware/hw.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
|
||||
main_layout = new QStackedLayout;
|
||||
main_layout = new QStackedLayout(this);
|
||||
main_layout->setMargin(0);
|
||||
|
||||
homeWindow = new HomeWindow(this);
|
||||
@@ -46,7 +46,6 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
|
||||
QFontDatabase::addApplicationFont("../assets/fonts/opensans_semibold.ttf");
|
||||
|
||||
// no outline to prevent the focus rectangle
|
||||
setLayout(main_layout);
|
||||
setStyleSheet(R"(
|
||||
* {
|
||||
font-family: Inter;
|
||||
|
||||
Reference in New Issue
Block a user