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', theme: 'white',
fontSize: 14, fontSize: 14,
displayNameStyle: 0 displayNameStyle: 0,
tootVisibility: 0
}, },
state: { state: {
collapse: false collapse: false

View File

@ -34,6 +34,26 @@
</tbody> </tbody>
</table> </table>
</div> </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"> <div class="sounds">
<h3>Sounds</h3> <h3>Sounds</h3>
<table> <table>
@ -82,6 +102,20 @@ export default {
name: 'username', name: 'username',
value: 2 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) 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: { sound_fav_rb: {
get () { get () {
return this.$store.state.Preferences.General.general.sound.fav_rb return this.$store.state.Preferences.General.general.sound.fav_rb
@ -146,52 +188,40 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
#general { #general {
table {
width: 100%;
}
td {
padding: 16px 0;
}
.title {
text-align: right;
width: 50%;
}
.status {
width: 50%;
text-align: center;
}
.appearance { .appearance {
color: var(--theme-secondary-color); color: var(--theme-secondary-color);
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
}
table { .toot {
width: 100%; color: var(--theme-secondary-color);
} width: 100%;
box-sizing: border-box;
td {
padding: 16px 0;
}
.title {
text-align: right;
width: 50%;
}
.status {
width: 50%;
text-align: center;
}
} }
.sounds { .sounds {
color: var(--theme-secondary-color); color: var(--theme-secondary-color);
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
table {
width: 100%;
}
td {
padding: 16px 0;
}
.title {
text-align: right;
width: 50%;
}
.status {
width: 50%;
text-align: center;
}
} }
} }
</style> </style>

View File

@ -10,7 +10,8 @@ const General = {
}, },
theme: 'white', theme: 'white',
fontSize: 14, fontSize: 14,
displayNameStyle: 0 displayNameStyle: 0,
tootVisibility: 0
}, },
loading: false loading: false
}, },
@ -94,6 +95,23 @@ const General = {
commit('updateGeneral', conf.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) { updateSound ({ commit, state }, sound) {
commit('changeLoading', true) commit('changeLoading', true)
const newSound = Object.assign({}, state.general.sound, sound) const newSound = Object.assign({}, state.general.sound, sound)