From a529422db054ddbcad0bdacd456ffbf99a5f2d81 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Mon, 26 Aug 2024 00:44:18 +0800 Subject: [PATCH] ui: add prefix PRIME_TYPE_ to PrimeType enum values (#33371) Add Prefix PRIME_TYPE_ to PrimeType Enum Values old-commit-hash: 4bb00a042a7f0e60f42d4311805921b41395de83 --- selfdrive/ui/qt/network/networking.cc | 2 +- selfdrive/ui/qt/network/wifi_manager.cc | 2 +- selfdrive/ui/qt/offroad/settings.cc | 4 ++-- selfdrive/ui/qt/widgets/prime.cc | 2 +- selfdrive/ui/ui.h | 20 ++++++++++---------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/selfdrive/ui/qt/network/networking.cc b/selfdrive/ui/qt/network/networking.cc index d7cdddff44..250fa0fbf8 100644 --- a/selfdrive/ui/qt/network/networking.cc +++ b/selfdrive/ui/qt/network/networking.cc @@ -205,7 +205,7 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid wifi->updateGsmSettings(roamingEnabled, QString::fromStdString(params.get("GsmApn")), metered); connect(uiState(), &UIState::primeTypeChanged, this, [=](PrimeType prime_type) { - bool gsmVisible = prime_type == PrimeType::NONE || prime_type == PrimeType::LITE; + bool gsmVisible = prime_type == PrimeType::PRIME_TYPE_NONE || prime_type == PrimeType::PRIME_TYPE_LITE; roamingToggle->setVisible(gsmVisible); editApnButton->setVisible(gsmVisible); meteredToggle->setVisible(gsmVisible); diff --git a/selfdrive/ui/qt/network/wifi_manager.cc b/selfdrive/ui/qt/network/wifi_manager.cc index 717da47096..b0c9535273 100644 --- a/selfdrive/ui/qt/network/wifi_manager.cc +++ b/selfdrive/ui/qt/network/wifi_manager.cc @@ -446,7 +446,7 @@ void WifiManager::addTetheringConnection() { void WifiManager::tetheringActivated(QDBusPendingCallWatcher *call) { int prime_type = uiState()->primeType(); - int ipv4_forward = (prime_type == PrimeType::NONE || prime_type == PrimeType::LITE); + int ipv4_forward = (prime_type == PrimeType::PRIME_TYPE_NONE || prime_type == PrimeType::PRIME_TYPE_LITE); if (!ipv4_forward) { QTimer::singleShot(5000, this, [=] { diff --git a/selfdrive/ui/qt/offroad/settings.cc b/selfdrive/ui/qt/offroad/settings.cc index dc60d40e48..1c17fdcdf7 100644 --- a/selfdrive/ui/qt/offroad/settings.cc +++ b/selfdrive/ui/qt/offroad/settings.cc @@ -248,7 +248,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) { addItem(translateBtn); QObject::connect(uiState(), &UIState::primeTypeChanged, [this] (PrimeType type) { - pair_device->setVisible(type == PrimeType::UNPAIRED); + pair_device->setVisible(type == PrimeType::PRIME_TYPE_UNPAIRED); }); QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) { for (auto btn : findChildren()) { @@ -336,7 +336,7 @@ void DevicePanel::poweroff() { } void DevicePanel::showEvent(QShowEvent *event) { - pair_device->setVisible(uiState()->primeType() == PrimeType::UNPAIRED); + pair_device->setVisible(uiState()->primeType() == PrimeType::PRIME_TYPE_UNPAIRED); ListWidget::showEvent(event); } diff --git a/selfdrive/ui/qt/widgets/prime.cc b/selfdrive/ui/qt/widgets/prime.cc index 25712c26c7..f86258ea4f 100644 --- a/selfdrive/ui/qt/widgets/prime.cc +++ b/selfdrive/ui/qt/widgets/prime.cc @@ -267,7 +267,7 @@ void SetupWidget::replyFinished(const QString &response, bool success) { QJsonObject json = doc.object(); bool is_paired = json["is_paired"].toBool(); PrimeType prime_type = static_cast(json["prime_type"].toInt()); - uiState()->setPrimeType(is_paired ? prime_type : PrimeType::UNPAIRED); + uiState()->setPrimeType(is_paired ? prime_type : PrimeType::PRIME_TYPE_UNPAIRED); if (!is_paired) { mainLayout->setCurrentIndex(0); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 237abe1224..4efdad8ac0 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -53,14 +53,14 @@ typedef enum UIStatus { } UIStatus; enum PrimeType { - UNKNOWN = -2, - UNPAIRED = -1, - NONE = 0, - MAGENTA = 1, - LITE = 2, - BLUE = 3, - MAGENTA_NEW = 4, - PURPLE = 5, + PRIME_TYPE_UNKNOWN = -2, + PRIME_TYPE_UNPAIRED = -1, + PRIME_TYPE_NONE = 0, + PRIME_TYPE_MAGENTA = 1, + PRIME_TYPE_LITE = 2, + PRIME_TYPE_BLUE = 3, + PRIME_TYPE_MAGENTA_NEW = 4, + PRIME_TYPE_PURPLE = 5, }; const QColor bg_colors [] = { @@ -115,7 +115,7 @@ public: void setPrimeType(PrimeType type); inline PrimeType primeType() const { return prime_type; } - inline bool hasPrime() const { return prime_type > PrimeType::NONE; } + inline bool hasPrime() const { return prime_type > PrimeType::PRIME_TYPE_NONE; } int fb_w = 0, fb_h = 0; @@ -140,7 +140,7 @@ private slots: private: QTimer *timer; bool started_prev = false; - PrimeType prime_type = PrimeType::UNKNOWN; + PrimeType prime_type = PrimeType::PRIME_TYPE_UNKNOWN; }; UIState *uiState();