/*******************************************************************************
*                                                                              *
* Société de Transports de Montréal.                                    	   *
* 2012                                                                         *
*                                                                              *
* Projet Zones Tests                                                           *
*                                                                              *
*                                                                              *
*                                                                              *
*******************************************************************************/
/*
    Description:
    Description du fichier si nécessaire.

*/

/* ************************************************************************** */
/* Revision:
### 20171124 JFM
    Verision d'origine.

### YYYMMDD Description du besoin ou du bug
    Description du changement.
 */

/* ************************************************************************** */


#ifndef MODBUSSETTINGSPAGE_H
#define MODBUSSETTINGSPAGE_H

#include "GlobalDefine.h"
#include <QGraphicsWidget>
#include "Guipage.h"
#include <QString>
#include "PushButton.h"
#include "ZTSimulator.h"
#include "TextButtonWidget.h"
#include <QCheckBox>
#include <QLineEdit>
#include <QSpinBox>
#include <QGraphicsPixmapItem>


class CZoneTest;

class CModbusSettingsPage : public CGuiPage
{
Q_OBJECT
public:
    CModbusSettingsPage(QGraphicsWidget *Parent = 0);

	CZoneTest *mProgramHandle;

    int SetActualSettings(bool UseModbus, QHostAddress CCHostAdd);

	virtual void resizeEvent(QGraphicsSceneResizeEvent *event);
	virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
	virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
	virtual void showEvent ( QShowEvent * event );


private:
	QGraphicsRectItem *mBackgroundRect;
    CTextButtonWidget *mCancelButton, *mApplyButton;
    QSpinBox *mIPChunk1, *mIPChunk2, *mIPChunk3, *mIPChunk4;
    QString mCurIP;
    QCheckBox *mUseModbusChkBox;
    QGraphicsTextItem *mMACAddress, *mModbusCCConnectionState, *mModbusCCLinkState;
    QGraphicsPixmapItem *mCCConnectionLED, *mCCModbusLinkLED;

    void ShowApplyButton();



public slots:
	void ButtonClicked(CTextButtonWidget *);
    void ModbusCCConnected(qint32 LocalIP, qint32 RemoteIP);
    void ModbusCCDisconnected();
    void ModbusCCLinkUP();
    void ModbusCCLinkDown();
    void SpinBoxValueChanged(int);
    void CheckBoxStatedChanged(int);

};

#endif // MODBUSSETTINGSPAGE_H
