small change
This commit is contained in:
parent
d6c95888c5
commit
58cb051a14
3 changed files with 32 additions and 24 deletions
|
@ -286,6 +286,14 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="CMultiColorLED" native="1" name="LEDOverallStatus" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>13</width>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/******************************************************************************\
|
||||
* Copyright (c) 2004-2006
|
||||
* Copyright (c) 2004-2008
|
||||
*
|
||||
* Author(s):
|
||||
* Volker Fischer
|
||||
|
@ -37,23 +37,23 @@ CMultiColorLEDbase::CMultiColorLEDbase ( QWidget* parent, Qt::WindowFlags f )
|
|||
BitmCubeGrey ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
||||
BitmCubeYellow ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL )
|
||||
{
|
||||
/* Create bitmaps */
|
||||
BitmCubeGreen.fill ( QColor ( 0, 255, 0 ) );
|
||||
BitmCubeRed.fill ( QColor ( 255, 0, 0 ) );
|
||||
BitmCubeGrey.fill ( QColor ( 192, 192, 192 ) );
|
||||
// create bitmaps
|
||||
BitmCubeGreen.fill ( QColor ( 0, 255, 0 ) );
|
||||
BitmCubeRed.fill ( QColor ( 255, 0, 0 ) );
|
||||
BitmCubeGrey.fill ( QColor ( 192, 192, 192 ) );
|
||||
BitmCubeYellow.fill ( QColor ( 255, 255, 0 ) );
|
||||
|
||||
/* Init color flags */
|
||||
// init color flags
|
||||
Reset();
|
||||
|
||||
/* Set init-bitmap */
|
||||
// set init bitmap
|
||||
SetPixmap ( BitmCubeGrey );
|
||||
eColorFlag = RL_GREY;
|
||||
|
||||
/* Init update time */
|
||||
// init update time
|
||||
iUpdateTime = DEFAULT_UPDATE_TIME;
|
||||
|
||||
/* Connect timer events to the desired slots */
|
||||
// connect timer events to the desired slots
|
||||
connect ( &TimerRedLight, SIGNAL ( timeout() ),
|
||||
this, SLOT ( OnTimerRedLight() ) );
|
||||
connect ( &TimerGreenLight, SIGNAL ( timeout() ),
|
||||
|
@ -64,9 +64,9 @@ CMultiColorLEDbase::CMultiColorLEDbase ( QWidget* parent, Qt::WindowFlags f )
|
|||
|
||||
void CMultiColorLEDbase::Reset()
|
||||
{
|
||||
/* Reset color flags */
|
||||
bFlagRedLi = false;
|
||||
bFlagGreenLi = false;
|
||||
// reset color flags
|
||||
bFlagRedLi = false;
|
||||
bFlagGreenLi = false;
|
||||
bFlagYellowLi = false;
|
||||
|
||||
UpdateColor();
|
||||
|
@ -125,7 +125,7 @@ void CMultiColorLEDbase::UpdateColor()
|
|||
return;
|
||||
}
|
||||
|
||||
/* If no color is active, set control to grey light */
|
||||
// if no color is active, set control to grey light
|
||||
if ( eColorFlag != RL_GREY )
|
||||
{
|
||||
SetPixmap ( BitmCubeGrey );
|
||||
|
@ -133,24 +133,24 @@ void CMultiColorLEDbase::UpdateColor()
|
|||
}
|
||||
}
|
||||
|
||||
void CMultiColorLEDbase::SetLight ( int iNewStatus )
|
||||
void CMultiColorLEDbase::SetLight ( const int iNewStatus )
|
||||
{
|
||||
switch ( iNewStatus )
|
||||
{
|
||||
case MUL_COL_LED_GREEN:
|
||||
// Green light
|
||||
// green light
|
||||
bFlagGreenLi = true;
|
||||
TimerGreenLight.setInterval ( iUpdateTime );
|
||||
break;
|
||||
|
||||
case MUL_COL_LED_YELLOW:
|
||||
// Yellow light
|
||||
// yellow light
|
||||
bFlagYellowLi = true;
|
||||
TimerYellowLight.setInterval ( iUpdateTime );
|
||||
break;
|
||||
|
||||
case MUL_COL_LED_RED:
|
||||
// Red light
|
||||
// red light
|
||||
bFlagRedLi = true;
|
||||
TimerRedLight.setInterval ( iUpdateTime );
|
||||
break;
|
||||
|
@ -159,9 +159,9 @@ void CMultiColorLEDbase::SetLight ( int iNewStatus )
|
|||
UpdateColor();
|
||||
}
|
||||
|
||||
void CMultiColorLEDbase::SetUpdateTime ( int iNUTi )
|
||||
void CMultiColorLEDbase::SetUpdateTime ( const int iNUTi )
|
||||
{
|
||||
/* Avoid too short intervals */
|
||||
// avoid too short intervals
|
||||
if ( iNUTi < MIN_TIME_FOR_RED_LIGHT )
|
||||
{
|
||||
iUpdateTime = MIN_TIME_FOR_RED_LIGHT;
|
||||
|
@ -177,7 +177,7 @@ CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f )
|
|||
: CMultiColorLEDbase ( parent, f )
|
||||
{
|
||||
// set modified style
|
||||
setFrameShape ( QFrame::Panel );
|
||||
setFrameShape ( QFrame::Panel );
|
||||
setFrameShadow ( QFrame::Sunken );
|
||||
setIndent ( 0 );
|
||||
setIndent ( 0 );
|
||||
}
|
||||
|
|
|
@ -57,14 +57,14 @@ public:
|
|||
CMultiColorLEDbase ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
||||
|
||||
void Reset();
|
||||
void SetUpdateTime ( int iNUTi );
|
||||
void SetLight ( int iNewStatus );
|
||||
void SetUpdateTime ( const int iNUTi );
|
||||
void SetLight ( const int iNewStatus );
|
||||
|
||||
protected:
|
||||
enum ELightColor { RL_GREY, RL_RED, RL_GREEN, RL_YELLOW };
|
||||
ELightColor eColorFlag;
|
||||
|
||||
virtual void SetPixmap ( QPixmap& NewBitmap ) {} // must be implemented in derived class!
|
||||
virtual void SetPixmap ( QPixmap& NewBitmap ) {} // must be implemented in derived class
|
||||
void UpdateColor();
|
||||
|
||||
QPixmap BitmCubeGreen;
|
||||
|
|
Loading…
Reference in a new issue