UI: PrimeUserWidget cleanup (#28300)

* cleanup

* setMargin is obsolete

* more
old-commit-hash: 13cf695738
beeps
Cameron Clough 2 years ago committed by GitHub
parent c2e86afc8c
commit 7db6687227
  1. 22
      selfdrive/ui/qt/widgets/prime.cc
  2. 10
      selfdrive/ui/qt/widgets/prime.h

@ -114,31 +114,30 @@ PairingPopup::PairingPopup(QWidget *parent) : QDialogBase(parent) {
} }
PrimeUserWidget::PrimeUserWidget(QWidget* parent) : QWidget(parent) { PrimeUserWidget::PrimeUserWidget(QWidget* parent) : QFrame(parent) {
mainLayout = new QVBoxLayout(this); QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setMargin(0); mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->setSpacing(30); mainLayout->setSpacing(30);
// subscribed prime layout // subscribed prime layout
QWidget *primeWidget = new QWidget; QWidget *primeWidget = new QWidget;
primeWidget->setObjectName("primeWidget"); primeWidget->setObjectName("primeWidget");
QVBoxLayout *primeLayout = new QVBoxLayout(primeWidget); QVBoxLayout *primeLayout = new QVBoxLayout(primeWidget);
primeLayout->setMargin(0); primeLayout->setContentsMargins(60, 50, 60, 50);
primeWidget->setContentsMargins(60, 50, 60, 50);
QLabel* subscribed = new QLabel(tr("✓ SUBSCRIBED")); QLabel *subscribed = new QLabel(tr("✓ SUBSCRIBED"));
subscribed->setStyleSheet("font-size: 41px; font-weight: bold; color: #86FF4E;"); subscribed->setStyleSheet("font-size: 41px; font-weight: bold; color: #86FF4E;");
primeLayout->addWidget(subscribed, 0, Qt::AlignTop); primeLayout->addWidget(subscribed, 0, Qt::AlignTop);
primeLayout->addSpacing(60); primeLayout->addSpacing(60);
QLabel* commaPrime = new QLabel(tr("comma prime")); QLabel *commaPrime = new QLabel(tr("comma prime"));
commaPrime->setStyleSheet("font-size: 75px; font-weight: bold;"); commaPrime->setStyleSheet("font-size: 75px; font-weight: bold;");
primeLayout->addWidget(commaPrime, 0, Qt::AlignTop); primeLayout->addWidget(commaPrime, 0, Qt::AlignTop);
primeLayout->addSpacing(20); primeLayout->addSpacing(20);
QLabel* connectUrl = new QLabel(tr("CONNECT.COMMA.AI")); QLabel *connectUrl = new QLabel(tr("CONNECT.COMMA.AI"));
connectUrl->setStyleSheet("font-size: 41px; font-family: Inter SemiBold; color: #A0A0A0;"); connectUrl->setStyleSheet("font-size: 41px; font-family: Inter SemiBold; color: #A0A0A0;");
primeLayout->addWidget(connectUrl, 0, Qt::AlignTop); primeLayout->addWidget(connectUrl, 0, Qt::AlignTop);
@ -148,10 +147,9 @@ PrimeUserWidget::PrimeUserWidget(QWidget* parent) : QWidget(parent) {
QWidget *pointsWidget = new QWidget; QWidget *pointsWidget = new QWidget;
pointsWidget->setObjectName("primeWidget"); pointsWidget->setObjectName("primeWidget");
QVBoxLayout *pointsLayout = new QVBoxLayout(pointsWidget); QVBoxLayout *pointsLayout = new QVBoxLayout(pointsWidget);
pointsLayout->setMargin(0); pointsLayout->setContentsMargins(60, 50, 60, 50);
pointsWidget->setContentsMargins(60, 50, 60, 50);
QLabel* commaPoints = new QLabel(tr("COMMA POINTS")); QLabel *commaPoints = new QLabel(tr("COMMA POINTS"));
commaPoints->setStyleSheet("font-size: 41px; font-family: Inter SemiBold;"); commaPoints->setStyleSheet("font-size: 41px; font-family: Inter SemiBold;");
pointsLayout->addWidget(commaPoints, 0, Qt::AlignTop); pointsLayout->addWidget(commaPoints, 0, Qt::AlignTop);
@ -183,7 +181,7 @@ void PrimeUserWidget::replyFinished(const QString &response) {
} }
PrimeAdWidget::PrimeAdWidget(QWidget* parent) : QFrame(parent) { PrimeAdWidget::PrimeAdWidget(QWidget* parent) : QFrame(parent) {
QVBoxLayout* main_layout = new QVBoxLayout(this); QVBoxLayout *main_layout = new QVBoxLayout(this);
main_layout->setContentsMargins(80, 90, 80, 60); main_layout->setContentsMargins(80, 90, 80, 60);
main_layout->setSpacing(0); main_layout->setSpacing(0);

@ -15,6 +15,7 @@ enum PrimeType {
MAGENTA_NEW = 4, MAGENTA_NEW = 4,
}; };
// pairing QR code // pairing QR code
class PairingQRWidget : public QWidget { class PairingQRWidget : public QWidget {
Q_OBJECT Q_OBJECT
@ -34,6 +35,7 @@ private slots:
void refresh(); void refresh();
}; };
// pairing popup widget // pairing popup widget
class PairingPopup : public QDialogBase { class PairingPopup : public QDialogBase {
Q_OBJECT Q_OBJECT
@ -42,15 +44,16 @@ public:
explicit PairingPopup(QWidget* parent); explicit PairingPopup(QWidget* parent);
}; };
// widget for paired users with prime // widget for paired users with prime
class PrimeUserWidget : public QWidget { class PrimeUserWidget : public QFrame {
Q_OBJECT Q_OBJECT
public: public:
explicit PrimeUserWidget(QWidget* parent = 0); explicit PrimeUserWidget(QWidget* parent = 0);
private: private:
QVBoxLayout* mainLayout; QLabel *points;
QLabel* points;
private slots: private slots:
void replyFinished(const QString &response); void replyFinished(const QString &response);
@ -64,6 +67,7 @@ public:
explicit PrimeAdWidget(QWidget* parent = 0); explicit PrimeAdWidget(QWidget* parent = 0);
}; };
// container widget // container widget
class SetupWidget : public QFrame { class SetupWidget : public QFrame {
Q_OBJECT Q_OBJECT

Loading…
Cancel
Save