homologation

This commit is contained in:
ackimixs
2024-05-07 10:14:14 +02:00
parent 18b1aa376a
commit 0406d64d38
3 changed files with 39 additions and 11 deletions

View File

@@ -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();
}
}
void Homologation::onPanneauDroitClicked()
{
emit panneauDroitClicked();
}
void Homologation::onPanneauGaucheClicked()
{
emit panneauGaucheClicked();
}

View File

@@ -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;
};

View File

@@ -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);