Commentaires
Ajout de commentaires Amélioration de l'affichate de l'état du modbus.
This commit is contained in:
@@ -67,6 +67,7 @@ CModbusSettingsPage::CModbusSettingsPage(QGraphicsWidget *Parent)
|
||||
mApplyButton = new CTextButtonWidget("Appliquer");
|
||||
mApplyButton->setParentItem(this);
|
||||
mApplyButton->setPos(650,550);
|
||||
mApplyButton->hide();
|
||||
connect(mApplyButton,SIGNAL(TxtButtonClicked(CTextButtonWidget*)),this,SLOT(ButtonClicked(CTextButtonWidget*)));
|
||||
|
||||
|
||||
@@ -89,6 +90,7 @@ CModbusSettingsPage::CModbusSettingsPage(QGraphicsWidget *Parent)
|
||||
mIPChunk1->setMaximum(255);
|
||||
IpSettingsPosx += 90;
|
||||
Dot->setPos(IpSettingsPosx-17,IpSettingsPosy-5);
|
||||
connect(mIPChunk1,SIGNAL(valueChanged(int)),this,SLOT(SpinBoxValueChanged(int)));
|
||||
|
||||
Proxy = new QGraphicsProxyWidget(this);
|
||||
Dot = new QGraphicsTextItem(".",this);
|
||||
@@ -101,6 +103,7 @@ CModbusSettingsPage::CModbusSettingsPage(QGraphicsWidget *Parent)
|
||||
mIPChunk2->setMaximum(255);
|
||||
IpSettingsPosx += 90;
|
||||
Dot->setPos(IpSettingsPosx-17,IpSettingsPosy-5);
|
||||
connect(mIPChunk2,SIGNAL(valueChanged(int)),this,SLOT(SpinBoxValueChanged(int)));
|
||||
|
||||
Proxy = new QGraphicsProxyWidget(this);
|
||||
Dot = new QGraphicsTextItem(".",this);
|
||||
@@ -113,6 +116,7 @@ CModbusSettingsPage::CModbusSettingsPage(QGraphicsWidget *Parent)
|
||||
mIPChunk3->setMaximum(255);
|
||||
IpSettingsPosx += 90;
|
||||
Dot->setPos(IpSettingsPosx-17,IpSettingsPosy - 5);
|
||||
connect(mIPChunk3,SIGNAL(valueChanged(int)),this,SLOT(SpinBoxValueChanged(int)));
|
||||
|
||||
Proxy = new QGraphicsProxyWidget(this);
|
||||
mIPChunk4 = new QSpinBox();
|
||||
@@ -121,11 +125,13 @@ CModbusSettingsPage::CModbusSettingsPage(QGraphicsWidget *Parent)
|
||||
mIPChunk4->setMaximum(255);
|
||||
Proxy->setPos(IpSettingsPosx,IpSettingsPosy);
|
||||
mIPChunk4->resize(70,30);
|
||||
connect(mIPChunk4,SIGNAL(valueChanged(int)),this,SLOT(SpinBoxValueChanged(int)));
|
||||
|
||||
Proxy = new QGraphicsProxyWidget(this);
|
||||
mUseModbusChkBox = new QCheckBox("Activer la communication Modbus avec la Commande Centralisée");
|
||||
Proxy->setWidget(mUseModbusChkBox);
|
||||
Proxy->setPos(100,100);
|
||||
connect(mUseModbusChkBox,SIGNAL(stateChanged(int)),this,SLOT(CheckBoxStatedChanged(int)));
|
||||
|
||||
IpSettingsPosx = 100;
|
||||
IpSettingsPosy += 50;
|
||||
@@ -215,6 +221,7 @@ int CModbusSettingsPage::SetActualSettings(bool UseModbus, QHostAddress CCHostAd
|
||||
add >>= 8;
|
||||
mIPChunk1->setValue(add & 0x000000FF);
|
||||
|
||||
mApplyButton->hide();
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@@ -243,6 +250,20 @@ void CModbusSettingsPage::ModbusCCLinkDown()
|
||||
mModbusCCLinkState->setPlainText("Lien Modbus CC: Non établi");
|
||||
}
|
||||
|
||||
void CModbusSettingsPage::CheckBoxStatedChanged(int state)
|
||||
{
|
||||
ShowApplyButton();
|
||||
}
|
||||
|
||||
void CModbusSettingsPage::SpinBoxValueChanged(int value)
|
||||
{
|
||||
ShowApplyButton();
|
||||
}
|
||||
|
||||
void CModbusSettingsPage::ShowApplyButton()
|
||||
{
|
||||
mApplyButton->show();
|
||||
}
|
||||
|
||||
//Grab the mouse if the user clicks outside buttons
|
||||
void CModbusSettingsPage::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
||||
@@ -69,6 +69,8 @@ private:
|
||||
QGraphicsTextItem *mModbusCCConnectionState, *mModbusCCLinkState;
|
||||
QGraphicsPixmapItem *mCCConnectionLED, *mCCModbusLinkLED;
|
||||
|
||||
void ShowApplyButton();
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
@@ -77,6 +79,8 @@ public slots:
|
||||
void ModbusCCDisconnected();
|
||||
void ModbusCCLinkUP();
|
||||
void ModbusCCLinkDown();
|
||||
void SpinBoxValueChanged(int);
|
||||
void CheckBoxStatedChanged(int);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ CStatusBar::CStatusBar(QGraphicsItem *Parent):
|
||||
|
||||
mZT1Status = mZT2Status = SB_ZT_INACTIVE_STATUS;
|
||||
mCCModbusState = SB_MODBUS_NOT_PRESENT;
|
||||
mSEIModbusState = SB_MODBUS_CONNECTED;//SB_MODBUS_NOT_PRESENT;
|
||||
mHistoModbusState = SB_MODBUS_CONNECTED;
|
||||
mSEIModbusState = SB_MODBUS_NOT_PRESENT;
|
||||
mHistoModbusState = SB_MODBUS_NOT_PRESENT;
|
||||
|
||||
mCCModbusONOFF.setParentItem(this);
|
||||
mCCModbusONOFF.setPos(730,3);
|
||||
@@ -227,6 +227,15 @@ void CStatusBar::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
||||
TextRect.adjust(painter->fontMetrics().width(Text),0,0,0);
|
||||
}*/
|
||||
}
|
||||
else if(mCCModbusState == SB_MODBUS_NOT_PRESENT)
|
||||
{
|
||||
painter->setPen(Qt::black);
|
||||
Text.clear();
|
||||
Text.sprintf("Modbus: Désactivé");
|
||||
TextRect.adjust(20,0,0,0);
|
||||
painter->drawText(TextRect, Qt::AlignLeft, Text);
|
||||
TextRect.adjust(painter->fontMetrics().width(Text),0,0,0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -444,6 +444,14 @@ unsigned int CZTPage::SetZT2Presence(bool IsPresent)
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CZTPage::SetModbusPresent(bool IsPresent)
|
||||
{
|
||||
if(IsPresent == true)
|
||||
{
|
||||
mStatusBar->SetCCModbusState(SB_MODBUS_CONNECTED);
|
||||
}
|
||||
}
|
||||
|
||||
void CZTPage::ModbusCCConnected()
|
||||
{
|
||||
mStatusBar->SetCCModbusState(SB_MODBUS_CONNECTED);
|
||||
|
||||
@@ -80,6 +80,7 @@ public:
|
||||
unsigned int UpdateEventsList();
|
||||
unsigned int RequestExitPassword();
|
||||
unsigned int SetZT2Presence(bool IsPresent);
|
||||
unsigned int SetModbusPresent(bool IsPresent);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user