Skip to content

Commit

Permalink
feat: setting to disable automatic gcode loading on mobile (#1028)
Browse files Browse the repository at this point in the history
Signed-off-by: Kieran Eglin <kieran.eglin@gmail.com>
Co-authored-by: Mathis Mensing <github@matmen.dev>
Co-authored-by: Pedro Lamas <pedrolamas@gmail.com>
  • Loading branch information
3 people committed Feb 5, 2023
1 parent 99f1f4b commit afcff8f
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/components/settings/GcodePreviewSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@
/>
</app-setting>

<template v-if="autoLoadOnPrintStart">
<v-divider />

<app-setting :title="$t('app.setting.label.auto_load_mobile_on_print_start')">
<v-switch
v-model="autoLoadMobileOnPrintStart"
hide-details
class="mb-5"
@click.native.stop
/>
</app-setting>
</template>

<v-divider />

<app-setting :title="$t('app.setting.label.auto_follow_on_file_load')">
Expand Down Expand Up @@ -270,6 +283,22 @@ export default class GcodePreviewSettings extends Vue {
value,
server: true
})
if (!value) {
this.autoLoadMobileOnPrintStart = false
}
}
get autoLoadMobileOnPrintStart () {
return this.$store.state.config.uiSettings.gcodePreview.autoLoadMobileOnPrintStart
}
set autoLoadMobileOnPrintStart (value: boolean) {
this.$store.dispatch('config/saveByPath', {
path: 'uiSettings.gcodePreview.autoLoadMobileOnPrintStart',
value,
server: true
})
}
get autoFollowOnFileLoad () {
Expand Down
4 changes: 4 additions & 0 deletions src/components/widgets/gcode-preview/GcodePreviewCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ export default class GcodePreviewCard extends Mixins(StateMixin, FilesMixin) {
}
get autoLoadOnPrintStart () {
if (this.isMobile) {
return this.$store.state.config.uiSettings.gcodePreview.autoLoadMobileOnPrintStart
}
return this.$store.state.config.uiSettings.gcodePreview.autoLoadOnPrintStart
}
Expand Down
1 change: 1 addition & 0 deletions src/locales/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ app:
auto_edit_extensions: Erweiterungen, die automatisch im Bearbeitungsmodus geöffnet werden
auto_follow_on_file_load: Fortschritt beim Laden einer Datei automatisch folgen
auto_load_on_print_start: Datei bei Druckstart automatisch laden
auto_load_mobile_on_print_start: Datei bei Druckstart auch auf mobilen Geräten laden
camera_flip_x: Horizontal spiegeln
camera_flip_y: Vertikal spiegeln
camera_rotate_by: Rotieren um
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ app:
auto_edit_extensions: Extensions to automatically open in edit mode
auto_follow_on_file_load: Automatically follow progress on file load
auto_load_on_print_start: Automatically load file on print start
auto_load_mobile_on_print_start: Automatically load file on mobile devices
axes: Axes
camera_flip_x: Flip horizontally
camera_flip_y: Flip vertically
Expand Down
1 change: 1 addition & 0 deletions src/store/config/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export const defaultState = (): ConfigState => {
showAnimations: true,
groupLowerLayers: false,
autoLoadOnPrintStart: false,
autoLoadMobileOnPrintStart: false,
autoFollowOnFileLoad: true,
autoZoom: false,
flip: {
Expand Down
1 change: 1 addition & 0 deletions src/store/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export interface GcodePreviewConfig {
showAnimations: boolean;
groupLowerLayers: boolean;
autoLoadOnPrintStart: boolean;
autoLoadMobileOnPrintStart: boolean;
autoFollowOnFileLoad: boolean;
autoZoom: boolean;
flip: {
Expand Down

0 comments on commit afcff8f

Please sign in to comment.