From a6c697f0cc6eac60acf1a735f6330ebba97c3173 Mon Sep 17 00:00:00 2001 From: yboucher <yann.boucher@etu.utc.fr> Date: Fri, 11 Jun 2021 19:55:29 +0200 Subject: [PATCH] Uniformisation de l'anglais dans toute l'application --- forms/interface.ui | 2 +- forms/savingdialog.ui | 10 +++--- forms/structurelibraryview.ui | 2 +- include/history.h | 2 +- include/neighborhood.hpp | 4 +-- include/state.hpp | 2 +- src/alphabet.cpp | 4 +-- src/colorlabel.cpp | 3 +- src/configurationloadingdialog.cpp | 6 ++-- src/gridview.cpp | 12 ++----- src/history.cpp | 2 +- src/interface.cpp | 22 ++++++------ src/modelloadingdialog.cpp | 6 ++-- src/neighborhoodDialog.cpp | 35 ------------------- .../mooreNeighborhoodRule.cpp | 2 +- .../vonNeumannNeighborhoodRule.cpp | 2 +- src/savingdialog.cpp | 2 +- src/structurereader.cpp | 18 +++++----- 18 files changed, 47 insertions(+), 89 deletions(-) diff --git a/forms/interface.ui b/forms/interface.ui index d5e9a15..a7367fc 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 c1e902f..28f9f7c 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 2be99c8..7ccd807 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 ef6f5a7..dcc555b 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 c886e53..f97c153 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 1ac3333..be1b012 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 edff000..7ae72c7 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 5590c8a..562c853 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 71fcefb..5e2660f 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 b24a52e..1363026 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 69d323b..8e632ea 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 174da4a..468b754 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 040a197..bedea52 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 2a54147..6307640 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 ceec70c..022f8f2 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 2fbe3e5..4716628 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 71bd215..de2d94d 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 9420418..eae9a09 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"); } -- GitLab