mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-09-07 08:43:40 +08:00
133 lines
2.9 KiB
C++
133 lines
2.9 KiB
C++
#pragma once
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
#include <QButtonGroup>
|
|
#include <QFrame>
|
|
#include <QLabel>
|
|
#include <QPushButton>
|
|
#include <QStackedWidget>
|
|
#include <QWidget>
|
|
|
|
#include "selfdrive/ui/qt/util.h"
|
|
|
|
#ifdef SUNNYPILOT
|
|
#include "selfdrive/ui/sunnypilot/ui.h"
|
|
#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h"
|
|
#define ListWidget ListWidgetSP
|
|
#define ParamControl ParamControlSP
|
|
#define ButtonControl ButtonControlSP
|
|
#define ButtonParamControl ButtonParamControlSP
|
|
#define ToggleControl ToggleControlSP
|
|
#define LabelControl LabelControlSP
|
|
#else
|
|
#include "selfdrive/ui/ui.h"
|
|
#include "selfdrive/ui/qt/widgets/controls.h"
|
|
#endif
|
|
|
|
// ********** 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;
|
|
|
|
signals:
|
|
void closeSettings();
|
|
void reviewTrainingGuide();
|
|
void showDriverView();
|
|
void expandToggleDescription(const QString ¶m);
|
|
void scrollToToggle(const QString ¶m);
|
|
|
|
protected:
|
|
QPushButton *sidebar_alert_widget;
|
|
QWidget *sidebar_widget;
|
|
QButtonGroup *nav_btns;
|
|
QStackedWidget *panel_widget;
|
|
};
|
|
|
|
class DevicePanel : public ListWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit DevicePanel(SettingsWindow *parent);
|
|
|
|
signals:
|
|
void reviewTrainingGuide();
|
|
void showDriverView();
|
|
|
|
protected slots:
|
|
void poweroff();
|
|
void reboot();
|
|
void updateCalibDescription();
|
|
|
|
protected:
|
|
Params params;
|
|
ButtonControl *pair_device;
|
|
ButtonControl *resetCalibBtn;
|
|
};
|
|
|
|
class InfiniteCableTogglesPanel : public ListWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit InfiniteCableTogglesPanel(SettingsWindow *parent);
|
|
|
|
public slots:
|
|
void expandToggleDescription(const QString ¶m);
|
|
void scrollToToggle(const QString ¶m);
|
|
|
|
protected:
|
|
Params params;
|
|
std::map<std::string, ParamControl*> toggles;
|
|
};
|
|
|
|
class TogglesPanel : public ListWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit TogglesPanel(SettingsWindow *parent);
|
|
void showEvent(QShowEvent *event) override;
|
|
|
|
public slots:
|
|
void expandToggleDescription(const QString ¶m);
|
|
void scrollToToggle(const QString ¶m);
|
|
|
|
protected slots:
|
|
virtual void updateState(const UIState &s);
|
|
|
|
protected:
|
|
Params params;
|
|
std::map<std::string, ParamControl*> toggles;
|
|
ButtonParamControl *long_personality_setting;
|
|
|
|
virtual void updateToggles();
|
|
};
|
|
|
|
class SoftwarePanel : public ListWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit SoftwarePanel(QWidget* parent = nullptr);
|
|
|
|
protected:
|
|
void showEvent(QShowEvent *event) override;
|
|
virtual void updateLabels();
|
|
void checkForUpdates();
|
|
|
|
bool is_onroad = false;
|
|
|
|
QLabel *onroadLbl;
|
|
LabelControl *versionLbl;
|
|
ButtonControl *installBtn;
|
|
ButtonControl *downloadBtn;
|
|
ButtonControl *targetBranchBtn;
|
|
|
|
Params params;
|
|
ParamWatcher *fs_watch;
|
|
};
|
|
|
|
// Forward declaration
|
|
class FirehosePanel;
|