28 #include <QMessageBox>
30 #include "ui_savepage.h"
37 , m_successfulWrite(false)
40 connect(ui->saveButton, &QAbstractButton::clicked,
this, &SavePage::writeToController);
55 return m_successfulWrite;
58 void SavePage::writeToController()
60 if (!
getWizard()->getConnectionManager()->isConnected()) {
61 QMessageBox msgBox(
this);
62 msgBox.setText(tr(
"An OpenPilot controller must be connected to your computer to save the "
63 "configuration.\nPlease connect your OpenPilot controller to your "
64 "computer and try again."));
65 msgBox.setStandardButtons(QMessageBox::Ok);
66 msgBox.setDefaultButton(QMessageBox::Ok);
75 m_successfulWrite = helper.setupVehicle();
78 ui->saveProgressLabel->setText(
79 QString(
"<font color='%1'>%2</font>")
80 .arg(m_successfulWrite ?
"green" :
"red", ui->saveProgressLabel->text()));
83 emit completeChanged();
86 void SavePage::enableButtons(
bool enable)
88 ui->saveButton->setEnabled(enable);
89 getWizard()->button(QWizard::NextButton)->setEnabled(enable);
90 getWizard()->button(QWizard::CancelButton)->setEnabled(enable);
91 getWizard()->button(QWizard::BackButton)->setEnabled(enable);
92 getWizard()->button(QWizard::CustomButton1)->setEnabled(enable);
93 QApplication::processEvents();
96 void SavePage::saveProgress(
int total,
int current, QString description)
98 qDebug() <<
"Progress " << current <<
"(" << total <<
")";
99 if (ui->saveProgressBar->maximum() != total) {
100 ui->saveProgressBar->setMaximum(total);
102 if (ui->saveProgressBar->value() != current) {
103 ui->saveProgressBar->setValue(current);
105 if (ui->saveProgressLabel->text() != description) {
106 ui->saveProgressLabel->setText(description);
The SetupWizard class is the main interface to the setup wizard. It provides selects the sequence of ...
SetupWizard * getWizard() const
void saveProgress(int total, int current, QString description)
The VehicleConfigurationHelper class provides an interface between the settings selected in the wizar...
SavePage(SetupWizard *wizard, QWidget *parent=nullptr)