MainWindow.cpp 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*********************************************************************/
  2. /* */
  3. /* Copyright 2022-2023 Rémi Synave - remi.synave@univ-littoral.fr */
  4. /* */
  5. /* This file is part of DSL. */
  6. /* This software uses Qt to build the Graphical User Interface */
  7. /* https://www.qt.io/ */
  8. /* */
  9. /* DSL is free software: you can redistribute it and/or modify */
  10. /* it under the terms of the GNU General Public License as published */
  11. /* by the Free Software Foundation, either version 3 of the License, */
  12. /* or (at your option) any later version. */
  13. /* */
  14. /* DSL is distributed in the hope that it will be useful, */
  15. /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
  16. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
  17. /* GNU General Public License for more details. */
  18. /* */
  19. /* You should have received a copy of the GNU General Public License */
  20. /* along with DSL. If not, see <http://www.gnu.org/licenses/>. */
  21. /* */
  22. /*********************************************************************/
  23. #include <QIcon>
  24. #include <QGuiApplication>
  25. #include <QScreen>
  26. #include <QWidget>
  27. #include <QMenuBar>
  28. #include <QFileDialog>
  29. #include <QUrl>
  30. #include <QFileInfo>
  31. #include <QInputDialog>
  32. #include <QDirIterator>
  33. #include <QVBoxLayout>
  34. #include <QDebug>
  35. #include <iostream>
  36. #include <filesystem>
  37. #include "MainWindow.hpp"
  38. MainWindow::MainWindow ()
  39. {
  40. setWindowTitle (tr ("CLF"));
  41. QWidget *central= new QWidget(this);
  42. setCentralWidget (central);
  43. setContentsMargins(0, 0, 0, 0);
  44. QVBoxLayout *layoutV = new QVBoxLayout(central);
  45. layoutV->setSpacing(0);
  46. layoutV->setContentsMargins(0, 0, 0, 0);
  47. central->setLayout(layoutV);
  48. wa = new WorkArea (sizeX, sizeY, central);
  49. wa->setContentsMargins(0, 0, 0, 0);
  50. wa->addSL(new StrengthLine(new QPoint((int)(sizeX*0.45),(int)(sizeY*0.1)),
  51. new QPoint((int)(sizeX*0.45),(int)(sizeY*0.9))));
  52. wa->addSL(new StrengthLine(new QPoint((int)(sizeX*0.55),(int)(sizeY*0.1)),
  53. new QPoint((int)(sizeX*0.55),(int)(sizeY*0.9))));
  54. wa->repaint();
  55. layoutV->addWidget(wa);
  56. la = new QLabel(QString("Distance entre les deux lignes : ")+QString::number(1-wa->getDistance()), central);
  57. layoutV->addWidget(la);
  58. connect (wa, SIGNAL(click()), this, SLOT(majDistance()));
  59. setFixedSize (sizeX, sizeY+50);
  60. }
  61. void
  62. MainWindow::majDistance()
  63. {
  64. la->setText(QString("Distance entre les deux lignes : ")+QString::number(1-wa->getDistance()));
  65. }