From 0406d64d38aab7bf70b8817136a9ab211b374a7c Mon Sep 17 00:00:00 2001 From: ackimixs Date: Tue, 7 May 2024 10:14:14 +0200 Subject: [PATCH] homologation --- Homologation.cpp | 24 +++++++++++++++++++++++- Homologation.h | 8 ++++++++ MainWindow.cpp | 18 ++++++++---------- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/Homologation.cpp b/Homologation.cpp index 752f38c..db810d8 100644 --- a/Homologation.cpp +++ b/Homologation.cpp @@ -18,9 +18,21 @@ Homologation::Homologation(QWidget *parent) : QWidget(parent) { replier->setBaseSize(378, 66); layout->addWidget(replier); + this->panneauGauche = new QPushButton("Panneau gauche", this); + panneauGauche->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 66px; width: 378px; margin-top: 20px; color: black; font-size: 33px;"); + panneauGauche->setBaseSize(378, 66); + layout->addWidget(panneauGauche); + + this->panneauDroit = new QPushButton("Panneau droit", this); + panneauDroit->setStyleSheet("background-color: #ED4747; border-radius: 20px; height: 66px; width: 378px; margin-top: 20px; color: black; font-size: 33px;"); + panneauDroit->setBaseSize(378, 66); + layout->addWidget(panneauDroit); + connect(this->deplier, &QPushButton::pressed, this, &Homologation::onDeplierClicked); connect(this->replier, &QPushButton::pressed, this, &Homologation::onReplierClicked); + + connect(this->panneauGauche, &QPushButton::pressed, this, &Homologation::onPanneauGaucheClicked); } void Homologation::onDeplierClicked() @@ -31,4 +43,14 @@ void Homologation::onDeplierClicked() void Homologation::onReplierClicked() { emit replierClicked(); -} \ No newline at end of file +} + +void Homologation::onPanneauDroitClicked() +{ + emit panneauDroitClicked(); +} + +void Homologation::onPanneauGaucheClicked() +{ + emit panneauGaucheClicked(); +} diff --git a/Homologation.h b/Homologation.h index dce2a19..93a2790 100644 --- a/Homologation.h +++ b/Homologation.h @@ -15,14 +15,22 @@ protected slots: void onReplierClicked(); + void onPanneauGaucheClicked(); + + void onPanneauDroitClicked(); + signals: void deplierClicked(); void replierClicked(); + void panneauGaucheClicked(); + void panneauDroitClicked(); private: QLayout* layout; QLabel* text; QPushButton* deplier; QPushButton* replier; + QPushButton* panneauGauche; + QPushButton* panneauDroit; }; diff --git a/MainWindow.cpp b/MainWindow.cpp index 272168e..db78576 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -58,13 +58,7 @@ MainWindow::MainWindow(const char *address, int port, QWidget *parent) : QMainWi std::this_thread::sleep_for(std::chrono::milliseconds(100)); this->tcpClient->sendMessage("ihm;servo_moteur;ouvrir pince;0"); std::this_thread::sleep_for(std::chrono::milliseconds(100)); - this->tcpClient->sendMessage("ihm;servo_moteur;fermer pince;1"); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); this->tcpClient->sendMessage("ihm;servo_moteur;ouvrir pince;2"); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - this->tcpClient->sendMessage("ihm;servo_moteur;check panneau;6"); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - this->tcpClient->sendMessage("ihm;servo_moteur;check panneau;7"); }); connect(this->homologation, &Homologation::replierClicked, [&]() { @@ -75,10 +69,14 @@ MainWindow::MainWindow(const char *address, int port, QWidget *parent) : QMainWi this->tcpClient->sendMessage("ihm;servo_moteur;fermer pince;2"); std::this_thread::sleep_for(std::chrono::milliseconds(100)); this->tcpClient->sendMessage("ihm;servo_moteur;baisser bras;1"); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - this->tcpClient->sendMessage("ihm;servo_moteur;uncheck panneau;6"); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - this->tcpClient->sendMessage("ihm;servo_moteur;uncheck panneau;7"); + }); + + connect(this->homologation, &Homologation::panneauGaucheClicked, [&]() { + this->tcpClient->sendMessage("ihm;servo_moteur;check panneau;6"); + }); + + connect(this->homologation, &Homologation::panneauDroitClicked, [&]() { + this->tcpClient->sendMessage("ihm;servo_moteur;check panneau;7"); }); this->teamChooser = new TeamChooser(centralWidget);