diff --git a/gui+moteur/OptimiseurDeCoupe.pro b/gui+moteur/OptimiseurDeCoupe.pro index 7820479..639e2a4 100644 --- a/gui+moteur/OptimiseurDeCoupe.pro +++ b/gui+moteur/OptimiseurDeCoupe.pro @@ -1,30 +1,32 @@ -SOURCES += \ - main.cpp \ - saisie.cpp \ - groupesaisie.cpp \ - convertunit.cpp \ - formulaireSaisie.cpp \ - fenetreprincipale.cpp \ - widgetresultats.cpp \ - moteur/Combinaison.cpp \ - moteur/List.cpp \ - moteur/MoteurCalculs.cpp \ - moteur/Paire.cpp - -DISTFILES += \ - readme.md - HEADERS += \ - saisie.h \ - groupesaisie.h \ - convertunit.h \ - formulaireSaisie.h \ - fenetreprincipale.h \ - widgetresultats.h \ moteur/Combinaison.h \ moteur/List.h \ moteur/MoteurCalculs.h \ - moteur/Paire.h + moteur/Paire.h \ + saisies/groupesaisie.h \ + saisies/saisie.h \ + convertunit.h \ + fenetreprincipale.h \ + formulaireSaisie.h \ + widgetresultats.h \ + wigetgraphique.h \ + graphique/barregraphique.h \ + graphique/wigetgraphique.h + +SOURCES += \ + moteur/Combinaison.cpp \ + moteur/List.cpp \ + moteur/MoteurCalculs.cpp \ + moteur/Paire.cpp \ + saisies/groupesaisie.cpp \ + saisies/saisie.cpp \ + convertunit.cpp \ + fenetreprincipale.cpp \ + formulaireSaisie.cpp \ + main.cpp \ + widgetresultats.cpp \ + graphique/barregraphique.cpp \ + graphique/wigetgraphique.cpp QT += widgets QT += core diff --git a/gui+moteur/OptimiseurDeCoupe.pro.user b/gui+moteur/OptimiseurDeCoupe.pro.user index 0935602..c0df82c 100644 --- a/gui+moteur/OptimiseurDeCoupe.pro.user +++ b/gui+moteur/OptimiseurDeCoupe.pro.user @@ -1,7 +1,11 @@ - + + + EnvironmentId + {dbeb1063-109c-4254-a1d8-90435a54e33e} + ProjectExplorer.Project.ActiveTarget 0 @@ -29,12 +33,15 @@ false 4 false + 80 + true true 1 true - 1 + false + 0 true - 1 + 0 8 true 1 @@ -51,14 +58,14 @@ ProjectExplorer.Project.Target.0 - Desktop - Desktop - {4504014b-1e17-4d6d-b40d-3165887d0a08} + Desktop Qt 5.4.2 GCC 64bit + Desktop Qt 5.4.2 GCC 64bit + qt.54.gcc_64_kit 0 0 0 - /home/rivka/Documents/IED_Paris8/l2/projet/build-OptimiseurDeCoupe-Desktop-Debug + /home/eytan/Documents/Workspace Qt/build-OptimiseurDeCoupe-Desktop_Qt_5_4_2_GCC_64bit-Debug true @@ -69,6 +76,8 @@ true false + false + false true @@ -84,7 +93,7 @@ 2 - Build + Compiler ProjectExplorer.BuildSteps.Build @@ -103,7 +112,7 @@ 1 - Clean + Nettoyer ProjectExplorer.BuildSteps.Clean @@ -117,7 +126,7 @@ true - /home/rivka/Documents/IED_Paris8/l2/projet/build-OptimiseurDeCoupe-Desktop-Release + /home/eytan/Documents/Workspace Qt/build-OptimiseurDeCoupe-Desktop_Qt_5_4_2_GCC_64bit-Release true @@ -128,6 +137,8 @@ true false + false + false true @@ -143,7 +154,7 @@ 2 - Build + Compiler ProjectExplorer.BuildSteps.Build @@ -162,7 +173,7 @@ 1 - Clean + Nettoyer ProjectExplorer.BuildSteps.Clean @@ -179,12 +190,12 @@ 0 - Deploy + Déploiement ProjectExplorer.BuildSteps.Deploy 1 - Deploy locally + Déployer localement ProjectExplorer.DefaultDeployConfiguration @@ -229,15 +240,15 @@ OptimiseurDeCoupe - Qt4ProjectManager.Qt4RunConfiguration:/home/rivka/Documents/IED_Paris8/l2/projet/git/gui+moteur/OptimiseurDeCoupe.pro + Qt4ProjectManager.Qt4RunConfiguration:/home/eytan/Documents/Workspace Qt/OptimiseurDeCoupe/OptimiseurDeCoupe.pro OptimiseurDeCoupe.pro false false 3768 - true - false + false + true false false true @@ -250,11 +261,11 @@ 1 - ProjectExplorer.Project.Updater.EnvironmentId - {7d05a338-dd84-4eea-beae-1785d25ac8ff} + ProjectExplorer.Project.Updater.FileVersion + 18 - ProjectExplorer.Project.Updater.FileVersion - 15 + Version + 18 diff --git a/gui+moteur/OptimiseurDeCoupe.pro.user.18 b/gui+moteur/OptimiseurDeCoupe.pro.user.18 deleted file mode 100644 index 97be427..0000000 --- a/gui+moteur/OptimiseurDeCoupe.pro.user.18 +++ /dev/null @@ -1,473 +0,0 @@ - - - - - - EnvironmentId - {dbeb1063-109c-4254-a1d8-90435a54e33e} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.4.1 GCC 64bit - Desktop Qt 5.4.1 GCC 64bit - qt.54.gcc_64_kit - 0 - 0 - 0 - - /home/eytan/Documents/Workspace Qt/build-OptimiseurDeCoupe-Desktop_Qt_5_4_1_GCC_64bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Compiler - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Nettoyer - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - DEBUG=0 - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /home/eytan/Documents/Workspace Qt/build-OptimiseurDeCoupe-Desktop_Qt_5_4_1_GCC_64bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Compiler - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Nettoyer - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 2 - - - 0 - Déploiement - - ProjectExplorer.BuildSteps.Deploy - - 1 - Déployer localement - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - OptimiseurDeCoupe - - Qt4ProjectManager.Qt4RunConfiguration:/home/eytan/Documents/Workspace Qt/OptimiseurDeCoupe/OptimiseurDeCoupe.pro - - OptimiseurDeCoupe.pro - false - false - - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop - Desktop - {8abf39d0-6fbc-4dc7-95be-9052013e0171} - 0 - 0 - 0 - - /home/eytan/Documents/Workspace Qt/build-OptimiseurDeCoupe-Desktop-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Compiler - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Nettoyer - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 10 - true - - - /home/eytan/Documents/Workspace Qt/build-OptimiseurDeCoupe-Desktop-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Compiler - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Nettoyer - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 8 - true - - 2 - - - 0 - Déploiement - - ProjectExplorer.BuildSteps.Deploy - - 1 - Déployer localement - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - -1 - - - - false - %{buildDir} - Exécutable personnalisé - - ProjectExplorer.CustomExecutableRunConfiguration - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 2 - - - ProjectExplorer.Project.Updater.FileVersion - 18 - - - Version - 18 - - diff --git a/gui+moteur/fenetreprincipale.cpp b/gui+moteur/fenetreprincipale.cpp index fd6a0da..93a9e53 100644 --- a/gui+moteur/fenetreprincipale.cpp +++ b/gui+moteur/fenetreprincipale.cpp @@ -6,15 +6,25 @@ FenetrePrincipale::FenetrePrincipale(QWidget *parent) : QWidget(parent) setWindowTitle(tr("Optimiseur de coupe")); setWindowIcon(QIcon("mainIcon.ico")); - // Tabs + // Police titre + QFont fontTitre; + fontTitre.setPointSize(12); + fontTitre.setBold(true); + fontTitre.setStyleHint(QFont::SansSerif); + + // Formulaire m_tabs = new QTabWidget(this); - m_formulaireSaisie = new FormulaireSaisie; + m_formulaireSaisie = new FormulaireSaisie(fontTitre); m_tabs->addTab(m_formulaireSaisie, tr("Formulaire de saisie")); // Résultats - m_widgetResultats = new WidgetResultats; + m_widgetResultats = new WidgetResultats(fontTitre); m_tabs->addTab(m_widgetResultats, tr("Résultats")); + // Graphique + m_widgetGraphique = new WidgetGraphique(fontTitre); + m_tabs->addTab(m_widgetGraphique, tr("Graphique des résultats")); + //Layout QVBoxLayout * mainLayout = new QVBoxLayout; mainLayout->addWidget(m_tabs); @@ -76,8 +86,8 @@ void FenetrePrincipale::traiterFormulaire(){ List * listFinaletroncons = moteur->getTroncons(); if(not listFinaletroncons->empty()){ erreur=10; - text = tr("Vous n'avez pas eu assez de matière première pour " - "couper tous les tronçons que vous désiriez.
Liste de troncons restants:
"); + text = tr("Vous n'avez pas assez de matière première pour " + "couper tous les tronçons désirés.
Liste des troncons restants:
"); text += listFinaletroncons->toStr(true); QMessageBox::warning(this, tr("Erreur"), text); } @@ -86,7 +96,7 @@ void FenetrePrincipale::traiterFormulaire(){ List * listFinaleBarres = moteur->getBarres(); if(not listFinaleBarres->empty()){ - text = tr("Il vous reste des barres entières que vous n'avez pas utilisées :
Liste des barres restantes :
"); + text = tr("Il vous reste une/des barre(s) entière(s) non utilisée(s) :
Liste de la/des barre(s) restante(s) :
"); text += listFinaleBarres->toStr(true) + "
"; } @@ -96,16 +106,17 @@ void FenetrePrincipale::traiterFormulaire(){ text += listFinaletroncons->toStr(true) + "
"; } - text += tr("
Voici la liste des coupes que vous devez effectuer :
"); - list listResultats = moteur->getResultatFinal(); - for(list::iterator it=listResultats.begin(); - it != listResultats.end(); + text += tr("
Voici la liste des coupes que vous devez effectuer :Exigence : ") + QString::number(moteur->getExigence()) + "
"; text += tr("Vous avez un rendement moyen de ") + QString::number(moteur->calculeRendementFinal(),'g', 4) + "%."; m_widgetResultats->updateResultats(text); + m_widgetGraphique->updateGraphique(listResultats); m_tabs->setCurrentIndex(1); delete tronconsList; delete barresList; diff --git a/gui+moteur/fenetreprincipale.h b/gui+moteur/fenetreprincipale.h index ddce71e..8fab207 100644 --- a/gui+moteur/fenetreprincipale.h +++ b/gui+moteur/fenetreprincipale.h @@ -8,7 +8,8 @@ #include "formulaireSaisie.h" #include "widgetresultats.h" #include "moteur/Combinaison.h" -#include +#include "convertunit.h" +#include "./graphique/wigetgraphique.h" // Moteur #include "moteur/List.h" @@ -26,6 +27,7 @@ class FenetrePrincipale : public QWidget QTabWidget * m_tabs; FormulaireSaisie * m_formulaireSaisie; WidgetResultats * m_widgetResultats; + WidgetGraphique * m_widgetGraphique; public slots: void traiterFormulaire(); }; diff --git a/gui+moteur/formulaireSaisie.cpp b/gui+moteur/formulaireSaisie.cpp index 211af9c..e86bd6a 100644 --- a/gui+moteur/formulaireSaisie.cpp +++ b/gui+moteur/formulaireSaisie.cpp @@ -1,18 +1,17 @@ #include "formulaireSaisie.h" -FormulaireSaisie::FormulaireSaisie(QWidget *parent) : QWidget(parent) +FormulaireSaisie::FormulaireSaisie(QFont & fontTitre, QWidget *parent) : QWidget(parent) { // Layout principal QVBoxLayout * layoutPrincipal = new QVBoxLayout; // Label : demande de remplir les infos QLabel * labelRemplirInfos = new QLabel(tr("Veuillez remplir les informations suivantes :")); - QFont fontTitre1("Droid Sans", 12); - fontTitre1.setBold(true); - labelRemplirInfos->setFont(fontTitre1); + labelRemplirInfos->setFont(fontTitre); // Groupes de saisie - QFont fontTitre2("Droid Sans", 10); + QFont fontTitre2; + fontTitre2.setPointSize(11); fontTitre2.setBold(true); m_groupeSaisieBarres = new GroupeSaisie(tr("Barres avant la découpe :"), fontTitre2); m_groupeSaisieTron = new GroupeSaisie(tr("Tronçons désirés :"), fontTitre2); diff --git a/gui+moteur/formulaireSaisie.h b/gui+moteur/formulaireSaisie.h index 09ee74d..6fb23e3 100644 --- a/gui+moteur/formulaireSaisie.h +++ b/gui+moteur/formulaireSaisie.h @@ -10,7 +10,7 @@ #include #include #include -#include "groupesaisie.h" +#include "saisies/groupesaisie.h" #include "convertunit.h" /* Fenêtre principale du programme @@ -21,7 +21,7 @@ class FormulaireSaisie : public QWidget { Q_OBJECT public: - explicit FormulaireSaisie(QWidget *parent = 0); + explicit FormulaireSaisie(QFont & fontTitre, QWidget *parent = 0); ~FormulaireSaisie(); QPushButton * buttonAppliquer() const; GroupeSaisie * groupeSaisieBarres() const; diff --git a/gui+moteur/graphique/barregraphique.cpp b/gui+moteur/graphique/barregraphique.cpp new file mode 100644 index 0000000..b3142cf --- /dev/null +++ b/gui+moteur/graphique/barregraphique.cpp @@ -0,0 +1,38 @@ +#include "barregraphique.h" + +BarreGraphique::BarreGraphique(Combinaison * combinaison, QWidget *parent) :m_combinaison(combinaison), m_height(55), QWidget(parent) +{ + setMinimumHeight(m_height); +} + + +// Dessine la découpe d'une barre +void BarreGraphique::paintEvent(QPaintEvent *e) +{ + std::list liste = m_combinaison->getPaires(); + int compteur = 0, longueur = 500; + double carreLongueur; + + // Compte le nombre de coupe + for (std::list::iterator it = liste.begin(); it != liste.end(); it++){ + compteur++; + } + longueur -= compteur*15; + + // Painter + QPainter painter(this); + QPoint topLeft, bottomRight; + QString text = "Sur une barre de " + ConvertUnit::toStrSimplifie(m_combinaison->getBarre()) + "."; + painter.drawText(0,10, text); + topLeft.setX(10); + topLeft.setY(15); + bottomRight.setY(m_height-10); + for (std::list::iterator it = liste.begin(); it != liste.end(); it++){ + carreLongueur = ( longueur * it->getLongueur() ) / m_combinaison->getBarre(); + bottomRight.setX(((int) carreLongueur) + topLeft.x()); + QRect rec(topLeft, bottomRight); + painter.drawRect(rec); + painter.drawText(rec, Qt::AlignCenter, it->toStr()); + topLeft.setX(bottomRight.x()+15); + } +} diff --git a/gui+moteur/graphique/barregraphique.h b/gui+moteur/graphique/barregraphique.h new file mode 100644 index 0000000..70e8950 --- /dev/null +++ b/gui+moteur/graphique/barregraphique.h @@ -0,0 +1,30 @@ +#ifndef BARREGRAPHIQUE_H +#define BARREGRAPHIQUE_H + +#include +#include +#include +#include +#include "../convertunit.h" +#include "../moteur/Paire.h" +#include "../moteur/Combinaison.h" + +class BarreGraphique : public QWidget +{ + Q_OBJECT +public: + explicit BarreGraphique(Combinaison * combinaison ,QWidget *parent = 0); + +private: + Combinaison * m_combinaison; + int m_height; + +signals: + +public slots: + +protected: + void paintEvent(QPaintEvent * e); +}; + +#endif // BARREGRAPHIQUE_H diff --git a/gui+moteur/graphique/wigetgraphique.cpp b/gui+moteur/graphique/wigetgraphique.cpp new file mode 100644 index 0000000..98628b5 --- /dev/null +++ b/gui+moteur/graphique/wigetgraphique.cpp @@ -0,0 +1,57 @@ +#include "wigetgraphique.h" + +WidgetGraphique::WidgetGraphique(QFont & fontTitre, QWidget *parent) : QWidget(parent) +{ + // Titre + QLabel * labelTitre = new QLabel(tr("Graphique des résultats")); + labelTitre->setFont(fontTitre); + + // Label : pas de résultats + m_labelNoResults = new QLabel(tr("Veuillez remplir le formulaire de saisie et cliquer sur \"Appliquer\".")); + // Graphique + QWidget * widgetBarres = new QWidget; + m_layoutBarres = new QVBoxLayout; + m_layoutBarres->addWidget(m_labelNoResults, 0, Qt::AlignTop | Qt::AlignLeft); + m_layoutBarres->setMargin(0); + widgetBarres->setLayout(m_layoutBarres); + + // Bouton quitter + QPushButton * buttonQuitter = new QPushButton(tr("Quitter")); + + // Layout + QVBoxLayout * mainLayout = new QVBoxLayout; + mainLayout->addWidget(labelTitre,0, Qt::AlignTop); + mainLayout->addWidget(widgetBarres); + mainLayout->addStretch(); + mainLayout->addWidget(buttonQuitter, 0, Qt::AlignBottom | Qt::AlignRight); + + setLayout(mainLayout); + + // Connexion + QObject::connect(buttonQuitter, SIGNAL(clicked()), qApp, SLOT(quit())); + +} + +void WidgetGraphique::updateGraphique(std::list * combinaison) +{ + // Vide le widget des barres + if(m_vectorBarres.size()==0){ + m_layoutBarres->removeWidget(m_labelNoResults); + } + else{ + int i; + for(i=0; i < m_vectorBarres.size(); i++){ + m_layoutBarres->removeWidget(m_vectorBarres[i]); + delete m_vectorBarres[i]; + } + m_vectorBarres.resize(0); + } + for(std::list::iterator it=combinaison->begin(); + it != combinaison->end(); + ++it){ + m_vectorBarres.resize(m_vectorBarres.size()+1); + m_vectorBarres.last() = new BarreGraphique(&(*it)); + m_layoutBarres->addWidget(m_vectorBarres.last()); + } +} + diff --git a/gui+moteur/graphique/wigetgraphique.h b/gui+moteur/graphique/wigetgraphique.h new file mode 100644 index 0000000..b2fab74 --- /dev/null +++ b/gui+moteur/graphique/wigetgraphique.h @@ -0,0 +1,30 @@ +#ifndef WIGETGRAPHIQUE_H +#define WIGETGRAPHIQUE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include "../moteur/Combinaison.h" +#include "barregraphique.h" + +class WidgetGraphique : public QWidget +{ + Q_OBJECT +public: + explicit WidgetGraphique(QFont & fontTitre,QWidget *parent = 0); + void updateGraphique(std::list *combinaison); +private: + QVBoxLayout * m_layoutBarres; + QLabel * m_labelNoResults; + QVector m_vectorBarres; +signals: + +public slots: +}; + +#endif // WIGETGRAPHIQUE_H diff --git a/gui+moteur/main.cpp b/gui+moteur/main.cpp index 9ee9b07..eea56fa 100644 --- a/gui+moteur/main.cpp +++ b/gui+moteur/main.cpp @@ -10,6 +10,10 @@ int main(int argc, char * argv[]) { QApplication app(argc, argv); + QFont police("Ubuntu", 10); + police.setStyleHint(QFont::SansSerif); + app.setFont(police); + // Chargement de la traduction QString locale = QLocale::system().name().section('_', 0, 0); QTranslator translator; diff --git a/gui+moteur/moteur/Combinaison.cpp b/gui+moteur/moteur/Combinaison.cpp index 4cdccc6..2f30b7e 100644 --- a/gui+moteur/moteur/Combinaison.cpp +++ b/gui+moteur/moteur/Combinaison.cpp @@ -29,15 +29,15 @@ void Combinaison::affiche() } #else QString Combinaison::toStr(){ - QString text("["); + QString text = "
  • Sur une barre de " + ConvertUnit::toStrSimplifie(m_barre) + " :
    "; for (list::iterator it = m_liste.begin(); it != m_liste.end(); it++) { if (it != m_liste.begin()) text+= ", "; text+=it->toStr(); } - text+= "]
    "; - text+= QObject::tr("Rendement de ") + QString::number(m_rendement,'g', 4) + QObject::tr("\% sur une barre de ") + ConvertUnit::toStrSimplifie(m_barre)+"
    "; + text+= "
    "; + text+= QObject::tr("Le rendement est de ") + QString::number(m_rendement,'g', 4) + "\%.
  • "; return text; } #endif @@ -74,6 +74,7 @@ double Combinaison::calculeRendement (double perte) } + // attacheBarre choisit dans la liste des barres la barre la plus proche de la somme // des tronçons de la combinaison // retourne -1.0 s'il n'y a pas de barre assez grande pour cette combinaison diff --git a/gui+moteur/moteur/Combinaison.h b/gui+moteur/moteur/Combinaison.h index d94d031..0df86c2 100644 --- a/gui+moteur/moteur/Combinaison.h +++ b/gui+moteur/moteur/Combinaison.h @@ -31,7 +31,7 @@ class Combinaison void push (double , int); double calculeRendement (double perte); double getRendement() const; - std::list getPaires() const; + std::list getPaires() const; double getBarre () const; double somme (); int getPosDernier (); diff --git a/gui+moteur/moteur/List.h b/gui+moteur/moteur/List.h index 8b4a0fa..87f602e 100644 --- a/gui+moteur/moteur/List.h +++ b/gui+moteur/moteur/List.h @@ -11,7 +11,7 @@ #include #include #include -#include "../saisie.h" +#include "../saisies/saisie.h" #include "../convertunit.h" #if DEBUG diff --git a/gui+moteur/moteur/MoteurCalculs.cpp b/gui+moteur/moteur/MoteurCalculs.cpp index 04cee25..d5775e4 100644 --- a/gui+moteur/moteur/MoteurCalculs.cpp +++ b/gui+moteur/moteur/MoteurCalculs.cpp @@ -1,7 +1,6 @@ #include "MoteurCalculs.h" #include - using namespace std; int limite = 0; int * lim = &limite; @@ -12,9 +11,11 @@ int * lim = &limite; MoteurCalculs::MoteurCalculs(List* troncons, List *barres, double perte) { + if (limite > 5000) exit (1); + *lim=*lim + 1; m_perteCoupe = perte; m_troncons = troncons; - ajoutePerte (); + ajoutePerte (); m_barres = barres; m_troncons->copie(&m_copieTroncons); m_exigence = 80; @@ -55,23 +56,24 @@ double MoteurCalculs::calculeRendementFinal () return sum / sumBarres *100; } + // dirige tous les calculs en appelant les fonctions nécessaires // se charge de l'affichage void MoteurCalculs::pilote () { - Combinaison *liste = new Combinaison (); + Combinaison *liste = new Combinaison (); while ((not getTroncons()->empty()) and (not getBarres()->empty()) and (m_exigence != 0)) - { + { cout << moteurCombinaisons(*liste) << endl; - rentreCombinaisonFinale(); - } + rentreCombinaisonFinale(); + } if (m_exigence == 0) { cout << "On tourne en rond" << endl; return; } #if DEBUG - affiche (); + affiche (); #endif } @@ -178,7 +180,6 @@ Combinaison& MoteurCalculs::maxi(Combinaison *lp) } return *lp; } - /*===================access=====================*/ List* MoteurCalculs::getTroncons () const @@ -196,9 +197,14 @@ double MoteurCalculs::getPerte () const return m_perteCoupe; } -list MoteurCalculs:: getResultatFinal () const +std::list MoteurCalculs::getResultatFinal() const +{ + return m_resultatFinal; +} + +std::list *MoteurCalculs::getPointResultatFinal() { - return m_resultatFinal; + return & m_resultatFinal; } int MoteurCalculs::getExigence() const diff --git a/gui+moteur/moteur/MoteurCalculs.h b/gui+moteur/moteur/MoteurCalculs.h index f4ad3c0..3f4e396 100644 --- a/gui+moteur/moteur/MoteurCalculs.h +++ b/gui+moteur/moteur/MoteurCalculs.h @@ -11,7 +11,6 @@ extern int limite; extern int * lim; - using namespace std; // liste de listes de paires class MoteurCalculs @@ -30,7 +29,8 @@ class MoteurCalculs List *getTroncons () const; List * getBarres () const; double getPerte () const; - std::list getResultatFinal () const; + std::list getResultatFinal() const; + std::list * getPointResultatFinal(); int getExigence() const; #if DEBUG diff --git a/gui+moteur/optimiseurdecoupe_en.qm b/gui+moteur/optimiseurdecoupe_en.qm deleted file mode 100644 index fac8f5e..0000000 Binary files a/gui+moteur/optimiseurdecoupe_en.qm and /dev/null differ diff --git a/gui+moteur/optimiseurdecoupe_en.ts b/gui+moteur/optimiseurdecoupe_en.ts index 92d39a4..f3db3fa 100644 --- a/gui+moteur/optimiseurdecoupe_en.ts +++ b/gui+moteur/optimiseurdecoupe_en.ts @@ -6,97 +6,69 @@ Optimiseur de coupe - Cut Optimizer + - Veuillez remplir les informations suivantes : - Please fill in the following information: - - - Barres avant la découpe : - Bar before cutting: - - - Tronçons désirés : - Segments requested: - - - Epaisseur de lame - Blade thickness - - - Appliquer - Apply - - - Quitter - Quit - - - + Formulaire de saisie - Entry form + - + Résultats - Results + - - - + + Graphique des résultats + + + + + + Erreur - Error + - + La longueur totale des barres avant la découpe est plus petite que la longueur totale des tronçons demandés. - The total length of bars before the cutting is smaller than the total length of segments requested. + - + L'épaisseur de la lame est plus grande que la plus petite longueur des barres avant la découpe. - The thickness of the blade is larger than the smallest length of bars before cutting. + - - - Vous n'avez pas eu assez de matière première pour couper tous les tronçons que vous désiriez. -Liste de troncons restants: - - You do not have enough raw materials to cut all segments you wanted. -List of remaining segments: + + Vous n'avez pas assez de matière première pour couper tous les tronçons désirés.<br>Liste des troncons restants:<br> + - - Il vous reste des barres entières que vous n'avez pas utilisées : -Liste des barres restantes : - - You have entire bar that you do not have used: -List of remaining bars: + + Il vous reste une/des barre(s) entière(s) non utilisée(s) :<br>Liste de la/des barre(s) restante(s) :<br> + - - -Voici la liste des coupes que vous devez effectuer : - - Here is the list of cuts that you must perform: + + Vous n'avez pas eu assez de matière première pour couper tous les tronçons que vous désiriez.<br>Liste de troncons restants:<br> + - Voici la liste des coupes que vous devez effectuer : - - List of cuts that you must perform: + + <br>Voici la liste des coupes que vous devez effectuer :<ul> + - - Exigence : - Requirement: + + </ul>Exigence : + - + Vous avez un rendement moyen de - You have an average yield of + @@ -104,86 +76,86 @@ Voici la liste des coupes que vous devez effectuer : Veuillez remplir les informations suivantes : - Please fill in the following information: + - + Barres avant la découpe : - Bar before cutting: + - + Tronçons désirés : - Segments requested: + - + Epaisseur de lame - Blade thickness + - + Appliquer - Apply + - + Quitter - Quit + GroupeSaisie - + Nombre de saisies : - Number of entry: + - + Longueur - Length + - + Unité - Unit + - + Quantité - Quantity + - + Ajouter une saisie - Add entry + - + Supprimer une saisie - Delete an entry - - - Nombre de saisie : 2 - Number of entry : 2 - - - Nombre de saisie : - Number of entry : + QObject - Rendement de - Output + Le rendement est de + + + + WidgetGraphique - - % sur une barre de - % from a bar of + + Quitter + + + + + Enregistrer en HTML + @@ -191,22 +163,17 @@ Voici la liste des coupes que vous devez effectuer : Résultats - Results - - - - Veuillez remplir le formulaire de saisie et cliquer sur "Appliquer". - Please fill the entry form and click on "Apply". + - + Quitter - Quit + - + Enregistrer en HTML - Save in HTML + diff --git a/gui+moteur/readme.md b/gui+moteur/readme.md deleted file mode 100644 index a60557e..0000000 --- a/gui+moteur/readme.md +++ /dev/null @@ -1,12 +0,0 @@ -# Optimiseur de coupe - -## Description -Ceci est la GUI de l'optimiseur de coupe - -## Installation et compilation -1. Installer QtCreator : http://www.qt.io/download-open-source/ -2. Ouvrir avec QtCreator OptimiseurDeCoupe.pro -3. Lancer la compilation - -## Capture d'écran -![exemple](http://i.imgur.com/KeRR6y5.png) diff --git a/gui+moteur/groupesaisie.cpp b/gui+moteur/saisies/groupesaisie.cpp similarity index 100% rename from gui+moteur/groupesaisie.cpp rename to gui+moteur/saisies/groupesaisie.cpp diff --git a/gui+moteur/groupesaisie.h b/gui+moteur/saisies/groupesaisie.h similarity index 100% rename from gui+moteur/groupesaisie.h rename to gui+moteur/saisies/groupesaisie.h diff --git a/gui+moteur/saisie.cpp b/gui+moteur/saisies/saisie.cpp similarity index 100% rename from gui+moteur/saisie.cpp rename to gui+moteur/saisies/saisie.cpp diff --git a/gui+moteur/saisie.h b/gui+moteur/saisies/saisie.h similarity index 100% rename from gui+moteur/saisie.h rename to gui+moteur/saisies/saisie.h diff --git a/gui+moteur/widgetresultats.cpp b/gui+moteur/widgetresultats.cpp index 5dbd7f7..e8b4345 100644 --- a/gui+moteur/widgetresultats.cpp +++ b/gui+moteur/widgetresultats.cpp @@ -1,32 +1,26 @@ #include "widgetresultats.h" -WidgetResultats::WidgetResultats(QWidget *parent) : QWidget(parent) +WidgetResultats::WidgetResultats(QFont & fontTitre, QWidget *parent) : QWidget(parent) { // Label Titre QLabel * labelTitre = new QLabel(tr("Résultats")); - QFont fontTitre1("Droid Sans", 12); - fontTitre1.setBold(true); - labelTitre->setFont(fontTitre1); + labelTitre->setFont(fontTitre); // Label Résultats - m_labelResultat = new QLabel(tr("Veuillez remplir le formulaire de saisie et cliquer sur \"Appliquer\".")); - m_labelResultat->setTextFormat(Qt::RichText); + m_labelResultat = new QTextEdit(tr("Veuillez remplir le formulaire de saisie et cliquer sur \"Appliquer\".")); + m_labelResultat->setReadOnly(true); + m_labelResultat->setMinimumSize(530,310); + m_labelResultat->setAlignment(Qt::AlignTop | Qt::AlignLeft); + m_labelResultat->setFrameShape(QFrame::NoFrame); // Bouton quitter QPushButton * buttonQuitter = new QPushButton(tr("Quitter")); - QPushButton * buttonSaveHTML = new QPushButton(tr("Enregistrer en HTML")); - QHBoxLayout * layoutBouttons = new QHBoxLayout; - QWidget * widgetBouttons = new QWidget(); - layoutBouttons->addWidget(buttonSaveHTML); - layoutBouttons->addWidget(buttonQuitter); - widgetBouttons->setLayout(layoutBouttons); // Layout QVBoxLayout * mainLayout = new QVBoxLayout; mainLayout->addWidget(labelTitre,0, Qt::AlignTop); - mainLayout->addWidget(m_labelResultat,0,Qt::AlignTop); - mainLayout->addStretch(); - mainLayout->addWidget(widgetBouttons, 0, Qt::AlignBottom | Qt::AlignRight); + mainLayout->addWidget(m_labelResultat); + mainLayout->addWidget(buttonQuitter, 0, Qt::AlignBottom | Qt::AlignRight); setLayout(mainLayout); diff --git a/gui+moteur/widgetresultats.h b/gui+moteur/widgetresultats.h index c41229b..95ffac4 100644 --- a/gui+moteur/widgetresultats.h +++ b/gui+moteur/widgetresultats.h @@ -3,18 +3,21 @@ #include #include +#include #include #include #include +#include +#include class WidgetResultats : public QWidget { Q_OBJECT public: - explicit WidgetResultats(QWidget *parent = 0); + explicit WidgetResultats(QFont & fontTitre, QWidget *parent = 0); void updateResultats(QString & text); private: - QLabel * m_labelResultat; + QTextEdit * m_labelResultat; signals: public slots: