Skip to content

Commit 589ad2e

Browse files
committed
few minor changes
1 parent 65e531f commit 589ad2e

File tree

6 files changed

+178
-79
lines changed

6 files changed

+178
-79
lines changed

xbot2_gui/Common/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ qt_add_qml_module(xbot2_gui_common
2727
CheckListItem.qml
2828
NotificationPopup.qml
2929
ResizableRectangle.qml
30+
QML_FILES DelayButtonRound.qml
3031
)
3132

3233
target_link_libraries(xbot2_gui PRIVATE xbot2_gui_commonplugin)
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import QtQuick
2+
import QtQuick.Controls.Basic
3+
4+
DelayButton {
5+
6+
id: control
7+
text: qsTr("")
8+
property color color: 'red'
9+
10+
contentItem: Text {
11+
text: control.text
12+
font: control.font
13+
opacity: enabled ? 1.0 : 0.3
14+
color: palette.active.text
15+
horizontalAlignment: Text.AlignHCenter
16+
verticalAlignment: Text.AlignVCenter
17+
elide: Text.ElideRight
18+
}
19+
20+
background: Rectangle {
21+
implicitWidth: 100
22+
implicitHeight: 100
23+
opacity: enabled ? 1 : 0.3
24+
color: control.down ? Qt.darker(control.color) : control.color
25+
radius: size / 2
26+
27+
readonly property real size: Math.min(control.width, control.height)
28+
width: size
29+
height: size
30+
anchors.centerIn: parent
31+
32+
Canvas {
33+
id: canvas
34+
anchors.fill: parent
35+
36+
Connections {
37+
target: control
38+
function onProgressChanged() { canvas.requestPaint(); }
39+
}
40+
41+
onPaint: {
42+
var ctx = getContext("2d")
43+
ctx.clearRect(0, 0, width, height)
44+
ctx.strokeStyle = "white"
45+
ctx.lineWidth = parent.size / 20
46+
ctx.beginPath()
47+
var startAngle = Math.PI / 5 * 3
48+
var endAngle = startAngle + control.progress * Math.PI / 5 * 9
49+
ctx.arc(width / 2, height / 2, width / 2 - ctx.lineWidth / 2 - 2, startAngle, endAngle)
50+
ctx.stroke()
51+
}
52+
}
53+
}
54+
55+
56+
onProgressChanged: console.log(progress)
57+
}

