Skip to content

Commit cfac537

Browse files
committed
close #41
1 parent 434f043 commit cfac537

File tree

2 files changed

+48
-12
lines changed

2 files changed

+48
-12
lines changed

src/components/Settings.vue

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293
/>
294294
<v-text-field v-model="settings.camera_color_object_size_min"
295295
@input="$v.settings.camera_color_object_size_min.$touch"
296-
v-bind:label="$t('message.camera_color_object_size_min')"
296+
v-bind:label="$t('message.settings_camera_color_object_size_min')"
297297
v-bind:error-messages="$v.settings.camera_color_object_size_min.$error == true ? $t('message.validation_integer') : null"
298298
/>
299299
<v-text-field v-model="settings.camera_path_object_size_max"
@@ -976,6 +976,16 @@ export default {
976976
this.snackText = this.$i18n.t('message.settings_errors');
977977
this.snackbar = true;
978978
} else {
979+
/* eslint-disable func-names, object-shorthand, prefer-arrow-callback */
980+
const needRestart = this.needRestart();
981+
let needRestartFlag = false;
982+
Object.entries(this.$v.settings).forEach(function (field) {
983+
if (field[1].$dirty
984+
&& needRestart[field[0]]) {
985+
needRestartFlag = true;
986+
}
987+
});
988+
/* eslint-enable */
979989
const legacySettings = qs.stringify({
980990
ctrl_hud_image: data.ctrl_hud_image,
981991
cv_image_factor: data.cv_image_factor,
@@ -1016,7 +1026,7 @@ export default {
10161026
.then(() => {
10171027
console.log('Updated settings');
10181028
this.prepopulate();
1019-
this.snackText = this.$i18n.t('message.settings_updated');
1029+
this.snackText = this.$i18n.t('message.settings_updated') + (needRestartFlag ? this.$i18n.t('message.settings_restart_needed') : '');
10201030
this.snackbar = true;
10211031
this.$v.settings.$reset();
10221032
console.log('set dirty false');
@@ -1048,7 +1058,40 @@ export default {
10481058
const currentStatus = this.$store.getters.drawerStatus;
10491059
this.$store.commit('toggleDrawer', !currentStatus);
10501060
},
1051-
errorMessages() { return !this.$v.settings.camera_color_object_size_max.required ? 'Valore numerico necessario' : null; }
1061+
errorMessages() { return !this.$v.settings.camera_color_object_size_max.required ? 'Valore numerico necessario' : null; },
1062+
needRestart() {
1063+
return {
1064+
ctrl_hud_image: true,
1065+
cv_image_factor: true,
1066+
camera_color_object_size_max: true,
1067+
camera_color_object_size_min: true,
1068+
camera_exposure_mode: true,
1069+
camera_framerate: true,
1070+
camera_jpeg_bitrate: true,
1071+
camera_jpeg_quality: true,
1072+
camera_path_object_size_max: true,
1073+
camera_path_object_size_min: true,
1074+
cnn_default_model: true,
1075+
cbName: true,
1076+
btnFun: true,
1077+
audioLevel: true,
1078+
moveFwdElapse: false,
1079+
moveFwdSpeed: false,
1080+
moveTurnElapse: false,
1081+
moveTurnSpeed: false,
1082+
ctrlFwdElapse: false,
1083+
ctrlFwdSpeed: false,
1084+
ctrlTurnElapse: false,
1085+
ctrlTurnSpeed: false,
1086+
motorMode: true,
1087+
trimFactor: true,
1088+
startSound: true,
1089+
stopSound: true,
1090+
shutterSound: true,
1091+
startupProgram: true,
1092+
progLevel: false
1093+
};
1094+
}
10521095
},
10531096
data() {
10541097
return {
@@ -1224,20 +1267,17 @@ export default {
12241267
minValue: 0
12251268
},
12261269
cnn_default_model: {
1227-
required,
1228-
alpha
1270+
required
12291271
},
12301272
wifiMode: {
12311273
required,
12321274
alpha
12331275
},
12341276
wifiSSID: {
12351277
required,
1236-
alpha
12371278
},
12381279
wifiPsw: {
12391280
required,
1240-
alpha
12411281
},
12421282
audioLevel: {
12431283
required,
@@ -1298,19 +1338,14 @@ export default {
12981338
decimal
12991339
},
13001340
startSound: {
1301-
alpha
13021341
},
13031342
stopSound: {
1304-
alpha
13051343
},
13061344
shutterSound: {
1307-
alpha
13081345
},
13091346
startupProgram: {
1310-
alpha
13111347
},
13121348
progLevel: {
1313-
alpha
13141349
}
13151350
},
13161351
};

src/i18n/locales/it/messages.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@
237237
"settings_toolbax_standard": "Standard",
238238
"settings_toolbax_advanced": "Avanzate",
239239
"settings_confirm_exit_text": "Le modifiche apportate andranno perse, comfermi di voler cambiare pagina?",
240+
"settings_restart_needed": "Per rendere effettive le modifiche, riavviare CdoerBot.",
240241
"validation_integer": "Inserire un numero intero (1234)",
241242
"validation_decimal": "Inserire un numero decimale (12.34)",
242243
"validation_integer_positive": "Inserire un numero intero maggiore o uguale a 0",

0 commit comments

Comments
 (0)