added command line argument and function to disable all LEDs on main window to save CPU on slow computers
This commit is contained in:
parent
b21af7809b
commit
355aca41be
5 changed files with 88 additions and 37 deletions
|
@ -28,6 +28,7 @@
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
|
CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
|
||||||
const bool bNewConnectOnStartup,
|
const bool bNewConnectOnStartup,
|
||||||
|
const bool bNewDisalbeLEDs,
|
||||||
QWidget* parent, Qt::WindowFlags f ) :
|
QWidget* parent, Qt::WindowFlags f ) :
|
||||||
pClient ( pNCliP ), QDialog ( parent, f ),
|
pClient ( pNCliP ), QDialog ( parent, f ),
|
||||||
ClientSettingsDlg ( pNCliP, parent
|
ClientSettingsDlg ( pNCliP, parent
|
||||||
|
@ -129,11 +130,6 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
|
||||||
MultiColorLEDBarInputLevelR->setValue ( 0 );
|
MultiColorLEDBarInputLevelR->setValue ( 0 );
|
||||||
|
|
||||||
|
|
||||||
// TEST
|
|
||||||
MultiColorLEDBarInputLevelL->setEnabled ( false );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// init slider controls ---
|
// init slider controls ---
|
||||||
// audio in fader
|
// audio in fader
|
||||||
SliderAudInFader->setRange ( AUD_FADER_IN_MIN, AUD_FADER_IN_MAX );
|
SliderAudInFader->setRange ( AUD_FADER_IN_MIN, AUD_FADER_IN_MAX );
|
||||||
|
@ -169,6 +165,15 @@ MultiColorLEDBarInputLevelL->setEnabled ( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// disable controls on request ---
|
||||||
|
// disable LEDs in main window if requested
|
||||||
|
if ( bNewDisalbeLEDs )
|
||||||
|
{
|
||||||
|
MultiColorLEDBarInputLevelL->setEnabled ( false );
|
||||||
|
LEDOverallStatus->setEnabled ( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Settings menu ----------------------------------------------------------
|
// Settings menu ----------------------------------------------------------
|
||||||
pSettingsMenu = new QMenu ( "&View", this );
|
pSettingsMenu = new QMenu ( "&View", this );
|
||||||
pSettingsMenu->addAction ( tr ( "&Chat..." ), this,
|
pSettingsMenu->addAction ( tr ( "&Chat..." ), this,
|
||||||
|
|
|
@ -67,6 +67,7 @@ class CLlconClientDlg : public QDialog, private Ui_CLlconClientDlgBase
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLlconClientDlg ( CClient* pNCliP, const bool bNewConnectOnStartup,
|
CLlconClientDlg ( CClient* pNCliP, const bool bNewConnectOnStartup,
|
||||||
|
const bool bNewDisalbeLEDs,
|
||||||
QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
||||||
virtual ~CLlconClientDlg();
|
virtual ~CLlconClientDlg();
|
||||||
|
|
||||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -47,6 +47,7 @@ int main ( int argc, char** argv )
|
||||||
bool bIsClient = true;
|
bool bIsClient = true;
|
||||||
bool bUseGUI = true;
|
bool bUseGUI = true;
|
||||||
bool bConnectOnStartup = false;
|
bool bConnectOnStartup = false;
|
||||||
|
bool bDisalbeLEDs = false;
|
||||||
int iUploadRateLimitKbps = DEF_MAX_UPLOAD_RATE_KBPS;
|
int iUploadRateLimitKbps = DEF_MAX_UPLOAD_RATE_KBPS;
|
||||||
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER;
|
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER;
|
||||||
std::string strIniFileName = "";
|
std::string strIniFileName = "";
|
||||||
|
@ -78,6 +79,15 @@ int main ( int argc, char** argv )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// disable LEDs flag ---------------------------------------------------
|
||||||
|
if ( GetFlagArgument ( argc, argv, i, "-d", "--disableleds" ) )
|
||||||
|
{
|
||||||
|
bDisalbeLEDs = true;
|
||||||
|
cout << "disable LEDs in main window" << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// use logging ---------------------------------------------------------
|
// use logging ---------------------------------------------------------
|
||||||
if ( GetStringArgument ( argc, argv, i, "-l", "--log", strArgument ) )
|
if ( GetStringArgument ( argc, argv, i, "-l", "--log", strArgument ) )
|
||||||
{
|
{
|
||||||
|
@ -203,7 +213,7 @@ int main ( int argc, char** argv )
|
||||||
|
|
||||||
// GUI object
|
// GUI object
|
||||||
CLlconClientDlg ClientDlg (
|
CLlconClientDlg ClientDlg (
|
||||||
&Client, bConnectOnStartup,
|
&Client, bConnectOnStartup, bDisalbeLEDs,
|
||||||
0
|
0
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// this somehow only works reliable on Windows
|
// this somehow only works reliable on Windows
|
||||||
|
@ -303,6 +313,8 @@ std::string UsageArguments ( char **argv )
|
||||||
" -u, --maxuploadrate maximum upload rate (only avaiable for server)\n"
|
" -u, --maxuploadrate maximum upload rate (only avaiable for server)\n"
|
||||||
" -c, --connect connect to last server on startup (only\n"
|
" -c, --connect connect to last server on startup (only\n"
|
||||||
" available for client)\n"
|
" available for client)\n"
|
||||||
|
" -d, --disableleds disable LEDs in main window (only available\n"
|
||||||
|
" for client)\n"
|
||||||
" -h, -?, --help this help text\n"
|
" -h, -?, --help this help text\n"
|
||||||
"Example: " + std::string ( argv[0] ) + " -l -inifile myinifile.ini\n";
|
"Example: " + std::string ( argv[0] ) + " -l -inifile myinifile.ini\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f )
|
CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f )
|
||||||
: QLabel ( parent, f ),
|
: QLabel ( parent, f ),
|
||||||
|
BitmCubeDisabled ( QString::fromUtf8 ( ":/png/LEDs/res/CLEDDisabledSmall.png" ) ),
|
||||||
BitmCubeGrey ( QString::fromUtf8 ( ":/png/LEDs/res/CLEDGreySmall.png" ) ),
|
BitmCubeGrey ( QString::fromUtf8 ( ":/png/LEDs/res/CLEDGreySmall.png" ) ),
|
||||||
BitmCubeGreen ( QString::fromUtf8 ( ":/png/LEDs/res/CLEDGreenSmall.png" ) ),
|
BitmCubeGreen ( QString::fromUtf8 ( ":/png/LEDs/res/CLEDGreenSmall.png" ) ),
|
||||||
BitmCubeYellow ( QString::fromUtf8 ( ":/png/LEDs/res/CLEDYellowSmall.png" ) ),
|
BitmCubeYellow ( QString::fromUtf8 ( ":/png/LEDs/res/CLEDYellowSmall.png" ) ),
|
||||||
|
@ -63,14 +64,22 @@ CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f )
|
||||||
this, SLOT ( OnNewPixmap ( const QPixmap& ) ) );
|
this, SLOT ( OnNewPixmap ( const QPixmap& ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMultiColorLED::Reset()
|
void CMultiColorLED::changeEvent ( QEvent* curEvent )
|
||||||
{
|
{
|
||||||
// reset color flags
|
// act on enabled changed state
|
||||||
bFlagRedLi = false;
|
if ( curEvent->type() == QEvent::EnabledChange )
|
||||||
bFlagGreenLi = false;
|
{
|
||||||
bFlagYellowLi = false;
|
if ( this->isEnabled() )
|
||||||
|
{
|
||||||
UpdateColor();
|
emit newPixmap ( BitmCubeGrey );
|
||||||
|
eColorFlag = RL_GREY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emit newPixmap ( BitmCubeDisabled );
|
||||||
|
eColorFlag = RL_DISABLED;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMultiColorLED::OnTimerRedLight()
|
void CMultiColorLED::OnTimerRedLight()
|
||||||
|
@ -134,8 +143,23 @@ void CMultiColorLED::UpdateColor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMultiColorLED::Reset()
|
||||||
|
{
|
||||||
|
if ( this->isEnabled() )
|
||||||
|
{
|
||||||
|
// reset color flags
|
||||||
|
bFlagRedLi = false;
|
||||||
|
bFlagGreenLi = false;
|
||||||
|
bFlagYellowLi = false;
|
||||||
|
|
||||||
|
UpdateColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CMultiColorLED::SetLight ( const int iNewStatus )
|
void CMultiColorLED::SetLight ( const int iNewStatus )
|
||||||
{
|
{
|
||||||
|
if ( this->isEnabled() )
|
||||||
|
{
|
||||||
switch ( iNewStatus )
|
switch ( iNewStatus )
|
||||||
{
|
{
|
||||||
case MUL_COL_LED_GREEN:
|
case MUL_COL_LED_GREEN:
|
||||||
|
@ -158,6 +182,7 @@ void CMultiColorLED::SetLight ( const int iNewStatus )
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateColor();
|
UpdateColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMultiColorLED::SetUpdateTime ( const int iNUTi )
|
void CMultiColorLED::SetUpdateTime ( const int iNUTi )
|
||||||
|
|
|
@ -60,11 +60,20 @@ public:
|
||||||
void SetLight ( const int iNewStatus );
|
void SetLight ( const int iNewStatus );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum ELightColor { RL_GREY, RL_GREEN, RL_YELLOW, RL_RED };
|
enum ELightColor
|
||||||
|
{
|
||||||
|
RL_DISABLED,
|
||||||
|
RL_GREY,
|
||||||
|
RL_GREEN,
|
||||||
|
RL_YELLOW,
|
||||||
|
RL_RED
|
||||||
|
};
|
||||||
ELightColor eColorFlag;
|
ELightColor eColorFlag;
|
||||||
|
|
||||||
|
virtual void changeEvent ( QEvent* curEvent );
|
||||||
void UpdateColor();
|
void UpdateColor();
|
||||||
|
|
||||||
|
QPixmap BitmCubeDisabled;
|
||||||
QPixmap BitmCubeGrey;
|
QPixmap BitmCubeGrey;
|
||||||
QPixmap BitmCubeGreen;
|
QPixmap BitmCubeGreen;
|
||||||
QPixmap BitmCubeYellow;
|
QPixmap BitmCubeYellow;
|
||||||
|
@ -142,5 +151,4 @@ protected:
|
||||||
CMultColLEDListViewItem LED0, LED1;
|
CMultColLEDListViewItem LED0, LED1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _MULTCOLORLED_H__FD6B49B5_87DF_48DD_A873_804E1606C2AC__INCLUDED_
|
#endif // _MULTCOLORLED_H__FD6B49B5_87DF_48DD_A873_804E1606C2AC__INCLUDED_
|
||||||
|
|
Loading…
Reference in a new issue