![]() |
TTPA (Écran)
1.1
BTS SN-IR La Salle Avignon 2018
|
Classe principale de l'application (IHM) Plus de détails...
#include <ihm.h>
Connecteurs publics | |
void | rafraichirCSS () |
Rafraichit le CSS lié à l'affichage (fontes, couleurs) utilisant getRatioFenetreY() | |
void | setInfoConnect (QString nom) |
Affiche le nom du joueur sur la table. | |
void | setNomPeripherique (QString nom) |
Affiche le nom du périférique connecté | |
void | setLayerEcran (uint8_t layer) |
Change d'ecran. | |
void | commencerSeance () |
Commencer la seance. | |
void | finirSeance () |
Finir la seance et afficher la fenêtre Recap. | |
void | pauserSeance () |
void | reprendreSeance () |
Reprendre la seance suite a une pause. | |
void | resetSeance () |
Reset des statistiques et de la configuration. | |
void | impacterZone (uint8_t zone) |
Calcul et affiche l'impact sur l'IHM et la table. | |
void | balleEnJeu () |
La balle a été capté sur le capteur coté joueur, ajout de la balle. | |
void | setZoneRobot (uint8_t zone) |
Place le robot sur la table. | |
void | setZoneObjectif (uint8_t zone) |
Place la zone objectif sur la table. | |
void | setBallesMaximum (int balles) |
Definit le nombre de balles maximum pour la seance. | |
void | rafraichirHeure () |
Rafraichit l'heure sur l'IHM (Logo et Table) | |
void | rafraichirTimerSeance () |
Rafraichit le timer de la seance. | |
void | quitter () |
Quitte l'application (utilisé par le raccourcit CTRL+Q) | |
Fonctions membres publiques | |
CIhm (QWidget *parent=0) | |
float | getRatioFenetreX () |
Récupere le ratio du width par rapport à la résolution par default 960x540. | |
float | getRatioFenetreY () |
Récupere le ratio du height par rapport à la résolution par default 960x540. | |
void | rafraichirCSS (float ratio) |
~CIhm () | |
Connecteurs privés | |
void | initialisationFenetre () |
Initialise la taille des fenetres en fonction de la résolution de l'ecran en mode plein-ecran. | |
void | setLayerEcranLogo () |
Bascule sur le menu d'attente. | |
void | setLayerEcranTable () |
Bascule sur l'interface de la table. | |
void | setLayerEcranRecap () |
Bascule sur la récapitulation de la séance. | |
void | deconnecterJoueur () |
Actions nécéssaires a la deconnexion du joueur. | |
void | connecterJoueur () |
Actions nécéssaires a la connexion du joueur. | |
void | impacterRandom () |
[DEBUG] Envoi une balle aléatoire sur la table coté robot | |
void | setZoneRobotRandom () |
[DEBUG] Definir une position du robot aléatoire (executé depuis un button sur l'IHM) | |
void | setZoneObjectifRandom () |
[DEBUG] Definir un objectif aléatoire (executé depuis un button sur l'IHM) | |
void | setInfoConnectDemo () |
[DEBUG] Execute setInfoConnect() avec le nom de demonstration | |
void | setNomPeripheriqueDemo () |
[DEBUG] Execute setNomPeripherique() avec le nom de demonstration | |
void | envoyerCommande () |
[DEBUG] Envoi une commande de la console, accepte aussi les trames | |
void | activerConsole () |
[DEBUG] Reset le CSS de la console (nécéssaire a cause du delai) | |
Fonctions membres privées | |
QString | ballesTotalSurBallesMaximum () |
String affichant le l'état des balles renvoyées sur le nombre de balles parametrée pour la seance. | |
void | connecterSignaux () |
Réalise la connexion des slots/signaux. | |
void | initialisationStats () |
Initialisation des statistiques de la seance. | |
void | rafraichirStats () |
Rafraichissement des statistiques de la seance exécuté a chaque impact/changement de parametre. | |
void | raccourcisClavier () |
Implémentation des raccourcis clavier. | |
void | gererArguments () |
Verification des options de lancement. | |
QString | calculerPourcentageQString (int x, int y) |
Récupere sous forme de QString un pourcentage: "(X%)" utilisé pour les statistiques. | |
void | setTimerSeance (unsigned int iTemps=0) |
Ecriture du temps dans m_pQLabelTimerSeance. | |
QString | getTimerSeanceString (unsigned int iTemps) |
Attributs privés | |
CommunicationBluetooth * | m_pCommunicationBluetooth |
Gestion de la communication Bluetooth. | |
QThread * | m_pThreadCommunicationBluetooth |
Thread pour la classe CommunicationBluetooth. | |
CTable * | m_pTable |
Association vers la classe CTable. | |
CTrame * | m_pTrame |
QFont | m_font |
QFont | m_fontSmall |
QFont | m_fontNormal |
QFont | m_fontNom |
QString | m_fontNoirStyle |
QString | m_fontRougeStyle |
QString | m_fontVertStyle |
QString | m_fontTitreStyle |
unsigned int | m_iTempsSeance |
Temps en seconde de la seance. | |
QTimer * | m_pTimerHeure |
Timer rafraichissant l'Heure. | |
QTimer * | m_pTimerSeance |
Timer incrémentant le temps de la seance. |
CIhm::CIhm | ( | QWidget * | parent = 0 | ) | [explicit] |
Références connecterSignaux(), DELAI_FIXFENETRE, CommunicationBluetooth::Evenement, gererArguments(), initialisationFenetre(), LAYER_LOGO, m_fontNoirStyle, m_fontRougeStyle, m_fontTitreStyle, m_fontVertStyle, m_iTempsSeance, m_pCommunicationBluetooth, m_pTable, m_pThreadCommunicationBluetooth, m_pTimerHeure, m_pTimerSeance, m_pTrame, PORT_BLUETOOTH, raccourcisClavier(), et setTimerSeance().
: QWidget(parent) { setupUi(this); raccourcisClavier(); #ifndef QT_NO_DEBUG qDebug() << Q_FUNC_INFO << "PID :" << (int)qApp->applicationPid() << "TID :" << QApplication::instance()->thread()->currentThreadId() << qApp->thread(); #endif // Gestion de la communication Bluetooth m_pCommunicationBluetooth = new CommunicationBluetooth(PORT_BLUETOOTH, CommunicationBluetooth::Evenement); // ou : //communicationBluetooth = new CommunicationBluetooth(PORT_BLUETOOTH, CommunicationBluetooth::Scrutation); m_pThreadCommunicationBluetooth = new QThread; m_pCommunicationBluetooth->moveToThread(m_pThreadCommunicationBluetooth); m_pTrame = new CTrame(this); m_fontNoirStyle = QString::fromUtf8("QLabel\n{\n color: #000000;\n}"); m_fontRougeStyle = QString::fromUtf8("QLabel\n{\n color: #FF0000;\n}"); m_fontVertStyle = QString::fromUtf8("QLabel\n{\n color: #006500;\n}"); m_fontTitreStyle = QString::fromUtf8("QLabel\n{\n color: #000000;\n background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(0, 0, 0, 0)); \n}"); m_pTable = new CTable(this); QTimer::singleShot(DELAI_FIXFENETRE, this, SLOT(initialisationFenetre())); QTimer::singleShot(DELAI_FIXFENETRE*4, this, SLOT(initialisationFenetre())); m_pHBLayoutTable->addWidget(m_pTable); m_pTimerHeure = new QTimer(this); m_pTimerHeure->setInterval(3000); m_pTimerSeance = new QTimer(this); m_pTimerSeance->setInterval(1000); m_iTempsSeance = 0; setTimerSeance(0); gererArguments(); m_pFenetres->setCurrentIndex(LAYER_LOGO); connecterSignaux(); m_pTimerHeure->start(); // démarre la communication Bluetooth m_pThreadCommunicationBluetooth->start(); }
CIhm::~CIhm | ( | ) |
Références CommunicationBluetooth::finir(), m_pCommunicationBluetooth, et m_pThreadCommunicationBluetooth.
{ // Ferme la communication Bluetooth m_pCommunicationBluetooth->finir(); m_pThreadCommunicationBluetooth->quit(); m_pThreadCommunicationBluetooth->wait(); delete m_pCommunicationBluetooth; delete m_pThreadCommunicationBluetooth; #ifndef QT_NO_DEBUG qDebug() << Q_FUNC_INFO << "fin"; #endif }
void CIhm::activerConsole | ( | ) | [private, slot] |
Référencé par envoyerCommande().
{
m_pConsole->setStyleSheet("QLineEdit#m_pConsole\n{\n\n}");
}
CIhm::balleEnJeu | ( | ) | [slot] |
Références CTable::balleEnJeu(), ballesTotalSurBallesMaximum(), m_fontNormal, m_pTable, et rafraichirStats().
Référencé par connecterSignaux(), et gererArguments().
{ qDebug() << Q_FUNC_INFO; m_pTable->balleEnJeu(); m_pQLabelTopMid->setFont(m_fontNormal); m_pQLabelTopMid->setText(ballesTotalSurBallesMaximum()); rafraichirStats(); }
QString CIhm::ballesTotalSurBallesMaximum | ( | ) | [private] |
Références CTable::getBallesMaximum(), CTable::getBallesTotal(), et m_pTable.
Référencé par balleEnJeu(), commencerSeance(), impacterZone(), rafraichirCSS(), et setBallesMaximum().
{ QString ballesMax = QString::number(m_pTable->getBallesMaximum()); if (!m_pTable->getBallesMaximum()) ballesMax = QString::fromUtf8("∞"); return /*QString::fromUtf8(IHM_BALLESENVOYEES) +*/ QString::number(m_pTable->getBallesTotal()) + " / " + ballesMax; }
QString CIhm::calculerPourcentageQString | ( | int | x, |
int | y | ||
) | [private] |
Référencé par finirSeance(), et rafraichirStats().
{ if (!y) return "(0%)"; return "(" + QString::number((double(x) / double(y))*100,'f',0) + "%)"; }
CIhm::commencerSeance | ( | ) | [slot] |
Références ballesTotalSurBallesMaximum(), CSS_TIMER_ON, LAYER_TABLE, m_iTempsSeance, m_pTable, m_pTimerSeance, rafraichirStats(), CTable::resetStatistiques(), setLayerEcran(), et setTimerSeance().
Référencé par connecterSignaux(), et gererArguments().
{ qDebug() << Q_FUNC_INFO; // if (m_pFenetres->currentIndex() != LAYER_TABLE) // return; setLayerEcran(LAYER_TABLE); m_iTempsSeance = 0; m_pTimerSeance->start(1000); m_pQLabelTimerSeance->setStyleSheet(CSS_TIMER_ON); m_pHBLayoutTable->addWidget(m_pTable); m_pTable->resetStatistiques(); m_pQLabelTopMid->setText(ballesTotalSurBallesMaximum()); setTimerSeance(0); rafraichirStats(); }
void CIhm::connecterJoueur | ( | ) | [private, slot] |
Références LAYER_LOGO, LOGO_ATTENTECONFIGURATION, et setLayerEcran().
Référencé par connecterSignaux(), et gererArguments().
{ qDebug() << Q_FUNC_INFO; setLayerEcran(LAYER_LOGO); // m_pQLabelLogoTexte->setText(LOGO_ATTENTEIDENTIFICATION); Ancien Message m_pQLabelLogoTexte->setText(LOGO_ATTENTECONFIGURATION); }
void CIhm::connecterSignaux | ( | ) | [private] |
Références balleEnJeu(), commencerSeance(), connecterJoueur(), deconnecterJoueur(), finirSeance(), impacterZone(), m_pCommunicationBluetooth, m_pThreadCommunicationBluetooth, m_pTimerHeure, m_pTimerSeance, m_pTrame, main(), pauserSeance(), quitter(), rafraichirCSS(), rafraichirHeure(), rafraichirTimerSeance(), reprendreSeance(), resetSeance(), setBallesMaximum(), setInfoConnect(), setLayerEcran(), setNomPeripherique(), setZoneObjectif(), et setZoneRobot().
Référencé par CIhm().
{ // Thread Bluetooth connect(m_pThreadCommunicationBluetooth, SIGNAL(started()), m_pCommunicationBluetooth, SLOT(main())); connect(m_pThreadCommunicationBluetooth, SIGNAL(finished()), m_pCommunicationBluetooth, SLOT(terminer())); // Timers connect(m_pTimerHeure, SIGNAL(timeout()),this, SLOT(rafraichirHeure())); connect(m_pTimerSeance, SIGNAL(timeout()),this, SLOT(rafraichirTimerSeance())); // Gestion des trames connect(m_pCommunicationBluetooth, SIGNAL(nouvellesDonneesRecues(QString)), m_pTrame, SLOT(traiterTrame(QString))); connect(m_pTrame, SIGNAL(setLayerEcran(uint8_t)), this, SLOT(setLayerEcran(uint8_t))); connect(m_pTrame, SIGNAL(setInfoConnect(QString)), this, SLOT(setInfoConnect(QString))); connect(m_pTrame, SIGNAL(resetSeance()), this, SLOT(resetSeance())); connect(m_pTrame, SIGNAL(commencerSeance()), this, SLOT(commencerSeance())); connect(m_pTrame, SIGNAL(pauserSeance()), this, SLOT(pauserSeance())); connect(m_pTrame, SIGNAL(reprendreSeance()), this, SLOT(reprendreSeance())); connect(m_pTrame, SIGNAL(finirSeance()), this, SLOT(finirSeance())); connect(m_pTrame, SIGNAL(impacterZone(uint8_t)), this, SLOT(impacterZone(uint8_t))); connect(m_pTrame, SIGNAL(balleEnJeu()), this, SLOT(balleEnJeu())); connect(m_pTrame, SIGNAL(setZoneRobot(uint8_t)), this, SLOT(setZoneRobot(uint8_t))); connect(m_pTrame, SIGNAL(setZoneObjectif(uint8_t)), this, SLOT(setZoneObjectif(uint8_t))); connect(m_pTrame, SIGNAL(setBallesMaximum(int)), this, SLOT(setBallesMaximum(int))); connect(m_pTrame, SIGNAL(rafraichirCSS()), this, SLOT(rafraichirCSS())); connect(m_pTrame, SIGNAL(quitter()), this, SLOT(quitter())); connect(m_pCommunicationBluetooth, SIGNAL(deconnecterJoueur()), this, SLOT(deconnecterJoueur())); connect(m_pCommunicationBluetooth, SIGNAL(connecterJoueur()), this, SLOT(connecterJoueur())); connect(m_pCommunicationBluetooth, SIGNAL(setNomPeripherique(QString)), this, SLOT(setNomPeripherique(QString))); }
void CIhm::deconnecterJoueur | ( | ) | [private, slot] |
Références LAYER_LOGO, LOGO_ATTENTECONNEXION, resetSeance(), et setLayerEcran().
Référencé par connecterSignaux(), et gererArguments().
{ qDebug() << Q_FUNC_INFO; setLayerEcran(LAYER_LOGO); m_pQLabelLogoTexte->setText(LOGO_ATTENTECONNEXION); m_pQLabelLogoNom->setText(""); m_pQLabelLogoNomMessage->setText(""); resetSeance(); }
void CIhm::envoyerCommande | ( | ) | [private, slot] |
Références activerConsole(), m_pTrame, quitter(), et CTrame::traiterTrame().
Référencé par gererArguments().
{ QString texte = m_pConsole->text(); QTimer::singleShot(300, this, SLOT(activerConsole())); m_pConsole->setStyleSheet("QLineEdit#m_pConsole\n" "{\n" " background-color: #00FF00;\n" "}"); if(texte.startsWith("$TTPA:")) { bool retour = m_pTrame->traiterTrame(texte); if (!retour) m_pConsole->setStyleSheet("QLineEdit#m_pConsole\n{\nbackground-color: #FF0000;\n}"); return; } if(texte.startsWith("hide ")) { QStringList args = texte.split(" "); if(args.length() == 2) { m_pConsole->hide(); QTimer::singleShot(1000 * args.at(1).toInt(), m_pConsole, SLOT(show())); } return; } if (texte.toLower() == "quit") { quitter(); return; } m_pConsole->setStyleSheet("QLineEdit#m_pConsole\n{\nbackground-color: #FF0000;\n}"); }
CIhm::finirSeance | ( | ) | [slot] |
Références calculerPourcentageQString(), CTable::finirSeance(), CTable::getBallesBonnes(), CTable::getBallesEnchainees(), CTable::getBallesObjectif(), CTable::getBallesTotal(), CTable::getZoneObjectif(), LAYER_RECAP, m_pTable, m_pTimerSeance, rafraichirStats(), RECAP_STAT1, RECAP_STAT1_ALT, RECAP_STAT2, RECAP_STAT3, setLayerEcran(), et ZONE_AUCUNE.
Référencé par connecterSignaux(), et gererArguments().
{ qDebug() << Q_FUNC_INFO; setLayerEcran(LAYER_RECAP); QString decalage = " "; m_pTimerSeance->stop(); m_pTable->finirSeance(); //================== // STAT 1 if(m_pTable->getZoneObjectif() == ZONE_AUCUNE) { m_pQLabelLeftStat1TexteRecap->setText(decalage+ RECAP_STAT1_ALT); m_pQLabelLeftStat1NbRecap->setText(QString::number(m_pTable->getBallesBonnes()) + " / " + QString::number(m_pTable->getBallesTotal()) ); m_pQLabelLeftStat1PerRecap->setText(calculerPourcentageQString(m_pTable->getBallesBonnes(),m_pTable->getBallesTotal()) ); } else { m_pQLabelLeftStat1TexteRecap->setText(decalage+ RECAP_STAT1); m_pQLabelLeftStat1NbRecap->setText(QString::number(m_pTable->getBallesObjectif()) + " / " + QString::number(m_pTable->getBallesTotal()) ); m_pQLabelLeftStat1PerRecap->setText(calculerPourcentageQString(m_pTable->getBallesObjectif(),m_pTable->getBallesTotal()) ); } //================== // STAT 2 m_pQLabelLeftStat2TexteRecap->setText(decalage+ RECAP_STAT2); rafraichirStats(); //================== // STAT 3 m_pQLabelLeftStat3TexteRecap->setText(decalage+ RECAP_STAT3); m_pQLabelLeftStat3NbRecap->setText(QString::number(m_pTable->getBallesEnchainees())); //================== // STAT 4 // TODO m_pHBLayoutTableRecap->addWidget(m_pTable); }
void CIhm::gererArguments | ( | ) | [private] |
Références balleEnJeu(), commencerSeance(), connecterJoueur(), deconnecterJoueur(), DEV_BALLESMAX, envoyerCommande(), finirSeance(), impacterRandom(), CTable::m_args, m_fontRougeStyle, m_pTable, CTable::setBallesMaximum(), setBallesMaximum(), setInfoConnectDemo(), setLayerEcranTable(), setNomPeripheriqueDemo(), setZoneObjectifRandom(), et setZoneRobotRandom().
Référencé par CIhm().
{ QStringList args = QCoreApplication::arguments(); // Verification des arguments srand(QTime::currentTime().msec()); m_pTable->m_args = args; //============= // DEV if (!args.contains("-dev",Qt::CaseInsensitive)) // Suppression des boutons pour les tests sans materiel { m_pQLabelLogoNom->setText(""); m_pQLabelLogoNomMessage->setText(""); delete m_pTestZoneRobotRandom; delete m_pTestZoneObjectifRandom; delete m_pTestZoneRandom; delete m_pTestZoneReset; } else { m_pQLabelTopLeftNomRecap->setText("MODE DEVELOPPEMENT"); m_pQLabelTopLeftNomRecap->setStyleSheet(m_fontRougeStyle); m_pQLabelTopLeftNom->setText("MODE DEVELOPPEMENT"); m_pQLabelTopLeftNom->setStyleSheet(m_fontRougeStyle); m_pQLabelLogoNom->setText("MODE DEVELOPPEMENT"); m_pQLabelLogoNom->setStyleSheet(m_fontRougeStyle); m_pQLabelLogoNomMessage->setText(""); m_pTable->setBallesMaximum(DEV_BALLESMAX); } if (!args.contains("-dev",Qt::CaseInsensitive) && !args.contains("-console",Qt::CaseInsensitive)) { delete m_pTestOutrepasser; delete m_pTestStartRecap; } else { connect(m_pTestOutrepasser, SIGNAL(pressed()), this, SLOT(commencerSeance())); connect(m_pTestStartRecap, SIGNAL(pressed()), this, SLOT(commencerSeance())); } //============= // WINDOWED if (!args.contains("-windowed",Qt::CaseInsensitive)) // mode fenétré { this->showFullScreen(); } //============= // MODE DEMO if (args.contains("-demo",Qt::CaseInsensitive)) // Mode de demonstration { setBallesMaximum(DEV_BALLESMAX); QTimer::singleShot(2000, this, SLOT(connecterJoueur())); QTimer::singleShot(2000, this, SLOT(setInfoConnectDemo())); QTimer::singleShot(2000, this, SLOT(setNomPeripheriqueDemo())); QTimer::singleShot(3500, this, SLOT(setZoneObjectifRandom())); if (!args.contains("-norobot",Qt::CaseInsensitive)) QTimer::singleShot(4000, this, SLOT(setZoneRobotRandom())); QTimer::singleShot(5000, this, SLOT(commencerSeance())); QTimer::singleShot(4000, this, SLOT(setLayerEcranTable())); for(int i=0 ; i < DEV_BALLESMAX ; i++) { QTimer::singleShot((6500) + i*1000, this, SLOT(balleEnJeu())); if(rand() % 10) // 1 chance sur 10 de rater QTimer::singleShot((7000) + i*1000, this, SLOT(impacterRandom())); } QTimer::singleShot((7000) + (1+DEV_BALLESMAX)*1000, this, SLOT(finirSeance())); QTimer::singleShot((15000) + (DEV_BALLESMAX)*1000, this, SLOT(deconnecterJoueur())); } //============= // CONSOLE if (!args.contains("-console",Qt::CaseInsensitive)) { delete m_pConsole; } else { connect(m_pConsole, SIGNAL(returnPressed()), this, SLOT(envoyerCommande())); } }
float CIhm::getRatioFenetreX | ( | ) |
Références TAILLE_FENETRE_DEFAULT_WIDTH.
{ return ( (float)this->width()/TAILLE_FENETRE_DEFAULT_WIDTH ); }
float CIhm::getRatioFenetreY | ( | ) |
Références TAILLE_FENETRE_DEFAULT_HEIGHT.
Référencé par initialisationFenetre(), rafraichirCSS(), resetSeance(), setInfoConnect(), et setLayerEcran().
{ return ( (float)this->height()/TAILLE_FENETRE_DEFAULT_HEIGHT ); }
QString CIhm::getTimerSeanceString | ( | unsigned int | iTemps | ) | [private] |
Référencé par pauserSeance(), reprendreSeance(), et setTimerSeance().
{ unsigned int iMinutes = (unsigned int)((float)iTemps / (float)60); unsigned int iSecondes = iTemps - (iMinutes*60); QString zeroSeconde = ""; // CORRECTION LIEE AU ZERO if (iSecondes < 10) zeroSeconde = "0"; return QString::number(iMinutes) + ":" + zeroSeconde + QString::number(iSecondes) + " "; }
void CIhm::impacterRandom | ( | ) | [private, slot] |
Références impacterZone().
Référencé par gererArguments().
{ qDebug() << ">> DEV! " << Q_FUNC_INFO; impacterZone(rand() % 9); }
CIhm::impacterZone | ( | uint8_t | zone | ) | [slot] |
zone | enum voir const.h |
Références ballesTotalSurBallesMaximum(), CTable::impacterZone(), m_pTable, et rafraichirStats().
Référencé par connecterSignaux(), et impacterRandom().
{ qDebug() << Q_FUNC_INFO; m_pTable->impacterZone(zone); m_pQLabelTopMid->setText(ballesTotalSurBallesMaximum()); rafraichirStats(); }
void CIhm::initialisationFenetre | ( | ) | [private, slot] |
Références getRatioFenetreY(), initialisationStats(), LOGO_ATTENTECONNEXION, m_fontNoirStyle, m_fontNormal, m_fontTitreStyle, m_pTable, rafraichirCSS(), rafraichirHeure(), RATIO_ENTETE, RECAP_TITRE_TEXTE, et CTable::setFiletTaille().
Référencé par CIhm().
{ rafraichirCSS(getRatioFenetreY()); //===================== // LAYER LOGO m_pQLabelLogo->setFixedHeight(this->height() /2); m_pQLabelLogo->setFixedWidth(this->width() /2); m_pQLabelLogoTexte->setFixedHeight(this->height() / RATIO_ENTETE); m_pQLabelLogoHeure->setFixedHeight(this->height() / RATIO_ENTETE); m_pQLabelLogoTexte->setText(LOGO_ATTENTECONNEXION); //===================== // LAYER TABLE qDebug() << Q_FUNC_INFO << QTime::currentTime().toString(); m_pQLabelTopRightHeure->setFixedHeight(this->height() / RATIO_ENTETE); m_pQLabelTimerSeance->setFixedHeight(this->height() / RATIO_ENTETE); m_pQLabelTimerSeanceRecap->setFixedHeight(this->height() / RATIO_ENTETE); m_pQLabelTopMid->setFixedHeight(this->height() / RATIO_ENTETE); m_pQLabelTopMid->setStyleSheet(m_fontNoirStyle); m_pTable->setFiletTaille(getRatioFenetreY()); initialisationStats(); //===================== // LAYER RECAP m_pQLabelTopRightHeureRecap->setFixedHeight(this->height() / RATIO_ENTETE); m_pQLabelTopTexteRecap->setFixedHeight(this->height() / RATIO_ENTETE); m_pQLabelTopTexteRecap->setStyleSheet(m_fontTitreStyle); m_pQLabelTopTexteRecap->setFont(m_fontNormal); m_pQLabelTopTexteRecap->setText(RECAP_TITRE_TEXTE); //===================== // HEURE rafraichirHeure(); }
void CIhm::initialisationStats | ( | ) | [private] |
Références m_font, m_fontNoirStyle, m_fontNormal, rafraichirStats(), et TABLE_STAT1.
Référencé par initialisationFenetre().
{ m_pQLabelLeftStat1Texte->setFont(m_font); m_pQLabelLeftStat1Nb->setFont(m_font); m_pQLabelLeftStat1Texte->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat1Nb->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat1Texte->setText(TABLE_STAT1); //RECAP m_pQLabelLeftStat1TexteRecap->setFont(m_font); m_pQLabelLeftStat1TexteRecap->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat2TexteRecap->setFont(m_font); m_pQLabelLeftStat2TexteRecap->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat3TexteRecap->setFont(m_font); m_pQLabelLeftStat3TexteRecap->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat4TexteRecap->setFont(m_font); m_pQLabelLeftStat4TexteRecap->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat1PerRecap->setFont(m_font); m_pQLabelLeftStat1PerRecap->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat2PerRecap->setFont(m_font); m_pQLabelLeftStat2PerRecap->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat3PerRecap->setFont(m_font); m_pQLabelLeftStat3PerRecap->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat4PerRecap->setFont(m_font); m_pQLabelLeftStat4PerRecap->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat1NbRecap->setFont(m_fontNormal); m_pQLabelLeftStat1NbRecap->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat2NbRecap->setFont(m_fontNormal); m_pQLabelLeftStat2NbRecap->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat3NbRecap->setFont(m_fontNormal); m_pQLabelLeftStat3NbRecap->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat4NbRecap->setFont(m_fontNormal); m_pQLabelLeftStat4NbRecap->setStyleSheet(m_fontNoirStyle); m_pQLabelLeftStat1TexteRecap->clear(); m_pQLabelLeftStat2TexteRecap->clear(); m_pQLabelLeftStat3TexteRecap->clear(); m_pQLabelLeftStat4TexteRecap->clear(); m_pQLabelLeftStat1PerRecap->clear(); m_pQLabelLeftStat2PerRecap->clear(); m_pQLabelLeftStat3PerRecap->clear(); m_pQLabelLeftStat4PerRecap->clear(); m_pQLabelLeftStat1NbRecap->clear(); m_pQLabelLeftStat2NbRecap->clear(); m_pQLabelLeftStat3NbRecap->clear(); m_pQLabelLeftStat4NbRecap->clear(); rafraichirStats(); }
void CIhm::pauserSeance | ( | ) | [slot] |
Références CSS_TIMER_OFF, getTimerSeanceString(), m_iTempsSeance, et m_pTimerSeance.
Référencé par connecterSignaux().
{ qDebug() << Q_FUNC_INFO; m_pTimerSeance->stop(); m_pQLabelTimerSeance->setStyleSheet(CSS_TIMER_OFF); m_pQLabelTimerSeance->setText(QString::fromUtf8("▮▮ ") + getTimerSeanceString(m_iTempsSeance)); }
void CIhm::quitter | ( | ) | [slot] |
Référencé par connecterSignaux(), envoyerCommande(), et raccourcisClavier().
{ close(); }
void CIhm::raccourcisClavier | ( | ) | [private] |
Références quitter().
Référencé par CIhm().
{ // CTRL+Q QAction *actionQuitter = new QAction("&Quitter", this); actionQuitter->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); //actionQuitter->setShortcut(QKeySequence(QKeySequence::Quit)); // Ctrl+Q, NE FONCTIONNE PAS SUR PI addAction(actionQuitter); connect(actionQuitter, SIGNAL(triggered()), this, SLOT(quitter())); }
void CIhm::rafraichirCSS | ( | float | ratio | ) |
Références ballesTotalSurBallesMaximum(), m_font, m_fontNoirStyle, m_fontNom, m_fontNormal, m_fontSmall, m_fontTitreStyle, m_pTable, CTable::rafraichirCSS(), TAILLE_TEXTE, TAILLE_TEXTE_NOM, TAILLE_TEXTE_NORMAL, et TAILLE_TEXTE_SMALL.
{ //========================= // SPECIFIQUE AU LOGO //========================= m_font.setBold(true); m_fontSmall.setBold(true); m_fontNormal.setBold(true); m_fontNom.setBold(true); m_font.setPointSize((int)(TAILLE_TEXTE*ratio)); m_fontSmall.setPointSize((int)(TAILLE_TEXTE_SMALL*ratio)); m_fontNormal.setPointSize((int)(TAILLE_TEXTE_NORMAL*ratio)); m_fontNom.setPointSize((int)(TAILLE_TEXTE_NOM*ratio)); m_pQLabelLogoTexte->setFont(m_font); m_pQLabelLogoTexte->setStyleSheet(m_fontTitreStyle); m_pQLabelLogoHeure->setFont(m_fontNormal); m_pQLabelLogoHeure->setStyleSheet(m_fontNoirStyle); m_pQLabelLogoNom->setFont(m_font); m_pQLabelLogoNomMessage->setFont(m_font); m_pQLabelLogoNomMessage->setStyleSheet(m_fontNoirStyle); //========================= // SPECIFIQUE A LA TABLE //========================= m_pQLabelTopMid->setFont(m_fontNormal); m_pQLabelTopLeftNom->setFont(m_fontNom); m_pQLabelTopLeftNomPeripherique->setFont(m_fontSmall); m_pQLabelTopRightHeure->setFont(m_fontNormal); m_pQLabelTopRightHeure->setStyleSheet(m_fontNoirStyle); m_pQLabelTimerSeance->setFont(m_fontNormal); m_pQLabelTimerSeanceRecap->setFont(m_fontNormal); m_pQLabelTopMid->setText(ballesTotalSurBallesMaximum()); m_pTable->rafraichirCSS(ratio); //========================= // SPECIFIQUE AU RECAP //========================= m_pQLabelTopRightHeureRecap->setFont(m_fontNormal); m_pQLabelTopRightHeureRecap->setStyleSheet(m_fontNoirStyle); m_pQLabelTopLeftNomRecap->setFont(m_fontNom); m_pQLabelTopLeftNomPeripheriqueRecap->setFont(m_fontSmall); }
CIhm::rafraichirCSS | ( | ) | [slot] |
Rafraichit le CSS lié à l'affichage (fontes, couleurs)
ratio |
Références getRatioFenetreY().
Référencé par connecterSignaux(), initialisationFenetre(), et resetSeance().
{ rafraichirCSS(getRatioFenetreY()); }
void CIhm::rafraichirHeure | ( | ) | [slot] |
Référencé par connecterSignaux(), et initialisationFenetre().
{ QString zeroMinute = "", zeroHeure = ""; // CORRECTION LIEE AU ZERO if (QTime::currentTime().hour() < 10) zeroHeure = "0"; if (QTime::currentTime().minute() < 10) zeroMinute = "0"; QString format = zeroHeure + QString::number(QTime::currentTime().hour()) + ":" + zeroMinute + QString::number(QTime::currentTime().minute()) + " "; // EASTER EGG ( ͡° ͜ʖ ͡°) if (QTime::currentTime().hour() == 13 && QTime::currentTime().minute() == 37){ format = "L3:3T";} m_pQLabelTopRightHeureRecap->setText(format); m_pQLabelTopRightHeure->setText(format); m_pQLabelLogoHeure->setText(format); }
void CIhm::rafraichirStats | ( | ) | [private] |
Références calculerPourcentageQString(), CTable::getBallesHorsTable(), CTable::getBallesTotal(), et m_pTable.
Référencé par balleEnJeu(), commencerSeance(), finirSeance(), impacterZone(), initialisationStats(), resetSeance(), setZoneObjectif(), et setZoneObjectifRandom().
{ m_pQLabelLeftStat1Nb->setText(QString::number(m_pTable->getBallesHorsTable()) + " " + calculerPourcentageQString(m_pTable->getBallesHorsTable(), m_pTable->getBallesTotal() - 1)); m_pQLabelLeftStat2NbRecap->setText(QString::number(m_pTable->getBallesHorsTable()) + " / " + QString::number(m_pTable->getBallesTotal()) ); m_pQLabelLeftStat2PerRecap->setText(calculerPourcentageQString(m_pTable->getBallesHorsTable(), m_pTable->getBallesTotal()) ); }
void CIhm::rafraichirTimerSeance | ( | ) | [slot] |
Références CSS_TIMER_ON, m_iTempsSeance, et setTimerSeance().
Référencé par connecterSignaux().
{ // qDebug() << Q_FUNC_INFO; /!\ Spam m_iTempsSeance++; m_pQLabelTimerSeance->setStyleSheet(CSS_TIMER_ON); setTimerSeance(m_iTempsSeance); }
CIhm::reprendreSeance | ( | ) | [slot] |
Références CSS_TIMER_RES, getTimerSeanceString(), m_iTempsSeance, et m_pTimerSeance.
Référencé par connecterSignaux().
{ qDebug() << Q_FUNC_INFO; m_pTimerSeance->start(1000); m_pQLabelTimerSeance->setStyleSheet(CSS_TIMER_RES); m_pQLabelTimerSeance->setText(QString::fromUtf8("▶ ") + getTimerSeanceString(m_iTempsSeance)); }
CIhm::resetSeance | ( | ) | [slot] |
Références getRatioFenetreY(), m_iTempsSeance, m_pTable, m_pTimerSeance, rafraichirCSS(), rafraichirStats(), CTable::resetSeance(), setInfoConnect(), et setTimerSeance().
Référencé par connecterSignaux(), et deconnecterJoueur().
{ qDebug() << Q_FUNC_INFO; m_pTable->resetSeance(); rafraichirCSS(getRatioFenetreY()); rafraichirStats(); setInfoConnect(m_pQLabelLogoNom->text()); m_iTempsSeance = 0; m_pTimerSeance->stop(); setTimerSeance(0); }
CIhm::setBallesMaximum | ( | int | balles | ) | [slot] |
balles | int |
Références ballesTotalSurBallesMaximum(), m_fontNormal, m_pTable, et CTable::setBallesMaximum().
Référencé par connecterSignaux(), et gererArguments().
{ qDebug() << Q_FUNC_INFO << "BALLES: " << balles; m_pTable->setBallesMaximum(balles); // rafraichirCSS(getRatioFenetreY()); // nécéssaire pour refresh l'IHM car ballemax est utilisé par elle aussi m_pQLabelTopMid->setFont(m_fontNormal); m_pQLabelTopMid->setText(ballesTotalSurBallesMaximum()); }
CIhm::setInfoConnect | ( | QString | nom | ) | [slot] |
nom | QString nom du joueur |
Références getRatioFenetreY(), LOGO_ATTENTECONFIGURATION, m_fontNom, et TAILLE_TEXTE_NOM.
Référencé par connecterSignaux(), resetSeance(), et setInfoConnectDemo().
{ if (nom == "") return; m_pQLabelTopLeftNomRecap->setText(nom); m_pQLabelTopLeftNom->setText(nom); // m_pQLabelLogoNom->setText(nom); affiche le nom du peripherique depuis 1.1 m_pQLabelLogoTexte->setText(LOGO_ATTENTECONFIGURATION); qDebug() << Q_FUNC_INFO << " nom : " << nom; float tailleNomRatio; if (nom.length() > 20) tailleNomRatio = (4.0 / (float)(nom.length()) + (1-4.0/20)); else tailleNomRatio = 1.0; m_fontNom.setPointSize((int)(TAILLE_TEXTE_NOM*getRatioFenetreY()) * tailleNomRatio); // m_pQLabelTopLeftNom->setFont(m_fontNom); affiche le nom du peripherique depuis 1.1 m_pQLabelTopLeftNomRecap->setFont(m_fontNom); }
void CIhm::setInfoConnectDemo | ( | ) | [private, slot] |
Références IHM_NOMDETEST, et setInfoConnect().
Référencé par gererArguments().
{ setInfoConnect(IHM_NOMDETEST); }
CIhm::setLayerEcran | ( | uint8_t | layer | ) | [slot] |
layer | enum voir const.h |
Références getRatioFenetreY(), m_pTable, et CTable::setLayerEcran().
Référencé par commencerSeance(), connecterJoueur(), connecterSignaux(), deconnecterJoueur(), finirSeance(), setLayerEcranLogo(), setLayerEcranRecap(), et setLayerEcranTable().
{ m_pTable->setLayerEcran(layer,getRatioFenetreY()); m_pFenetres->setCurrentIndex(layer); qDebug() << Q_FUNC_INFO; }
void CIhm::setLayerEcranLogo | ( | ) | [private, slot] |
Références LAYER_LOGO, et setLayerEcran().
{ setLayerEcran(LAYER_LOGO); }
void CIhm::setLayerEcranRecap | ( | ) | [private, slot] |
Références LAYER_RECAP, et setLayerEcran().
{ setLayerEcran(LAYER_RECAP); }
void CIhm::setLayerEcranTable | ( | ) | [private, slot] |
Références LAYER_TABLE, et setLayerEcran().
Référencé par gererArguments().
{ setLayerEcran(LAYER_TABLE); }
CIhm::setNomPeripherique | ( | QString | nom = "Peripherique DEMO" | ) | [slot] |
nom | QString nom du périférique |
Références LOGO_JOUEUR_CONNECTE, et m_fontVertStyle.
Référencé par connecterSignaux(), et setNomPeripheriqueDemo().
{ m_pQLabelLogoNom->setText(nom); m_pQLabelTopLeftNomPeripherique->setText("(" + nom + ")"); m_pQLabelTopLeftNomPeripheriqueRecap->setText("(" + nom + ")"); m_pQLabelLogoNom->setStyleSheet(m_fontVertStyle); m_pQLabelTopLeftNomPeripherique->setStyleSheet(m_fontVertStyle); m_pQLabelTopLeftNomPeripheriqueRecap->setStyleSheet(m_fontVertStyle); m_pQLabelLogoNomMessage->setText(LOGO_JOUEUR_CONNECTE); }
void CIhm::setNomPeripheriqueDemo | ( | ) | [private, slot] |
Références IHM_PERIPHERIQUEDETEST, et setNomPeripherique().
Référencé par gererArguments().
void CIhm::setTimerSeance | ( | unsigned int | iTemps = 0 | ) | [private] |
Minutes,Secondes |
Références getTimerSeanceString().
Référencé par CIhm(), commencerSeance(), rafraichirTimerSeance(), et resetSeance().
{ m_pQLabelTimerSeance->setText( getTimerSeanceString(iTemps) ); m_pQLabelTimerSeanceRecap->setText( getTimerSeanceString(iTemps) ); }
CIhm::setZoneObjectif | ( | uint8_t | zone | ) | [slot] |
zone | enum voir const.h |
Références m_pTable, rafraichirStats(), et CTable::setZoneObjectif().
Référencé par connecterSignaux().
{ qDebug() << Q_FUNC_INFO << "ZONE: " << zone; m_pTable->setZoneObjectif(zone); rafraichirStats(); }
void CIhm::setZoneObjectifRandom | ( | ) | [private, slot] |
Références m_pTable, rafraichirStats(), et CTable::setZoneObjectif().
Référencé par gererArguments().
{ qDebug() << ">> DEV! " << Q_FUNC_INFO; m_pTable->setZoneObjectif(rand() % 9); rafraichirStats(); }
CIhm::setZoneRobot | ( | uint8_t | zone | ) | [slot] |
zone | enum voir const.h |
Références m_pTable, et CTable::setZoneRobot().
Référencé par connecterSignaux().
{ qDebug() << Q_FUNC_INFO << "ZONE: " << zone; m_pTable->setZoneRobot(zone); }
void CIhm::setZoneRobotRandom | ( | ) | [private, slot] |
Références m_pTable, et CTable::setZoneRobot().
Référencé par gererArguments().
{ qDebug() << ">> DEV! " << Q_FUNC_INFO; int random = -1; while (random < 0 || random == m_pTable->getZoneObjectif()) { srand(QTime::currentTime().msec()); random = rand() % 9; m_pTable->setZoneRobot(random); } }
QFont CIhm::m_font [private] |
Référencé par initialisationStats(), et rafraichirCSS().
QString CIhm::m_fontNoirStyle [private] |
Référencé par CIhm(), initialisationFenetre(), initialisationStats(), et rafraichirCSS().
QFont CIhm::m_fontNom [private] |
Référencé par rafraichirCSS(), et setInfoConnect().
QFont CIhm::m_fontNormal [private] |
Référencé par balleEnJeu(), initialisationFenetre(), initialisationStats(), rafraichirCSS(), et setBallesMaximum().
QString CIhm::m_fontRougeStyle [private] |
Référencé par CIhm(), et gererArguments().
QFont CIhm::m_fontSmall [private] |
Référencé par rafraichirCSS().
QString CIhm::m_fontTitreStyle [private] |
Référencé par CIhm(), initialisationFenetre(), et rafraichirCSS().
QString CIhm::m_fontVertStyle [private] |
Référencé par CIhm(), et setNomPeripherique().
unsigned int CIhm::m_iTempsSeance [private] |
Référencé par CIhm(), commencerSeance(), pauserSeance(), rafraichirTimerSeance(), reprendreSeance(), et resetSeance().
Référencé par CIhm(), connecterSignaux(), et ~CIhm().
CTable* CIhm::m_pTable [private] |
Référencé par balleEnJeu(), ballesTotalSurBallesMaximum(), CIhm(), commencerSeance(), finirSeance(), gererArguments(), impacterZone(), initialisationFenetre(), rafraichirCSS(), rafraichirStats(), resetSeance(), setBallesMaximum(), setLayerEcran(), setZoneObjectif(), setZoneObjectifRandom(), setZoneRobot(), et setZoneRobotRandom().
QThread* CIhm::m_pThreadCommunicationBluetooth [private] |
Référencé par CIhm(), connecterSignaux(), et ~CIhm().
QTimer* CIhm::m_pTimerHeure [private] |
Référencé par CIhm(), et connecterSignaux().
QTimer* CIhm::m_pTimerSeance [private] |
Référencé par CIhm(), commencerSeance(), connecterSignaux(), finirSeance(), pauserSeance(), reprendreSeance(), et resetSeance().
CTrame* CIhm::m_pTrame [private] |
Référencé par CIhm(), connecterSignaux(), et envoyerCommande().