diff --git a/forms/interface.ui b/forms/interface.ui index d5e9a15b351be2962a7a897b806c14eaf357dd95..a7367fcd035c29818be0818e7646acee4059c8d0 100644 --- a/forms/interface.ui +++ b/forms/interface.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>1068</width> - <height>800</height> + <height>833</height> </rect> </property> <property name="windowTitle"> diff --git a/forms/savingdialog.ui b/forms/savingdialog.ui index c1e902fac0e18f1df3b44ce2c05c210bcf346e21..28f9f7cc178b8e71bc168632644265aa001d03ff 100644 --- a/forms/savingdialog.ui +++ b/forms/savingdialog.ui @@ -17,13 +17,13 @@ <item> <widget class="QGroupBox" name="groupBox"> <property name="title"> - <string>Sauvegarde</string> + <string>Save</string> </property> <layout class="QFormLayout" name="formLayout"> <item row="0" column="0"> <widget class="QLabel" name="label"> <property name="text"> - <string>Nom : </string> + <string>Name : </string> </property> <property name="buddy"> <cstring>nom</cstring> @@ -36,7 +36,7 @@ <item row="1" column="0"> <widget class="QLabel" name="label_2"> <property name="text"> - <string>Auteur : </string> + <string>Author : </string> </property> <property name="buddy"> <cstring>auteur</cstring> @@ -59,14 +59,14 @@ <item row="3" column="1"> <widget class="QPlainTextEdit" name="desc"> <property name="placeholderText"> - <string>Entrer une description de la structure, ses caractéristiques remarquables...</string> + <string>Describe the structure, its noteworthy characteristics...</string> </property> </widget> </item> <item row="2" column="0"> <widget class="QLabel" name="label_4"> <property name="text"> - <string>Date de création : </string> + <string>Creation date :</string> </property> <property name="buddy"> <cstring>date</cstring> diff --git a/forms/structurelibraryview.ui b/forms/structurelibraryview.ui index 2be99c8d9a71fe3475d7a068d1ebb10d39a80207..7ccd807e2bd550f5014a267f811722a29f4929dc 100644 --- a/forms/structurelibraryview.ui +++ b/forms/structurelibraryview.ui @@ -17,7 +17,7 @@ <item> <widget class="QLabel" name="label_5"> <property name="text"> - <string>Double clic pour faire un glisser-déposer de la structure.</string> + <string>Double click to drag a structure into the main view.</string> </property> </widget> </item> diff --git a/include/history.h b/include/history.h index ef6f5a736d708870a63bce1d6a8457711b66b765..dcc555bea7b66369be9b0e83a30553ee5c13e431 100644 --- a/include/history.h +++ b/include/history.h @@ -61,7 +61,7 @@ public: { if(tab.size()>0) return tab.back(); - throw HistoryException("La pile est vide. \n"); + throw HistoryException("The stack is empty."); } //! \brief Fonction qui vérifie si l'historique est vide ou pas //! \return Retourne un booléen selon si le prédicat "l'historique est vide" diff --git a/include/neighborhood.hpp b/include/neighborhood.hpp index c886e53cb64b7e972ef82c356327b1026157caf1..f97c15365ceea99072077d6e6aab158b92d7d2cb 100644 --- a/include/neighborhood.hpp +++ b/include/neighborhood.hpp @@ -97,7 +97,7 @@ public: //! \pre La coord ne doit pas déjà exister void addNeighbor(Coord c, unsigned char s) { if (s >= MAX_ETATS) - throw NeighborhoodException("Valeur d'état supérieure à l'état maximal"); + throw NeighborhoodException("Invalid state value (>= MAX_ETATS)"); sorted = false; neighborPositions[neighbors++] = {(int8_t)c.x, (int8_t)c.y, s}; @@ -119,7 +119,7 @@ public: pair<Coord, unsigned char> neighbor_at_index(unsigned i) const { if (i >= size()) - throw NeighborhoodException("Index invalide\n"); + throw NeighborhoodException("Invalid index"); if (!sorted) { std::sort(std::begin(neighborPositions), std::begin(neighborPositions) + neighbors, diff --git a/include/state.hpp b/include/state.hpp index 1ac3333563464fdc9ac53eab346a15e49d3b88fa..be1b0129548059c76ec1c22fa3cb1c7ea1240156 100644 --- a/include/state.hpp +++ b/include/state.hpp @@ -23,7 +23,7 @@ class state{ public: //! \brief Constructeur de l'état - state(stateColor c, const std::string& l = "sans nom"):color(c),label(l){} + state(stateColor c, const std::string& l = "unnamed"):color(c),label(l){} //! \brief Accesseur en lecture de la couleur const stateColor& getColor() const { return color; } diff --git a/src/alphabet.cpp b/src/alphabet.cpp index edff000570d8964eeb04186e80b090a64f4e9b49..7ae72c7913f285eae7f6e07f07319f728dcb078e 100644 --- a/src/alphabet.cpp +++ b/src/alphabet.cpp @@ -20,7 +20,7 @@ const state &Alphabet::getState(unsigned int it) const{ // Définition de la mé return etats[it]; } else - throw AlphabetException("ID d'état invalide"); + throw AlphabetException("Invalid state ID"); } void Alphabet::setState(unsigned int it, const state &s){ // Méthode permettant de modifier un identifiant d'un état. On se doit de vérifier si l'identifiant que veut donner n'a pas déjà été attribué @@ -29,6 +29,6 @@ void Alphabet::setState(unsigned int it, const state &s){ // Méthode permettant etats[it] = s; } else - throw AlphabetException("ID d'état invalide"); + throw AlphabetException("Invalid state ID"); } diff --git a/src/colorlabel.cpp b/src/colorlabel.cpp index 5590c8a13d3d4deca975ae98818416c48ab78f6c..562c8536dd2585e6995111bc387c9ce48ce83981 100644 --- a/src/colorlabel.cpp +++ b/src/colorlabel.cpp @@ -8,6 +8,7 @@ #include <string> #include <QListWidget> #include <QColorDialog> +#include <QMessageBox> #include "constantes.hpp" @@ -49,7 +50,7 @@ ColorLabel::~ColorLabel() void ColorLabel::generateState(){ if(a.taille() >= MAX_ETATS) // On vérifie qu'il reste encore de la place dans l'alphabet { - throw AlphabetException("Nombre d'états maximal atteint"); + QMessageBox::warning(this, "Error", "Reached the maximal amount of states"); } else { std::string string_name_state = ui->state_label->text().toStdString(); // On passe notre QString en string pour pouvoir utiliser le constructeur diff --git a/src/configurationloadingdialog.cpp b/src/configurationloadingdialog.cpp index 71fcefb77afbcb65860f4255629523f3c6616121..5e2660f70ab53bce05a52d625432b03a30290c5e 100644 --- a/src/configurationloadingdialog.cpp +++ b/src/configurationloadingdialog.cpp @@ -105,7 +105,7 @@ void ConfigurationLoadingDialog::done(int r) { if(!m_current_configuration.empty() && ui->tree->selectedItems().size() != 1) // validate the data somehow { - QMessageBox::information(this, "Erreur", "Il est nécéssaire de sélectionner un modèle."); + QMessageBox::information(this, "Error", "It is required to select a configuration."); return; } else @@ -125,7 +125,7 @@ QJsonObject ConfigurationLoadingDialog::load_configuration(const QString &filena { QFile f(filename); if (!f.open(QFile::ReadOnly | QFile::Text)) - throw ConfigurationLoadingException("Impossible de lire le fichier"); + throw ConfigurationLoadingException("Error reading file"); QTextStream in(&f); @@ -133,7 +133,7 @@ QJsonObject ConfigurationLoadingDialog::load_configuration(const QString &filena QJsonDocument jsonDoc = QJsonDocument::fromJson(in.readAll().toUtf8(), &parseError); if (parseError.error != QJsonParseError::NoError) { - throw ConfigurationLoadingException("Erreur de parsing JSON à " + std::to_string(parseError.offset) + ":" + parseError.errorString().toStdString()); + throw ConfigurationLoadingException("JSON parsing error at: " + std::to_string(parseError.offset) + ":" + parseError.errorString().toStdString()); } const QJsonObject root = jsonDoc.object(); diff --git a/src/gridview.cpp b/src/gridview.cpp index b24a52ebbb975f66118de32238e45cfd53e9bc5b..1363026a814f381d355d9acb1567c35716790635 100644 --- a/src/gridview.cpp +++ b/src/gridview.cpp @@ -30,14 +30,6 @@ Cette classe représente le widget utilisé pour l'affichage et l'interaction av #include "structurereader.hpp" - //! Permet de convertir un stateColor vers un QColor. - //! Détail d'implémentation. - static QColor stateColor_to_QColor(const stateColor& sc) -{ - return QColor::fromRgb(sc.getRed(), sc.getGreen(), sc.getBlue()); -} - - namespace detail { Graphics_view_zoom::Graphics_view_zoom(QGraphicsView* view) @@ -303,8 +295,8 @@ GridView::GridView(QWidget *parent) layout->addWidget(m_view); m_mouse_pos_label = new QLabel(""); layout->addWidget(m_mouse_pos_label); - layout->addWidget(new QLabel("Clic gauche : éditer; Clic droit : sélectionner", this)); - layout->addWidget(new QLabel("Maintenir SHIFT pour déplacer la grille; Molette ou CTRL+/CTRL- pour zoomer", this)); + layout->addWidget(new QLabel("Left click : edit; Right click : select", this)); + layout->addWidget(new QLabel("Hold SHIFT to move across the grid; Scroll wheel or CTRL+/CTRL- to zoom", this)); setLayout(layout); m_drag_drop_handler = new DragDropHandlerItem(*this); diff --git a/src/history.cpp b/src/history.cpp index 69d323b3d75001b598ba69271e77f0e17256ac6b..8e632ea1fbef7474c7f860bf8dda37bf12170071 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -33,5 +33,5 @@ Grid History::popGrid(){ tab.pop_back(); return tmp; } - throw HistoryException("La pile est vide. \n"); + throw HistoryException("Empty stack"); } diff --git a/src/interface.cpp b/src/interface.cpp index 174da4a0ca524e048bfa0a93e31b092947082c8d..468b7540a4fbce6a78f0d21b262eb44413d30a04 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -151,7 +151,7 @@ QString MainWindow::afficher_interface_sauvegarde_structure() if (!dialog.exec()) return ""; - QString filename = QFileDialog::getSaveFileName(this, "Choisir un nom de fichier", "", "Format Cellulut (*.json);;Format Golly RLE (*.rle)"); + QString filename = QFileDialog::getSaveFileName(this, "Choose a file name", "", "Cellulut format (*.json);;Golly RLE format (*.rle)"); QFileInfo info(filename); //printf("%s\n", info.suffix().toStdString().c_str()); // on pourrait utiliser un Factory ici, mais c'est possiblement overkill, les possibilités d'évolution de format de fichier sont faibles et ne justifient pas l'effort @@ -177,7 +177,7 @@ QString MainWindow::afficher_interface_sauvegarde_structure() QFile file(filename); if (!file.open(QIODevice::WriteOnly)) { - QMessageBox::information(this, "Impossible de créer le fichier", + QMessageBox::information(this, "Unable to create file", file.errorString()); return ""; } @@ -414,7 +414,7 @@ void MainWindow::save_model() if (!dialog.exec()) return; - QString filename = QFileDialog::getSaveFileName(this, "Choisir un nom de fichier", QString(), "Modèle d'automate (*.json)"); + QString filename = QFileDialog::getSaveFileName(this, "Choose a file name", QString(), "Automaton model file (*.json)"); PropertySaverVisitor trans_saver; for (auto& prop : m_transition_rule->get_properties()) @@ -457,7 +457,7 @@ void MainWindow::save_model() QFile file(filename); if (!file.open(QFile::WriteOnly | QFile::Text | QFile::Truncate)) { - QMessageBox::information(this, "Impossible de créer le fichier", + QMessageBox::information(this, "Unable to create file", file.errorString()); } file.write(doc.toJson()); @@ -557,7 +557,7 @@ void MainWindow::save_grid_configuration() const Grid& grid = ui->grid_view->get_grid(); Structure grid_data = grid.to_structure(); - QString title = QInputDialog::getText(this, "Choisir un titre", "Titre de la configuration : "); + QString title = QInputDialog::getText(this, "Choose a title", "Configuration title : "); if (title.isEmpty()) return; @@ -573,14 +573,14 @@ void MainWindow::save_grid_configuration() json_data["top"] = grid_data.top_left.y; json_data["data"] = QString::fromStdString(structure_data); - QString filename = QFileDialog::getSaveFileName(this, "Choisir un nom de fichier", "", "Configuration Cellulut (*.json)"); + QString filename = QFileDialog::getSaveFileName(this, "Choose a file name", "", "Cellulut configuration (*.json)"); if (filename.isEmpty()) return; QFile file(filename); if (!file.open(QIODevice::WriteOnly | QFile::Text | QFile::Truncate)) { - QMessageBox::information(this, "Impossible de créer le fichier", + QMessageBox::information(this, "Unable to create file", file.errorString()); } @@ -668,7 +668,7 @@ void MainWindow::play_bad_apple() QFile f("extras/bad_apple.json"); if (!f.open(QFile::ReadOnly | QFile::Text)) { - QMessageBox::warning(this, "", "Can't find 'extras/bad_apple.json'\n"); + QMessageBox::warning(this, "", "Couldn't open 'extras/bad_apple.json'\n"); return; } QTextStream in(&f); @@ -809,7 +809,7 @@ void MainWindow::on_nextButton_clicked() void MainWindow::on_prevButton_clicked() { if(!simulation.back()) { - QMessageBox::critical(this, "Retour arrière impossible", "L'historique est vide : impossible de revenir en arrière."); + QMessageBox::warning(this, "Unable to step back", "Empty history : unable to step back"); } ui->grid_view->copy_grid(simulation.getGrid()); ui->nbStepsLabel->setText(QString::number(simulation.getTime())+" steps"); @@ -826,9 +826,9 @@ void MainWindow::on_playPauseButton_clicked() ui->playPauseButton->setText("Pause"); int frequence = ui->simSpeedSpinbox->value(); if(frequence == 0) { - QMessageBox::critical(this, "Impossible de démarrer", "Impossible de lancer la simulation à une vitesse nulle."); + QMessageBox::critical(this, "Unable to start", "Speed needs to be nonzero."); } else if(!simulation.runnable()) { - QMessageBox::critical(this, "Impossible de démarrer", "Impossible de lancer la simulation : les règles ne sont pas définies ou incompatibles."); + QMessageBox::critical(this, "Unable to start", "Unable to begin the simulation : incompatible rules."); } else { timer->setInterval(1000/frequence); timer->start(); diff --git a/src/modelloadingdialog.cpp b/src/modelloadingdialog.cpp index 040a197538c01a23d4958b67ab6cb08de90d1a04..bedea522c0f58735d5bb4fd05f37d49e41a7b472 100644 --- a/src/modelloadingdialog.cpp +++ b/src/modelloadingdialog.cpp @@ -86,14 +86,14 @@ void ModelLoadingDialog::update_info(QTreeWidgetItem *item, int column) QFile f(item->data(0, Qt::UserRole).toString()); if (!f.open(QFile::ReadOnly | QFile::Text)) - throw ModelLoadingException("Impossible de lire le fichier"); + throw ModelLoadingException("Unable to read file"); QTextStream in(&f); QJsonParseError parseError; QJsonDocument jsonDoc = QJsonDocument::fromJson(in.readAll().toUtf8(), &parseError); if(parseError.error != QJsonParseError::NoError) { - throw ModelLoadingException("Erreur de parsing JSON à " + std::to_string(parseError.offset) + ":" + parseError.errorString().toStdString()); + throw ModelLoadingException("JSON parsing error at: " + std::to_string(parseError.offset) + ":" + parseError.errorString().toStdString()); } const QJsonObject root = jsonDoc.object(); @@ -112,7 +112,7 @@ void ModelLoadingDialog::done(int r) { if(!m_current_model.empty() && ui->tree->selectedItems().size() != 1) // validate the data somehow { - QMessageBox::information(this, "Erreur", "Il est nécéssaire de sélectionner un modèle."); + QMessageBox::information(this, "Error", "It is required to select a model."); return; } else diff --git a/src/neighborhoodDialog.cpp b/src/neighborhoodDialog.cpp index 2a54147d79f50dad457e64cd6b263e3cf5b58e58..63076408b8374881b99bbb40eac4e8b7e05c9536 100644 --- a/src/neighborhoodDialog.cpp +++ b/src/neighborhoodDialog.cpp @@ -35,8 +35,6 @@ NeighborhoodDialog::NeighborhoodDialog(Neighborhood& n, QWidget *parent) : if(abs(currentY) >= yMax /2) yMax = (abs(currentY)+1) * 2; } - std::cout << "xMax =" << xMax << " yMax=" << yMax << endl; - ui->widthSpinBox_2->setValue(xMax); ui->heightSpinBox_2->setValue(yMax); ResizeCreateGrid(xMax, yMax, n); @@ -91,7 +89,6 @@ Neighborhood* NeighborhoodDialog::getNeighborhood() const if( currentGrid.get_state({i,j}) == 1 || currentGrid.get_state({i,j}) == 3) { Coord newCoord = {i - currentPoint.x, j - currentPoint.y}; newNeighborhood->addNeighbor(newCoord, 1); - std::cout << "Nouveau voisin : X=" << newCoord.x << " Y=" << newCoord.y << endl; fflush(stdout); } } @@ -114,38 +111,6 @@ void NeighborhoodDialog::on_validateGridDim_2_clicked() ui->validateGridDim_2->setEnabled(false); delete oldNeighborhood; - - /* - unsigned oldNbrRow = oldGrid.get_rows(); // rows = nbr de lignes => axe y - unsigned oldNbrCol = oldGrid.get_col(); // col = nbr de colonne => axe x - - if(oldNbrRow <= nbrRow && oldNbrCol <= nbrCol) { - //std::cout << "superieur\n"; - fflush(stdout); - for (unsigned y = 0; y < oldNbrRow ; y++) { - for (unsigned x = 0; x < oldNbrCol ; x++) { - Coord pos = {static_cast<int>(x), static_cast<int>(y)}; - newGrid.set_cell(pos, oldGrid.get_state(pos)); - //std::cout << "oldState : " << oldGrid.get_state(pos) << endl; - } - } - } - else - { - //std::cout << "superieur\n"; - fflush(stdout); - for (unsigned y = 0; y < nbrRow ; y++) { - for (unsigned x = 0; x < nbrCol ; x++) { - Coord pos = {static_cast<int>(x), static_cast<int>(y)}; - newGrid.set_cell(pos, oldGrid.get_state(pos)); - //std::cout << "oldState : " << oldGrid.get_state(pos) << endl; - } - } - } - - ui->grid_view->copy_grid(newGrid); - ui->validateGridDim_2->setEnabled(false); - */ } void NeighborhoodDialog::on_heightSpinBox_2_valueChanged(int) diff --git a/src/neighborhood_rules/mooreNeighborhoodRule.cpp b/src/neighborhood_rules/mooreNeighborhoodRule.cpp index ceec70c7156027b7bbef996fe6ee1586a156ae25..022f8f232d5295931d2ac76ab6f396d24d7ed3a7 100644 --- a/src/neighborhood_rules/mooreNeighborhoodRule.cpp +++ b/src/neighborhood_rules/mooreNeighborhoodRule.cpp @@ -7,7 +7,7 @@ mooreNeighborhoodRule::mooreNeighborhoodRule(int _radius) current_format_radius = radius.val = _radius; if(_radius == 0) - throw NeighborhoodException("Le rayon ne peut pas être égal à 0"); + throw NeighborhoodException("Radius can't be zero"); update_format(); } diff --git a/src/neighborhood_rules/vonNeumannNeighborhoodRule.cpp b/src/neighborhood_rules/vonNeumannNeighborhoodRule.cpp index 2fbe3e5e7f45eb3a4ebe600d8182c204cfcfc67e..4716628029c222be3c435897eb4a245dc0c8e502 100644 --- a/src/neighborhood_rules/vonNeumannNeighborhoodRule.cpp +++ b/src/neighborhood_rules/vonNeumannNeighborhoodRule.cpp @@ -7,7 +7,7 @@ vonNeumannNeighborhoodRule::vonNeumannNeighborhoodRule(int _radius) current_format_radius = radius.val = _radius; if(_radius == 0) - throw NeighborhoodException("Le rayon ne peut pas être égal à 0"); + throw NeighborhoodException("Radius can't be zero"); update_format(); } diff --git a/src/savingdialog.cpp b/src/savingdialog.cpp index 71bd215d93d1d98905ec2d8f09bf9094279fe9b3..de2d94df99b1bbc83b219e03692b92173b99b44f 100644 --- a/src/savingdialog.cpp +++ b/src/savingdialog.cpp @@ -31,7 +31,7 @@ void SavingDialog::done(int r) { if(ui->nom->text().isEmpty()) // validate the data somehow { - QMessageBox::information(this, "Erreur", "Le champ 'Titre' doit être rempli."); + QMessageBox::information(this, "Error", "The 'Title' field needs to be completed."); return; } else diff --git a/src/structurereader.cpp b/src/structurereader.cpp index 9420418a99f5f935341044cbc5341a7012b60eca..eae9a098e2698d06877e84e2cd85a69035358a66 100644 --- a/src/structurereader.cpp +++ b/src/structurereader.cpp @@ -20,7 +20,7 @@ char StructureReader::peek() const { if (m_idx >= m_data.size()) - throw StructureReaderException("Fichier invalide, la lecture a dépassé la fin du fichier."); + throw StructureReaderException("Invalid file, reach end-of-file unexpectedly."); return m_data[m_idx]; } @@ -40,7 +40,7 @@ void StructureReader::expect(const std::string &str) { read_white(); if (m_data.substr(m_idx, str.size()) != str) - throw StructureReaderException("Valeur attendue : " + str); + throw StructureReaderException("Expected string : " + str); m_idx += str.size(); read_white(); } @@ -93,7 +93,7 @@ int StructureReader::read_int() } catch (std::exception& e) { - throw StructureReaderException("La valeur lue n'est pas un entier !"); + throw StructureReaderException("Expected an integer"); } m_idx += cars_read; @@ -237,7 +237,7 @@ Structure JSONStructureReader::read_structure() QJsonDocument jsonDoc = QJsonDocument::fromJson(byteArray, &parseError); if(parseError.error != QJsonParseError::NoError) { - throw StructureReaderException("Erreur de parsing JSON à " + std::to_string(parseError.offset) + ":" + parseError.errorString().toStdString()); + throw StructureReaderException("JSON parsing error at: " + std::to_string(parseError.offset) + ":" + parseError.errorString().toStdString()); } QJsonObject root = jsonDoc.object(); @@ -245,9 +245,9 @@ Structure JSONStructureReader::read_structure() Structure s; if (!root.contains("cells")) - throw StructureReaderException("Pas de champ 'cells' !"); + throw StructureReaderException("No 'cells' field !"); if (!root["cells"].isArray()) - throw StructureReaderException("'cells' doit être un array."); + throw StructureReaderException("'cells' must be an array."); s.author = root.value("author").toString().toStdString(); s.title = root.value("title").toString().toStdString(); @@ -256,7 +256,7 @@ Structure JSONStructureReader::read_structure() for (const auto& entry : root["cells"].toArray()) { - const char* msg = "Chaque entrée de 'cells' doit être un objet contenant des entiers x, y, et state."; + const char* msg = "Each 'cells' entry must contain fields x, y, and state."; if (!entry.isObject()) throw StructureReaderException(msg); @@ -279,7 +279,7 @@ Structure load_structure(const std::string &path) QString filename = QString::fromStdString(path); QFile f(filename); if (!f.open(QFile::ReadOnly | QFile::Text)) - throw StructureReaderException("Impossible de lire le fichier"); + throw StructureReaderException("Unable to open file"); QTextStream in(&f); std::string data = in.readAll().toStdString(); @@ -295,5 +295,5 @@ Structure load_structure(const std::string &path) return rle.read_structure(); } else - throw StructureReaderException("Format de fichier de structure invalide"); + throw StructureReaderException("Invalid structure file format"); }