Skip to content

Commit

Permalink
changed RYG indicator lights with colour-blind compensation, created …
Browse files Browse the repository at this point in the history
…by geheimerEichkater (#57)
  • Loading branch information
corrados committed Nov 11, 2020
1 parent 963bb03 commit 75163b4
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 35 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

- the Jamulus server now has a different icon, created by geheimerEichkater (#700)

- changed RYG indicator lights with colour-blind compensation, created by geheimerEichkater (#57)



Expand Down
2 changes: 2 additions & 0 deletions src/clientsettingsdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP,
// init delay and other information controls
ledNetw->Reset();
ledOverallDelay->Reset();
ledNetw->SetType ( CMultiColorLED::MT_INDICATOR );
ledOverallDelay->SetType ( CMultiColorLED::MT_INDICATOR );
lblPingTimeValue->setText ( "---" );
lblOverallDelayValue->setText ( "---" );
lblUpstreamValue->setText ( "---" );
Expand Down
58 changes: 39 additions & 19 deletions src/multicolorled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,14 @@ CMultiColorLED::CMultiColorLED ( QWidget* parent )
setPixmap ( BitmCubeGrey );
eColorFlag = RL_GREY;

// set default type (also resets the multicolor LED)
SetType ( MT_LED );
// set default type and reset
eType = MT_LED;
Reset();
}

void CMultiColorLED::SetType ( const EType eNType )
{
if ( eNType == MT_LED )
{
pBitmGreen = &BitmCubeGreen;
pBitmYellow = &BitmCubeYellow;
pBitmRed = &BitmCubeRed;
}
else
{
pBitmGreen = &BitmIndicatorGreen;
pBitmYellow = &BitmIndicatorYellow;
pBitmRed = &BitmIndicatorRed;
}

eType = eNType;
Reset();
}

Expand Down Expand Up @@ -92,7 +81,14 @@ void CMultiColorLED::SetColor ( const ELightColor eNewColorFlag )
// red
if ( eColorFlag != RL_RED )
{
setPixmap ( *pBitmRed );
if ( eType == MT_LED )
{
setPixmap ( BitmCubeRed );
}
else
{
setPixmap ( BitmIndicatorRed );
}
setAccessibleDescription ( tr ( "Red" ) );
eColorFlag = RL_RED;
}
Expand All @@ -102,7 +98,14 @@ void CMultiColorLED::SetColor ( const ELightColor eNewColorFlag )
// yellow
if ( eColorFlag != RL_YELLOW )
{
setPixmap ( *pBitmYellow );
if ( eType == MT_LED )
{
setPixmap ( BitmCubeYellow );
}
else
{
setPixmap ( BitmIndicatorYellow );
}
setAccessibleDescription ( tr ( "Yellow" ) );
eColorFlag = RL_YELLOW;
}
Expand All @@ -112,7 +115,14 @@ void CMultiColorLED::SetColor ( const ELightColor eNewColorFlag )
// green
if ( eColorFlag != RL_GREEN )
{
setPixmap ( *pBitmGreen );
if ( eType == MT_LED )
{
setPixmap ( BitmCubeGreen );
}
else
{
setPixmap ( BitmIndicatorGreen );
}
setAccessibleDescription ( tr ( "Green" ) );
eColorFlag = RL_GREEN;
}
Expand All @@ -122,7 +132,15 @@ void CMultiColorLED::SetColor ( const ELightColor eNewColorFlag )
// if no color is active, set control to grey light
if ( eColorFlag != RL_GREY )
{
setPixmap ( BitmCubeGrey );
if ( eType == MT_LED )
{
setPixmap ( BitmCubeGrey );
}
else
{
// make it invisible if in indicator mode
setPixmap ( QPixmap() );
}
eColorFlag = RL_GREY;
}
break;
Expand All @@ -133,6 +151,8 @@ void CMultiColorLED::Reset()
{
if ( isEnabled() )
{
// set color flag to disable to make sure the pixmap gets updated
eColorFlag = RL_DISABLED;
SetColor ( RL_GREY );
}
}
Expand Down
29 changes: 13 additions & 16 deletions src/multicolorled.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,19 @@ class CMultiColorLED : public QLabel
virtual void changeEvent ( QEvent* curEvent );
void SetColor ( const ELightColor eNewColorFlag );

QPixmap BitmCubeDisabled;
QPixmap BitmCubeGrey;
QPixmap BitmCubeGreen;
QPixmap BitmCubeYellow;
QPixmap BitmCubeRed;
QPixmap BitmIndicatorGreen;
QPixmap BitmIndicatorYellow;
QPixmap BitmIndicatorRed;
QPixmap BitmCubeDisabled;
QPixmap BitmCubeGrey;
QPixmap BitmCubeGreen;
QPixmap BitmCubeYellow;
QPixmap BitmCubeRed;
QPixmap BitmIndicatorGreen;
QPixmap BitmIndicatorYellow;
QPixmap BitmIndicatorRed;

QPixmap* pBitmGreen;
QPixmap* pBitmYellow;
QPixmap* pBitmRed;
int iUpdateTime;
EType eType;

int iUpdateTime;

bool bFlagRedLi;
bool bFlagGreenLi;
bool bFlagYellowLi;
bool bFlagRedLi;
bool bFlagGreenLi;
bool bFlagYellowLi;
};

0 comments on commit 75163b4

Please sign in to comment.