@@ -7,6 +7,9 @@ import QtQuick.Controls 2.0
77import QtGraphicalEffects 1.15
88
99import "../../dist/glean.js" as Glean ;
10+ // These must be imported after Glean because they rely on Glean being in the environment.
11+ import "./generatedPings.js" as Pings ;
12+ import "./generatedMetrics.js" as Metrics ;
1013
1114Rectangle {
1215 id: screen
@@ -16,38 +19,54 @@ Rectangle {
1619 property int displayText: 0
1720
1821 Button {
19- id: glean
20- text: " PUSH 👏 THIS 👏 BUTTON"
22+ id: record
23+ text: " Record"
24+ anchors .horizontalCenter : ping .horizontalCenter
25+ anchors .bottom : ping .bottom
26+ anchors .bottomMargin : 80
27+ palette .buttonText : " black"
28+ palette .button : " #f1f1f1"
29+ font .bold : true
30+ onClicked : () => {
31+ console .log (" Adding to the `button_clicked` metric." )
32+ Metrics .buttonClicked .add ();
33+ }
34+ }
35+
36+ Button {
37+ id: ping
38+ text: " Submit ping"
2139 anchors .centerIn : parent
2240 palette .buttonText : " white"
2341 palette .button : " #ff5000"
2442 font .bold : true
2543 onClicked : () => {
2644 screen .displayText = 1 ;
27- console . info ( " Nothing will happen. Glean.js is not yet implemented. " );
45+ Pings . samplePing . submit ( );
2846 }
2947 }
3048
3149 DropShadow {
32- anchors .fill : glean
50+ anchors .fill : ping
3351 horizontalOffset: 7
3452 verticalOffset: - 7
3553 radius: 0
3654 color: " #0059ab"
37- source: glean
55+ source: ping
3856 }
3957
4058 Text {
4159 id: consoleWarn
42- text: " Now, take a look at the logs on your terminal."
60+ text: " A ping should have been submitted, please check you terminal for logs ."
4361 visible: displayText
44- anchors .top : glean .bottom
62+ anchors .top : ping .bottom
4563 anchors .topMargin : 30
46- anchors .horizontalCenter : glean .horizontalCenter
64+ anchors .horizontalCenter : ping .horizontalCenter
4765 }
4866
4967 Component .onCompleted : {
50- // Initialize Glean when the application starts.
51- Glean .Glean .initialize (" qt-qml-app" , true );
68+ // Initialize Glean.
69+ Glean .Glean .initialize (" qt-qml-app" , true , { debug: { logPings: true }});
70+ Metrics .appStarted .set ();
5271 }
5372}
0 commit comments