xbot2_gui/Font/MaterialSymbolNames.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Item {
3535
property string plotSmall: '\ue922'
3636
property string weight: '\ue13d'
3737
property string dashboard: '\ue9b0'
38+
property string netSettings: '\ueb2f'
3839

3940
property FontLoader filledFont: FontLoader {
4041
source: `/Font/materialsymbols/MaterialSymbolsOutlined[opsz,wght,FILL,GRAD@20,200,1,200].otf`

xbot2_gui/Home/HelloScreen.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ MultiPaneResponsiveLayout {
132132

133133
ColumnLayout {
134134

135-
property string iconText: 'Log'
135+
property string iconText: 'Server log'
136136
property string iconChar: MaterialSymbolNames.log
137137

138138
id: textCol
@@ -148,7 +148,7 @@ MultiPaneResponsiveLayout {
148148
CheckBox {
149149
id: verbosityCheck
150150
text: 'Verbose'
151-
checked: true
151+
checked: false
152152
}
153153

154154
CheckBox {

xbot2_gui/Home/ServerStatusCard.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Card1 {
6969

7070
Timer {
7171
id: delayedConnect
72-
interval: 1000
72+
interval: 3000
7373
onTriggered: root.updateServerUrl()
7474
}
7575

xbot2_gui/TestThings/Playground.qml

Lines changed: 116 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -20,98 +20,136 @@ Item {
2020
//
2121
id: root
2222

23+
Column {
24+
2325
SpinBox {
2426
id: camZSpin
2527
from: 0
2628
to: 1000
2729
value: 200
2830
}
2931

30-
// The root scene
31-
Node {
32-
id: standAloneScene
32+
Repeater {
3333

34-
DirectionalLight {
35-
ambientColor: Qt.rgba(0.5, 0.5, 0.5, 1.0)
36-
brightness: 1.0
37-
eulerRotation.x: -25
38-
}
34+
model: robot.jointNames.length
3935

40-
Model {
41-
source: "#Cube"
42-
x: 50
43-
scale: Qt.vector3d(1, 0.05, 0.05)
44-
materials: [
45-
DefaultMaterial {
46-
diffuseColor: Qt.rgba(0.8, 0.0, 0.0, 1.0)
47-
}
48-
]
49-
}
36+
Slider {
37+
required property int index
38+
from: -3
39+
to: 3
5040

51-
Model {
52-
source: "#Cube"
53-
y: 50
54-
scale: Qt.vector3d(1, 0.05, 0.05)
55-
eulerRotation.z: 90
56-
materials: [
57-
DefaultMaterial {
58-
diffuseColor: Qt.rgba(0.0, 0.8, 0.0, 1.0)
59-
}
60-
]
61-
}
41+
onValueChanged: {
6242

63-
Model {
64-
source: "#Cube"
65-
z: 50
66-
scale: Qt.vector3d(1, 0.05, 0.05)
67-
eulerRotation.y: -90
68-
materials: [
69-
DefaultMaterial {
70-
diffuseColor: Qt.rgba(0., 0.0, 0.8, 1.0)
71-
}
72-
]
43+
robot.q[index] = value
44+
robot.updateQ(robot.q)
45+
}
7346
}
7447

75-
Model {
76-
source: "#Sphere"
77-
scale: Qt.vector3d(0.1, 0.1, 0.1)
78-
materials: [
79-
DefaultMaterial {
80-
diffuseColor: Qt.rgba(0.0, 0.8, 0.0, 0.2)
81-
}
82-
]
83-
}
8448

85-
RobotModelNode {
86-
client: root.client
49+
}
50+
51+
}
52+
53+
// The root scene
54+
Node {
55+
56+
id: standAloneScene
57+
58+
Node {
59+
id: originNode
60+
// Stationary perspective camera
61+
PerspectiveCamera {
62+
id: cameraPerspectiveTwo
63+
position: Qt.vector3d(200, 0, 0)
64+
clipNear: 1
65+
Component.onCompleted: lookAt(Qt.vector3d(0, 0, 0))
66+
}
8767
}
8868

89-
// CustomMesh {
90-
// // name: modelData.linkName
91-
// // type: modelData.type
92-
// meshUri: 'package://kyon_urdf/meshes/collision/mesh_pelvis.stl'
93-
// // meshUri: '#Cube'
94-
// // scale: Qt.vector3d(0.001, 0.001, 0.001)
95-
96-
// // cylinderLength: modelData.length || 0
97-
// // cylinderRadius: modelData.radius || 0
98-
// // scale: modelData.scale
99-
// // localPosition: modelData.origin_xyz
100-
// // localRotation: modelData.origin_rot
101-
// // color: root.color
102-
// // alpha: root.alpha
103-
// // visible: root.visible
104-
// client: root.client
105-
// }
106-
107-
// Stationary perspective camera
108-
PerspectiveCamera {
109-
id: cameraPerspectiveTwo
110-
position: Qt.vector3d(200, 0, 0)
111-
clipNear: 1
112-
113-
Component.onCompleted: lookAt(Qt.vector3d(0, 0, 0))
69+
Node {
70+
71+
id: modelScene
72+
73+
DirectionalLight {
74+
ambientColor: Qt.rgba(0.5, 0.5, 0.5, 1.0)
75+
brightness: 1.0
76+
eulerRotation.x: -25
77+
}
78+
79+
Model {
80+
source: "#Cube"
81+
x: 50
82+
scale: Qt.vector3d(1, 0.05, 0.05)
83+
materials: [
84+
DefaultMaterial {
85+
diffuseColor: Qt.rgba(0.8, 0.0, 0.0, 1.0)
86+
}
87+
]
88+
}
89+
90+
Model {
91+
source: "#Cube"
92+
y: 50
93+
scale: Qt.vector3d(1, 0.05, 0.05)
94+
eulerRotation.z: 90
95+
materials: [
96+
DefaultMaterial {
97+
diffuseColor: Qt.rgba(0.0, 0.8, 0.0, 1.0)
98+
}
99+
]
100+
}
101+
102+
Model {
103+
source: "#Cube"
104+
z: 50
105+
scale: Qt.vector3d(1, 0.05, 0.05)
106+
eulerRotation.y: -90
107+
materials: [
108+
DefaultMaterial {
109+
diffuseColor: Qt.rgba(0., 0.0, 0.8, 1.0)
110+
}
111+
]
112+
}
113+
114+
Model {
115+
source: "#Sphere"
116+
scale: Qt.vector3d(0.1, 0.1, 0.1)
117+
materials: [
118+
DefaultMaterial {
119+
diffuseColor: Qt.rgba(0.0, 0.8, 0.0, 0.2)
120+
}
121+
]
122+
}
123+
124+
RobotModelNode {
125+
id: robot
126+
client: root.client
127+
}
128+
129+
eulerRotation.x: -90
130+
eulerRotation.y: 90
131+
132+
// CustomMesh {
133+
// // name: modelData.linkName
134+
// // type: modelData.type
135+
// meshUri: 'package://kyon_urdf/meshes/collision/mesh_pelvis.stl'
136+
// // meshUri: '#Cube'
137+
// // scale: Qt.vector3d(0.001, 0.001, 0.001)
138+
139+
// // cylinderLength: modelData.length || 0
140+
// // cylinderRadius: modelData.radius || 0
141+
// // scale: modelData.scale
142+
// // localPosition: modelData.origin_xyz
143+
// // localRotation: modelData.origin_rot
144+
// // color: root.color
145+
// // alpha: root.alpha
146+
// // visible: root.visible
147+
// client: root.client
148+
// }
149+
150+
114151
}
152+
115153
}
116154

117155
View3D {
@@ -122,9 +160,11 @@ Item {
122160

123161
OrbitCameraController {
124162
camera: cameraPerspectiveTwo
125-
origin: standAloneScene
163+
origin: originNode
126164
anchors.fill: parent
127165
}
166+
167+
128168
}
129169
}
130170

0 commit comments

Comments
 (0)