Skip to content
Snippets Groups Projects
Commit a5311f5c authored by Marco Matthies's avatar Marco Matthies
Browse files

Change for formatting for config.qml for better readability

parent 9d2a55b0
No related branches found
No related tags found
No related merge requests found
...@@ -11,245 +11,244 @@ import QtQuick.Dialogs ...@@ -11,245 +11,244 @@ import QtQuick.Dialogs
import org.julialang import org.julialang
ApplicationWindow { ApplicationWindow {
id: configWindow id: configWindow
title: "Configure simulation" title: "Configure simulation"
width: 700 width: 700
height: 350 height: 350
visible: true visible: true
ColumnLayout { ColumnLayout {
id: generalSettings id: generalSettings
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 20 anchors.leftMargin: 20
anchors.topMargin: 20 anchors.topMargin: 20
spacing: 8 spacing: 8
Text { Text {
text: "General Settings:" text: "General Settings:"
horizontalAlignment: Text.AlignCenter horizontalAlignment: Text.AlignCenter
font.bold: true font.bold: true
} }
RowLayout { RowLayout {
Label { text: "Configuration file:" } Label { text: "Configuration file:" }
Label { Label {
text: conf.userconfigfile text: conf.userconfigfile
font.italic: true font.italic: true
} }
Button { Button {
text: "Select..." text: "Select..."
onClicked: conffileChooser.open() onClicked: conffileChooser.open()
} }
FileDialog { FileDialog {
id: conffileChooser id: conffileChooser
defaultSuffix: "toml" defaultSuffix: "toml"
fileMode: FileDialog.SaveFile fileMode: FileDialog.SaveFile
nameFilters: ["Configuration files (*.toml)"] nameFilters: ["Configuration files (*.toml)"]
onAccepted: conf.userconfigfile = selectedFile onAccepted: conf.userconfigfile = selectedFile
} }
} }
RowLayout { RowLayout {
Label { text: "Output folder:" } Label { text: "Output folder:" }
Label { Label {
text: conf.outdir text: conf.outdir
font.italic: true font.italic: true
} }
Button { Button {
text: "Select..." text: "Select..."
onClicked: outdirChooser.open() onClicked: outdirChooser.open()
} }
FolderDialog { FolderDialog {
id: outdirChooser id: outdirChooser
selectedFolder: conf.outdir selectedFolder: conf.outdir
onAccepted: conf.outdir = selectedFolder onAccepted: conf.outdir = selectedFolder
} }
} }
//XXX Not all regions have data available! //XXX Not all regions have data available!
// (currently, only Jena is fully configured) // (currently, only Jena is fully configured)
RowLayout { RowLayout {
Label { text: "Region:" } Label { text: "Region:" }
ComboBox { ComboBox {
currentIndex: 3 currentIndex: 3
model: ["Bodensee", "Eichsfeld", "Hohenlohe", "Jena", model: ["Bodensee", "Eichsfeld", "Hohenlohe", "Jena",
"Oberrhein", "Thüringer Becken"] "Oberrhein", "Thüringer Becken"]
onCurrentIndexChanged: conf.region = currentText onCurrentIndexChanged: conf.region = currentText
} }
} }
RowLayout {
Label { text: "Crop model:" }
ComboBox {
currentIndex: 0
model: ["ALMaSS", "AquaCrop"]
onCurrentIndexChanged: conf.cropmodel = currentText
}
}
RowLayout { //TODO how can I enable multi-species selection?
Label { text: "Species:" }
ComboBox {
currentIndex: 0
model: ["Skylark", "Wolpertinger"]
onCurrentIndexChanged: conf.species = currentText
}
}
//XXX For which years do I actually have data? RowLayout {
RowLayout { Label { text: "Crop model:" }
Label { text: "Start date:" } ComboBox {
SpinBox { currentIndex: 0
Layout.maximumWidth: 100 model: ["ALMaSS", "AquaCrop"]
from: 1 onCurrentIndexChanged: conf.cropmodel = currentText
to: 31 }
value: conf.startdateday }
editable: true
wrap: true
onValueModified: conf.startdateday = value
}
SpinBox {
Layout.maximumWidth: 100
from: 1
to: 12
value: conf.startdatemonth
editable: true
wrap: true
onValueModified: conf.startdatemonth = value
}
SpinBox {
Layout.maximumWidth: 100
from: 2000
to: 2050
value: conf.startdateyear
editable: true
wrap: true
textFromValue: function(value) { return Number(value).toString(); }
onValueModified: conf.startdateyear = value
}
}
RowLayout { RowLayout { //TODO how can I enable multi-species selection?
Label { text: "End date:" } Label { text: "Species:" }
SpinBox { ComboBox {
Layout.maximumWidth: 100 currentIndex: 0
from: 1 model: ["Skylark", "Wolpertinger"]
to: 31 onCurrentIndexChanged: conf.species = currentText
value: conf.enddateday }
editable: true
wrap: true
onValueModified: conf.enddateday = value
}
SpinBox {
Layout.maximumWidth: 100
from: 1
to: 12
value: conf.enddatemonth
editable: true
wrap: true
onValueModified: conf.enddatemonth = value
}
SpinBox {
Layout.maximumWidth: 100
from: 2000
to: 2050
value: conf.enddateyear
editable: true
wrap: true
textFromValue: function(value) { return Number(value).toString(); }
onValueModified: conf.enddateyear = value
}
}
} }
ColumnLayout { //XXX For which years do I actually have data?
id: advancedSettings RowLayout {
anchors.top: parent.top Label { text: "Start date:" }
anchors.right: parent.right SpinBox {
anchors.left: generalSettings.right Layout.maximumWidth: 100
anchors.rightMargin: 20 from: 1
anchors.topMargin: 20 to: 31
anchors.leftMargin: 20 value: conf.startdateday
spacing: 8 editable: true
wrap: true
Text { onValueModified: conf.startdateday = value
text: "Advanced Settings:" }
horizontalAlignment: Text.AlignCenter SpinBox {
font.bold: true Layout.maximumWidth: 100
} from: 1
to: 12
value: conf.startdatemonth
editable: true
wrap: true
onValueModified: conf.startdatemonth = value
}
SpinBox {
Layout.maximumWidth: 100
from: 2000
to: 2050
value: conf.startdateyear
editable: true
wrap: true
textFromValue: function(value) { return Number(value).toString(); }
onValueModified: conf.startdateyear = value
}
}
RowLayout { RowLayout {
Label { text: "Random seed:" } Label { text: "End date:" }
SpinBox { SpinBox {
from: 0 Layout.maximumWidth: 100
to: 2147483647 from: 1
value: 2 to: 31
editable: true value: conf.enddateday
onValueModified: conf.seed = value editable: true
} wrap: true
} onValueModified: conf.enddateday = value
}
SpinBox {
Layout.maximumWidth: 100
from: 1
to: 12
value: conf.enddatemonth
editable: true
wrap: true
onValueModified: conf.enddatemonth = value
}
SpinBox {
Layout.maximumWidth: 100
from: 2000
to: 2050
value: conf.enddateyear
editable: true
wrap: true
textFromValue: function(value) { return Number(value).toString(); }
onValueModified: conf.enddateyear = value
}
}
}
ColumnLayout {
id: advancedSettings
anchors.top: parent.top
anchors.right: parent.right
anchors.left: generalSettings.right
anchors.rightMargin: 20
anchors.topMargin: 20
anchors.leftMargin: 20
spacing: 8
Text {
text: "Advanced Settings:"
horizontalAlignment: Text.AlignCenter
font.bold: true
}
RowLayout { RowLayout {
Label { text: "Log level:" } Label { text: "Random seed:" }
ComboBox { SpinBox {
currentIndex: 2 from: 0
model: ["debug", "info", "warn"] to: 2147483647
onCurrentIndexChanged: conf.loglevel = currentText value: 2
} editable: true
} onValueModified: conf.seed = value
}
}
RowLayout { RowLayout {
Label { text: "Processors:" } Label { text: "Log level:" }
SpinBox { ComboBox {
from: 1 currentIndex: 2
to: 8 model: ["debug", "info", "warn"]
value: conf.processors onCurrentIndexChanged: conf.loglevel = currentText
editable: true }
onValueModified: conf.processors = value }
}
}
CheckBox { RowLayout {
checked: conf.csvoutput Label { text: "Processors:" }
text: "Write CSV output" SpinBox {
onClicked: conf.csvoutput = checked from: 1
} to: 8
value: conf.processors
editable: true
onValueModified: conf.processors = value
}
}
//TODO add config options for: CheckBox {
// farmmodel checked: conf.csvoutput
// targetspecies text: "Write CSV output"
// insectmodel onClicked: conf.csvoutput = checked
} }
footer: ToolBar { //TODO add config options for:
RowLayout { // farmmodel
anchors.right: parent.right // targetspecies
layoutDirection: Qt.RightToLeft // insectmodel
}
Button {
text: "Start new simulation" footer: ToolBar {
onClicked: { RowLayout {
//TODO show splash anchors.right: parent.right
Julia.writeconfig() layoutDirection: Qt.RightToLeft
Julia.newsimulation()
configWindow.close() Button {
} text: "Start new simulation"
} onClicked: {
//TODO show splash
Button { Julia.writeconfig()
text: "Save configuration" Julia.newsimulation()
onClicked: { configWindow.close()
Julia.writeconfig()
configWindow.close()
}
}
Button {
text: "Cancel"
onClicked: configWindow.close()
}
} }
}
Button {
text: "Save configuration"
onClicked: {
Julia.writeconfig()
configWindow.close()
}
}
Button {
text: "Cancel"
onClicked: configWindow.close()
}
} }
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment