add ability to choose the incompletes location
This commit is contained in:
@@ -93,6 +93,9 @@ class OptionsController {
|
||||
|
||||
String downloadLocation = model.downloadLocation
|
||||
settings.downloadLocation = new File(downloadLocation)
|
||||
|
||||
String incompleteLocation = model.incompleteLocation
|
||||
settings.incompleteLocation = new File(incompleteLocation)
|
||||
|
||||
if (settings.embeddedRouter) {
|
||||
text = view.inBwField.text
|
||||
@@ -174,7 +177,18 @@ class OptionsController {
|
||||
int rv = chooser.showOpenDialog(null)
|
||||
if (rv == JFileChooser.APPROVE_OPTION)
|
||||
model.downloadLocation = chooser.getSelectedFile().getAbsolutePath()
|
||||
}
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void incompleteLocation() {
|
||||
def chooser = new JFileChooser()
|
||||
chooser.setFileHidingEnabled(false)
|
||||
chooser.setDialogTitle("Select location for downloaded files")
|
||||
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY)
|
||||
int rv = chooser.showOpenDialog(null)
|
||||
if (rv == JFileChooser.APPROVE_OPTION)
|
||||
model.incompleteLocation = chooser.getSelectedFile().getAbsolutePath()
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void automaticFontAction() {
|
||||
|
@@ -45,9 +45,12 @@ class Ready extends AbstractLifecycleHandler {
|
||||
props.load(it)
|
||||
}
|
||||
props = new MuWireSettings(props)
|
||||
if (props.incompleteLocation == null)
|
||||
props.incompleteLocation = new File(home, "incompletes")
|
||||
} else {
|
||||
log.info("creating new properties")
|
||||
props = new MuWireSettings()
|
||||
props.incompleteLocation = new File(home, "incompletes")
|
||||
props.embeddedRouter = Boolean.parseBoolean(System.getProperties().getProperty("embeddedRouter"))
|
||||
props.updateType = System.getProperty("updateType","jar")
|
||||
def nickname
|
||||
|
@@ -15,6 +15,7 @@ class OptionsModel {
|
||||
@Observable boolean shareDownloadedFiles
|
||||
@Observable boolean shareHiddenFiles
|
||||
@Observable String downloadLocation
|
||||
@Observable String incompleteLocation
|
||||
@Observable boolean searchComments
|
||||
@Observable boolean browseFiles
|
||||
|
||||
@@ -56,6 +57,7 @@ class OptionsModel {
|
||||
shareDownloadedFiles = settings.shareDownloadedFiles
|
||||
shareHiddenFiles = settings.shareHiddenFiles
|
||||
downloadLocation = settings.downloadLocation.getAbsolutePath()
|
||||
incompleteLocation = settings.incompleteLocation.getAbsolutePath()
|
||||
searchComments = settings.searchComments
|
||||
browseFiles = settings.browseFiles
|
||||
|
||||
|
@@ -100,6 +100,10 @@ class OptionsView {
|
||||
label(text : "Save downloaded files to:", constraints: gbc(gridx:0, gridy:7))
|
||||
button(text : "Choose", constraints : gbc(gridx : 1, gridy:7), downloadLocationAction)
|
||||
label(text : bind {model.downloadLocation}, constraints: gbc(gridx:0, gridy:8, gridwidth:2))
|
||||
|
||||
label(text : "Store incomplete files in:", constraints: gbc(gridx:0, gridy:9))
|
||||
button(text : "Choose", constraints : gbc(gridx : 1, gridy:9), incompleteLocationAction)
|
||||
label(text : bind {model.incompleteLocation}, constraints: gbc(gridx:0, gridy:10, gridwidth:2))
|
||||
|
||||
}
|
||||
i = builder.panel {
|
||||
|
Reference in New Issue
Block a user