mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-03 20:42:09 +08:00
144 lines
3.0 KiB
C++
144 lines
3.0 KiB
C++
#pragma once
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
#include <QButtonGroup>
|
|
#include <QFrame>
|
|
#include <QLabel>
|
|
#include <QMouseEvent>
|
|
#include <QPushButton>
|
|
#include <QStackedWidget>
|
|
#include <QWidget>
|
|
|
|
#include "selfdrive/ui/ui.h"
|
|
#include "selfdrive/ui/qt/util.h"
|
|
#include "selfdrive/ui/qt/widgets/controls.h"
|
|
|
|
// ********** settings window + top-level panels **********
|
|
class SettingsWindow : public QFrame {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit SettingsWindow(QWidget *parent = 0);
|
|
void setCurrentPanel(int index, const QString ¶m = "");
|
|
|
|
protected:
|
|
void showEvent(QShowEvent *event) override;
|
|
|
|
void hideEvent(QHideEvent *event) override;
|
|
|
|
signals:
|
|
void closeSettings();
|
|
void reviewTrainingGuide();
|
|
void showDriverView();
|
|
void expandToggleDescription(const QString ¶m);
|
|
void scrollToToggle(const QString ¶m);
|
|
|
|
void closePanel();
|
|
void closeSubPanel();
|
|
void closeSubSubPanel();
|
|
void closeSubSubSubPanel();
|
|
void updateMetric(bool isMetric, bool bootRun=false);
|
|
void updateTuningLevel();
|
|
|
|
private:
|
|
QPushButton *sidebar_alert_widget;
|
|
QWidget *sidebar_widget;
|
|
QButtonGroup *nav_btns;
|
|
QStackedWidget *panel_widget;
|
|
|
|
void updateDeveloperToggle(int tuningLevel);
|
|
|
|
bool panelOpen;
|
|
bool subPanelOpen;
|
|
bool subSubPanelOpen;
|
|
bool subSubSubPanelOpen;
|
|
|
|
Params params;
|
|
};
|
|
|
|
class GalaxyQRPopup : public DialogBase {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit GalaxyQRPopup(const QString &url, QWidget *parent = nullptr);
|
|
|
|
protected:
|
|
void mousePressEvent(QMouseEvent *event) override {
|
|
reject();
|
|
DialogBase::mousePressEvent(event);
|
|
}
|
|
};
|
|
|
|
class DevicePanel : public ListWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit DevicePanel(SettingsWindow *parent);
|
|
|
|
signals:
|
|
void reviewTrainingGuide();
|
|
void showDriverView();
|
|
|
|
private slots:
|
|
void poweroff();
|
|
void reboot();
|
|
void updateCalibDescription();
|
|
|
|
private:
|
|
Params params;
|
|
ButtonControl *pair_device;
|
|
ButtonControl *pair_galaxy;
|
|
QPushButton *galaxy_qr_btn;
|
|
ButtonControl *resetCalibBtn;
|
|
ButtonControl *resetDmCalibBtn;
|
|
};
|
|
|
|
class TogglesPanel : public ListWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit TogglesPanel(SettingsWindow *parent);
|
|
void showEvent(QShowEvent *event) override;
|
|
|
|
signals:
|
|
void updateMetric(bool metric, bool bootRun=false);
|
|
void simpleModeChanged(bool enabled);
|
|
|
|
public slots:
|
|
void expandToggleDescription(const QString ¶m);
|
|
void scrollToToggle(const QString ¶m);
|
|
|
|
private slots:
|
|
void updateState(const UIState &s);
|
|
|
|
private:
|
|
Params params;
|
|
std::map<std::string, ParamControl*> toggles;
|
|
ButtonParamControl *long_personality_setting;
|
|
|
|
void syncRhdToggle();
|
|
void updateToggles();
|
|
};
|
|
|
|
class SoftwarePanel : public ListWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit SoftwarePanel(QWidget* parent = nullptr);
|
|
|
|
private:
|
|
void showEvent(QShowEvent *event) override;
|
|
void updateLabels();
|
|
void checkForUpdates();
|
|
|
|
bool is_onroad = false;
|
|
|
|
QLabel *onroadLbl;
|
|
LabelControl *versionLbl;
|
|
ButtonControl *installBtn;
|
|
ButtonControl *downloadBtn;
|
|
ButtonControl *targetBranchBtn;
|
|
|
|
Params params;
|
|
ParamWatcher *fs_watch;
|
|
};
|