works
This commit is contained in:
parent
55926e762a
commit
a36de69f26
|
@ -38,6 +38,11 @@ void TrainingGuide::mouseReleaseEvent(QMouseEvent *e) {
|
|||
}
|
||||
}
|
||||
|
||||
void TrainingGuide::reset(){
|
||||
currentIndex = 0;
|
||||
image.load("../assets/training/step0.jpg");
|
||||
}
|
||||
|
||||
TrainingGuide::TrainingGuide(QWidget* parent) : QFrame(parent){
|
||||
image.load("../assets/training/step0.jpg");
|
||||
}
|
||||
|
@ -115,6 +120,7 @@ void OnboardingWindow::updateActiveScreen() {
|
|||
if (!accepted_terms) {
|
||||
setCurrentIndex(0);
|
||||
} else if (!training_done) {
|
||||
emit resetTrainingGuide();
|
||||
setCurrentIndex(1);
|
||||
} else {
|
||||
emit onboardingDone();
|
||||
|
@ -139,8 +145,10 @@ OnboardingWindow::OnboardingWindow(QWidget *parent) : QStackedWidget(parent) {
|
|||
Params().write_db_value("CompletedTrainingVersion", current_training_version);
|
||||
updateActiveScreen();
|
||||
});
|
||||
connect(this, SIGNAL(resetTrainingGuide()), tr, SLOT(reset()));
|
||||
addWidget(tr);
|
||||
|
||||
|
||||
setStyleSheet(R"(
|
||||
* {
|
||||
color: white;
|
||||
|
|
|
@ -29,6 +29,9 @@ private:
|
|||
|
||||
signals:
|
||||
void completedTraining();
|
||||
|
||||
public slots:
|
||||
void reset();
|
||||
};
|
||||
|
||||
|
||||
|
@ -61,6 +64,7 @@ private:
|
|||
|
||||
signals:
|
||||
void onboardingDone();
|
||||
void resetTrainingGuide();
|
||||
|
||||
public slots:
|
||||
void updateActiveScreen();
|
||||
|
|
|
@ -110,6 +110,17 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
|
|||
|
||||
device_layout->addWidget(horizontal_line());
|
||||
|
||||
device_layout->addWidget(new ButtonControl("Review Training Guide", "REVIEW",
|
||||
"Review the rules, features, and limitations of openpilot",
|
||||
[=]() {
|
||||
if (ConfirmationDialog::confirm("Are you sure you want to review the training guide?")) {
|
||||
Params().delete_db_value("CompletedTrainingVersion");
|
||||
emit reviewTrainingGuide();
|
||||
}
|
||||
}));
|
||||
|
||||
device_layout->addWidget(horizontal_line());
|
||||
|
||||
QString brand = params.read_db_bool("Passive") ? "dashcam" : "openpilot";
|
||||
device_layout->addWidget(new ButtonControl("Uninstall " + brand, "UNINSTALL",
|
||||
"",
|
||||
|
@ -253,6 +264,8 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
|
|||
{"Developer", new DeveloperPanel()},
|
||||
};
|
||||
|
||||
QObject::connect(panels[0].second, SIGNAL(reviewTrainingGuide()), this, SIGNAL(reviewTrainingGuide()));
|
||||
|
||||
sidebar_layout->addSpacing(45);
|
||||
nav_btns = new QButtonGroup();
|
||||
for (auto &[name, panel] : panels) {
|
||||
|
|
|
@ -17,6 +17,8 @@ class DevicePanel : public QWidget {
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit DevicePanel(QWidget* parent = nullptr);
|
||||
signals:
|
||||
void reviewTrainingGuide();
|
||||
};
|
||||
|
||||
class DeveloperPanel : public QFrame {
|
||||
|
@ -37,6 +39,7 @@ public:
|
|||
|
||||
signals:
|
||||
void closeSettings();
|
||||
void reviewTrainingGuide();
|
||||
|
||||
private:
|
||||
QPushButton *sidebar_alert_widget;
|
||||
|
|
|
@ -17,6 +17,7 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
|
|||
QObject::connect(homeWindow, SIGNAL(closeSettings()), this, SLOT(closeSettings()));
|
||||
QObject::connect(homeWindow, SIGNAL(offroadTransition(bool)), this, SLOT(offroadTransition(bool)));
|
||||
QObject::connect(settingsWindow, SIGNAL(closeSettings()), this, SLOT(closeSettings()));
|
||||
QObject::connect(settingsWindow, SIGNAL(reviewTrainingGuide()), this, SLOT(reviewTrainingGuide()));
|
||||
|
||||
// start at onboarding
|
||||
main_layout->setCurrentWidget(onboardingWindow);
|
||||
|
@ -47,6 +48,11 @@ void MainWindow::closeSettings() {
|
|||
main_layout->setCurrentWidget(homeWindow);
|
||||
}
|
||||
|
||||
void MainWindow::reviewTrainingGuide() {
|
||||
main_layout->setCurrentWidget(onboardingWindow);
|
||||
onboardingWindow->updateActiveScreen();
|
||||
}
|
||||
|
||||
bool MainWindow::eventFilter(QObject *obj, QEvent *event){
|
||||
if (event->type() == QEvent::MouseButtonPress) {
|
||||
homeWindow->glWindow->wake();
|
||||
|
|
|
@ -26,4 +26,5 @@ public slots:
|
|||
void offroadTransition(bool offroad);
|
||||
void openSettings();
|
||||
void closeSettings();
|
||||
void reviewTrainingGuide();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue