autocell.h 2.99 KB
Newer Older
Victor Blanchet's avatar
Victor Blanchet committed
1
2
3
#ifndef AUTOCELL_H
#define AUTOCELL_H

Romain De Laage De Bellefaye's avatar
Romain De Laage De Bellefaye committed
4
#include <reseau_cellule_etats.h>
Victor Blanchet's avatar
Victor Blanchet committed
5

Victor Blanchet's avatar
Victor Blanchet committed
6
#include <QObject>
Victor Blanchet's avatar
Victor Blanchet committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <QApplication>
#include <QPushButton>
#include <QWidget>
#include <QLineEdit>
#include <QLabel>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QComboBox>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QHeaderView>
#include <QLayoutItem>
#include <QFont>
#include <QPushButton>
#include <QCheckBox>
#include <QFormLayout>

Victor Blanchet's avatar
Victor Blanchet committed
24
25
using namespace std;

Victor Blanchet's avatar
Victor Blanchet committed
26
27
28
class AutoCell : public QWidget

{
29
30
    static std::unique_ptr<AutoCell> instance;

31
    Reseau* Grille = nullptr;
Leon Do Castelo's avatar
Leon Do Castelo committed
32
    std::vector<QString> listeGrille;
Victor Blanchet's avatar
Victor Blanchet committed
33

Victor Blanchet's avatar
Victor Blanchet committed
34
35
36
37
38
39
    Q_OBJECT
    QGridLayout* general;

    //définition de la frame choix du modèle
    QWidget* win_model_choice;
    QLabel* lab_model_choice;
40
41
42
    QComboBox* liste;
    QGridLayout* grid_model_choice;
    QPushButton* button_add_model;
Victor Blanchet's avatar
Victor Blanchet committed
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

    //définition de la frame initialisation
    QWidget* win_init;
    QLabel* lab_init;
    QGridLayout* form_init;

    QFormLayout* form_saved_grids;
    QFormLayout* form_config;

    QComboBox *list_grids;
    QCheckBox* check_load_grid;

    QLineEdit* edit_largeur;
    QLineEdit* edit_hauteur;
    QCheckBox* check_aleatoire;
    QPushButton* button_valide_init;

    //définition de la frame "panneau de contrôle de l'exécution"
    QWidget* win_run_ctrl;
    QLabel* lab_run_crtl;

64
65
66
67
    QGridLayout* grid_run_control;

    QLabel* lab_time_step;
    QLineEdit* edit_time_step;
Boris Cazic's avatar
Boris Cazic committed
68
    QPushButton* button_valider_delai;
69
70
71
    QPushButton* button_prev;
    QPushButton* button_run;
    QPushButton* button_next;
Boris Cazic's avatar
Boris Cazic committed
72
    QPushButton* button_reinitialiser;
73

74
75
    QLabel* lab_sauv_grille;
    QLineEdit* edit_nom_grille;
76
77
    QPushButton* button_save_grid;

Victor Blanchet's avatar
Victor Blanchet committed
78
79
80
81
82
83
84
    //définition de la frame affichage de la grille
    QWidget* win_grid;
    QTableWidget* grid;

    //notice
    QWidget* win_notice;
    QLabel* lab_notice;
85

Victor Blanchet's avatar
Victor Blanchet committed
86
87
    explicit AutoCell(QWidget* parent=nullptr);

88
89
90
91
92
93
94
95
96
97
    public:

    static AutoCell& getInstance() {
        if(instance == nullptr) {
            instance.reset(new AutoCell);
        }

        return *instance;
    }

Victor Blanchet's avatar
Victor Blanchet committed
98
99
100
    public slots:
    //void chargerModele();
    //void listerModele(); //à faire en dernier
Maxime Goret's avatar
Maxime Goret committed
101
    void chargerGrilles();
Victor Blanchet's avatar
Victor Blanchet committed
102
103
    //void listerGrille(); //déjà réfléchir à la recopie
    //Reseau initialiserGrille(); //méthode à implémenter qui récupère les données du formulaire - penser à réinitialiser les données annexes
Victor Blanchet's avatar
Victor Blanchet committed
104
    //void afficherGrille(Reseau&); //affiche une grille
Maxime Goret's avatar
Maxime Goret committed
105
    //void chargerGrilles(const QString &text);
Victor Blanchet's avatar
Victor Blanchet committed
106
107
108

    void afficherGrille(Reseau* Grille);

Victor Blanchet's avatar
Victor Blanchet committed
109
110
    void initialiserGrille();
    void RAZ();
Boris Cazic's avatar
Boris Cazic committed
111
    void gererSimulation();
Victor Blanchet's avatar
Victor Blanchet committed
112
    //void sauvegarderGrille();
Victor Blanchet's avatar
Victor Blanchet committed
113
114
115
    //Reseau& modifierCellule(const QModelIndex&, Reseau& Grille);//à implémenter

    void modifierCellule(const QModelIndex& index);
116
    void sauvegarderGrille();
Boris Cazic's avatar
Boris Cazic committed
117
    void defNouveauModele();
118
    void afficherErreur(QString& msg);
119
    void initAutomate(const QString& name);
Romain De Laage De Bellefaye's avatar
Romain De Laage De Bellefaye committed
120
121
122
    void changeDelai();
    void previous();
    void next();
Victor Blanchet's avatar
Victor Blanchet committed
123
124
125
};

#endif // AUTOCELL_H