From dcdd2a9b9a49e793871c14255fd69ae20e46ef83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 4 Jun 2018 17:10:45 +0200 Subject: [PATCH] [solver] Improve messages for edge cases (No equation, no solution...) --- apps/solver/base.de.i18n | 7 +++++-- apps/solver/base.en.i18n | 7 +++++-- apps/solver/base.es.i18n | 7 +++++-- apps/solver/base.fr.i18n | 7 +++++-- apps/solver/base.pt.i18n | 9 ++++++--- apps/solver/list_controller.cpp | 4 ++++ apps/solver/solutions_controller.cpp | 8 +++++++- 7 files changed, 37 insertions(+), 12 deletions(-) diff --git a/apps/solver/base.de.i18n b/apps/solver/base.de.i18n index 1b0ba2ecb..3b935cb33 100644 --- a/apps/solver/base.de.i18n +++ b/apps/solver/base.de.i18n @@ -8,8 +8,11 @@ TooManyVariables = "Le système a trop d'inconnus" NonLinearSystem = "Le système n'est pas linéaire" Solution = "Solution" ApproximateSolution = "Solution approchée" -SearchInverval = "Interval de recherche" -NoSolution = "Le systeme n'admet aucune solution" +SearchInverval = "Intervalle de recherche" +NoSolutionSystem = "Le systeme n'admet aucune solution" +NoSolutionEquation = "L'équation n'admet aucune solution" +NoSolutionInterval = "Aucune solution trouvée dans cet intervalle" +EnterEquation = "Entrez une équation" InfiniteNumberOfSolutions = "Le systeme admet une infinite de solutions" ApproximateSolutionIntervalInstruction0= "Entrez l'intervalle dans lequel" ApproximateSolutionIntervalInstruction1= "rechercher une solution approchée." diff --git a/apps/solver/base.en.i18n b/apps/solver/base.en.i18n index 1b0ba2ecb..3b935cb33 100644 --- a/apps/solver/base.en.i18n +++ b/apps/solver/base.en.i18n @@ -8,8 +8,11 @@ TooManyVariables = "Le système a trop d'inconnus" NonLinearSystem = "Le système n'est pas linéaire" Solution = "Solution" ApproximateSolution = "Solution approchée" -SearchInverval = "Interval de recherche" -NoSolution = "Le systeme n'admet aucune solution" +SearchInverval = "Intervalle de recherche" +NoSolutionSystem = "Le systeme n'admet aucune solution" +NoSolutionEquation = "L'équation n'admet aucune solution" +NoSolutionInterval = "Aucune solution trouvée dans cet intervalle" +EnterEquation = "Entrez une équation" InfiniteNumberOfSolutions = "Le systeme admet une infinite de solutions" ApproximateSolutionIntervalInstruction0= "Entrez l'intervalle dans lequel" ApproximateSolutionIntervalInstruction1= "rechercher une solution approchée." diff --git a/apps/solver/base.es.i18n b/apps/solver/base.es.i18n index 1b0ba2ecb..3b935cb33 100644 --- a/apps/solver/base.es.i18n +++ b/apps/solver/base.es.i18n @@ -8,8 +8,11 @@ TooManyVariables = "Le système a trop d'inconnus" NonLinearSystem = "Le système n'est pas linéaire" Solution = "Solution" ApproximateSolution = "Solution approchée" -SearchInverval = "Interval de recherche" -NoSolution = "Le systeme n'admet aucune solution" +SearchInverval = "Intervalle de recherche" +NoSolutionSystem = "Le systeme n'admet aucune solution" +NoSolutionEquation = "L'équation n'admet aucune solution" +NoSolutionInterval = "Aucune solution trouvée dans cet intervalle" +EnterEquation = "Entrez une équation" InfiniteNumberOfSolutions = "Le systeme admet une infinite de solutions" ApproximateSolutionIntervalInstruction0= "Entrez l'intervalle dans lequel" ApproximateSolutionIntervalInstruction1= "rechercher une solution approchée." diff --git a/apps/solver/base.fr.i18n b/apps/solver/base.fr.i18n index 1b0ba2ecb..3b935cb33 100644 --- a/apps/solver/base.fr.i18n +++ b/apps/solver/base.fr.i18n @@ -8,8 +8,11 @@ TooManyVariables = "Le système a trop d'inconnus" NonLinearSystem = "Le système n'est pas linéaire" Solution = "Solution" ApproximateSolution = "Solution approchée" -SearchInverval = "Interval de recherche" -NoSolution = "Le systeme n'admet aucune solution" +SearchInverval = "Intervalle de recherche" +NoSolutionSystem = "Le systeme n'admet aucune solution" +NoSolutionEquation = "L'équation n'admet aucune solution" +NoSolutionInterval = "Aucune solution trouvée dans cet intervalle" +EnterEquation = "Entrez une équation" InfiniteNumberOfSolutions = "Le systeme admet une infinite de solutions" ApproximateSolutionIntervalInstruction0= "Entrez l'intervalle dans lequel" ApproximateSolutionIntervalInstruction1= "rechercher une solution approchée." diff --git a/apps/solver/base.pt.i18n b/apps/solver/base.pt.i18n index a42654af7..3b935cb33 100644 --- a/apps/solver/base.pt.i18n +++ b/apps/solver/base.pt.i18n @@ -1,15 +1,18 @@ SolverApp = "Equation" SolverAppCapital = "EQUATION" AddEquation = "Ajouter une équation" -Resolve = "Résoudre" +Resolve = "Résoudre l'équation" RequireEquation = "L'entrée doit être une équation" UseEquationModel = "Utiliser le modèle d'équation" TooManyVariables = "Le système a trop d'inconnus" NonLinearSystem = "Le système n'est pas linéaire" Solution = "Solution" ApproximateSolution = "Solution approchée" -SearchInverval = "Interval de recherche" -NoSolution = "Le systeme n'admet aucune solution" +SearchInverval = "Intervalle de recherche" +NoSolutionSystem = "Le systeme n'admet aucune solution" +NoSolutionEquation = "L'équation n'admet aucune solution" +NoSolutionInterval = "Aucune solution trouvée dans cet intervalle" +EnterEquation = "Entrez une équation" InfiniteNumberOfSolutions = "Le systeme admet une infinite de solutions" ApproximateSolutionIntervalInstruction0= "Entrez l'intervalle dans lequel" ApproximateSolutionIntervalInstruction1= "rechercher une solution approchée." diff --git a/apps/solver/list_controller.cpp b/apps/solver/list_controller.cpp index c2d800b44..6471d4d74 100644 --- a/apps/solver/list_controller.cpp +++ b/apps/solver/list_controller.cpp @@ -141,6 +141,10 @@ bool ListController::expressionLayoutFieldDidReceiveEvent(ExpressionLayoutField } void ListController::resolveEquations() { + if (m_equationStore->numberOfModels() == 0) { + app()->displayWarning(I18n::Message::EnterEquation); + return; + } EquationStore::Error e = m_equationStore->exactSolve(static_cast(app())->localContext()); switch (e) { case EquationStore::Error::TooManyVariables: diff --git a/apps/solver/solutions_controller.cpp b/apps/solver/solutions_controller.cpp index 9621e0929..dff596dc2 100644 --- a/apps/solver/solutions_controller.cpp +++ b/apps/solver/solutions_controller.cpp @@ -69,7 +69,13 @@ I18n::Message SolutionsController::emptyMessage() { if (m_equationStore->numberOfSolutions() == INT_MAX) { return I18n::Message::InfiniteNumberOfSolutions; } - return I18n::Message::NoSolution; + if (m_equationStore->type() == EquationStore::Type::Monovariable) { + return I18n::Message::NoSolutionInterval; + } + if (m_equationStore->numberOfModels() <= 1) { + return I18n::Message::NoSolutionEquation; + } + return I18n::Message::NoSolutionSystem; } Responder * SolutionsController::defaultController() {