203 lines
7.9 KiB
QML
Executable File
203 lines
7.9 KiB
QML
Executable File
import QtQuick 2.12
|
|
import QtQuick.Controls 2.12
|
|
|
|
|
|
Popup {
|
|
id: boite_dialogue_nettoyage_ecran
|
|
|
|
// 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: 50
|
|
readonly property double pourcentage_boite_dialogue_titre: 0.2
|
|
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.30
|
|
readonly property int bouton_largeur: 500
|
|
|
|
readonly property int step_timer_sortie: 10 // en ms
|
|
|
|
// Propriétés :
|
|
property int valeur_timer_sortie: 0
|
|
|
|
// Propriétés alias :
|
|
|
|
|
|
// Signaux :
|
|
|
|
|
|
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
|
|
}
|
|
|
|
|
|
Timer {
|
|
id: timer_sortie
|
|
interval: step_timer_sortie
|
|
triggeredOnStart: false
|
|
repeat: true
|
|
onTriggered: {
|
|
if (valeur_timer_sortie < shipheart_mouse_press_and_hold_interval_tres_long) valeur_timer_sortie+= step_timer_sortie;
|
|
else // Le fait de ne pas utilise le OnPressandHold permet d'être sût que la sortie se fait au même moment que la fin du comptage (sinon, on peut avoir de petits décalages)
|
|
{
|
|
timer_sortie.running = false;
|
|
valeur_timer_sortie = 0;
|
|
shipheart_clic();
|
|
boite_dialogue_nettoyage_ecran.close();
|
|
}
|
|
}
|
|
}
|
|
|
|
Column {
|
|
id: affichage_boite_dialogue_nettoyage_ecran
|
|
|
|
spacing: 20
|
|
|
|
//=========================================================================
|
|
// Titre :
|
|
//=========================================================================
|
|
Rectangle {
|
|
id: titre_boite_dialogue_nettoyage_ecran
|
|
|
|
width: boite_dialogue_nettoyage_ecran.width - (2 * padding_popup)
|
|
height: (boite_dialogue_nettoyage_ecran.height - (2 * padding_popup) - (2 * affichage_boite_dialogue_nettoyage_ecran.spacing)) * pourcentage_boite_dialogue_titre
|
|
color: "transparent"
|
|
|
|
Text {
|
|
text: qsTr("Nettoyage de l'écran")
|
|
anchors.fill: parent
|
|
verticalAlignment: Text.AlignVCenter
|
|
horizontalAlignment: Text.AlignHCenter
|
|
wrapMode: Text.Wrap
|
|
color: couleur_blanc_casse
|
|
font.pixelSize:40
|
|
font.weight: Font.Bold
|
|
}
|
|
}
|
|
|
|
//=========================================================================
|
|
// Message :
|
|
//=========================================================================
|
|
Rectangle {
|
|
id: message_boite_dialogue_nettoyage_ecran
|
|
|
|
width: boite_dialogue_nettoyage_ecran.width - (2 * padding_popup)
|
|
height: (boite_dialogue_nettoyage_ecran.height - (2 * padding_popup) - (2 * affichage_boite_dialogue_nettoyage_ecran.spacing)) * pourcentage_boite_dialogue_message
|
|
color: "transparent"
|
|
|
|
Text {
|
|
anchors.fill: parent
|
|
verticalAlignment: Text.AlignVCenter
|
|
horizontalAlignment: Text.AlignHCenter
|
|
wrapMode: Text.Wrap
|
|
text: qsTr("L'écran est actuellement figé afin de vous permettre de le nettoyer sans risque de déclencher des actions non désirées.<br /><br />Maintenez le bouton ci-dessous pendant plus de %1 secondes pour sortir de ce mode.").arg(shipheart_mouse_press_and_hold_interval_tres_long / 1000)
|
|
color: couleur_blanc_casse
|
|
font.pixelSize:18
|
|
}
|
|
}
|
|
|
|
//=========================================================================
|
|
// Boutons :
|
|
//=========================================================================
|
|
Row {
|
|
height: (boite_dialogue_nettoyage_ecran.height - (2 * padding_popup) - (2 * affichage_boite_dialogue_nettoyage_ecran.spacing)) * pourcentage_boite_dialogue_ligne_boutons
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
spacing: 20
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
// Bouton Sortie :
|
|
Rectangle {
|
|
id: bouton_sortie
|
|
|
|
width: bouton_largeur
|
|
height: parent.height * 0.5
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
radius: shipheart_rayon_bouton
|
|
color: couleur_gris_tres_fonce
|
|
Label {
|
|
id: bouton_sortie_label
|
|
anchors.centerIn: parent
|
|
text: qsTr("Sortie")
|
|
color: couleur_blanc_casse
|
|
font.pixelSize:20
|
|
}
|
|
|
|
// Barre grandissante pour montrer durée d'appui vs tempo nécessaire :
|
|
Rectangle {
|
|
width: (valeur_timer_sortie / shipheart_mouse_press_and_hold_interval_tres_long) * parent.width
|
|
height: parent.height
|
|
color: couleur_gris_tres_pale_transparent
|
|
radius: shipheart_rayon_bouton
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onPressed: { // Déclenché lors de l'appui inital
|
|
valeur_timer_sortie = 0;
|
|
timer_sortie.running = true;
|
|
}
|
|
onClicked: { // Déclenché si l'appui n'a pas été suffisement long pour avoir un Press&Hold :
|
|
timer_sortie.running = false;
|
|
valeur_timer_sortie = 0;
|
|
}
|
|
onExited: { // Déclenché si le doigt sort de la zone du bouton (sinon, on continue à compter alors qu'on est sorti de la zone et même relaché le doigt !!)
|
|
timer_sortie.running = false;
|
|
valeur_timer_sortie = 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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|