mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-05 15:35:40 +08:00
ui: sunnypilot menu refactor (#242)
* ui: `SPOptionControl` * This works * only need to initialize * Use QButtonGroup * Add method to update specific labels * Always init label with value * add method to update external methods * Update in another PR * Unnecessary * construct std map with defined range * Test that it works * In separate PR * change var * refreshLabels() instead * Revert "refreshLabels() instead" This reverts commit ceed9935cf48c7db974e45ab5ab496a7bc3f9f26. * allow individual `refresh` classes * now we can do it in another PR! * General: OnroadScreenOff * General: OnroadScreenOffBrightness * General: BrightnessControl * Controls: CameraOffset * Controls: PathOffset * Controls: AutoLaneChangeTimer * Controls: GapAdjustCruiseMode * Controls: TorqueFriction * Controls: TorqueMaxLatAccel * Controls: SpeedLimitOffsetType * Controls: SpeedLimitValueOffset * General: MaxTimeOffroad * Visuals: DevUiInfo * Visuals: ChevronInfo * unused * add comment
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -92,223 +92,175 @@ private:
|
||||
bool update = false;
|
||||
};
|
||||
|
||||
class SpeedLimitOffsetType : public AbstractControl {
|
||||
class SpeedLimitOffsetType : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SpeedLimitOffsetType();
|
||||
|
||||
signals:
|
||||
void offsetTypeUpdated();
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
};
|
||||
|
||||
class SpeedLimitValueOffset : public AbstractControl {
|
||||
class SpeedLimitValueOffset : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SpeedLimitValueOffset();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
Params params;
|
||||
};
|
||||
|
||||
class MaxTimeOffroad : public AbstractControl {
|
||||
class MaxTimeOffroad : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MaxTimeOffroad();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
Params params;
|
||||
};
|
||||
|
||||
class OnroadScreenOff : public AbstractControl {
|
||||
class OnroadScreenOff : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OnroadScreenOff();
|
||||
|
||||
signals:
|
||||
void toggleUpdated();
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
};
|
||||
|
||||
class OnroadScreenOffBrightness : public AbstractControl {
|
||||
class OnroadScreenOffBrightness : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OnroadScreenOffBrightness();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
Params params;
|
||||
};
|
||||
|
||||
class BrightnessControl : public AbstractControl {
|
||||
class BrightnessControl : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BrightnessControl();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
Params params;
|
||||
};
|
||||
|
||||
class CameraOffset : public AbstractControl {
|
||||
class CameraOffset : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CameraOffset();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
Params params;
|
||||
};
|
||||
|
||||
class PathOffset : public AbstractControl {
|
||||
class PathOffset : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PathOffset();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
Params params;
|
||||
};
|
||||
|
||||
class AutoLaneChangeTimer : public AbstractControl {
|
||||
class AutoLaneChangeTimer : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AutoLaneChangeTimer();
|
||||
|
||||
void refresh();
|
||||
|
||||
signals:
|
||||
void toggleUpdated();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
};
|
||||
|
||||
class GapAdjustCruiseMode : public AbstractControl {
|
||||
class GapAdjustCruiseMode : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GapAdjustCruiseMode();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
Params params;
|
||||
};
|
||||
|
||||
class TorqueFriction : public AbstractControl {
|
||||
class TorqueFriction : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TorqueFriction();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
Params params;
|
||||
};
|
||||
|
||||
class TorqueMaxLatAccel : public AbstractControl {
|
||||
class TorqueMaxLatAccel : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TorqueMaxLatAccel();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
Params params;
|
||||
};
|
||||
|
||||
class DevUiInfo : public AbstractControl {
|
||||
class DevUiInfo : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DevUiInfo();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
Params params;
|
||||
};
|
||||
|
||||
class ChevronInfo : public AbstractControl {
|
||||
class ChevronInfo : public SPOptionControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ChevronInfo();
|
||||
|
||||
private:
|
||||
QPushButton btnplus;
|
||||
QPushButton btnminus;
|
||||
QLabel label;
|
||||
Params params;
|
||||
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
Params params;
|
||||
};
|
||||
|
||||
class SidebarTemp : public QWidget {
|
||||
|
||||
Reference in New Issue
Block a user