Improve usability (#5142)

Fix #3862
This commit is contained in:
Satsuki Yanagi 2019-07-12 22:24:29 +09:00 committed by syuilo
parent 70691e1523
commit b3c6e28717
3 changed files with 46 additions and 14 deletions

View file

@ -290,6 +290,8 @@ common:
load-raw-images: "添付された画像を高画質で表示する" load-raw-images: "添付された画像を高画質で表示する"
load-remote-media: "リモートサーバーのメディアを表示する" load-remote-media: "リモートサーバーのメディアを表示する"
sync: "同期" sync: "同期"
save: "保存"
saved: "保存しました"
home-profile: "ホームのプロファイル" home-profile: "ホームのプロファイル"
deck-profile: "デッキのプロファイル" deck-profile: "デッキのプロファイル"

View file

@ -29,8 +29,25 @@ export default Vue.extend({
computed: { computed: {
appTypeForce: { appTypeForce: {
get() { return this.$store.state.device.appTypeForce; }, get() { return this.$store.state.device.appTypeForce; },
set(value) { this.$store.commit('device/set', { key: 'appTypeForce', value }); } set(value) {
this.$store.commit('device/set', { key: 'appTypeForce', value });
this.reload();
}
}, },
}, },
methods: {
reload() {
this.$root.dialog({
type: 'warning',
text: this.$t('@.reload-to-apply-the-setting'),
showCancelButton: true
}).then(({ canceled }) => {
if (!canceled) {
location.reload();
}
});
},
}
}); });
</script> </script>

View file

@ -143,13 +143,17 @@
<ui-input v-model="webSearchEngine">{{ $t('@._settings.web-search-engine') }} <ui-input v-model="webSearchEngine">{{ $t('@._settings.web-search-engine') }}
<template #desc>{{ $t('@._settings.web-search-engine-desc') }}</template> <template #desc>{{ $t('@._settings.web-search-engine-desc') }}</template>
</ui-input> </ui-input>
<ui-button @click="save('webSearchEngine', webSearchEngine)"><fa :icon="faSave"/> {{ $t('@._settings.save') }}</ui-button>
</section> </section>
<section v-if="!$root.isMobile"> <section v-if="!$root.isMobile">
<header>{{ $t('@._settings.paste') }}</header> <header>{{ $t('@._settings.paste') }}</header>
<ui-input v-model="pastedFileName">{{ $t('@._settings.pasted-file-name') }} <ui-input v-model="pastedFileName">{{ $t('@._settings.pasted-file-name') }}
<template #desc>{{ $t('@._settings.pasted-file-name-desc') }}</template> <template v-if="pastedFileName === this.$store.state.settings.pastedFileName" #desc>{{ $t('@._settings.pasted-file-name-desc') }}</template>
<template v-else #desc>{{ pastedFileNamePreview() }}</template>
</ui-input> </ui-input>
<ui-button @click="save('pastedFileName', pastedFileName)"><fa :icon="faSave"/> {{ $t('@._settings.save') }}</ui-button>
<ui-switch v-model="pasteDialog">{{ $t('@._settings.paste-dialog') }} <ui-switch v-model="pasteDialog">{{ $t('@._settings.paste-dialog') }}
<template #desc>{{ $t('@._settings.paste-dialog-desc') }}</template> <template #desc>{{ $t('@._settings.paste-dialog-desc') }}</template>
</ui-switch> </ui-switch>
@ -289,6 +293,8 @@ import XNotification from './notification.vue';
import { url, version } from '../../../../config'; import { url, version } from '../../../../config';
import checkForUpdate from '../../../scripts/check-for-update'; import checkForUpdate from '../../../scripts/check-for-update';
import { formatTimeString } from '../../../../../../misc/format-time-string';
import { faSave } from '@fortawesome/free-regular-svg-icons';
export default Vue.extend({ export default Vue.extend({
i18n: i18n(), i18n: i18n(),
@ -319,8 +325,11 @@ export default Vue.extend({
return { return {
meta: null, meta: null,
version, version,
webSearchEngine: this.$store.state.settings.webSearchEngine,
pastedFileName : this.$store.state.settings.pastedFileName,
latestVersion: undefined, latestVersion: undefined,
checkingForUpdate: false checkingForUpdate: false,
faSave
}; };
}, },
computed: { computed: {
@ -419,16 +428,6 @@ export default Vue.extend({
set(value) { this.$store.dispatch('settings/set', { key: 'defaultNoteVisibility', value }); } set(value) { this.$store.dispatch('settings/set', { key: 'defaultNoteVisibility', value }); }
}, },
webSearchEngine: {
get() { return this.$store.state.settings.webSearchEngine; },
set(value) { this.$store.dispatch('settings/set', { key: 'webSearchEngine', value }); }
},
pastedFileName: {
get() { return this.$store.state.settings.pastedFileName; },
set(value) { this.$store.dispatch('settings/set', { key: 'pastedFileName', value }); }
},
pasteDialog: { pasteDialog: {
get() { return this.$store.state.settings.pasteDialog; }, get() { return this.$store.state.settings.pasteDialog; },
set(value) { this.$store.dispatch('settings/set', { key: 'pasteDialog', value }); } set(value) { this.$store.dispatch('settings/set', { key: 'pasteDialog', value }); }
@ -565,6 +564,17 @@ export default Vue.extend({
} }
}); });
}, },
save(key, value) {
this.$store.dispatch('settings/set', {
key,
value
}).then(() => {
this.$root.dialog({
type: 'success',
text: this.$t('@._settings.saved')
})
});
},
customizeHome() { customizeHome() {
location.href = '/?customize'; location.href = '/?customize';
}, },
@ -600,7 +610,10 @@ export default Vue.extend({
const sound = new Audio(`${url}/assets/message.mp3`); const sound = new Audio(`${url}/assets/message.mp3`);
sound.volume = this.$store.state.device.soundVolume; sound.volume = this.$store.state.device.soundVolume;
sound.play(); sound.play();
} },
pastedFileNamePreview() {
return `${formatTimeString(new Date(), this.pastedFileName).replace(/{{number}}/g, `1`)}.png`
},
} }
}); });
</script> </script>