Exact picture seems to work

This commit is contained in:
2025-09-02 21:53:03 +02:00
parent f15208fe6d
commit b2571c191f
137 changed files with 2487 additions and 797 deletions

View File

@@ -5,6 +5,16 @@ package ch.gtache.fro.gui;
*/
public interface SettingsController extends Controller {
/**
* Imports settings from a file
*/
void importSettings();
/**
* Exports settings to a file
*/
void exportSettings();
@Override
SettingsModel model();
}

View File

@@ -1,11 +1,9 @@
package ch.gtache.fro.practice.gui;
import ch.gtache.fro.gui.Model;
/**
* Model for the practice view - exact guess
*/
public interface PracticeExactModel extends Model {
public interface PracticeExactModel extends PracticeQuestionModel {
/**
* Returns the user's current guess
@@ -19,5 +17,5 @@ public interface PracticeExactModel extends Model {
*
* @param guess The guess
*/
void guess(String guess);
void setGuess(String guess);
}

View File

@@ -11,4 +11,9 @@ public interface PracticeGuessController extends Controller {
* Confirms the current guess
*/
void confirm();
/**
* Proceeds to the next question/show the result page
*/
void next();
}

View File

@@ -1,11 +1,24 @@
package ch.gtache.fro.practice.gui;
import ch.gtache.fro.gui.Model;
import ch.gtache.fro.practice.PracticeRun;
/**
* Model for the practice view
*/
public interface PracticeModel extends Model {
/**
* Returns the current practice run
*
* @return The practice run
*/
PracticeRun practiceRun();
/**
* Sets the practice run
*
* @param practiceRun The practice run
*/
void setPracticeRun(PracticeRun practiceRun);
}

View File

@@ -29,5 +29,5 @@ public interface PracticeMultichoiceModel extends Model {
*
* @param selected The selected bird
*/
void selected(Bird selected);
void setSelected(Bird selected);
}

View File

@@ -1,12 +1,11 @@
package ch.gtache.fro.practice.gui;
import ch.gtache.fro.Picture;
import ch.gtache.fro.gui.Model;
/**
* Represents a model for a practice view with a picture
*/
public interface PracticePictureModel extends Model {
public interface PracticePictureModel extends PracticeQuestionModel {
/**
* Returns the picture to guess
@@ -20,5 +19,5 @@ public interface PracticePictureModel extends Model {
*
* @param picture The picture
*/
void picture(Picture picture);
void setPicture(Picture picture);
}

View File

@@ -0,0 +1,35 @@
package ch.gtache.fro.practice.gui;
import ch.gtache.fro.Bird;
import ch.gtache.fro.gui.Model;
import java.util.List;
/**
* Model for the practice questions views
*/
public interface PracticeQuestionModel extends Model {
/**
* Returns whether the view is currently showing the question result
*
* @return The result
*/
boolean isShowingResult();
/**
* Returns the list of guesses made
*
* @return The guesses
*/
List<Bird> guesses();
/**
* Returns the number of guesses made
*
* @return The guess count
*/
default int guessesCount() {
return guesses().size();
}
}

View File

@@ -7,6 +7,11 @@ import ch.gtache.fro.gui.Controller;
*/
public interface PracticeResultController extends Controller {
/**
* Closes the practice result view
*/
void confirm();
@Override
PracticeResultModel model();
}

View File

@@ -1,9 +1,52 @@
package ch.gtache.fro.practice.gui;
import ch.gtache.fro.gui.Model;
import ch.gtache.fro.practice.PracticeResult;
/**
* Model for the practice result view
*/
public interface PracticeResultModel extends Model {
/**
* Gets the practice result
*
* @return the practice result
*/
PracticeResult result();
/**
* Sets the practice result
*
* @param result the practice result
*/
void setResult(PracticeResult result);
/**
* The text for the success label
*
* @return The text
*/
String successLabel();
/**
* The text for the failure label
*
* @return The text
*/
String failureLabel();
/**
* The text for the label of successful guesses
*
* @return The text
*/
String successListLabel();
/**
* The text for the label of failed guesses
*
* @return The text
*/
String failureListLabel();
}

View File

@@ -1,7 +1,8 @@
package ch.gtache.fro.practice.gui;
import ch.gtache.fro.gui.Model;
import ch.gtache.fro.practice.PracticeType;
import ch.gtache.fro.practice.PracticeParameters;
import ch.gtache.fro.practice.QuestionType;
import java.util.List;
@@ -15,21 +16,49 @@ public interface PracticeSettingsModel extends Model {
*
* @return The list of practice types
*/
List<PracticeType> practiceTypes();
List<QuestionType> questionTypes();
/**
* Returns the currently selected practice type
*
* @return The practice type
*/
PracticeType practiceType();
QuestionType questionType();
/**
* Sets the practice type
*
* @param practiceType The practice type
* @param questionType The practice type
*/
void practiceType(PracticeType practiceType);
void setQuestionType(QuestionType questionType);
/**
* Returns the number of unsuccessful guesses before a question is considered as failed
*
* @return The number of unsuccessful guesses
*/
int guessesNumber();
/**
* Sets the number of unsuccessful guesses before a question is considered as failed
*
* @param guessesNumber The number of unsuccessful guesses
*/
void setGuessesNumber(int guessesNumber);
/**
* Returns the number of questions
*
* @return The number of questions
*/
int questionsNumber();
/**
* Sets the number of questions
*
* @param questionsNumber The number of questions
*/
void setQuestionsNumber(int questionsNumber);
/**
* Returns true if the practice type has suggestions
@@ -50,5 +79,12 @@ public interface PracticeSettingsModel extends Model {
*
* @param suggestionsNumber The number of suggestions
*/
void suggestionsNumber(int suggestionsNumber);
void setSuggestionsNumber(int suggestionsNumber);
/**
* Returns the current practice parameters
*
* @return The practice parameters
*/
PracticeParameters practiceParameters();
}

View File

@@ -1,12 +1,11 @@
package ch.gtache.fro.practice.gui;
import ch.gtache.fro.Sound;
import ch.gtache.fro.gui.Model;
/**
* Represents a model for a practice view with a sound
*/
public interface PracticeSoundModel extends Model {
public interface PracticeSoundModel extends PracticeQuestionModel {
/**
* Returns the sound to guess
@@ -20,5 +19,5 @@ public interface PracticeSoundModel extends Model {
*
* @param sound The sound
*/
void sound(Sound sound);
void setSound(Sound sound);
}

View File

@@ -28,5 +28,5 @@ public interface PracticeSoundMultichoicePictureModel extends PracticeSoundModel
*
* @param selected The selected picture
*/
void selected(Picture selected);
void setSelected(Picture selected);
}