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
import org.julialang
ApplicationWindow {
id: configWindow
title: "Configure simulation"
width: 700
height: 350
visible: true
ColumnLayout {
id: generalSettings
anchors.top: parent.top
anchors.left: parent.left
anchors.leftMargin: 20
anchors.topMargin: 20
spacing: 8
Text {
text: "General Settings:"
horizontalAlignment: Text.AlignCenter
font.bold: true
}
id: configWindow
title: "Configure simulation"
width: 700
height: 350
visible: true
ColumnLayout {
id: generalSettings
anchors.top: parent.top
anchors.left: parent.left
anchors.leftMargin: 20
anchors.topMargin: 20
spacing: 8
Text {
text: "General Settings:"
horizontalAlignment: Text.AlignCenter
font.bold: true
}
RowLayout {
Label { text: "Configuration file:" }
Label {
text: conf.userconfigfile
font.italic: true
}
Button {
text: "Select..."
onClicked: conffileChooser.open()
}
FileDialog {
id: conffileChooser
defaultSuffix: "toml"
fileMode: FileDialog.SaveFile
nameFilters: ["Configuration files (*.toml)"]
onAccepted: conf.userconfigfile = selectedFile
}
}
RowLayout {
Label { text: "Configuration file:" }
Label {
text: conf.userconfigfile
font.italic: true
}
Button {
text: "Select..."
onClicked: conffileChooser.open()
}
FileDialog {
id: conffileChooser
defaultSuffix: "toml"
fileMode: FileDialog.SaveFile
nameFilters: ["Configuration files (*.toml)"]
onAccepted: conf.userconfigfile = selectedFile
}
}
RowLayout {
Label { text: "Output folder:" }
Label {
text: conf.outdir
font.italic: true
}
Button {
text: "Select..."
onClicked: outdirChooser.open()
}
FolderDialog {
id: outdirChooser
selectedFolder: conf.outdir
onAccepted: conf.outdir = selectedFolder
}
}
RowLayout {
Label { text: "Output folder:" }
Label {
text: conf.outdir
font.italic: true
}
Button {
text: "Select..."
onClicked: outdirChooser.open()
}
FolderDialog {
id: outdirChooser
selectedFolder: conf.outdir
onAccepted: conf.outdir = selectedFolder
}
}
//XXX Not all regions have data available!
// (currently, only Jena is fully configured)
RowLayout {
Label { text: "Region:" }
ComboBox {
currentIndex: 3
model: ["Bodensee", "Eichsfeld", "Hohenlohe", "Jena",
"Oberrhein", "Thüringer Becken"]
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 Not all regions have data available!
// (currently, only Jena is fully configured)
RowLayout {
Label { text: "Region:" }
ComboBox {
currentIndex: 3
model: ["Bodensee", "Eichsfeld", "Hohenlohe", "Jena",
"Oberrhein", "Thüringer Becken"]
onCurrentIndexChanged: conf.region = currentText
}
}
//XXX For which years do I actually have data?
RowLayout {
Label { text: "Start date:" }
SpinBox {
Layout.maximumWidth: 100
from: 1
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 {
Label { text: "Crop model:" }
ComboBox {
currentIndex: 0
model: ["ALMaSS", "AquaCrop"]
onCurrentIndexChanged: conf.cropmodel = currentText
}
}
RowLayout {
Label { text: "End date:" }
SpinBox {
Layout.maximumWidth: 100
from: 1
to: 31
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
}
}
RowLayout { //TODO how can I enable multi-species selection?
Label { text: "Species:" }
ComboBox {
currentIndex: 0
model: ["Skylark", "Wolpertinger"]
onCurrentIndexChanged: conf.species = currentText
}
}
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
}
//XXX For which years do I actually have data?
RowLayout {
Label { text: "Start date:" }
SpinBox {
Layout.maximumWidth: 100
from: 1
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 {
Label { text: "Random seed:" }
SpinBox {
from: 0
to: 2147483647
value: 2
editable: true
onValueModified: conf.seed = value
}
}
RowLayout {
Label { text: "End date:" }
SpinBox {
Layout.maximumWidth: 100
from: 1
to: 31
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 {
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 {
Label { text: "Log level:" }
ComboBox {
currentIndex: 2
model: ["debug", "info", "warn"]
onCurrentIndexChanged: conf.loglevel = currentText
}
}
RowLayout {
Label { text: "Random seed:" }
SpinBox {
from: 0
to: 2147483647
value: 2
editable: true
onValueModified: conf.seed = value
}
}
RowLayout {
Label { text: "Processors:" }
SpinBox {
from: 1
to: 8
value: conf.processors
editable: true
onValueModified: conf.processors = value
}
}
RowLayout {
Label { text: "Log level:" }
ComboBox {
currentIndex: 2
model: ["debug", "info", "warn"]
onCurrentIndexChanged: conf.loglevel = currentText
}
}
CheckBox {
checked: conf.csvoutput
text: "Write CSV output"
onClicked: conf.csvoutput = checked
}
RowLayout {
Label { text: "Processors:" }
SpinBox {
from: 1
to: 8
value: conf.processors
editable: true
onValueModified: conf.processors = value
}
}
//TODO add config options for:
// farmmodel
// targetspecies
// insectmodel
CheckBox {
checked: conf.csvoutput
text: "Write CSV output"
onClicked: conf.csvoutput = checked
}
footer: ToolBar {
RowLayout {
anchors.right: parent.right
layoutDirection: Qt.RightToLeft
Button {
text: "Start new simulation"
onClicked: {
//TODO show splash
Julia.writeconfig()
Julia.newsimulation()
configWindow.close()
}
}
Button {
text: "Save configuration"
onClicked: {
Julia.writeconfig()
configWindow.close()
}
}
Button {
text: "Cancel"
onClicked: configWindow.close()
}
//TODO add config options for:
// farmmodel
// targetspecies
// insectmodel
}
footer: ToolBar {
RowLayout {
anchors.right: parent.right
layoutDirection: Qt.RightToLeft
Button {
text: "Start new simulation"
onClicked: {
//TODO show splash
Julia.writeconfig()
Julia.newsimulation()
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