refs #461 Add toot visibility setting in preferences

This commit is contained in:
AkiraFukushima 2018-08-01 23:09:36 +09:00
parent a5eeac7230
commit 2dd68338ed
3 changed files with 86 additions and 37 deletions

View File

@ -9,7 +9,8 @@ const Base = {
},
theme: 'white',
fontSize: 14,
displayNameStyle: 0
displayNameStyle: 0,
tootVisibility: 0
},
state: {
collapse: false

View File

@ -34,6 +34,26 @@
</tbody>
</table>
</div>
<div class="toot">
<h3>Toot</h3>
<table>
<tbody>
<tr>
<td class="title">Default Visibility:</td>
<td class="status">
<el-select v-model="tootVisibility" placeholder="visibility">
<el-option
v-for="v in visibilities"
:key="v.value"
:label="v.name"
:value="v.value">
</el-option>
</el-select>
</td>
</tr>
</tbody>
</table>
</div>
<div class="sounds">
<h3>Sounds</h3>
<table>
@ -82,6 +102,20 @@ export default {
name: 'username',
value: 2
}
],
visibilities: [
{
name: 'public',
value: 0
},
{
name: 'unlisted',
value: 1
},
{
name: 'private',
value: 2
}
]
}
},
@ -106,6 +140,14 @@ export default {
this.$store.dispatch('Preferences/General/updateDisplayNameStyle', value)
}
},
tootVisibility: {
get () {
return this.$store.state.Preferences.General.general.tootVisibility
},
set (value) {
this.$store.dispatch('Preferences/General/updateTootVisibility', value)
}
},
sound_fav_rb: {
get () {
return this.$store.state.Preferences.General.general.sound.fav_rb
@ -146,52 +188,40 @@ export default {
<style lang="scss" scoped>
#general {
table {
width: 100%;
}
td {
padding: 16px 0;
}
.title {
text-align: right;
width: 50%;
}
.status {
width: 50%;
text-align: center;
}
.appearance {
color: var(--theme-secondary-color);
width: 100%;
box-sizing: border-box;
}
table {
width: 100%;
}
td {
padding: 16px 0;
}
.title {
text-align: right;
width: 50%;
}
.status {
width: 50%;
text-align: center;
}
.toot {
color: var(--theme-secondary-color);
width: 100%;
box-sizing: border-box;
}
.sounds {
color: var(--theme-secondary-color);
width: 100%;
box-sizing: border-box;
table {
width: 100%;
}
td {
padding: 16px 0;
}
.title {
text-align: right;
width: 50%;
}
.status {
width: 50%;
text-align: center;
}
}
}
</style>

View File

@ -10,7 +10,8 @@ const General = {
},
theme: 'white',
fontSize: 14,
displayNameStyle: 0
displayNameStyle: 0,
tootVisibility: 0
},
loading: false
},
@ -94,6 +95,23 @@ const General = {
commit('updateGeneral', conf.general)
})
},
updateTootVisibility ({ dispatch, commit, state }, value) {
const newGeneral = Object.assign({}, state.general, {
tootVisibility: value
})
const config = {
general: newGeneral
}
ipcRenderer.send('save-preferences', config)
ipcRenderer.once('error-save-preferences', (event, err) => {
ipcRenderer.removeAllListeners('response-save-preferences')
})
ipcRenderer.once('response-save-preferences', (event, conf) => {
ipcRenderer.removeAllListeners('error-save-preferences')
dispatch('App/loadPreferences', null, { root: true })
commit('updateGeneral', conf.general)
})
},
updateSound ({ commit, state }, sound) {
commit('changeLoading', true)
const newSound = Object.assign({}, state.general.sound, sound)