Import initial du projet shipheart_cm5

This commit is contained in:
2026-08-13 09:19:38 +02:00
commit 53e47729fb
533 changed files with 127946 additions and 0 deletions
+229
View File
@@ -0,0 +1,229 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Popup {
id: boite_dialogue_entrees_level_sensor
// Propriétés fixes :
readonly property double pourcentage_largeur_page_popup: 0.8
readonly property double pourcentage_hauteur_page_popup: 0.7
readonly property int padding_popup: 20
readonly property double pourcentage_boite_dialogue_titre: 0.3
readonly property double pourcentage_boite_dialogue_message: 1 - pourcentage_boite_dialogue_titre - pourcentage_boite_dialogue_ligne_boutons
readonly property double pourcentage_boite_dialogue_ligne_boutons: 0.3
readonly property int bouton_largeur: 200
// Propriétés :
// Propriétés alias :
property alias boutonAnnuler: bouton_annuler.visible
property alias boutonAnnulerTexte: bouton_annuler_label.text
// Signaux :
signal clicked(int bouton, int no_entree) // Valeur à lire lorsque le "OnClicked' est activé
x: (shipheart_largeur_page * (1 - pourcentage_largeur_page_popup)) / 2;
y: (shipheart_hauteur_page * (1 - pourcentage_hauteur_page_popup)) / 2;
width: shipheart_largeur_page * pourcentage_largeur_page_popup;
height: shipheart_hauteur_page * pourcentage_hauteur_page_popup;
padding: padding_popup
modal: true
// focus: true // SDIR # 224 : Il ne faut PAS activer le focus. Sinon, à la fermeture, le focus précédent est réactivé (comme le dernier TextField par exemple)
closePolicy: Popup.NoAutoClose //Popup.CloseOnPressOutside
background: Rectangle {
color: shipheart_couleur_fond_boite_dialogue_niveau_0
radius: 20
}
Column {
id: affichage_boite_dialogue
spacing: 20
//=========================================================================
// Titre :
//=========================================================================
Rectangle {
id: titre_boite_dialogue
width: boite_dialogue_entrees_level_sensor.width - (2 * padding_popup)
height: (boite_dialogue_entrees_level_sensor.height - (2 * padding_popup) - (2 * affichage_boite_dialogue.spacing)) * pourcentage_boite_dialogue_titre
color: "transparent"
Label {
text: qsTr("Entrées Level Sensor")
anchors.fill: parent
verticalAlignment: Text.AlignTop
horizontalAlignment: Text.AlignHCenter
topPadding: 20
wrapMode: Text.Wrap
color: couleur_blanc_casse
font.pixelSize:40
font.weight: Font.Bold
}
Label {
text: qsTr("Affectation de l'entrée du réservoir")
anchors.fill: parent
verticalAlignment: Text.AlignBottom
horizontalAlignment: Text.AlignHCenter
bottomPadding: 20
wrapMode: Text.Wrap
color: couleur_blanc_casse
font.pixelSize:18
}
}
//=========================================================================
// Choix de l'entrée :
//=========================================================================
Rectangle {
width: boite_dialogue_entrees_level_sensor.width - (2 * padding_popup)
height: (boite_dialogue_entrees_level_sensor.height - (2 * padding_popup) - (2 * affichage_boite_dialogue.spacing)) * pourcentage_boite_dialogue_message
color: "transparent"
Grid {
id: grille_entrees_level_sensor
width: parent.width
height: parent.height
columns: 1
spacing: 20
Repeater { // Constitue les blocs d'entrées, telq qu'ils sont physiquement (4 entrées + espace)
model: modele_entrees_level_sensor
delegate: Row {
width: (parent.width - ((grille_entrees_level_sensor.columns - 1) * grille_entrees_level_sensor.spacing)) / grille_entrees_level_sensor.columns
height: (parent.height - grille_entrees_level_sensor.spacing) / 2
Repeater { // Constitue les 4 entrées par bloc
model: valeurs
delegate: Rectangle { // Ce rectangle réserve la place pour chaque bouton mais n'est pas visible
width: parent.width / 4
height: parent.height
color: "transparent"
Rectangle { // Ce rectangle est le bouton visible, légèrement plus petit que son père pour réserver un espace entre chaque entrée au sein du même bloc
width: parent.width * 0.98
height: parent.height
radius: shipheart_rayon_bouton
color: ((model.used === 1) && (model.no_entree !== entree_en_cours)) ? couleur_gris_fonce : couleur_gris_tres_fonce
Label {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignTop
topPadding: 20
text: no
color: (model.used === 0) ? couleur_blanc_casse : couleur_gris_moyen
font.pixelSize: 18
font.bold: true
}
Label {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignBottom
bottomPadding: 20
visible: model.no_entree !== 0
text: "X"
color: couleur_green_yellow
font.pixelSize: 18
font.bold: true
}
}
MouseArea {
anchors.fill: parent
enabled: (model.used === 0) || (model.no_entree === entree_en_cours)
onClicked: {
shipheart_clic();
boite_dialogue_entrees_level_sensor.clicked(shipheart_boite_dialogue_bouton_1, no);
}
}
}
}
}
}
}
}
//=========================================================================
// Boutons :
//=========================================================================
Row {
height: (boite_dialogue_entrees_level_sensor.height - (2 * padding_popup) - (2 * affichage_boite_dialogue.spacing)) * pourcentage_boite_dialogue_ligne_boutons
anchors.horizontalCenter: parent.horizontalCenter
spacing: 20
//--------------------------------------------------------------------
// Bouton Annuler :
Rectangle {
id: bouton_annuler
width: bouton_largeur
height: parent.height * 0.5
anchors.verticalCenter: parent.verticalCenter
radius: shipheart_rayon_bouton
color: couleur_gris_tres_fonce
Label {
id: bouton_annuler_label
anchors.centerIn: parent
text: qsTr("Annuler")
color: couleur_blanc_casse
font.pixelSize:20
}
MouseArea {
anchors.fill: parent
onClicked: {
shipheart_clic();
boite_dialogue_entrees_level_sensor.clicked(shipheart_boite_dialogue_bouton_2, 0);
boite_dialogue_entrees_level_sensor.close();
}
}
}
}
}
//=============================================================================================================
// Transitions d'ouverture et de fermeture de la boite de dialogue
//=============================================================================================================
enter: Transition {
ParallelAnimation {
NumberAnimation {
property: "opacity"
from: 0.0
to: 1.0
//easing.type: Easing.InElastic
duration: 200
}
NumberAnimation {
property: "scale"
from: 0.0
to: 1.0
// easing.type: Easing.OutBack
duration: 200
}
}
}
exit: Transition {
ParallelAnimation {
NumberAnimation {
property: "opacity"
from: 1.0
to: 0.0
duration: 200
}
NumberAnimation {
property: "scale"
from: 1.0
to: 0.0
duration: 200
}
}
}
}