mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-01 11:32:21 +08:00
ui: set dialog confirm button text (#26365)
* ui: set dialog confirm button text * short * blue confirm old-commit-hash: e78280da12c799ca7b5e391c53421607a5df617c
This commit is contained in:
@@ -314,7 +314,7 @@ void WifiUI::refresh() {
|
||||
QPushButton *forgetBtn = new QPushButton(tr("FORGET"));
|
||||
forgetBtn->setObjectName("forgetBtn");
|
||||
QObject::connect(forgetBtn, &QPushButton::clicked, [=]() {
|
||||
if (ConfirmationDialog::confirm(tr("Forget Wi-Fi Network \"%1\"?").arg(QString::fromUtf8(network.ssid)), this)) {
|
||||
if (ConfirmationDialog::confirm(tr("Forget Wi-Fi Network \"%1\"?").arg(QString::fromUtf8(network.ssid)), tr("Forget"), this)) {
|
||||
wifi->forgetConnection(network.ssid);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -169,7 +169,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
|
||||
auto resetCalibBtn = new ButtonControl(tr("Reset Calibration"), tr("RESET"), "");
|
||||
connect(resetCalibBtn, &ButtonControl::showDescriptionEvent, this, &DevicePanel::updateCalibDescription);
|
||||
connect(resetCalibBtn, &ButtonControl::clicked, [&]() {
|
||||
if (ConfirmationDialog::confirm(tr("Are you sure you want to reset calibration?"), this)) {
|
||||
if (ConfirmationDialog::confirm(tr("Are you sure you want to reset calibration?"), tr("Reset"), this)) {
|
||||
params.remove("CalibrationParams");
|
||||
}
|
||||
});
|
||||
@@ -178,7 +178,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
|
||||
if (!params.getBool("Passive")) {
|
||||
auto retrainingBtn = new ButtonControl(tr("Review Training Guide"), tr("REVIEW"), tr("Review the rules, features, and limitations of openpilot"));
|
||||
connect(retrainingBtn, &ButtonControl::clicked, [=]() {
|
||||
if (ConfirmationDialog::confirm(tr("Are you sure you want to review the training guide?"), this)) {
|
||||
if (ConfirmationDialog::confirm(tr("Are you sure you want to review the training guide?"), tr("Review"), this)) {
|
||||
emit reviewTrainingGuide();
|
||||
}
|
||||
});
|
||||
@@ -266,7 +266,7 @@ void DevicePanel::updateCalibDescription() {
|
||||
|
||||
void DevicePanel::reboot() {
|
||||
if (!uiState()->engaged()) {
|
||||
if (ConfirmationDialog::confirm(tr("Are you sure you want to reboot?"), this)) {
|
||||
if (ConfirmationDialog::confirm(tr("Are you sure you want to reboot?"), tr("Reboot"), this)) {
|
||||
// Check engaged again in case it changed while the dialog was open
|
||||
if (!uiState()->engaged()) {
|
||||
Params().putBool("DoReboot", true);
|
||||
@@ -279,7 +279,7 @@ void DevicePanel::reboot() {
|
||||
|
||||
void DevicePanel::poweroff() {
|
||||
if (!uiState()->engaged()) {
|
||||
if (ConfirmationDialog::confirm(tr("Are you sure you want to power off?"), this)) {
|
||||
if (ConfirmationDialog::confirm(tr("Are you sure you want to power off?"), tr("Power Off"), this)) {
|
||||
// Check engaged again in case it changed while the dialog was open
|
||||
if (!uiState()->engaged()) {
|
||||
Params().putBool("DoShutdown", true);
|
||||
|
||||
@@ -77,7 +77,7 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) {
|
||||
// uninstall button
|
||||
auto uninstallBtn = new ButtonControl(tr("Uninstall %1").arg(getBrand()), tr("UNINSTALL"));
|
||||
connect(uninstallBtn, &ButtonControl::clicked, [&]() {
|
||||
if (ConfirmationDialog::confirm(tr("Are you sure you want to uninstall?"), this)) {
|
||||
if (ConfirmationDialog::confirm(tr("Are you sure you want to uninstall?"), tr("Uninstall"), this)) {
|
||||
params.putBool("DoUninstall", true);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -185,7 +185,11 @@ void InputDialog::setMinLength(int length) {
|
||||
ConfirmationDialog::ConfirmationDialog(const QString &prompt_text, const QString &confirm_text, const QString &cancel_text,
|
||||
const bool rich, QWidget *parent) : QDialogBase(parent) {
|
||||
QFrame *container = new QFrame(this);
|
||||
container->setStyleSheet("QFrame { background-color: #1B1B1B; color: #C9C9C9; }");
|
||||
container->setStyleSheet(R"(
|
||||
QFrame { background-color: #1B1B1B; color: #C9C9C9; }
|
||||
#confirm_btn { background-color: #465BEA; }
|
||||
#confirm_btn:pressed { background-color: #3049F4; }
|
||||
)");
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(container);
|
||||
main_layout->setContentsMargins(32, rich ? 32 : 120, 32, 32);
|
||||
|
||||
@@ -208,6 +212,7 @@ ConfirmationDialog::ConfirmationDialog(const QString &prompt_text, const QString
|
||||
|
||||
if (confirm_text.length()) {
|
||||
QPushButton* confirm_btn = new QPushButton(confirm_text);
|
||||
confirm_btn->setObjectName("confirm_btn");
|
||||
btn_layout->addWidget(confirm_btn);
|
||||
QObject::connect(confirm_btn, &QPushButton::clicked, this, &ConfirmationDialog::accept);
|
||||
}
|
||||
@@ -223,8 +228,8 @@ bool ConfirmationDialog::alert(const QString &prompt_text, QWidget *parent) {
|
||||
return d.exec();
|
||||
}
|
||||
|
||||
bool ConfirmationDialog::confirm(const QString &prompt_text, QWidget *parent) {
|
||||
ConfirmationDialog d = ConfirmationDialog(prompt_text, tr("Ok"), tr("Cancel"), false, parent);
|
||||
bool ConfirmationDialog::confirm(const QString &prompt_text, const QString &confirm_text, QWidget *parent) {
|
||||
ConfirmationDialog d = ConfirmationDialog(prompt_text, confirm_text, tr("Cancel"), false, parent);
|
||||
return d.exec();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
explicit ConfirmationDialog(const QString &prompt_text, const QString &confirm_text,
|
||||
const QString &cancel_text, const bool rich, QWidget* parent);
|
||||
static bool alert(const QString &prompt_text, QWidget *parent);
|
||||
static bool confirm(const QString &prompt_text, QWidget *parent);
|
||||
static bool confirm(const QString &prompt_text, const QString &confirm_text, QWidget *parent);
|
||||
static bool rich(const QString &prompt_text, QWidget *parent);
|
||||
};
|
||||
|
||||
|
||||
@@ -238,6 +238,14 @@
|
||||
<source>Disengage to Power Off</source>
|
||||
<translation>openpilot をキャンセルしてシャットダウンができます</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reset</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Review</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DriveStats</name>
|
||||
@@ -854,6 +862,10 @@ location set</source>
|
||||
<source>CHECK</source>
|
||||
<translation>確認</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Uninstall</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SshControl</name>
|
||||
@@ -1056,5 +1068,9 @@ location set</source>
|
||||
<source>Forget Wi-Fi Network "%1"?</source>
|
||||
<translation>Wi-Fiネットワーク%1を削除してもよろしいですか?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Forget</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@@ -238,6 +238,14 @@
|
||||
<source>Disengage to Power Off</source>
|
||||
<translation>전원을 종료하려면 해제하세요</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reset</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Review</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DriveStats</name>
|
||||
@@ -854,6 +862,10 @@ location set</source>
|
||||
<source>CHECK</source>
|
||||
<translation>확인</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Uninstall</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SshControl</name>
|
||||
@@ -1056,5 +1068,9 @@ location set</source>
|
||||
<source>Forget Wi-Fi Network "%1"?</source>
|
||||
<translation>wifi 네트워크 저장안함 "%1"?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Forget</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@@ -238,6 +238,14 @@
|
||||
<source>Disengage to Power Off</source>
|
||||
<translation>Desacione para Desligar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reset</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Review</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DriveStats</name>
|
||||
@@ -858,6 +866,10 @@ trabalho definido</translation>
|
||||
<source>CHECK</source>
|
||||
<translation>VERIFICAR</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Uninstall</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SshControl</name>
|
||||
@@ -1060,5 +1072,9 @@ trabalho definido</translation>
|
||||
<source>Forget Wi-Fi Network "%1"?</source>
|
||||
<translation>Esquecer Rede Wi-Fi "%1"?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Forget</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@@ -238,6 +238,14 @@
|
||||
<source>Disengage to Power Off</source>
|
||||
<translation>取消openpilot以关机</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reset</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Review</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DriveStats</name>
|
||||
@@ -852,6 +860,10 @@ location set</source>
|
||||
<source>CHECK</source>
|
||||
<translation>查看</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Uninstall</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SshControl</name>
|
||||
@@ -1054,5 +1066,9 @@ location set</source>
|
||||
<source>Forget Wi-Fi Network "%1"?</source>
|
||||
<translation>忘记WiFi网络 "%1"?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Forget</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@@ -238,6 +238,14 @@
|
||||
<source>Disengage to Power Off</source>
|
||||
<translation>請先取消控車才能關機</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reset</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Review</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DriveStats</name>
|
||||
@@ -854,6 +862,10 @@ location set</source>
|
||||
<source>CHECK</source>
|
||||
<translation>檢查</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Uninstall</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SshControl</name>
|
||||
@@ -1056,5 +1068,9 @@ location set</source>
|
||||
<source>Forget Wi-Fi Network "%1"?</source>
|
||||
<translation>清除 Wi-Fi 網路 "%1"?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Forget</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
Reference in New Issue
Block a user