Modificato il modo di colorare le label per nodi ROS

This commit is contained in:
2019-11-18 11:25:51 +01:00
parent 069fa97b40
commit 2f59630197
4 changed files with 20 additions and 20 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.8.2, 2019-11-14T17:08:08. -->
<!-- Written by QtCreator 4.8.2, 2019-11-15T17:00:31. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@@ -96,21 +96,14 @@ void RoboGlue_GUI::on_commonStatusChange() {
this->ui->lbl_follower->setText(QString().fromStdString(this->m->comSettings.nodeNames.find("follower")->second+": "+std::to_string(static_cast<uint>(m->commonStatus.followerTime))));
this->ui->lbl_recorder->setText(QString().fromStdString(this->m->comSettings.nodeNames.find("recorder")->second+": "+std::to_string(static_cast<uint>(m->commonStatus.recorderTime))));
this->ui->lbl_broadcaster->setText(QString().fromStdString(this->m->comSettings.nodeNames.find("broadcaster")->second+": "+std::to_string(static_cast<uint>(m->commonStatus.broadcasterTime))));
if(m->commonStatus.relayTime > m->comSettings.deadTime ||
m->commonStatus.followerTime > m->comSettings.deadTime ||
m->commonStatus.recorderTime > m->comSettings.deadTime ||
m->commonStatus.broadcasterTime > m->comSettings.deadTime) {
this->ui->lbl_relay->setStyleSheet("QLabel { background-color : red; color : white; }");
this->ui->lbl_follower->setStyleSheet("QLabel { background-color : red; color : white; }");
this->ui->lbl_recorder->setStyleSheet("QLabel { background-color : red; color : white; }");
this->ui->lbl_broadcaster->setStyleSheet("QLabel { background-color : red; color : white; }");
} else {
this->ui->lbl_relay->setStyleSheet("QLabel { background-color : green; color : white; }");
this->ui->lbl_follower->setStyleSheet("QLabel { background-color : green; color : white; }");
this->ui->lbl_recorder->setStyleSheet("QLabel { background-color : green; color : white; }");
this->ui->lbl_broadcaster->setStyleSheet("QLabel { background-color : green; color : white; }");
}
if (m->commonStatus.relayRunning) this->ui->lbl_relay->setStyleSheet("QLabel { background-color : red; color : white; }");
else this->ui->lbl_relay->setStyleSheet("QLabel { background-color : green; color : white; }");
if (m->commonStatus.recorderRunning) this->ui->lbl_recorder->setStyleSheet("QLabel { background-color : red; color : white; }");
else this->ui->lbl_recorder->setStyleSheet("QLabel { background-color : green; color : white; }");
if (m->commonStatus.followerRunning) this->ui->lbl_follower->setStyleSheet("QLabel { background-color : red; color : white; }");
else this->ui->lbl_follower->setStyleSheet("QLabel { background-color : green; color : white; }");
if (m->commonStatus.broadcasterRunning) this->ui->lbl_broadcaster->setStyleSheet("QLabel { background-color : red; color : white; }");
else this->ui->lbl_broadcaster->setStyleSheet("QLabel { background-color : green; color : white; }");
}
void RoboGlue_GUI::on_pad_hoverEvent(QEvent* e) {

View File

@@ -1437,6 +1437,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_stopRos">
<property name="text">
<string>Stop_ROS</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@@ -16,10 +16,10 @@ RoboGlue_SHARED::~RoboGlue_SHARED(){
void RoboGlue_SHARED::on_statusTimer(void){
double curTime = static_cast<double>(std::time(NULL));
commonStatus.relayTime = fabs(commonStatus.relayLast - curTime);
commonStatus.followerTime = fabs(commonStatus.followerLast - curTime);
commonStatus.recorderTime = fabs(commonStatus.recorderLast - curTime);
commonStatus.broadcasterTime = fabs(commonStatus.broadcasterLast - curTime);
commonStatus.relayRunning = (commonStatus.relayTime = fabs(commonStatus.relayLast - curTime)) < comSettings.deadTime;
commonStatus.followerRunning = (commonStatus.followerTime = fabs(commonStatus.followerLast - curTime)) < comSettings.deadTime;
commonStatus.recorderRunning = (commonStatus.recorderTime = fabs(commonStatus.recorderLast - curTime)) < comSettings.deadTime;
commonStatus.broadcasterRunning = (commonStatus.broadcasterTime = fabs(commonStatus.broadcasterLast - curTime)) < comSettings.deadTime;
emit this->commonStatusChange();
}
////////////////////////////////////////////////////////////////