2006-12-18 15:39:33 +01:00
|
|
|
/******************************************************************************\
|
2011-02-22 19:56:52 +01:00
|
|
|
* Copyright (c) 2004-2011
|
2006-12-18 15:39:33 +01:00
|
|
|
*
|
|
|
|
* Author(s):
|
|
|
|
* Volker Fischer
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
*
|
|
|
|
* SetLight():
|
|
|
|
* 0: Green
|
|
|
|
* 1: Yellow
|
|
|
|
* 2: Red
|
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License as published by the Free Software
|
|
|
|
* Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
* version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
\******************************************************************************/
|
|
|
|
|
2009-05-01 12:28:52 +02:00
|
|
|
#if !defined ( _MULTCOLORLED_H__FD6B49B5_87DF_48DD_A873_804E1606C2AC__INCLUDED_ )
|
|
|
|
#define _MULTCOLORLED_H__FD6B49B5_87DF_48DD_A873_804E1606C2AC__INCLUDED_
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2008-01-20 19:07:13 +01:00
|
|
|
#include <qlabel.h>
|
|
|
|
#include <qpixmap.h>
|
|
|
|
#include <qtimer.h>
|
2008-01-14 23:14:17 +01:00
|
|
|
#include <qtreewidget.h>
|
|
|
|
#include <qicon.h>
|
2006-12-18 15:39:33 +01:00
|
|
|
#include "global.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Definitions ****************************************************************/
|
|
|
|
#define DEFAULT_UPDATE_TIME 300
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
// the red and yellow light should be on at least this interval
|
2006-12-18 15:39:33 +01:00
|
|
|
#define MIN_TIME_FOR_RED_LIGHT 100
|
|
|
|
|
|
|
|
|
|
|
|
/* Classes ********************************************************************/
|
2008-02-01 09:27:09 +01:00
|
|
|
class CMultiColorLED : public QLabel
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2008-02-01 09:27:09 +01:00
|
|
|
CMultiColorLED ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
2006-12-18 15:39:33 +01:00
|
|
|
|
|
|
|
void Reset();
|
2008-01-27 15:41:12 +01:00
|
|
|
void SetUpdateTime ( const int iNUTi );
|
|
|
|
void SetLight ( const int iNewStatus );
|
2006-12-18 15:39:33 +01:00
|
|
|
|
|
|
|
protected:
|
2009-06-13 10:14:11 +02:00
|
|
|
enum ELightColor
|
|
|
|
{
|
|
|
|
RL_DISABLED,
|
|
|
|
RL_GREY,
|
|
|
|
RL_GREEN,
|
|
|
|
RL_YELLOW,
|
|
|
|
RL_RED
|
|
|
|
};
|
2007-09-08 12:45:14 +02:00
|
|
|
ELightColor eColorFlag;
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2009-06-13 10:14:11 +02:00
|
|
|
virtual void changeEvent ( QEvent* curEvent );
|
2006-12-18 15:39:33 +01:00
|
|
|
void UpdateColor();
|
|
|
|
|
2009-06-13 10:14:11 +02:00
|
|
|
QPixmap BitmCubeDisabled;
|
2009-05-01 12:55:51 +02:00
|
|
|
QPixmap BitmCubeGrey;
|
2006-12-18 15:39:33 +01:00
|
|
|
QPixmap BitmCubeGreen;
|
|
|
|
QPixmap BitmCubeYellow;
|
|
|
|
QPixmap BitmCubeRed;
|
|
|
|
|
|
|
|
QTimer TimerRedLight;
|
|
|
|
QTimer TimerGreenLight;
|
|
|
|
QTimer TimerYellowLight;
|
|
|
|
|
|
|
|
int iUpdateTime;
|
|
|
|
|
|
|
|
bool bFlagRedLi;
|
|
|
|
bool bFlagGreenLi;
|
|
|
|
bool bFlagYellowLi;
|
|
|
|
|
|
|
|
protected slots:
|
2008-03-28 22:46:13 +01:00
|
|
|
void OnTimerRedLight();
|
|
|
|
void OnTimerGreenLight();
|
|
|
|
void OnTimerYellowLight();
|
|
|
|
virtual void OnNewPixmap ( const QPixmap& newPixmap ) { setPixmap ( newPixmap ); }
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2008-03-28 22:46:13 +01:00
|
|
|
signals:
|
|
|
|
void newPixmap ( const QPixmap& newPixmap );
|
|
|
|
};
|
2006-12-18 15:39:33 +01:00
|
|
|
|
|
|
|
|
2008-02-01 09:27:09 +01:00
|
|
|
class CMultColLEDListViewItem : public CMultiColorLED
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2008-03-28 22:46:13 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
2006-12-18 15:39:33 +01:00
|
|
|
public:
|
2011-03-29 09:21:00 +02:00
|
|
|
CMultColLEDListViewItem ( const int iNewCol )
|
|
|
|
: pListViewItem ( NULL ), iColumn ( iNewCol ) {}
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2008-01-14 23:14:17 +01:00
|
|
|
void SetListViewItemPointer ( QTreeWidgetItem* pNewListViewItem )
|
2006-11-25 15:46:57 +01:00
|
|
|
{
|
|
|
|
pListViewItem = pNewListViewItem;
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
|
2008-03-28 22:46:13 +01:00
|
|
|
protected slots:
|
|
|
|
virtual void OnNewPixmap ( const QPixmap& newPixmap )
|
2006-11-25 15:46:57 +01:00
|
|
|
{
|
|
|
|
if ( pListViewItem != NULL )
|
|
|
|
{
|
2008-03-28 22:46:13 +01:00
|
|
|
pListViewItem->setIcon ( iColumn, QIcon ( newPixmap ) );
|
2006-11-25 15:46:57 +01:00
|
|
|
}
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
|
2008-03-28 22:46:13 +01:00
|
|
|
protected:
|
2008-02-01 09:27:09 +01:00
|
|
|
QTreeWidgetItem* pListViewItem;
|
|
|
|
int iColumn;
|
2006-12-18 15:39:33 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-01-14 23:14:17 +01:00
|
|
|
class CServerListViewItem : public QTreeWidgetItem
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
|
|
|
public:
|
2011-03-29 09:21:00 +02:00
|
|
|
CServerListViewItem ( QTreeWidget* parent )
|
2011-04-14 21:40:12 +02:00
|
|
|
: QTreeWidgetItem ( parent ), LED ( 2 )
|
2006-11-25 15:46:57 +01:00
|
|
|
{
|
2011-04-14 21:40:12 +02:00
|
|
|
LED.SetListViewItemPointer ( this );
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
|
2011-04-14 21:40:12 +02:00
|
|
|
void SetLight ( int iNewStatus )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2011-04-14 21:40:12 +02:00
|
|
|
LED.SetLight ( iNewStatus );
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2011-04-14 21:40:12 +02:00
|
|
|
CMultColLEDListViewItem LED;
|
2006-12-18 15:39:33 +01:00
|
|
|
};
|
|
|
|
|
2011-03-29 09:21:00 +02:00
|
|
|
|
|
|
|
class CConnectionServerListViewItem : public QTreeWidgetItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CConnectionServerListViewItem ( QTreeWidget* parent )
|
|
|
|
: QTreeWidgetItem ( parent ), LED ( 4 )
|
|
|
|
{
|
|
|
|
LED.SetListViewItemPointer ( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Reset() { LED.Reset(); }
|
|
|
|
void SetUpdateTime ( const int iNUTi ) { LED.SetUpdateTime ( iNUTi ); }
|
|
|
|
void SetLight ( int iNewStatus ) { LED.SetLight ( iNewStatus ); }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CMultColLEDListViewItem LED;
|
|
|
|
};
|
|
|
|
|
2009-05-01 12:28:52 +02:00
|
|
|
#endif // _MULTCOLORLED_H__FD6B49B5_87DF_48DD_A873_804E1606C2AC__INCLUDED_
|