2024-03-17 12:34:59 +01:00
< template >
2024-03-17 15:47:42 +01:00
< h1 class = "title mb-4 ml-5 mt-5" > Paramètres < / h1 >
2024-03-17 16:49:50 +01:00
< v -divider :thickness ="2" class = "border-opacity-100" color = "primary" / >
2024-03-17 15:47:42 +01:00
< h2 class = "title ml-10 mb-5 mt-5" > Son < / h2 >
2024-03-17 12:34:59 +01:00
< div style = "display: flex; align-items: center;" >
2024-03-17 16:49:50 +01:00
< v -switch label = "Activer le son intégré" v -model = " EmbeddedSound " class = "ml-15" color = "primary" / >
2024-03-17 12:34:59 +01:00
< div style = "width: 250px; margin-left: 16px;" >
2024-03-17 15:47:42 +01:00
< v -slider class = "ml-15" : disabled = "EmbeddedSound === false" v -model = " EmbeddedSoundVolume " color = "primary" / >
2024-03-17 12:34:59 +01:00
< / div >
< / div >
2024-03-17 16:49:50 +01:00
< v -switch label = "Activer le son MQTT" v -model = " MQTTSound " class = "ml-15" color = "primary" / >
< v -divider / >
< h2 class = "title ml-10 mb-5 mt-5" > Affichage < / h2 >
< v -switch label = "Activer l'affichage des sattelites" v -model = " SattelitesDisplay " class = "ml-15" color = "primary" / >
< v -divider / >
< h2 class = "title ml-10 mb-5 mt-5" > MQTT < / h2 >
< div style = "display: flex; align-items: center;" >
< v -icon v-model ="MQTTBrokerState" class="ml-15" color="error" icon="record" > mdi -record < / v-icon >
< v -label class = "ml-2 mb-5 mt-5" > Etat du serveur MQTT < / v - l a b e l >
< / div >
< v -divider / >
2024-03-17 12:34:59 +01:00
< / template >
2024-03-17 15:47:42 +01:00
< script setup >
import { ref , onMounted , watch } from 'vue' ;
2024-03-17 12:34:59 +01:00
2024-03-17 15:47:42 +01:00
const EmbeddedSound = ref ( false ) ; // Définition d'une référence pour la case à cocher. Initialement décochée.
const EmbeddedSoundVolume = ref ( 50 ) ; // Définition d'une référence pour la case à cocher. Initialement décochée.
const MQTTSound = ref ( false ) ; // Définition d'une référence pour la case à cocher. Initialement décochée.
2024-03-17 16:49:50 +01:00
const MQTTBrokerState = ref ( false ) ; // Définition d'une référence pour la case à cocher. Initialement décochée.
const SattelitesDisplay = ref ( false ) ;
2024-03-17 15:47:42 +01:00
onMounted ( ( ) => {
if ( localStorage . getItem ( 'EmbeddedSound' ) ) {
EmbeddedSound . value = localStorage . getItem ( 'EmbeddedSound' ) === 'true' ; // Si l'état de la case à cocher est stocké, le mettre dans la référence
}
if ( localStorage . getItem ( 'MQTTSound' ) ) {
MQTTSound . value = localStorage . getItem ( 'MQTTSound' ) === 'true' ; // Si l'état de la case à cocher est stocké, le mettre dans la référence
}
if ( localStorage . getItem ( 'EmbeddedSoundVolume' ) ) {
EmbeddedSoundVolume . value = localStorage . getItem ( 'EmbeddedSoundVolume' ) ; // Si l'état de la case à cocher est stocké, le mettre dans la référence
}
2024-03-17 16:49:50 +01:00
if ( localStorage . getItem ( 'SattelitesDisplay' ) ) {
SattelitesDisplay . value = localStorage . getItem ( 'SattelitesDisplay' ) === 'true' ; // Added a default value for this switch
}
2024-03-17 15:47:42 +01:00
} ) ;
watch ( EmbeddedSound , ( EmbeddedSoundNewValue ) => {
if ( EmbeddedSoundNewValue !== null ) {
localStorage . setItem ( 'EmbeddedSound' , EmbeddedSoundNewValue ) ; // Mettre à jour l'état de la case à cocher dans le LocalStorage chaque fois qu'il change.
}
} ) ;
watch ( EmbeddedSoundVolume , ( EmbeddedSoundVolumeNewValue ) => {
if ( EmbeddedSoundVolumeNewValue !== null ) {
localStorage . setItem ( 'EmbeddedSoundVolume' , EmbeddedSoundVolumeNewValue ) ; // Mettre à jour l'état de la case à cocher dans le LocalStorage chaque fois qu'il change.
}
} ) ;
watch ( MQTTSound , ( MQTTSoundNewValue ) => {
2024-03-17 12:34:59 +01:00
2024-03-17 15:47:42 +01:00
if ( MQTTSoundNewValue !== null ) {
localStorage . setItem ( 'MQTTSound' , MQTTSoundNewValue ) ; // Mettre à jour l'état de la case à cocher dans le LocalStorage chaque fois qu'il change.
}
} ) ;
2024-03-17 16:49:50 +01:00
watch ( SattelitesDisplay , ( SattelitesDisplaynewValue ) => {
if ( SattelitesDisplaynewValue !== null ) {
localStorage . setItem ( 'SattelitesDisplay' , SattelitesDisplaynewValue ) ; // Added a default value for this switch
}
} ) ;
2024-03-17 15:47:42 +01:00
< / script >