first Commit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// LightPanel.h — 光源控制面板(串口异步化)
|
||||
#pragma once
|
||||
#include <QObject>
|
||||
namespace Ui { class MainWindowClass; }
|
||||
class LightController;
|
||||
class QTimer;
|
||||
|
||||
class LightPanel : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LightPanel(Ui::MainWindowClass& ui, LightController* ctrl, QObject* parent);
|
||||
~LightPanel();
|
||||
void switchLight(bool leftOn, bool rightOn, int stabilizeMs = 120);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
|
||||
signals:
|
||||
void logMessage(const QString& msg);
|
||||
|
||||
private slots:
|
||||
void onConnect(); void onDisconnect();
|
||||
void onSetCH1(); void onSetCH2();
|
||||
void onLightOn(); void onLightOff();
|
||||
void onSliderCH1Changed(int v);
|
||||
void onSliderCH2Changed(int v);
|
||||
void refreshComPorts();
|
||||
|
||||
private:
|
||||
void updateStates();
|
||||
void queueBrightnessApply(int channelMask);
|
||||
void applyBrightnessNow();
|
||||
void syncLinkedBrightness(int value);
|
||||
void sendBrightnessCommand(int targetMask, int value);
|
||||
Ui::MainWindowClass& ui;
|
||||
LightController* m_ctrl;
|
||||
bool m_lightOpen = false;
|
||||
bool m_lightOutputOn = false;
|
||||
bool m_lightCommandBusy = false;
|
||||
QTimer* m_brightnessApplyTimer = nullptr;
|
||||
int m_pendingBrightnessMask = 0;
|
||||
};
|
||||
Reference in New Issue
Block a user