UI: button released -> clicked (#21606)

old-commit-hash: 9215748080
commatwo_master
Adeeb Shihadeh 4 years ago committed by GitHub
parent e2c0ec924d
commit 17faf6e48f
  1. 4
      selfdrive/ui/qt/home.cc
  2. 8
      selfdrive/ui/qt/offroad/networking.cc
  3. 8
      selfdrive/ui/qt/offroad/onboarding.cc
  4. 22
      selfdrive/ui/qt/offroad/settings.cc
  5. 6
      selfdrive/ui/qt/setup/reset.cc
  6. 2
      selfdrive/ui/qt/setup/wifi.cc
  7. 4
      selfdrive/ui/qt/text.cc
  8. 2
      selfdrive/ui/qt/widgets/controls.cc
  9. 2
      selfdrive/ui/qt/widgets/controls.h
  10. 8
      selfdrive/ui/qt/widgets/input.cc
  11. 4
      selfdrive/ui/qt/widgets/offroad_alerts.cc
  12. 2
      selfdrive/ui/qt/widgets/setup.cc
  13. 2
      selfdrive/ui/qt/widgets/ssh_keys.cc

@ -99,13 +99,13 @@ OffroadHome::OffroadHome(QWidget* parent) : QFrame(parent) {
update_notif = new QPushButton("UPDATE");
update_notif->setVisible(false);
update_notif->setStyleSheet("background-color: #364DEF;");
QObject::connect(update_notif, &QPushButton::released, [=]() { center_layout->setCurrentIndex(1); });
QObject::connect(update_notif, &QPushButton::clicked, [=]() { center_layout->setCurrentIndex(1); });
header_layout->addWidget(update_notif, 0, Qt::AlignHCenter | Qt::AlignRight);
alert_notif = new QPushButton();
alert_notif->setVisible(false);
alert_notif->setStyleSheet("background-color: #E22C2C;");
QObject::connect(alert_notif, &QPushButton::released, [=] { center_layout->setCurrentIndex(2); });
QObject::connect(alert_notif, &QPushButton::clicked, [=] { center_layout->setCurrentIndex(2); });
header_layout->addWidget(alert_notif, 0, Qt::AlignHCenter | Qt::AlignRight);
header_layout->addWidget(new QLabel(getBrandVersion()), 0, Qt::AlignHCenter | Qt::AlignRight);

@ -30,7 +30,7 @@ Networking::Networking(QWidget* parent, bool show_advanced) : QFrame(parent) {
advancedSettings->setObjectName("advancedBtn");
advancedSettings->setStyleSheet("margin-right: 30px;");
advancedSettings->setFixedSize(350, 100);
connect(advancedSettings, &QPushButton::released, [=]() { main_layout->setCurrentWidget(an); });
connect(advancedSettings, &QPushButton::clicked, [=]() { main_layout->setCurrentWidget(an); });
vlayout->addSpacing(10);
vlayout->addWidget(advancedSettings, 0, Qt::AlignRight);
vlayout->addSpacing(10);
@ -125,7 +125,7 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid
QPushButton* back = new QPushButton("Back");
back->setObjectName("back_btn");
back->setFixedSize(500, 100);
connect(back, &QPushButton::released, [=]() { emit backPress(); });
connect(back, &QPushButton::clicked, [=]() { emit backPress(); });
main_layout->addWidget(back, 0, Qt::AlignLeft);
// Enable tethering layout
@ -136,7 +136,7 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid
// Change tethering password
ButtonControl *editPasswordButton = new ButtonControl("Tethering Password", "EDIT");
connect(editPasswordButton, &ButtonControl::released, [=]() {
connect(editPasswordButton, &ButtonControl::clicked, [=]() {
QString pass = InputDialog::getText("Enter new tethering password", this, "", true, 8, wifi->getTetheringPassword());
if (!pass.isEmpty()) {
wifi->changeTetheringPassword(pass);
@ -260,7 +260,7 @@ void WifiUI::refresh() {
if (wifi->isKnownConnection(network.ssid) && !wifi->isTetheringEnabled()) {
QPushButton *forgetBtn = new QPushButton("FORGET");
forgetBtn->setObjectName("forgetBtn");
QObject::connect(forgetBtn, &QPushButton::released, [=]() {
QObject::connect(forgetBtn, &QPushButton::clicked, [=]() {
if (ConfirmationDialog::confirm("Forget WiFi Network \"" + QString::fromUtf8(network.ssid) + "\"?", this)) {
wifi->forgetConnection(network.ssid);
}

@ -82,7 +82,7 @@ void TermsPage::showEvent(QShowEvent *event) {
QPushButton *decline_btn = new QPushButton("Decline");
buttons->addWidget(decline_btn);
QObject::connect(decline_btn, &QPushButton::released, this, &TermsPage::declinedTerms);
QObject::connect(decline_btn, &QPushButton::clicked, this, &TermsPage::declinedTerms);
accept_btn = new QPushButton("Scroll to accept");
accept_btn->setEnabled(false);
@ -95,7 +95,7 @@ void TermsPage::showEvent(QShowEvent *event) {
}
)");
buttons->addWidget(accept_btn);
QObject::connect(accept_btn, &QPushButton::released, this, &TermsPage::acceptedTerms);
QObject::connect(accept_btn, &QPushButton::clicked, this, &TermsPage::acceptedTerms);
}
void TermsPage::enableAccept() {
@ -125,12 +125,12 @@ void DeclinePage::showEvent(QShowEvent *event) {
QPushButton *back_btn = new QPushButton("Back");
buttons->addWidget(back_btn);
QObject::connect(back_btn, &QPushButton::released, this, &DeclinePage::getBack);
QObject::connect(back_btn, &QPushButton::clicked, this, &DeclinePage::getBack);
QPushButton *uninstall_btn = new QPushButton("Decline, uninstall " + getBrand());
uninstall_btn->setStyleSheet("background-color: #B73D3D");
buttons->addWidget(uninstall_btn);
QObject::connect(uninstall_btn, &QPushButton::released, [=]() {
QObject::connect(uninstall_btn, &QPushButton::clicked, [=]() {
Params().putBool("DoUninstall", true);
});
}

@ -118,11 +118,11 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
auto dcamBtn = new ButtonControl("Driver Camera", "PREVIEW",
"Preview the driver facing camera to help optimize device mounting position for best driver monitoring experience. (vehicle must be off)");
connect(dcamBtn, &ButtonControl::released, [=]() { emit showDriverView(); });
connect(dcamBtn, &ButtonControl::clicked, [=]() { emit showDriverView(); });
QString resetCalibDesc = "openpilot requires the device to be mounted within 4° left or right and within 5° up or down. openpilot is continuously calibrating, resetting is rarely required.";
auto resetCalibBtn = new ButtonControl("Reset Calibration", "RESET", resetCalibDesc);
connect(resetCalibBtn, &ButtonControl::released, [=]() {
connect(resetCalibBtn, &ButtonControl::clicked, [=]() {
if (ConfirmationDialog::confirm("Are you sure you want to reset calibration?", this)) {
Params().remove("CalibrationParams");
}
@ -152,7 +152,7 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
ButtonControl *retrainingBtn = nullptr;
if (!params.getBool("Passive")) {
retrainingBtn = new ButtonControl("Review Training Guide", "REVIEW", "Review the rules, features, and limitations of openpilot");
connect(retrainingBtn, &ButtonControl::released, [=]() {
connect(retrainingBtn, &ButtonControl::clicked, [=]() {
if (ConfirmationDialog::confirm("Are you sure you want to review the training guide?", this)) {
Params().remove("CompletedTrainingVersion");
emit reviewTrainingGuide();
@ -161,7 +161,7 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
}
auto uninstallBtn = new ButtonControl("Uninstall " + getBrand(), "UNINSTALL");
connect(uninstallBtn, &ButtonControl::released, [=]() {
connect(uninstallBtn, &ButtonControl::clicked, [=]() {
if (ConfirmationDialog::confirm("Are you sure you want to uninstall?", this)) {
Params().putBool("DoUninstall", true);
}
@ -182,7 +182,7 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
QPushButton *reboot_btn = new QPushButton("Reboot");
reboot_btn->setStyleSheet("height: 120px;border-radius: 15px; background-color: #393939;");
power_layout->addWidget(reboot_btn);
QObject::connect(reboot_btn, &QPushButton::released, [=]() {
QObject::connect(reboot_btn, &QPushButton::clicked, [=]() {
if (ConfirmationDialog::confirm("Are you sure you want to reboot?", this)) {
Hardware::reboot();
}
@ -191,7 +191,7 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
QPushButton *poweroff_btn = new QPushButton("Power Off");
poweroff_btn->setStyleSheet("height: 120px;border-radius: 15px; background-color: #E22C2C;");
power_layout->addWidget(poweroff_btn);
QObject::connect(poweroff_btn, &QPushButton::released, [=]() {
QObject::connect(poweroff_btn, &QPushButton::clicked, [=]() {
if (ConfirmationDialog::confirm("Are you sure you want to power off?", this)) {
Hardware::poweroff();
}
@ -207,7 +207,7 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : QWidget(parent) {
versionLbl = new LabelControl("Version", "", QString::fromStdString(params.get("ReleaseNotes")).trimmed());
lastUpdateLbl = new LabelControl("Last Update Check", "", "The last time openpilot successfully checked for an update. The updater only runs while the car is off.");
updateBtn = new ButtonControl("Check for Update", "");
connect(updateBtn, &ButtonControl::released, [=]() {
connect(updateBtn, &ButtonControl::clicked, [=]() {
if (params.getBool("IsOffroad")) {
const QString paramsPath = QString::fromStdString(params.getParamsPath());
fs_watch->addPath(paramsPath + "/d/LastUpdateTime");
@ -270,12 +270,12 @@ QWidget * network_panel(QWidget * parent) {
// wifi + tethering buttons
auto wifiBtn = new ButtonControl("WiFi Settings", "OPEN");
QObject::connect(wifiBtn, &ButtonControl::released, [=]() { HardwareEon::launch_wifi(); });
QObject::connect(wifiBtn, &ButtonControl::clicked, [=]() { HardwareEon::launch_wifi(); });
layout->addWidget(wifiBtn);
layout->addWidget(horizontal_line());
auto tetheringBtn = new ButtonControl("Tethering Settings", "OPEN");
QObject::connect(tetheringBtn, &ButtonControl::released, [=]() { HardwareEon::launch_tethering(); });
QObject::connect(tetheringBtn, &ButtonControl::clicked, [=]() { HardwareEon::launch_tethering(); });
layout->addWidget(tetheringBtn);
layout->addWidget(horizontal_line());
@ -320,7 +320,7 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
close_btn->setFixedSize(200, 200);
sidebar_layout->addSpacing(45);
sidebar_layout->addWidget(close_btn, 0, Qt::AlignCenter);
QObject::connect(close_btn, &QPushButton::released, this, &SettingsWindow::closeSettings);
QObject::connect(close_btn, &QPushButton::clicked, this, &SettingsWindow::closeSettings);
// setup panels
DevicePanel *device = new DevicePanel(this);
@ -372,7 +372,7 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
ScrollView *panel_frame = new ScrollView(panel, this);
panel_widget->addWidget(panel_frame);
QObject::connect(btn, &QPushButton::released, [=, w = panel_frame]() {
QObject::connect(btn, &QPushButton::clicked, [=, w = panel_frame]() {
btn->setChecked(true);
panel_widget->setCurrentWidget(w);
});

@ -67,12 +67,12 @@ Reset::Reset(bool recover, QWidget *parent) : QWidget(parent) {
rejectBtn = new QPushButton("Cancel");
blayout->addWidget(rejectBtn);
QObject::connect(rejectBtn, &QPushButton::released, QCoreApplication::instance(), &QCoreApplication::quit);
QObject::connect(rejectBtn, &QPushButton::clicked, QCoreApplication::instance(), &QCoreApplication::quit);
rebootBtn = new QPushButton("Reboot");
blayout->addWidget(rebootBtn);
#ifdef __aarch64__
QObject::connect(rebootBtn, &QPushButton::released, [=]{
QObject::connect(rebootBtn, &QPushButton::clicked, [=]{
std::system("sudo reboot");
});
#endif
@ -80,7 +80,7 @@ Reset::Reset(bool recover, QWidget *parent) : QWidget(parent) {
confirmBtn = new QPushButton("Confirm");
confirmBtn->setStyleSheet("background-color: #465BEA;");
blayout->addWidget(confirmBtn);
QObject::connect(confirmBtn, &QPushButton::released, this, &Reset::confirm);
QObject::connect(confirmBtn, &QPushButton::clicked, this, &Reset::confirm);
rejectBtn->setVisible(!recover);
rebootBtn->setVisible(recover);

@ -23,7 +23,7 @@ WifiSetup::WifiSetup(QWidget *parent) : QWidget(parent) {
finish_btn->setFixedSize(400, 200);
main_layout->addWidget(finish_btn, 0, Qt::AlignTop | Qt::AlignLeft);
QObject::connect(finish_btn, &QPushButton::released, this, &WifiSetup::finish);
QObject::connect(finish_btn, &QPushButton::clicked, this, &WifiSetup::finish);
QWidget* n = new Networking(this, true);

@ -34,12 +34,12 @@ int main(int argc, char *argv[]) {
QPushButton *btn = new QPushButton();
#ifdef __aarch64__
btn->setText("Reboot");
QObject::connect(btn, &QPushButton::released, [=]() {
QObject::connect(btn, &QPushButton::clicked, [=]() {
Hardware::reboot();
});
#else
btn->setText("Exit");
QObject::connect(btn, &QPushButton::released, &a, &QApplication::quit);
QObject::connect(btn, &QPushButton::clicked, &a, &QApplication::quit);
#endif
main_layout->addWidget(btn, 0, 0, Qt::AlignRight | Qt::AlignBottom);

@ -83,7 +83,7 @@ ButtonControl::ButtonControl(const QString &title, const QString &text, const QS
}
)");
btn.setFixedSize(250, 100);
QObject::connect(&btn, &QPushButton::released, this, &ButtonControl::released);
QObject::connect(&btn, &QPushButton::clicked, this, &ButtonControl::clicked);
hlayout->addWidget(&btn);
}

@ -75,7 +75,7 @@ public:
inline QString text() const { return btn.text(); }
signals:
void released();
void clicked();
public slots:
void setEnabled(bool enabled) { btn.setEnabled(enabled); };

@ -48,8 +48,8 @@ InputDialog::InputDialog(const QString &title, QWidget *parent, const QString &s
background-color: #444444;
)");
header_layout->addWidget(cancel_btn, 0, Qt::AlignRight);
QObject::connect(cancel_btn, &QPushButton::released, this, &InputDialog::reject);
QObject::connect(cancel_btn, &QPushButton::released, this, &InputDialog::cancel);
QObject::connect(cancel_btn, &QPushButton::clicked, this, &InputDialog::reject);
QObject::connect(cancel_btn, &QPushButton::clicked, this, &InputDialog::cancel);
main_layout->addLayout(header_layout);
@ -184,13 +184,13 @@ ConfirmationDialog::ConfirmationDialog(const QString &prompt_text, const QString
if (cancel_text.length()) {
QPushButton* cancel_btn = new QPushButton(cancel_text);
btn_layout->addWidget(cancel_btn);
QObject::connect(cancel_btn, &QPushButton::released, this, &ConfirmationDialog::reject);
QObject::connect(cancel_btn, &QPushButton::clicked, this, &ConfirmationDialog::reject);
}
if (confirm_text.length()) {
QPushButton* confirm_btn = new QPushButton(confirm_text);
btn_layout->addWidget(confirm_btn);
QObject::connect(confirm_btn, &QPushButton::released, this, &ConfirmationDialog::accept);
QObject::connect(confirm_btn, &QPushButton::clicked, this, &ConfirmationDialog::accept);
}
QVBoxLayout *outer_layout = new QVBoxLayout(this);

@ -26,13 +26,13 @@ AbstractAlert::AbstractAlert(bool hasRebootBtn, QWidget *parent) : QFrame(parent
QPushButton *dismiss_btn = new QPushButton("Dismiss");
dismiss_btn->setFixedSize(400, 125);
footer_layout->addWidget(dismiss_btn, 0, Qt::AlignBottom | Qt::AlignLeft);
QObject::connect(dismiss_btn, &QPushButton::released, this, &AbstractAlert::dismiss);
QObject::connect(dismiss_btn, &QPushButton::clicked, this, &AbstractAlert::dismiss);
if (hasRebootBtn) {
QPushButton *rebootBtn = new QPushButton("Reboot and Update");
rebootBtn->setFixedSize(600, 125);
footer_layout->addWidget(rebootBtn, 0, Qt::AlignBottom | Qt::AlignRight);
QObject::connect(rebootBtn, &QPushButton::released, [=]() { Hardware::reboot(); });
QObject::connect(rebootBtn, &QPushButton::clicked, [=]() { Hardware::reboot(); });
}
setStyleSheet(R"(
* {

@ -167,7 +167,7 @@ SetupWidget::SetupWidget(QWidget* parent) : QFrame(parent) {
background: #585858;
)");
finishRegistationLayout->addWidget(finishButton);
QObject::connect(finishButton, &QPushButton::released, this, &SetupWidget::showQrCode);
QObject::connect(finishButton, &QPushButton::clicked, this, &SetupWidget::showQrCode);
mainLayout->addWidget(finishRegistration);

@ -9,7 +9,7 @@ SshControl::SshControl() : ButtonControl("SSH Keys", "", "Warning: This grants S
username_label.setStyleSheet("color: #aaaaaa");
hlayout->insertWidget(1, &username_label);
QObject::connect(this, &ButtonControl::released, [=]() {
QObject::connect(this, &ButtonControl::clicked, [=]() {
if (text() == "ADD") {
QString username = InputDialog::getText("Enter your GitHub username", this);
if (username.length() > 0) {

Loading…
Cancel
Save