mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
Ref T111, blink function for LED
This commit is contained in:
committed by
Mathew Sutcliffe
parent
ccdfa8e12f
commit
c2ff451415
@@ -237,6 +237,11 @@ namespace BlackGui
|
|||||||
setLed();
|
setLed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CLedWidget::blink(int resetTimeMs)
|
||||||
|
{
|
||||||
|
this->setOn(true, resetTimeMs);
|
||||||
|
}
|
||||||
|
|
||||||
void CLedWidget::setTriState(int resetTimeMs)
|
void CLedWidget::setTriState(int resetTimeMs)
|
||||||
{
|
{
|
||||||
if (resetTimeMs < 0 && m_resetTimer.isActive()) { m_resetTimer.stop();}
|
if (resetTimeMs < 0 && m_resetTimer.isActive()) { m_resetTimer.stop();}
|
||||||
@@ -283,13 +288,13 @@ namespace BlackGui
|
|||||||
|
|
||||||
const QStringList &CLedWidget::shapes()
|
const QStringList &CLedWidget::shapes()
|
||||||
{
|
{
|
||||||
static const QStringList shapes( {":/qled/icons/qled/circle_" , ":/qled/icons/qled/square_" , ":/qled/icons/qled/triang_" , ":/qled/icons/qled/round_"});
|
static const QStringList shapes({":/qled/icons/qled/circle_" , ":/qled/icons/qled/square_" , ":/qled/icons/qled/triang_" , ":/qled/icons/qled/round_"});
|
||||||
return shapes;
|
return shapes;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList &CLedWidget::colorFiles()
|
const QStringList &CLedWidget::colorFiles()
|
||||||
{
|
{
|
||||||
static const QStringList colors( { "red.svg", "green.svg", "yellow.svg", "grey.svg", "orange.svg", "purple.svg", "blue.svg", "black.svg" });
|
static const QStringList colors({ "red.svg", "green.svg", "yellow.svg", "grey.svg", "orange.svg", "purple.svg", "blue.svg", "black.svg" });
|
||||||
return colors;
|
return colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ namespace BlackGui
|
|||||||
//! Allows to set the led value {true, false}
|
//! Allows to set the led value {true, false}
|
||||||
void setOn(bool on, int resetTimeMs = -1);
|
void setOn(bool on, int resetTimeMs = -1);
|
||||||
|
|
||||||
|
//! Set to on for resetTimeMs
|
||||||
|
void blink(int resetTimeMs = 500);
|
||||||
|
|
||||||
//! Sets the 3rd state
|
//! Sets the 3rd state
|
||||||
void setTriState(int resetTimeMs = -1);
|
void setTriState(int resetTimeMs = -1);
|
||||||
|
|
||||||
@@ -133,21 +136,21 @@ namespace BlackGui
|
|||||||
void clicked();
|
void clicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
State m_value = Off; //!< current value
|
State m_value = Off; //!< current value
|
||||||
LedColor m_colorOn = Yellow; //!< On color
|
LedColor m_colorOn = Yellow; //!< On color
|
||||||
LedColor m_colorOff = Black; //!< Off color
|
LedColor m_colorOff = Black; //!< Off color
|
||||||
LedColor m_colorTriState = Blue; //!< tri-state color
|
LedColor m_colorTriState = Blue; //!< tri-state color
|
||||||
LedShape m_shape = Circle; //!< shape
|
LedShape m_shape = Circle; //!< shape
|
||||||
double m_whRatio = 1.0; //!< width/height ratio
|
double m_whRatio = 1.0; //!< width/height ratio
|
||||||
int m_widthTarget = -1; //!< desired width
|
int m_widthTarget = -1; //!< desired width
|
||||||
int m_heightCalculated = 1; //!< calculated height
|
int m_heightCalculated = 1; //!< calculated height
|
||||||
|
|
||||||
QString m_tooltipOn = "on"; //!< tooltip when on
|
QString m_tooltipOn = "on"; //!< tooltip when on
|
||||||
QString m_tooltipOff = "off"; //!< tooltip when off
|
QString m_tooltipOff = "off"; //!< tooltip when off
|
||||||
QString m_tooltipTriState = "tri-state"; //!< tooltip tri state
|
QString m_tooltipTriState = "tri-state"; //!< tooltip tri-state
|
||||||
QString m_currentToolTip = "off"; //!< currently used tooltip
|
QString m_currentToolTip = "off"; //!< currently used tooltip
|
||||||
QScopedPointer<QSvgRenderer> m_renderer; //!< Renderer
|
QScopedPointer<QSvgRenderer> m_renderer; //!< Renderer
|
||||||
QTimer m_resetTimer {this}; //!< reset state
|
QTimer m_resetTimer { this }; //!< reset state
|
||||||
|
|
||||||
//! Init
|
//! Init
|
||||||
void init();
|
void init();
|
||||||
|
|||||||
Reference in New Issue
Block a user