diff --git a/CMakeLists.txt b/CMakeLists.txt index 1828861..0ed0914 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,8 @@ add_executable(ihm_robot main.cpp resource.qrc TeamChooser.h TestMode.cpp TestMode.h + TestModeBtn.cpp + TestModeBtn.h ) target_link_libraries(ihm_robot diff --git a/Homologation.h b/Homologation.h index f35793c..c067cd4 100644 --- a/Homologation.h +++ b/Homologation.h @@ -12,17 +12,17 @@ public: this->layout = new QVBoxLayout(this); this->text = new QLabel("Mode Homologation", this); - text->setStyleSheet("font-size: 20px; font-weight: bold; margin-top: 20px;"); + text->setStyleSheet("font-size: 20px; font-weight: bold; margin-top: 20px; color: black;"); this->text->setAlignment(Qt::AlignCenter); layout->addWidget(text); this->deplier = new QPushButton("Déplier", this); - deplier->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 378px; margin-top: 20px;"); + deplier->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 378px; margin-top: 20px; color: black;"); deplier->setBaseSize(378, 46); layout->addWidget(deplier); this->replier = new QPushButton("Replier", this); - replier->setStyleSheet("background-color: #ED4747; border-radius: 20px; height: 46px; width: 378px; margin-top: 20px;"); + replier->setStyleSheet("background-color: #ED4747; border-radius: 20px; height: 46px; width: 378px; margin-top: 20px; color: black;"); replier->setBaseSize(378, 46); layout->addWidget(replier); diff --git a/InGame.h b/InGame.h index 0298b1e..3b045c4 100644 --- a/InGame.h +++ b/InGame.h @@ -11,9 +11,13 @@ public: this->mainLayout = new QVBoxLayout(this); this->mainLayout->setAlignment(Qt::AlignCenter); this->pts = new QLabel("Points : 0", this); + this->pts->setStyleSheet("font-size: 96px; color: black;"); this->x = new QLabel("X : 0", this); + this->x->setStyleSheet("font-size: 32px; color: black;"); this->y = new QLabel("Y : 0", this); + this->y->setStyleSheet("font-size: 32px; color: black;"); this->time = new QLabel("Time : 0m0s", this); + this->time->setStyleSheet("font-size: 32px; color: black;"); this->mainLayout->addWidget(pts); diff --git a/TeamChooser.h b/TeamChooser.h index bfbdbac..6d2b06f 100644 --- a/TeamChooser.h +++ b/TeamChooser.h @@ -10,9 +10,9 @@ public: { this->mainLayout = new QHBoxLayout(this); this->blueTeam = new QPushButton("Equipe Bleue", this); - this->blueTeam->setStyleSheet("background-color: #4D83A1; border-radius: 40px; margin-top: 20px;"); + this->blueTeam->setStyleSheet("background-color: #4D83A1; border-radius: 40px; margin-top: 20px; color: black;"); this->yellowTeam = new QPushButton("Equipe Jaune", this); - this->yellowTeam->setStyleSheet("background-color: #FFBF00; border-radius: 40px; margin-top: 20px;"); + this->yellowTeam->setStyleSheet("background-color: #FFBF00; border-radius: 40px; margin-top: 20px; color: black;"); this->mainLayout->addWidget(this->blueTeam); this->mainLayout->addWidget(this->yellowTeam); diff --git a/TestMode.h b/TestMode.h index ea9327a..05f8108 100644 --- a/TestMode.h +++ b/TestMode.h @@ -1,8 +1,65 @@ #pragma once +#include +#include #include +#include +#include "TestModeBtn.h" class TestMode : public QWidget { Q_OBJECT public: - TestMode(QWidget* parent = nullptr) : QWidget(parent) {} -}; + TestMode(QWidget* parent = nullptr) : QWidget(parent) { + this->mainLayout = new QVBoxLayout(this); + this->mainLayout->setAlignment(Qt::AlignCenter); + + this->text = new QLabel("Mode Test Position", this); + text->setStyleSheet("font-size: 20px; font-weight: bold; color: black;"); + this->text->setAlignment(Qt::AlignCenter); + this->mainLayout->addWidget(text); + + this->textcm = new QLabel("(en cm)", this); + textcm->setStyleSheet("font-size: 14px; font-weight: bold; color: black;"); + this->textcm->setAlignment(Qt::AlignCenter); + this->mainLayout->addWidget(textcm); + + this->X = new TestModeBtn("X", this); + this->mainLayout->addWidget(X); + this->Y = new TestModeBtn("Y", this); + this->mainLayout->addWidget(Y); + this->Theta = new TestModeBtn("θ", this); + this->mainLayout->addWidget(Theta); + + this->go = new QPushButton("Go", this); + go->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 36px; width: 378px; color: black;"); + go->setBaseSize(378, 46); + this->mainLayout->addWidget(go); + + connect(this->go, &QPushButton::pressed, this, &TestMode::onGoPressed); + } + +private slots: + void onGoPressed() + { + qInfo() << "go !"; + + // Récupérer les valeurs des TestModeBtn + int xValue = X->getValue(); + int yValue = Y->getValue(); + int thetaValue = Theta->getValue(); + + // Utiliser les valeurs comme nécessaire + qInfo() << "Valeur de X : " << xValue; + qInfo() << "Valeur de Y : " << yValue; + qInfo() << "Valeur de Theta : " << thetaValue; + } + + +private: + QVBoxLayout* mainLayout; + QLabel* text; + TestModeBtn* X; + TestModeBtn* Y; + TestModeBtn* Theta; + QPushButton* go; + QLabel* textcm; +}; \ No newline at end of file diff --git a/TestModeBtn.cpp b/TestModeBtn.cpp new file mode 100644 index 0000000..3f36a54 --- /dev/null +++ b/TestModeBtn.cpp @@ -0,0 +1,5 @@ +// +// Created by breizhhardware on 1/25/24. +// + +#include "TestModeBtn.h" diff --git a/TestModeBtn.h b/TestModeBtn.h new file mode 100644 index 0000000..1328b67 --- /dev/null +++ b/TestModeBtn.h @@ -0,0 +1,96 @@ +// +// Created by breizhhardware on 1/25/24. +// + +#ifndef TESTMODEBTN_H +#define TESTMODEBTN_H +#include +#include +#include +#include + + +class TestModeBtn : public QWidget{ + Q_OBJECT +public: + TestModeBtn(QString name, QWidget *parent = nullptr) : QWidget(parent) { + this->layout = new QVBoxLayout(this); + this->layout->setAlignment(Qt::AlignCenter); + + QHBoxLayout *xLayout = new QHBoxLayout(); + + this->Text = new QLabel(name, this); + Text->setStyleSheet("font-size: 24px; font-weight: bold; color: black;"); + xLayout->addWidget(Text); + + Decrement = new QPushButton("-", this); + Decrement->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 46px; color: black;"); + Decrement->setBaseSize(46, 46); + + + Value = new QLabel(QString::number(this->valueTaMere), this); + Value->setStyleSheet("font-size: 24px; font-weight: bold; color: black;"); + + Increment10 = new QPushButton("+10", this); + Increment10->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 46px; color: black;"); + Increment10->setBaseSize(46, 46); + + Decrement10 = new QPushButton("-10", this); + Decrement10->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 46px; color: black;"); + Decrement10->setBaseSize(46, 46); + + Increment = new QPushButton("+", this); + Increment->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 46px; color: black;"); + Increment->setBaseSize(46, 46); + + connect(this->Decrement, &QPushButton::pressed, this, [=]() + { + this->valueTaMere--; + this->Value->setText(QString::number(this->valueTaMere)); + }); + + connect(this->Increment, &QPushButton::pressed, this, [=]() + { + this->valueTaMere++; + this->Value->setText(QString::number(this->valueTaMere)); + }); + + connect(this->Increment10, &QPushButton::pressed, this, [=]() + { + this->valueTaMere += 10; + this->Value->setText(QString::number(this->valueTaMere)); + }); + + connect(this->Decrement10, &QPushButton::pressed, this, [=]() + { + this->valueTaMere -= 10; + this->Value->setText(QString::number(this->valueTaMere)); + }); + + xLayout->addWidget(Decrement10); + xLayout->addWidget(Decrement); + xLayout->addWidget(Value); + xLayout->addWidget(Increment); + xLayout->addWidget(Increment10); + + this->layout->addLayout(xLayout); + } + + int getValue() const + { + return valueTaMere; + } +private: + QVBoxLayout *layout; + QLabel *Text; + QPushButton *Decrement; + QLabel *Value; + QPushButton *Increment; + int valueTaMere = 0; + QPushButton *Increment10; + QPushButton *Decrement10; +}; + + + +#endif //TESTMODEBTN_H diff --git a/homeButton.h b/homeButton.h index 9bd6d40..c27fe2e 100644 --- a/homeButton.h +++ b/homeButton.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -12,20 +13,25 @@ public: this->mainLayout = new QVBoxLayout(this); this->homologation = new QPushButton("Mode Homologation", this); - this->homologation->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 378px; margin-top: 20px;"); + this->homologation->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 378px; margin-top: 10px; color: black;"); this->homologation->setBaseSize(378, 46); this->jeu = new QPushButton("Mode Jeu", this); - this->jeu->setStyleSheet("background-color: #ED4747; border-radius: 20px; height: 46px; width: 378px; margin-top: 20px;"); + this->jeu->setStyleSheet("background-color: #ED4747; border-radius: 20px; height: 46px; width: 378px; color: black; margin-top: 10px;"); this->jeu->setBaseSize(378, 46); this->test = new QPushButton("Mode Test", this); - this->test->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 378px; margin-top: 20px;"); + this->test->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 378px; color: black; margin-top: 10px;"); this->test->setBaseSize(378, 46); + this->quit = new QPushButton("Quitter", this); + this->quit->setStyleSheet("background-color: #ED4747; border-radius: 20px; height: 46px; width: 378px; color: black; margin-top: 10px;"); + this->quit->setBaseSize(378, 46); + this->mainLayout->addWidget(this->homologation); this->mainLayout->addWidget(this->jeu); this->mainLayout->addWidget(this->test); + this->mainLayout->addWidget(this->quit); connect(this->homologation, &QPushButton::pressed, this, [=]() { emit homologationClicked(); @@ -39,6 +45,10 @@ public: emit testClicked(); }); + connect(this->quit, &QPushButton::pressed, this, [=]() { + qApp->quit(); + }); + } signals: @@ -52,4 +62,5 @@ private: QPushButton* homologation; QPushButton* jeu; QPushButton* test; + QPushButton* quit; };