Commit 0a90a77f authored by André Hoarau's avatar André Hoarau
Browse files

Add bed and path widths in settings page

parent 23442225
......@@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
## Unreleased
## 0.3 - 2019-06-15
### Added
- *Task calendar* − Add sorting function for tasks (#122).
- *Seed company* − Add a radio button to choose default seed company (#111).
......
......@@ -5,6 +5,8 @@ Tous les changements importants seront documentés dans ce fichier.
## Non publiés
## 0.3 - 2019-06-15
### Ajouts
- *Calendrier* − Ajout de fonctions de tri pour les tâches (#122).
- *Fournisseur de semences* − Ajout d'un bouton radio pour choisir le fournisseur
......@@ -34,11 +36,11 @@ Tous les changements importants seront documentés dans ce fichier.
- Afficher les messages d'erreurs pour les champs obligatoires.
- Amélioration des champs de durée : passage des heures au minutes avec la
touche tabulation (#99).
- *Plan de culture* − N'afficher la couleur des séries que lorsque elles ont
- *Plan de culture* − N'afficher la couleur des séries que lorsqu'elles ont
été plantées ou semées.
### Corrections
- Correction du bogue des mois 10-11-12 pour les sélectionneur de dates
- Correction du bogue des mois 10-11-12 pour les sélectionneurs de dates
complètes (#114).
- *Plan de culture* − Dupliquer les étiquettes lorsque les séries sont
dupliquées.
......
......@@ -147,20 +147,14 @@ void SortFilterProxyModel::setFilterKeyStringColumn(const QString &columnName)
void SortFilterProxyModel::setSortColumn(const QString &columnName)
{
m_sortColumn = columnName;
QTime t;
t.start();
sort(roleIndex(m_sortColumn), m_sortOrder == "ascending" ? Qt::AscendingOrder : Qt::DescendingOrder);
qDebug("Time elapsed: %d ms", t.elapsed());
sortColumnChanged();
}
void SortFilterProxyModel::setSortOrder(const QString &order)
{
m_sortOrder = order;
QTime t;
t.start();
sort(roleIndex(m_sortColumn), m_sortOrder == "ascending" ? Qt::AscendingOrder : Qt::DescendingOrder);
qDebug("Time elapsed: %d ms", t.elapsed());
sortOrderChanged();
}
......
......@@ -11,6 +11,9 @@ Item {
id: control
property alias text: textField.text
property alias inputMethodHints: textField.inputMethodHints
property alias validator: textField.validator
property alias horizontalAlignment: textField.horizontalAlignment
signal editingFinished()
......
......@@ -87,7 +87,8 @@ Flickable {
}
readonly property int inRowSpacing: Number(inRowSpacingField.text)
readonly property int rowsPerBed: Number(rowsPerBedField.text)
readonly property real plantsBySquareMeter: rowsPerBed ? (1 / ((1.65 / rowsPerBed) * inRowSpacing / 100)) : 0
readonly property real standardTotalWidth: (settings.standardBedWidth + settings.standardPathWidth) / 100.0
readonly property real plantsBySquareMeter: rowsPerBed ? (1 / ((standardTotalWidth / rowsPerBed) * inRowSpacing / 100)) : 0
readonly property int seedsExtraPercentage: Number(seedsExtraPercentageField.text)
readonly property int seedsPerHole: Number(seedsPerHoleField.text)
readonly property real seedsPerGram: seedsPerGramField.text ? Number.fromLocaleString(Qt.locale(), seedsPerGramField.text) : 0
......@@ -561,6 +562,8 @@ Flickable {
id: settings
property bool useStandardBedLength
property int standardBedLength
property int standardBedWidth
property int standardPathWidth
property string dateType
}
......
......@@ -45,7 +45,9 @@ Page {
// property alias farmName: farmNameField.text
property alias showSeedCompanyBesideVariety: showSeedCompanySwitch.checked
property alias useStandardBedLength: standardBedLengthSwitch.checked
property alias standardBedLength: standardBedLengthField.text
property alias standardBedLength: standardBedLengthField.value
property alias standardBedWidth: standardBedWidthField.value
property alias standardPathWidth: standardPathWidthField.value
property alias showPlantingSuccessionNumber: showPlantingSuccessionNumberSwitch.checked
property string dateType
}
......@@ -124,26 +126,6 @@ Page {
width: parent.width
spacing: 0
// RowLayout {
// Layout.minimumHeight: Units.rowHeight
// Layout.leftMargin: Units.mediumSpacing
// Layout.rightMargin: Layout.leftMargin
// Label {
// text: qsTr("Farm name")
// font.family: "Roboto Regular"
// font.pixelSize: Units.fontSizeBodyAndButton
// Layout.fillWidth: true
// }
// MyTextField {
// id: farmNameField
// font.family: "Roboto Regular"
// font.pixelSize: Units.fontSizeBodyAndButton
// Layout.minimumWidth: 200
// }
// }
ThinDivider { width: parent.width }
RowLayout {
......@@ -156,6 +138,7 @@ Page {
text: qsTr("Date type")
font.family: "Roboto Regular"
font.pixelSize: Units.fontSizeBodyAndButton
elide: Text.ElideRight
}
ComboBox {
......@@ -184,6 +167,36 @@ Page {
ThinDivider { width: parent.width }
SettingsSwitch {
id: showPlantingSuccessionNumberSwitch
text: qsTr("Show planting succession numbers")
onToggled: restartSnackbar.open();
}
Item { Layout.fillHeight: true }
}
}
Label {
text: qsTr("Beds")
font.family: "Roboto Regular"
font.pixelSize: Units.fontSizeBodyAndButton
topPadding: Units.mediumSpacing
}
Pane {
width: parent.width
Material.elevation: 2
Material.background: "white"
padding: 0
ColumnLayout {
width: parent.width
spacing: 0
ThinDivider { width: parent.width }
SettingsSwitch {
id: standardBedLengthSwitch
text: qsTr("Standard bed length")
......@@ -204,29 +217,88 @@ Page {
text: qsTr("Bed length")
font.family: "Roboto Regular"
font.pixelSize: Units.fontSizeBodyAndButton
elide: Text.ElideRight
}
TextInput {
SpinBox {
id: standardBedLengthField
inputMethodHints: Qt.ImhDigitsOnly
validator: IntValidator { bottom: 0; top: 999 }
Layout.minimumWidth: 200
horizontalAlignment: Text.AlignRight
from: 0
to: 999
textFromValue: function(value, locale) {
return "%1 %2".arg(value).arg(qsTr("m"))
}
valueFromText: function(text, locale) {
var s = text.split(" ");
return Number(s[0]);
}
Layout.preferredWidth: 180
}
}
ThinDivider { width: parent.width }
SettingsSwitch {
id: showPlantingSuccessionNumberSwitch
text: qsTr("Show planting succession numbers")
onToggled: restartSnackbar.open();
RowLayout {
width: parent.width
enabled: standardBedLengthSwitch.checked
Layout.leftMargin: Units.mediumSpacing
Layout.rightMargin: Layout.leftMargin
Layout.minimumHeight: Units.rowHeight
Label {
Layout.fillWidth: true
text: qsTr("Bed width")
font.family: "Roboto Regular"
font.pixelSize: Units.fontSizeBodyAndButton
elide: Text.ElideRight
}
SpinBox {
id: standardBedWidthField
from: 0
to: 999
textFromValue: function(value, locale) {
return "%1 %2".arg(value).arg(qsTr("cm"))
}
valueFromText: function(text, locale) {
var s = text.split(" ");
return Number(s[0]);
}
Layout.preferredWidth: 180
}
}
Item { Layout.fillHeight: true }
}
ThinDivider { width: parent.width }
RowLayout {
width: parent.width
enabled: standardBedLengthSwitch.checked
Layout.leftMargin: Units.mediumSpacing
Layout.rightMargin: Layout.leftMargin
Layout.minimumHeight: Units.rowHeight
Label {
Layout.fillWidth: true
text: qsTr("Path width")
font.family: "Roboto Regular"
font.pixelSize: Units.fontSizeBodyAndButton
elide: Text.ElideRight
}
SpinBox {
id: standardPathWidthField
from: 0
to: 999
textFromValue: function(value, locale) {
return "%1 %2".arg(value).arg(qsTr("cm"))
}
valueFromText: function(text, locale) {
var s = text.split(" ");
return Number(s[0]);
}
Layout.preferredWidth: 180
}
}
}
}
Label {
......@@ -361,6 +433,7 @@ Page {
text: qsTr("Families, crops and varieties")
font.family: "Roboto Regular"
font.pixelSize: Units.fontSizeBodyAndButton
elide: Text.ElideRight
MouseArea {
anchors.fill: parent
onClicked: showFamilyPane = true
......@@ -388,6 +461,7 @@ Page {
text: qsTr("Keywords")
font.family: "Roboto Regular"
font.pixelSize: Units.fontSizeBodyAndButton
elide: Text.ElideRight
MouseArea {
anchors.fill: parent
onClicked: showKeywordPane = true
......@@ -415,6 +489,7 @@ Page {
text: qsTr("Seed companies")
font.family: "Roboto Regular"
font.pixelSize: Units.fontSizeBodyAndButton
elide: Text.ElideRight
MouseArea {
anchors.fill: parent
onClicked: showSeedCompanyPane = true
......@@ -442,6 +517,7 @@ Page {
text: qsTr("Task types")
font.family: "Roboto Regular"
font.pixelSize: Units.fontSizeBodyAndButton
elide: Text.ElideRight
MouseArea {
anchors.fill: parent
onClicked: showTaskTypePane = true
......@@ -469,6 +545,7 @@ Page {
text: qsTr("Units")
font.family: "Roboto Regular"
font.pixelSize: Units.fontSizeBodyAndButton
elide: Text.ElideRight
MouseArea {
anchors.fill: parent
onClicked: showUnitPane = true
......
......@@ -22,7 +22,7 @@ RowLayout {
Layout.fillWidth: true
font.family: "Roboto Regular"
font.pixelSize: Units.fontSizeBodyAndButton
elide: Text.ElideRight
}
Switch {
......
......@@ -188,6 +188,7 @@ ApplicationWindow {
SettingsPage {
id: settingsPage
paneWidth: Math.min(600, stackView.width * 0.8)
}
Settings {
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment