Skip to content
Snippets Groups Projects
Verified Commit 2686cac9 authored by Théo Pirkl's avatar Théo Pirkl :nail_care:
Browse files

Merge remote-tracking branch 'origin/devel' into devel

parents 0fee8c79 39b07ec2
No related branches found
No related tags found
1 merge request!21*poof* final version
package ch.hepia.api.weather; package ch.hepia.api.weather;
import org.json.JSONObject; import org.json.JSONObject;
import ch.hepia.config.AppConfig;
public class Meteo { public class Meteo {
private double temperature; private double temperature;
private String conditions; private String conditions;
...@@ -27,6 +29,54 @@ public class Meteo { ...@@ -27,6 +29,54 @@ public class Meteo {
*/ */
public String getConditions(){ return conditions; } public String getConditions(){ return conditions; }
public String getConditionsIcon(){
switch (this.conditions) {
case "Stratus":
case "Nuit nuageuse":
case "Fortement nuageux":
case "Développement nuageux":
case "Nuit avec développement nuageux":
return AppConfig.WEATHER_ICON_CLOUDY;
case "Ciel voilé":
case "Nuit légèrement voilée":
case "Faibles passages nuageux":
case "Brouillard":
case "Stratus se dissipant":
case "Nuit claire et stratus":
case "Faiblement nuageux":
return AppConfig.WEATHER_ICON_FOGGY;
case "Averses de pluie faible":
case "Nuit avec averses":
case "Averses de pluie modérée":
case "Averses de pluie forte":
case "Couvert avec averses":
case "Pluie faible":
case "Pluie forte":
case "Pluie modérée":
return AppConfig.WEATHER_ICON_RAINY;
case "Averses de neige faible":
case "Nuit avec averses de neige faible":
case "Neige faible":
case "Neige modérée":
case "Neige forte":
case "Pluie et neige mêlée faible":
case "Pluie et neige mêlée modérée":
case "Pluie et neige mêlée forte":
return AppConfig.WEATHER_ICON_SNOWY;
case "Faiblement orageux":
case "Nuit faiblement orageuse":
case "Orage modéré":
case "Fortement orageux":
return AppConfig.WEATHER_ICON_STORMY;
case "Ensoleillé":
case "Nuit claire":
case "Nuit bien dégagée":
case "Eclaircies":
default:
return AppConfig.WEATHER_ICON_SUNNY;
}
}
/** /**
* Builder of Meteo Object * Builder of Meteo Object
*/ */
......
...@@ -26,8 +26,9 @@ public final class AppConfig { ...@@ -26,8 +26,9 @@ public final class AppConfig {
public static List<String> CHAT_COMMANDS = List.of( public static List<String> CHAT_COMMANDS = List.of(
"help", "help",
"ignore", "block",
"ignoredlist" "unblock",
"blacklist"
); );
/** /**
......
...@@ -322,13 +322,13 @@ public class MainWindowController implements Initializable { ...@@ -322,13 +322,13 @@ public class MainWindowController implements Initializable {
case "help": case "help":
drawCommands(); drawCommands();
break; break;
case "ignore": case "block":
if (command.length > 1) { if (command.length > 1) {
Main.getContext().getUser().get().addIgnoredUser(new User(command[1])); Main.getContext().getUser().get().addIgnoredUser(new User(command[1]));
drawMessage(command[1] + " bloqué.", AppConfig.HELP_MESSAGE_ICON, c); drawMessage(command[1] + " bloqué.", AppConfig.HELP_MESSAGE_ICON, c);
} }
break; break;
case "ignoredlist": case "blacklist":
List<User> list = Main.getContext().getUser().get().getIgnoredUserList(); List<User> list = Main.getContext().getUser().get().getIgnoredUserList();
if (list.size() > 0) { if (list.size() > 0) {
StringBuilder buffer = new StringBuilder(list.get(0).getName()); StringBuilder buffer = new StringBuilder(list.get(0).getName());
...@@ -339,6 +339,10 @@ public class MainWindowController implements Initializable { ...@@ -339,6 +339,10 @@ public class MainWindowController implements Initializable {
AppConfig.HELP_MESSAGE_ICON, c); AppConfig.HELP_MESSAGE_ICON, c);
} }
break; break;
case "unblock":
List<User> ulist = Main.getContext().getUser().get().getIgnoredUserList();
ulist.remove(new User(command[1]));
break;
} }
} else { } else {
drawCommands(); drawCommands();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment