Advertisement
Guest User

mainwindow.cpp

a guest
Oct 29th, 2013
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.52 KB | None | 0 0
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3.  
  4. MainWindow::MainWindow(QWidget *parent) :
  5. QMainWindow(parent),
  6. ui(new Ui::MainWindow)
  7. {
  8. ui->setupUi(this);
  9.  
  10. automate = new Automate;
  11.  
  12. }
  13.  
  14. MainWindow::~MainWindow()
  15. {
  16. delete ui;
  17. }
  18.  
  19.  
  20. /*====================================================================================================================================================
  21. *
  22. * Partie Gestion des bouton poussoir present sur l'IHM
  23. *
  24. *
  25. *===================================================================================================================================================*/
  26.  
  27.  
  28. void MainWindow::on_pushButton_DetectionPortCOM_clicked()
  29. {
  30. /*==============================
  31. * Description : Fonction qui permet de savoir quel port peuvent être utiliser pour
  32. * la communication serie, donne differentes informations
  33. *
  34. * Created : 25/09/2013 - 16:30
  35. *
  36. * Notes : Cette fonction (premiere partie) n'a pas été réalisé par moi, ceci est un simple
  37. * copier/coller d'une fonction exemple que vous pourrez trouvez
  38. * a cette adresse: C:\Qt\Qt5.1.1\5.1.1\mingw48_32\examples\serialport\enumerator
  39. * (exemple pour l'utilisation de QSerialPort)
  40. *=============================*/
  41.  
  42. //Premiere partie
  43. QWidget *FenetreDetectionPort = new QWidget;
  44. FenetreDetectionPort->setWindowTitle(QObject::tr("Info about all available serial ports."));
  45. QVBoxLayout *layout = new QVBoxLayout;
  46.  
  47. foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
  48. QString s = QObject::tr("Port: ") + info.portName() + "\n"
  49. + QObject::tr("Location: ") + info.systemLocation() + "\n"
  50. + QObject::tr("Description: ") + info.description() + "\n"
  51. + QObject::tr("Manufacturer: ") + info.manufacturer() + "\n"
  52. + QObject::tr("Vendor Identifier: ") + (info.hasVendorIdentifier() ? QString::number(info.vendorIdentifier(), 16) : QString()) + "\n"
  53. + QObject::tr("Product Identifier: ") + (info.hasProductIdentifier() ? QString::number(info.productIdentifier(), 16) : QString()) + "\n"
  54. + QObject::tr("Busy: ") + (info.isBusy() ? QObject::tr("Yes") : QObject::tr("No")) + "\n";
  55.  
  56. QLabel *label = new QLabel(s);
  57. layout->addWidget(label);
  58. }
  59.  
  60. FenetreDetectionPort->setLayout(layout);
  61. FenetreDetectionPort->show();
  62. }
  63.  
  64.  
  65.  
  66. void MainWindow::on_pushButton_Connexion_clicked()
  67. {
  68. /*=========================================
  69. * Description : Traitement à faire lors d'un click sur le bouton : activation
  70. * des boutons et émission d'un Signal de connexion
  71. *
  72. * Created : 26/09/2013 - 08:23
  73. * Notes :
  74. *=========================================*/
  75. automate->action_Connexion();
  76. }
  77.  
  78.  
  79. void MainWindow::on_pushButton_DebutCommunication_clicked()
  80. {
  81. /*=========================================
  82. * Description : Traitement à faire lors d'un click sur le bouton : activation
  83. * des boutons et émission d'un Signal de connexion
  84. *
  85. * Created : 26/09/2013 - 08:45
  86. * Notes :
  87. *=========================================*/
  88. automate->action_DebutCommunication();
  89. }
  90.  
  91. void MainWindow::on_pushButton_Chenillard_clicked()
  92. {
  93. /*=========================================
  94. * Description : Traitement à faire lors d'un click sur le bouton : lance
  95. * le timer contrôlant le chenillard
  96. *
  97. * Created : 26/09/2013 - 08:48
  98. * Notes :
  99. *=========================================*/
  100. automate->action_Chenillard(); // démarrage du timer du chenillard
  101. }
  102.  
  103. void MainWindow::on_pushButton_StopChenillard_clicked()
  104. {
  105. /*=========================================
  106. * Description : Traitement à faire lors d'un click sur le bouton : arrete
  107. * le timer contrôlant le chenillard
  108. *
  109. * Created : 26/09/2013 - 15:42
  110. * Notes :
  111. *=========================================*/
  112. automate->action_StopChenillard(); // arret du timer du chenillard
  113. }
  114.  
  115. void MainWindow::on_pushButton_LireTrame_clicked()
  116. {
  117. /*=========================================
  118. * Description : Traitement à faire lors d'un click sur le bouton : lance
  119. * la lecture des données
  120. *
  121. * Created : 26/09/2013 - 08:50
  122. * Notes :
  123. *=========================================*/
  124. automate->action_LireTrame();
  125.  
  126. }
  127.  
  128. void MainWindow::on_pushButton_Quitter_clicked()
  129. {
  130. /*=========================================
  131. * Description : Traitement à faire lors d'un click sur le bouton : quitte
  132. * l'application
  133. *
  134. * Created : 26/09/2013 - 08:53
  135. * Notes :
  136. *=========================================*/
  137. automate->action_Quitter();
  138. }
  139.  
  140. void MainWindow::on_pushButton_LED1_clicked()
  141. {
  142. /*=========================================
  143. * Description : Lorsque l'on appuie sur le pushButon LED1, la LED
  144. * doit s'allumer ou s'éteindre
  145. *
  146. * Created : 26/09/2013 - 16:00
  147. * Notes :
  148. *=========================================*/
  149. automate->action_LED1();
  150. }
  151.  
  152. void MainWindow::on_pushButton_LED2_clicked()
  153. {
  154. /*=========================================
  155. * Description : Lorsque l'on appuie sur le pushButon LED2, la LED
  156. * doit s'allumer ou s'éteindre
  157. *
  158. * Created : 26/09/2013 - 16:00
  159. * Notes :
  160. *=========================================*/
  161. automate->action_LED2();
  162. }
  163.  
  164. void MainWindow::on_pushButton_LED3_clicked()
  165. {
  166. /*=========================================
  167. * Description : Lorsque l'on appuie sur le pushButon LED3, la LED
  168. * doit s'allumer ou s'éteindre
  169. *
  170. * Created : 26/09/2013 - 16:00
  171. * Notes :
  172. *=========================================*/
  173. automate->action_LED3();
  174. }
  175.  
  176. void MainWindow::on_pushButton_LED4_clicked()
  177. {
  178. /*=========================================
  179. * Description : Lorsque l'on appuie sur le pushButon LED4, la LED
  180. * doit s'allumer ou s'éteindre
  181. *
  182. * Created : 26/09/2013 - 16:00
  183. * Notes :
  184. *=========================================*/
  185. automate->action_LED4();
  186. }
  187.  
  188. void MainWindow::on_pushButton_LED5_clicked()
  189. {
  190. /*=========================================
  191. * Description : Lorsque l'on appuie sur le pushButon LED5, la LED
  192. * doit s'allumer ou s'éteindre
  193. *
  194. * Created : 26/09/2013 - 16:00
  195. * Notes :
  196. *=========================================*/
  197. automate->action_LED5();
  198. }
  199.  
  200. void MainWindow::on_pushButton_LED6_clicked()
  201. {
  202. /*=========================================
  203. * Description : Lorsque l'on appuie sur le pushButon LED6, la LED
  204. * doit s'allumer ou s'éteindre
  205. *
  206. * Created : 26/09/2013 - 16:00
  207. * Notes :
  208. *=========================================*/
  209. automate->action_LED6();
  210. }
  211.  
  212. void MainWindow::on_pushButton_LED7_clicked()
  213. {
  214. /*=========================================
  215. * Description : Lorsque l'on appuie sur le pushButon LED7, la LED
  216. * doit s'allumer ou s'éteindre
  217. *
  218. * Created : 26/09/2013 - 16:00
  219. * Notes :
  220. *=========================================*/
  221. automate->action_LED7();
  222. }
  223.  
  224. void MainWindow::on_pushButton_LED8_clicked()
  225. {
  226. /*=========================================
  227. * Description : Lorsque l'on appuie sur le pushButon LED8, la LED
  228. * doit s'allumer ou s'éteindre
  229. *
  230. * Created : 26/09/2013 - 16:00
  231. * Notes :
  232. *=========================================*/
  233. automate->action_LED8();
  234. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement