Skip to content

Commit a6e77e5

Browse files
committed
Do not use glean_parser on Qt sample
1 parent e0070fb commit a6e77e5

File tree

4 files changed

+57
-10
lines changed

4 files changed

+57
-10
lines changed

samples/qt-qml-app/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ npm run build:qt
1919
pip install -r requirements.txt
2020
```
2121

22-
3. Generate metrics and pings files.
23-
24-
```bash
25-
glean_parser translate metrics.yaml pings.yaml -f javascript -o generated
26-
```
27-
2822
4. Run the application.
2923

3024
```bash

samples/qt-qml-app/main.qml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import QtGraphicalEffects 1.15
88

99
import "../../glean/dist/glean.js" as Glean;
1010
// These must be imported after Glean because they rely on Glean being in the environment.
11-
import "./generated/pings.js" as Pings;
12-
import "./generated/sample.js" as Metrics;
11+
import "./pings.js" as Pings;
12+
import "./sample.js" as Metrics;
1313

1414
Rectangle {
1515
id: screen
@@ -42,7 +42,7 @@ Rectangle {
4242
font.bold: true
4343
onClicked: () => {
4444
screen.displayText = 1;
45-
Pings.pings.custom.submit();
45+
Pings.custom.submit();
4646
}
4747
}
4848

@@ -67,7 +67,7 @@ Rectangle {
6767
Component.onCompleted: {
6868
// Initialize Glean.
6969
Glean.Glean.default.initialize("qt-qml-app", true, { debug: { logPings: true }});
70-
Metrics.sample.appStarted.set();
70+
Metrics.appStarted.set();
7171
// !IMPORTANT!
7272
// If this message is changed the check in bin/qt-js-check **must** be updated.
7373
console.log("Initialized Glean succesfully.");

samples/qt-qml-app/pings.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* eslint-disable */
2+
3+
/* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6+
7+
"use strict";
8+
9+
/**
10+
* A custom ping to help showcase Glean.js.
11+
* It is sent everytime the user clicks the "Submit ping" button
12+
* on this sample app.
13+
*
14+
* Generated from `custom`.
15+
*/
16+
const custom = new Glean.Glean.default._private.PingType({
17+
includeClientId: true,
18+
sendIfEmpty: false,
19+
name: "custom",
20+
reasonCodes: [],
21+
}, );

samples/qt-qml-app/sample.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* eslint-disable */
2+
3+
/* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6+
7+
"use strict";
8+
9+
/**
10+
* The time the sample app was started.
11+
*
12+
* Generated from `sample.app_started`.
13+
*/
14+
const appStarted = new Glean.Glean.default._private.DatetimeMetricType({
15+
category: "sample",
16+
name: "app_started",
17+
sendInPings: ["custom"],
18+
lifetime: "ping",
19+
disabled: false,
20+
}, "millisecond");
21+
/**
22+
* The number of time the "Record" button was clicked.
23+
*
24+
* Generated from `sample.button_clicked`.
25+
*/
26+
const buttonClicked = new Glean.Glean.default._private.CounterMetricType({
27+
category: "sample",
28+
name: "button_clicked",
29+
sendInPings: ["custom"],
30+
lifetime: "ping",
31+
disabled: false,
32+
}, );

0 commit comments

Comments
 (0)