-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added methods to Setting. Created Language enum.
- Loading branch information
Robin Strand Prestmo
authored and
Robin Strand Prestmo
committed
Feb 20, 2026
1 parent
b143d6a
commit 80c40a8
Showing
3 changed files
with
56 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
|
|
||
| import java.util.*; | ||
|
|
||
| // Unntakshåndtering mangler | ||
| // Enhetstester mangler | ||
|
|
||
| /** | ||
|
|
||
11 changes: 11 additions & 0 deletions
11
helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Language.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package ntnu.sytemutvikling.team6.models; | ||
|
|
||
| /** | ||
| * Supported application languages. | ||
| * | ||
| * @author Robin Strand Prestmo | ||
| */ | ||
| public enum Language { | ||
| ENGLISH, | ||
| NORSK | ||
| } |
54 changes: 45 additions & 9 deletions
54
helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Settings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,77 @@ | ||
| package ntnu.sytemutvikling.team6.models; | ||
|
|
||
| // Mangler unntakshåndtering | ||
| // Mangler Enhetstesting | ||
|
|
||
| /** | ||
| * Represents the settings for a user | ||
| * Represents the settings for a user. | ||
| * | ||
| * @Author Robin Strand Prestmo | ||
| * @author Robin Strand Prestmo | ||
| */ | ||
| public class Settings { | ||
| private boolean lightMode; | ||
| private String language; | ||
| private Language language; | ||
| private boolean anonymous; | ||
|
|
||
| /** | ||
| * Creates settings for a user | ||
| * Sets standard settings. | ||
| * LightMode enabled, language set to English, | ||
| * Anonymous disabled | ||
| */ | ||
| public Settings() { | ||
| this(true, Language.ENGLISH, false); | ||
| } | ||
| /** | ||
| * Creates settings for a user. | ||
| * | ||
| * @param lightMode choose between light or dark mode | ||
| * @param language choose language | ||
| * @param anonymous choose if user is anonymous | ||
| * | ||
| */ | ||
| public Settings(boolean lightMode, String language, boolean anonymous) { | ||
| public Settings(boolean lightMode, Language language, boolean anonymous) { | ||
| if (language == null) { | ||
| throw new IllegalArgumentException("Language cannot be null"); | ||
| } | ||
| this.lightMode = lightMode; | ||
| this.language = language; | ||
| this.anonymous = anonymous; | ||
| } | ||
|
|
||
| public boolean getLightmode() { | ||
| /** | ||
| * Toggles between light and dark mode | ||
| */ | ||
| public void toggleLightMode() { | ||
| lightMode = !lightMode; | ||
| } | ||
|
|
||
| /** | ||
| * Toggles anonymous mode on and off | ||
| */ | ||
| public void toggleAnonymousMode() { | ||
| anonymous = !anonymous; | ||
| } | ||
|
|
||
| /** | ||
| * Change language to the chosen language. | ||
| * | ||
| * @param newLanguage the language to change to. | ||
| */ | ||
| public void changeLanguage(Language newLanguage) { | ||
| if (newLanguage == null) { | ||
| throw new IllegalArgumentException("Language cannot be null"); | ||
| } | ||
| language = newLanguage; | ||
| } | ||
|
|
||
| public boolean isLightMode() { | ||
| return lightMode; | ||
| } | ||
|
|
||
| public String getLanguage() { | ||
| public Language getLanguage() { | ||
| return language; | ||
| } | ||
|
|
||
| public boolean getAnonymous() { | ||
| public boolean isAnonymous() { | ||
| return anonymous; | ||
| } | ||
| } |