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
+411
View File
@@ -0,0 +1,411 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Popup {
id: boite_dialogue_action_circuit
// 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
readonly property int largeur_grand_bouton_action: (largeur_petit_bouton_action * 2) + espace_boutons
readonly property int largeur_petit_bouton_action: 140
readonly property int espace_boutons: 5
// Propriétés :
property string nom_circuit: ""
property int action_en_cours: -2
property int mode_cde: 0
// Propriétés alias :
property alias boutonAnnuler: bouton_annuler.visible
property alias boutonAnnulerTexte: bouton_annuler_label.text
// Signaux :
signal clicked(int bouton, int action) // 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_action_circuit.width - (2 * padding_popup)
height: (boite_dialogue_action_circuit.height - (2 * padding_popup) - (2 * affichage_boite_dialogue.spacing)) * pourcentage_boite_dialogue_titre
color: "transparent"
Label {
text: nom_circuit
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("Action à appliquer au circuit lorsque l'évènement se déclenche :")
anchors.fill: parent
verticalAlignment: Text.AlignBottom
horizontalAlignment: Text.AlignHCenter
bottomPadding: 20
wrapMode: Text.Wrap
color: couleur_blanc_casse
font.pixelSize:18
}
}
//=========================================================================
// Choix de l'action :
//=========================================================================
Rectangle {
width: boite_dialogue_action_circuit.width - (2 * padding_popup)
height: (boite_dialogue_action_circuit.height - (2 * padding_popup) - (2 * affichage_boite_dialogue.spacing)) * pourcentage_boite_dialogue_message
color: "transparent"
//------------------------------------
// Ligne des actions générales :
Row {
anchors {
top: parent.top
horizontalCenter: parent.horizontalCenter
}
height: (parent.height / 2) - (spacing / 2)
spacing: espace_boutons
// Bouton Aucune action :
Rectangle {
property int val: -2
width: largeur_grand_bouton_action
height: parent.height
radius: shipheart_rayon_bouton
color: (action_en_cours === val) ? couleur_gris_fonce : couleur_gris_tres_fonce
Label {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
text: qsTr("Aucune")
font.pixelSize: 18
color: (action_en_cours === parent.val) ? couleur_green_yellow : couleur_blanc_casse
font.weight: (action_en_cours === parent.val) ? Font.Bold : Font.Normal
}
MouseArea {
anchors.fill: parent
onClicked: {
shipheart_clic();
boite_dialogue_action_circuit.clicked(shipheart_boite_dialogue_bouton_1, parent.val);
}
}
}
// Bouton Bascule :
Rectangle {
property int val: -1
width: largeur_grand_bouton_action
height: parent.height
radius: shipheart_rayon_bouton
color: (action_en_cours === val) ? couleur_gris_fonce : couleur_gris_tres_fonce
Label {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
topPadding: -(parent.height * 0.3)
text: qsTr("Le circuit <b>bascule</b>")
font.pixelSize: 18
color: (action_en_cours === parent.val) ? couleur_green_yellow : couleur_blanc_casse
font.weight: (action_en_cours === parent.val) ? Font.Bold : Font.Normal
}
Label { // Complment de texte en dessous du titre de bouton proprement-dit.
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
topPadding: (parent.height * 0.3)
text: qsTr("[passe à <b>ON</b> s'il est <b>OFF</b><br /> ou à <b>OFF</b> s'il est <b>ON</b>]")
font.pixelSize: 15
// color: (action_en_cours === parent.val) ? couleur_green_yellow : couleur_gris_pale
color: couleur_gris_pale
}
MouseArea {
anchors.fill: parent
onClicked: {
shipheart_clic();
boite_dialogue_action_circuit.clicked(shipheart_boite_dialogue_bouton_1, parent.val);
}
}
}
}
//------------------------------------
// Ligne des consignes spécifiques :
Row {
anchors {
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
height: (parent.height / 2) - (spacing / 2)
spacing: espace_boutons
// Bouton OFF :
Rectangle {
property int val: 0
width: (mode_cde === shipheart_mode_commande_circuit_soft_variable) ? largeur_petit_bouton_action : largeur_grand_bouton_action
height: parent.height
radius: shipheart_rayon_bouton
color: (action_en_cours === 0) ? couleur_gris_fonce : couleur_gris_tres_fonce
Label {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
text: qsTr("OFF")
font.pixelSize: 18
color: (action_en_cours === parent.val) ? couleur_green_yellow : couleur_blanc_casse
font.weight: (action_en_cours === parent.val) ? Font.Bold : Font.Normal
}
MouseArea {
anchors.fill: parent
onClicked: {
shipheart_clic();
boite_dialogue_action_circuit.clicked(shipheart_boite_dialogue_bouton_1, parent.val);
}
}
}
// Bouton 10% :
Rectangle {
property int val: 10
width: largeur_petit_bouton_action
height: parent.height
radius: shipheart_rayon_bouton
color: (action_en_cours === val) ? couleur_gris_fonce : couleur_gris_tres_fonce
visible: (mode_cde === shipheart_mode_commande_circuit_soft_variable)
Label {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
text: parent.val + "%"
font.pixelSize: 18
color: (action_en_cours === parent.val) ? couleur_green_yellow : couleur_blanc_casse
font.weight: (action_en_cours === parent.val) ? Font.Bold : Font.Normal
}
MouseArea {
anchors.fill: parent
onClicked: {
shipheart_clic();
boite_dialogue_action_circuit.clicked(shipheart_boite_dialogue_bouton_1, parent.val);
}
}
}
// Bouton 25% :
Rectangle {
property int val: 25
width: largeur_petit_bouton_action
height: parent.height
radius: shipheart_rayon_bouton
color: (action_en_cours === val) ? couleur_gris_fonce : couleur_gris_tres_fonce
visible: (mode_cde === shipheart_mode_commande_circuit_soft_variable)
Label {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
text: parent.val + "%"
font.pixelSize: 18
color: (action_en_cours === parent.val) ? couleur_green_yellow : couleur_blanc_casse
font.weight: (action_en_cours === parent.val) ? Font.Bold : Font.Normal
}
MouseArea {
anchors.fill: parent
onClicked: {
shipheart_clic();
boite_dialogue_action_circuit.clicked(shipheart_boite_dialogue_bouton_1, parent.val);
}
}
}
// Bouton 50% :
Rectangle {
property int val: 50
width: largeur_petit_bouton_action
height: parent.height
radius: shipheart_rayon_bouton
color: (action_en_cours === val) ? couleur_gris_fonce : couleur_gris_tres_fonce
visible: (mode_cde === shipheart_mode_commande_circuit_soft_variable)
Label {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
text: parent.val + "%"
font.pixelSize: 18
color: (action_en_cours === parent.val) ? couleur_green_yellow : couleur_blanc_casse
font.weight: (action_en_cours === parent.val) ? Font.Bold : Font.Normal
}
MouseArea {
anchors.fill: parent
onClicked: {
shipheart_clic();
boite_dialogue_action_circuit.clicked(shipheart_boite_dialogue_bouton_1, parent.val);
}
}
}
// Bouton 75% :
Rectangle {
property int val: 75
width: largeur_petit_bouton_action
height: parent.height
radius: shipheart_rayon_bouton
color: (action_en_cours === val) ? couleur_gris_fonce : couleur_gris_tres_fonce
visible: (mode_cde === shipheart_mode_commande_circuit_soft_variable)
Label {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
text: parent.val + "%"
font.pixelSize: 18
color: (action_en_cours === parent.val) ? couleur_green_yellow : couleur_blanc_casse
font.weight: (action_en_cours === parent.val) ? Font.Bold : Font.Normal
}
MouseArea {
anchors.fill: parent
onClicked: {
shipheart_clic();
boite_dialogue_action_circuit.clicked(shipheart_boite_dialogue_bouton_1, parent.val);
}
}
}
// Bouton ON :
Rectangle {
property int val: 100
width: (mode_cde === shipheart_mode_commande_circuit_soft_variable) ? largeur_petit_bouton_action : largeur_grand_bouton_action
height: parent.height
radius: shipheart_rayon_bouton
color: (action_en_cours === 100) ? couleur_gris_fonce : couleur_gris_tres_fonce
Label {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
// text: qsTr("ON") + ((mode_cde === shipheart_mode_commande_circuit_soft_variable) ? "<br />100%" : "")
text: qsTr("ON")
font.pixelSize: 18
color: (action_en_cours === parent.val) ? couleur_green_yellow : couleur_blanc_casse
font.weight: (action_en_cours === parent.val) ? Font.Bold : Font.Normal
}
MouseArea {
anchors.fill: parent
onClicked: {
shipheart_clic();
boite_dialogue_action_circuit.clicked(shipheart_boite_dialogue_bouton_1, parent.val);
}
}
}
}
}
//=========================================================================
// Boutons :
//=========================================================================
Row {
height: (boite_dialogue_action_circuit.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_action_circuit.clicked(shipheart_boite_dialogue_bouton_2, 0);
}
}
}
}
}
//=============================================================================================================
// 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
}
}
}
}