config option for update check interval

pull/4/head
Zlatin Balevsky 2019-06-03 23:30:39 +01:00
parent 294605f5c7
commit c91440cbfc
3 changed files with 14 additions and 3 deletions

View File

@ -21,6 +21,10 @@ class OptionsController {
def settings = application.context.get("muwire-settings")
settings.downloadRetryInterval = Integer.valueOf(text)
text = view.updateField.text
model.updateCheckInterval = text
settings.updateCheckInterval = Integer.valueOf(text)
File settingsFile = new File(application.context.get("core").home, "MuWire.properties")
settingsFile.withOutputStream {
settings.write(it)

View File

@ -7,8 +7,10 @@ import griffon.metadata.ArtifactProviderFor
@ArtifactProviderFor(GriffonModel)
class OptionsModel {
@Observable String downloadRetryInterval
@Observable String updateCheckInterval
void mvcGroupInit(Map<String, String> args) {
downloadRetryInterval = application.context.get("muwire-settings").downloadRetryInterval
updateCheckInterval = application.context.get("muwire-settings").updateCheckInterval
}
}

View File

@ -22,6 +22,7 @@ class OptionsView {
def d
def p
def retryField
def updateField
def mainFrame
void initUI() {
@ -34,8 +35,12 @@ class OptionsView {
retryField = textField(text : bind { model.downloadRetryInterval }, columns : 2, constraints : gbc(gridx: 1, gridy: 0))
label(text : "minutes", constraints : gbc(gridx : 2, gridy: 0))
button(text : "Save", constraints : gbc(gridx : 1, gridy: 1), saveAction)
button(text : "Cancel", constraints : gbc(gridx : 2, gridy: 1), cancelAction)
label(text : "Check for updates every", constraints : gbc(gridx : 0, gridy: 1))
updateField = textField(text : bind {model.updateCheckInterval }, columns : 2, constraints : gbc(gridx : 1, gridy: 1))
label(text : "hours", constraints : gbc(gridx: 2, gridy : 1))
button(text : "Save", constraints : gbc(gridx : 1, gridy: 2), saveAction)
button(text : "Cancel", constraints : gbc(gridx : 2, gridy: 2), cancelAction)
}
}