Skip to content

Commit

Permalink
Fixed problem with settings accidently getting overwritten
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyalBingBong committed Jun 11, 2017
1 parent 4a323e4 commit f21c320
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"muted": true,
"skipInterval": 5
},
"window":{
"UI":{
"statusbar": {
"enabled": true,
"autohide": true
Expand Down
16 changes: 8 additions & 8 deletions src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,36 +590,36 @@ export function closeApp() {
}

export function isAutohidePlaybackUI() {
return !!settings.getSync('window.playback.autohide')
return !!settings.getSync('UI.playback.autohide')
}

export function toggleAutohidePlaybackUI(state) {
settings.setSync('window.playback.autohide', state)
settings.setSync('UI.playback.autohide', state)
}

export function isAutohideStatusbar() {
return !!settings.getSync('window.statusbar.autohide')
return !!settings.getSync('UI.statusbar.autohide')
}

export function toggleAutohideStatusbar(state) {
settings.setSync('window.statusbar.autohide', state)
settings.setSync('UI.statusbar.autohide', state)
}

export function isStatusbarEnabled() {
return !!settings.getSync('window.statusbar.enabled')
return !!settings.getSync('UI.statusbar.enabled')
}

export function toggleStatusbarVisibility(state) {
settings.setSync('window.statusbar.enabled', state)
settings.setSync('UI.statusbar.enabled', state)
viewer.updateStatusbarStyle()
}

export function isPlaybackUIEnabled() {
return !!settings.getSync('window.playback.enabled')
return !!settings.getSync('UI.playback.enabled')
}

export function togglePlaybackUIVisibility(state) {
settings.setSync('window.playback.enabled', state)
settings.setSync('UI.playback.enabled', state)
viewer.updateElementStyle()
viewer.updateStatusbarStyle()
}
2 changes: 2 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {app, ipcMain, BrowserWindow} from 'electron'
import {join} from 'path'
import settings from 'electron-settings'
import {isEnvDeveloper} from './helper.js'
import {defaultSettings} from '../config.json'

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
Expand All @@ -20,6 +21,7 @@ app.on('ready', () => {
settings.configure({
prettify: true
})
settings.defaults(defaultSettings)
// Create the browser window.
mainWindow = new BrowserWindow({
width: settings.getSync('window.width') || 800,
Expand Down

0 comments on commit f21c320

Please sign in to comment.