zui 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (325) hide show
  1. checksums.yaml +7 -0
  2. data/Components/Builtins/Accordion.qml +208 -0
  3. data/Components/Builtins/Action.qml +43 -0
  4. data/Components/Builtins/ActionButton.qml +19 -0
  5. data/Components/Builtins/ActionGroup.qml +81 -0
  6. data/Components/Builtins/AlertDialog.qml +398 -0
  7. data/Components/Builtins/AnchorAnimation.qml +3 -0
  8. data/Components/Builtins/AnchorChanges.qml +11 -0
  9. data/Components/Builtins/AnimatedImage.qml +39 -0
  10. data/Components/Builtins/Animation.qml +3 -0
  11. data/Components/Builtins/AnimationController.qml +11 -0
  12. data/Components/Builtins/ApplicationWindow.qml +103 -0
  13. data/Components/Builtins/AreaChart.qml +70 -0
  14. data/Components/Builtins/AspectRatio.qml +30 -0
  15. data/Components/Builtins/Audio.qml +85 -0
  16. data/Components/Builtins/AudioInput.qml +10 -0
  17. data/Components/Builtins/AudioOutput.qml +10 -0
  18. data/Components/Builtins/Avatar.qml +46 -0
  19. data/Components/Builtins/Badge.qml +38 -0
  20. data/Components/Builtins/Banner.qml +133 -0
  21. data/Components/Builtins/BarChart.qml +67 -0
  22. data/Components/Builtins/BarIconButton.qml +30 -0
  23. data/Components/Builtins/BarIndicator.qml +26 -0
  24. data/Components/Builtins/Behavior.qml +13 -0
  25. data/Components/Builtins/Blur.qml +14 -0
  26. data/Components/Builtins/BorderImage.qml +38 -0
  27. data/Components/Builtins/BorderOverlay.qml +25 -0
  28. data/Components/Builtins/BottomSheet.qml +211 -0
  29. data/Components/Builtins/Breadcrumb.qml +169 -0
  30. data/Components/Builtins/BubbleChart.qml +3 -0
  31. data/Components/Builtins/BusyIndicator.qml +24 -0
  32. data/Components/Builtins/Button.qml +55 -0
  33. data/Components/Builtins/ButtonGroup.qml +18 -0
  34. data/Components/Builtins/Calendar.qml +55 -0
  35. data/Components/Builtins/Camera.qml +18 -0
  36. data/Components/Builtins/CandlestickChart.qml +3 -0
  37. data/Components/Builtins/Canvas.qml +159 -0
  38. data/Components/Builtins/CaptureSession.qml +19 -0
  39. data/Components/Builtins/Card.qml +23 -0
  40. data/Components/Builtins/Carousel.qml +72 -0
  41. data/Components/Builtins/Center.qml +20 -0
  42. data/Components/Builtins/CheckDelegate.qml +132 -0
  43. data/Components/Builtins/Checkbox.qml +62 -0
  44. data/Components/Builtins/Chip.qml +65 -0
  45. data/Components/Builtins/Circle.qml +35 -0
  46. data/Components/Builtins/Clipboard.qml +29 -0
  47. data/Components/Builtins/ColorAnimation.qml +3 -0
  48. data/Components/Builtins/ColorPicker.qml +70 -0
  49. data/Components/Builtins/Colorize.qml +14 -0
  50. data/Components/Builtins/Column.qml +17 -0
  51. data/Components/Builtins/ColumnLayout.qml +13 -0
  52. data/Components/Builtins/ConfirmDialog.qml +20 -0
  53. data/Components/Builtins/ConstrainedBox.qml +28 -0
  54. data/Components/Builtins/Container.qml +30 -0
  55. data/Components/Builtins/ContextMenu.qml +140 -0
  56. data/Components/Builtins/CursorSurface.qml +18 -0
  57. data/Components/Builtins/DataTable.qml +69 -0
  58. data/Components/Builtins/DatePicker.qml +180 -0
  59. data/Components/Builtins/DayOfWeekRow.qml +11 -0
  60. data/Components/Builtins/DelayButton.qml +47 -0
  61. data/Components/Builtins/DelegateModel.qml +10 -0
  62. data/Components/Builtins/DelegateModelGroup.qml +10 -0
  63. data/Components/Builtins/Dial.qml +42 -0
  64. data/Components/Builtins/Dialog.qml +128 -0
  65. data/Components/Builtins/DialogButtonBox.qml +137 -0
  66. data/Components/Builtins/Divider.qml +26 -0
  67. data/Components/Builtins/DonutChart.qml +3 -0
  68. data/Components/Builtins/DoubleSpinBox.qml +58 -0
  69. data/Components/Builtins/DragArea.qml +43 -0
  70. data/Components/Builtins/Drawer.qml +107 -0
  71. data/Components/Builtins/DropArea.qml +19 -0
  72. data/Components/Builtins/DropShadow.qml +16 -0
  73. data/Components/Builtins/Dropdown.qml +19 -0
  74. data/Components/Builtins/ExpansionPanel.qml +157 -0
  75. data/Components/Builtins/FilePicker.qml +140 -0
  76. data/Components/Builtins/FittedBox.qml +40 -0
  77. data/Components/Builtins/Flickable.qml +40 -0
  78. data/Components/Builtins/Flipable.qml +45 -0
  79. data/Components/Builtins/Flow.qml +16 -0
  80. data/Components/Builtins/FocusScope.qml +29 -0
  81. data/Components/Builtins/FolderListModel.qml +9 -0
  82. data/Components/Builtins/FolderPicker.qml +93 -0
  83. data/Components/Builtins/FontLoader.qml +21 -0
  84. data/Components/Builtins/FontPicker.qml +91 -0
  85. data/Components/Builtins/Frame.qml +71 -0
  86. data/Components/Builtins/FrameAnimation.qml +13 -0
  87. data/Components/Builtins/Gauge.qml +3 -0
  88. data/Components/Builtins/Glow.qml +15 -0
  89. data/Components/Builtins/Gradient.qml +93 -0
  90. data/Components/Builtins/Grid.qml +16 -0
  91. data/Components/Builtins/GridLayout.qml +16 -0
  92. data/Components/Builtins/GridView.qml +226 -0
  93. data/Components/Builtins/GroupBox.qml +95 -0
  94. data/Components/Builtins/Heatmap.qml +3 -0
  95. data/Components/Builtins/Histogram.qml +3 -0
  96. data/Components/Builtins/HorizontalHeader.qml +23 -0
  97. data/Components/Builtins/HorizontalHeaderDelegate.qml +39 -0
  98. data/Components/Builtins/HoverArea.qml +19 -0
  99. data/Components/Builtins/Icon.qml +16 -0
  100. data/Components/Builtins/Image.qml +110 -0
  101. data/Components/Builtins/ImageCapture.qml +14 -0
  102. data/Components/Builtins/ItemDelegate.qml +152 -0
  103. data/Components/Builtins/KeyCatcher.qml +25 -0
  104. data/Components/Builtins/Label.qml +43 -0
  105. data/Components/Builtins/LayoutItemProxy.qml +51 -0
  106. data/Components/Builtins/Legend.qml +86 -0
  107. data/Components/Builtins/Line.qml +28 -0
  108. data/Components/Builtins/LineChart.qml +87 -0
  109. data/Components/Builtins/ListModel.qml +8 -0
  110. data/Components/Builtins/ListView.qml +65 -0
  111. data/Components/Builtins/Loader.qml +33 -0
  112. data/Components/Builtins/Markdown.qml +23 -0
  113. data/Components/Builtins/MediaDevices.qml +10 -0
  114. data/Components/Builtins/MediaPlayer.qml +27 -0
  115. data/Components/Builtins/MediaRecorder.qml +16 -0
  116. data/Components/Builtins/Menu.qml +119 -0
  117. data/Components/Builtins/MenuBar.qml +128 -0
  118. data/Components/Builtins/MenuItem.qml +77 -0
  119. data/Components/Builtins/MenuSeparator.qml +30 -0
  120. data/Components/Builtins/MessageDialog.qml +104 -0
  121. data/Components/Builtins/ModalSheet.qml +222 -0
  122. data/Components/Builtins/ModelView3d.qml +50 -0
  123. data/Components/Builtins/MonthGrid.qml +23 -0
  124. data/Components/Builtins/MultiEffect.qml +48 -0
  125. data/Components/Builtins/MultiSelect.qml +23 -0
  126. data/Components/Builtins/NavigationRail.qml +154 -0
  127. data/Components/Builtins/NumberAnimation.qml +3 -0
  128. data/Components/Builtins/NumberField.qml +18 -0
  129. data/Components/Builtins/OpacityAnimator.qml +3 -0
  130. data/Components/Builtins/OpacityMask.qml +21 -0
  131. data/Components/Builtins/OpticalGlyph.qml +16 -0
  132. data/Components/Builtins/Page.qml +111 -0
  133. data/Components/Builtins/PageIndicator.qml +63 -0
  134. data/Components/Builtins/Pagination.qml +158 -0
  135. data/Components/Builtins/Pane.qml +72 -0
  136. data/Components/Builtins/PanelHero.qml +15 -0
  137. data/Components/Builtins/ParallelAnimation.qml +3 -0
  138. data/Components/Builtins/ParentAnimation.qml +3 -0
  139. data/Components/Builtins/ParentChange.qml +10 -0
  140. data/Components/Builtins/ParticleSystem.qml +81 -0
  141. data/Components/Builtins/PasswordField.qml +58 -0
  142. data/Components/Builtins/Path.qml +35 -0
  143. data/Components/Builtins/PathAnimation.qml +3 -0
  144. data/Components/Builtins/PauseAnimation.qml +3 -0
  145. data/Components/Builtins/PieChart.qml +3 -0
  146. data/Components/Builtins/PinchArea.qml +23 -0
  147. data/Components/Builtins/Popup.qml +130 -0
  148. data/Components/Builtins/Progress.qml +15 -0
  149. data/Components/Builtins/ProgressRing.qml +120 -0
  150. data/Components/Builtins/PropertyAction.qml +11 -0
  151. data/Components/Builtins/PropertyAnimation.qml +3 -0
  152. data/Components/Builtins/PropertyChanges.qml +10 -0
  153. data/Components/Builtins/RadarChart.qml +3 -0
  154. data/Components/Builtins/RadialGauge.qml +3 -0
  155. data/Components/Builtins/RadioButton.qml +46 -0
  156. data/Components/Builtins/RadioDelegate.qml +115 -0
  157. data/Components/Builtins/RadioGroup.qml +58 -0
  158. data/Components/Builtins/RangeSlider.qml +39 -0
  159. data/Components/Builtins/Rectangle.qml +23 -0
  160. data/Components/Builtins/RectangularShadow.qml +23 -0
  161. data/Components/Builtins/ReorderableList.qml +204 -0
  162. data/Components/Builtins/RichText.qml +23 -0
  163. data/Components/Builtins/RotationAnimation.qml +3 -0
  164. data/Components/Builtins/RotationAnimator.qml +3 -0
  165. data/Components/Builtins/RoundButton.qml +42 -0
  166. data/Components/Builtins/Row.qml +17 -0
  167. data/Components/Builtins/RowLayout.qml +13 -0
  168. data/Components/Builtins/ScaleAnimator.qml +3 -0
  169. data/Components/Builtins/ScatterChart.qml +3 -0
  170. data/Components/Builtins/ScreenCapture.qml +78 -0
  171. data/Components/Builtins/ScriptAction.qml +15 -0
  172. data/Components/Builtins/Scroll.qml +18 -0
  173. data/Components/Builtins/ScrollBar.qml +18 -0
  174. data/Components/Builtins/ScrollIndicator.qml +15 -0
  175. data/Components/Builtins/SearchField.qml +178 -0
  176. data/Components/Builtins/SearchableDropdown.qml +21 -0
  177. data/Components/Builtins/SectionHeader.qml +14 -0
  178. data/Components/Builtins/SelectableText.qml +33 -0
  179. data/Components/Builtins/SelectionRectangle.qml +17 -0
  180. data/Components/Builtins/Separator.qml +13 -0
  181. data/Components/Builtins/SequentialAnimation.qml +3 -0
  182. data/Components/Builtins/Settings.qml +10 -0
  183. data/Components/Builtins/ShaderEffect.qml +115 -0
  184. data/Components/Builtins/ShaderEffectSource.qml +61 -0
  185. data/Components/Builtins/Shaders/grayscale.frag +14 -0
  186. data/Components/Builtins/Shaders/grayscale.frag.qsb +0 -0
  187. data/Components/Builtins/Shaders/passthrough.frag +11 -0
  188. data/Components/Builtins/Shaders/passthrough.frag.qsb +0 -0
  189. data/Components/Builtins/Shaders/pixelate.frag +16 -0
  190. data/Components/Builtins/Shaders/pixelate.frag.qsb +0 -0
  191. data/Components/Builtins/Shaders/vignette.frag +18 -0
  192. data/Components/Builtins/Shaders/vignette.frag.qsb +0 -0
  193. data/Components/Builtins/Shaders/wave.frag +18 -0
  194. data/Components/Builtins/Shaders/wave.frag.qsb +0 -0
  195. data/Components/Builtins/Shape.qml +53 -0
  196. data/Components/Builtins/Skeleton.qml +78 -0
  197. data/Components/Builtins/Slider.qml +21 -0
  198. data/Components/Builtins/SmoothedAnimation.qml +3 -0
  199. data/Components/Builtins/Snackbar.qml +181 -0
  200. data/Components/Builtins/SortFilterProxyModel.qml +16 -0
  201. data/Components/Builtins/SoundEffect.qml +10 -0
  202. data/Components/Builtins/Spacer.qml +13 -0
  203. data/Components/Builtins/Sparkline.qml +3 -0
  204. data/Components/Builtins/SpinBox.qml +44 -0
  205. data/Components/Builtins/SplitView.qml +31 -0
  206. data/Components/Builtins/SpringAnimation.qml +3 -0
  207. data/Components/Builtins/Stack.qml +14 -0
  208. data/Components/Builtins/StackLayout.qml +19 -0
  209. data/Components/Builtins/StackView.qml +122 -0
  210. data/Components/Builtins/StackedBarChart.qml +3 -0
  211. data/Components/Builtins/StandardPaths.qml +9 -0
  212. data/Components/Builtins/State.qml +13 -0
  213. data/Components/Builtins/StateGroup.qml +11 -0
  214. data/Components/Builtins/Support/AnimationDriver.qml +79 -0
  215. data/Components/Builtins/Support/AnimationGroupDriver.qml +32 -0
  216. data/Components/Builtins/Support/ChartCanvas.qml +629 -0
  217. data/Components/Builtins/Support/ModelView3dScene.qml +292 -0
  218. data/Components/Builtins/Support/OptionalModuleState.js +5 -0
  219. data/Components/Builtins/SwipeDelegate.qml +231 -0
  220. data/Components/Builtins/SwipeView.qml +69 -0
  221. data/Components/Builtins/SwitchDelegate.qml +140 -0
  222. data/Components/Builtins/TabBar.qml +117 -0
  223. data/Components/Builtins/TabButton.qml +105 -0
  224. data/Components/Builtins/TableView.qml +388 -0
  225. data/Components/Builtins/TableViewDelegate.qml +17 -0
  226. data/Components/Builtins/Tabs.qml +138 -0
  227. data/Components/Builtins/Text.qml +24 -0
  228. data/Components/Builtins/TextArea.qml +59 -0
  229. data/Components/Builtins/TextField.qml +21 -0
  230. data/Components/Builtins/TextMetrics.qml +39 -0
  231. data/Components/Builtins/TimePicker.qml +213 -0
  232. data/Components/Builtins/Timer.qml +13 -0
  233. data/Components/Builtins/Toast.qml +213 -0
  234. data/Components/Builtins/Toggle.qml +19 -0
  235. data/Components/Builtins/ToggleSwitch.qml +22 -0
  236. data/Components/Builtins/ToolBar.qml +61 -0
  237. data/Components/Builtins/ToolButton.qml +41 -0
  238. data/Components/Builtins/ToolSeparator.qml +36 -0
  239. data/Components/Builtins/Tooltip.qml +20 -0
  240. data/Components/Builtins/Transition.qml +3 -0
  241. data/Components/Builtins/TreeView.qml +423 -0
  242. data/Components/Builtins/TreeViewDelegate.qml +46 -0
  243. data/Components/Builtins/Tumbler.qml +18 -0
  244. data/Components/Builtins/UniformAnimator.qml +3 -0
  245. data/Components/Builtins/VectorAnimation.qml +3 -0
  246. data/Components/Builtins/VectorImage.qml +62 -0
  247. data/Components/Builtins/VerticalHeader.qml +21 -0
  248. data/Components/Builtins/VerticalHeaderDelegate.qml +35 -0
  249. data/Components/Builtins/Video.qml +54 -0
  250. data/Components/Builtins/VideoOutput.qml +54 -0
  251. data/Components/Builtins/WebView.qml +57 -0
  252. data/Components/Builtins/WeekNumberColumn.qml +13 -0
  253. data/Components/Builtins/WidgetButton.qml +26 -0
  254. data/Components/Builtins/Window.qml +90 -0
  255. data/Components/Builtins/WindowCapture.qml +11 -0
  256. data/Components/Builtins/Wrap.qml +18 -0
  257. data/Components/Builtins/XAnimator.qml +3 -0
  258. data/Components/Builtins/YAnimator.qml +3 -0
  259. data/Components/README.md +45 -0
  260. data/ControlNode.qml +1369 -0
  261. data/Controls/BarIconButton.qml +27 -0
  262. data/Controls/BarIndicator.qml +22 -0
  263. data/Controls/BorderOverlay.qml +10 -0
  264. data/Controls/BorderSurface.qml +10 -0
  265. data/Controls/Button.qml +78 -0
  266. data/Controls/ButtonGroup.qml +19 -0
  267. data/Controls/ConfirmDialog.qml +37 -0
  268. data/Controls/CursorSurface.qml +29 -0
  269. data/Controls/Dropdown.qml +59 -0
  270. data/Controls/MultiSelect.qml +32 -0
  271. data/Controls/NumberField.qml +24 -0
  272. data/Controls/OpticalGlyph.qml +14 -0
  273. data/Controls/PanelActionButton.qml +10 -0
  274. data/Controls/PanelHero.qml +18 -0
  275. data/Controls/PanelKeyCatcher.qml +25 -0
  276. data/Controls/PanelSectionHeader.qml +11 -0
  277. data/Controls/PanelSeparator.qml +10 -0
  278. data/Controls/PanelSlider.qml +36 -0
  279. data/Controls/PanelToolTip.qml +13 -0
  280. data/Controls/SearchableDropdown.qml +11 -0
  281. data/Controls/TextField.qml +25 -0
  282. data/Controls/Toggle.qml +22 -0
  283. data/Controls/ToggleSwitch.qml +26 -0
  284. data/Controls/WidgetButton.qml +35 -0
  285. data/Controls/qmldir +25 -0
  286. data/Desktop.qml +76 -0
  287. data/LICENSE +22 -0
  288. data/README.md +112 -0
  289. data/Service.qml +430 -0
  290. data/Theme/Border.qml +22 -0
  291. data/Theme/Color.qml +22 -0
  292. data/Theme/Style.qml +47 -0
  293. data/Theme/Util.qml +6 -0
  294. data/Theme/qmldir +5 -0
  295. data/bin/zui +7 -0
  296. data/lib/zui/animation.rb +24 -0
  297. data/lib/zui/application.rb +327 -0
  298. data/lib/zui/builder.rb +725 -0
  299. data/lib/zui/cli.rb +91 -0
  300. data/lib/zui/command.rb +101 -0
  301. data/lib/zui/component_registry.rb +91 -0
  302. data/lib/zui/components.rb +262 -0
  303. data/lib/zui/distribution.rb +200 -0
  304. data/lib/zui/generator.rb +84 -0
  305. data/lib/zui/host.rb +123 -0
  306. data/lib/zui/node.rb +30 -0
  307. data/lib/zui/platform.rb +40 -0
  308. data/lib/zui/protocol.rb +29 -0
  309. data/lib/zui/runner.rb +37 -0
  310. data/lib/zui/runtime.rb +23 -0
  311. data/lib/zui/scheduler.rb +136 -0
  312. data/lib/zui/source_bundle.rb +63 -0
  313. data/lib/zui/state_store.rb +100 -0
  314. data/lib/zui/value.rb +44 -0
  315. data/lib/zui.rb +33 -0
  316. data/native/CMakeLists.txt +45 -0
  317. data/native/ZuiClipboard.cpp +16 -0
  318. data/native/ZuiClipboard.h +16 -0
  319. data/native/ZuiProcess.cpp +84 -0
  320. data/native/ZuiProcess.h +34 -0
  321. data/native/main.cpp +64 -0
  322. data/vendor/host/linux-x86_64/PROVENANCE.md +15 -0
  323. data/vendor/host/linux-x86_64/zui-host +0 -0
  324. data/vendor/host/linux-x86_64/zui-host.sha256 +1 -0
  325. metadata +365 -0
@@ -0,0 +1,292 @@
1
+ import QtQuick
2
+ import QtQuick3D
3
+ import QtQuick3D.AssetUtils
4
+
5
+ Item {
6
+ id: modelViewRoot
7
+
8
+ required property var renderer
9
+ property real currentPitch: Number(renderer.prop("rotation_x", 0))
10
+ property real currentYaw: Number(renderer.prop("rotation_y", 0))
11
+ property real currentRoll: Number(renderer.prop("rotation_z", 0))
12
+ property real currentZoom: clampZoom(Number(renderer.prop("zoom", 1)))
13
+ property real automaticYaw: 0
14
+ property real fittedScale: 1
15
+ property real boundsDiameter: 0
16
+ property vector3d modelCenter: Qt.vector3d(0, 0, 0)
17
+ property real observedResetRevision: Number(renderer.prop("reset_revision", 0))
18
+ property bool ready: false
19
+ property string loadedModelSource: ""
20
+
21
+ function clampZoom(value) {
22
+ return Math.max(Number(renderer.prop("minimum_zoom", 0.65)), Math.min(Number(renderer.prop("maximum_zoom", 3.2)), Number(value)));
23
+ }
24
+
25
+ function event(name, payload) {
26
+ if (renderer.subscribed(name))
27
+ renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, name, payload || {
28
+ });
29
+
30
+ }
31
+
32
+ function sendRotation() {
33
+ event("rotation_change", {
34
+ "x": currentPitch,
35
+ "y": currentYaw,
36
+ "z": currentRoll
37
+ });
38
+ }
39
+
40
+ function setZoom(value, notify) {
41
+ currentZoom = clampZoom(value);
42
+ if (notify)
43
+ event("zoom_change", {
44
+ "value": currentZoom
45
+ });
46
+
47
+ }
48
+
49
+ function resetView(notify) {
50
+ currentPitch = Number(renderer.prop("rotation_x", 0));
51
+ currentYaw = Number(renderer.prop("rotation_y", 0));
52
+ currentRoll = Number(renderer.prop("rotation_z", 0));
53
+ setZoom(Number(renderer.prop("zoom", 1)), notify);
54
+ if (notify)
55
+ sendRotation();
56
+
57
+ }
58
+
59
+ function updateBounds() {
60
+ var bounds = runtimeModel.bounds;
61
+ var size = Qt.vector3d(bounds.maximum.x - bounds.minimum.x, bounds.maximum.y - bounds.minimum.y, bounds.maximum.z - bounds.minimum.z);
62
+ var diameter = Math.max(size.x, size.y, size.z);
63
+ boundsDiameter = diameter;
64
+ if (!isFinite(diameter) || diameter <= 0) {
65
+ fittedScale = Number(renderer.prop("model_scale", 1));
66
+ modelCenter = Qt.vector3d(Number(renderer.prop("center_x", 0)), Number(renderer.prop("center_y", 0)), Number(renderer.prop("center_z", 0)));
67
+ return ;
68
+ }
69
+ modelCenter = Qt.vector3d((bounds.maximum.x + bounds.minimum.x) / 2, (bounds.maximum.y + bounds.minimum.y) / 2, (bounds.maximum.z + bounds.minimum.z) / 2);
70
+ var requestedScale = Number(renderer.prop("model_scale", 0));
71
+ fittedScale = requestedScale > 0 ? requestedScale : Number(renderer.prop("fit_size", 230)) / diameter;
72
+ }
73
+
74
+ function syncFromRenderer() {
75
+ var revision = Number(renderer.prop("reset_revision", 0));
76
+ if (revision !== observedResetRevision) {
77
+ observedResetRevision = revision;
78
+ resetView(false);
79
+ return ;
80
+ }
81
+ if (!orbitDrag.active) {
82
+ currentPitch = Number(renderer.prop("rotation_x", currentPitch));
83
+ currentYaw = Number(renderer.prop("rotation_y", currentYaw));
84
+ currentRoll = Number(renderer.prop("rotation_z", currentRoll));
85
+ }
86
+ if (!zoomPinch.active)
87
+ setZoom(Number(renderer.prop("zoom", currentZoom)), false);
88
+
89
+ }
90
+
91
+ function synchronizeModelSource() {
92
+ var requestedSource = String(renderer.assetUrl(renderer.prop("source", "")));
93
+ if (requestedSource === loadedModelSource)
94
+ return ;
95
+
96
+ ready = false;
97
+ loadedModelSource = requestedSource;
98
+ runtimeModel.source = requestedSource;
99
+ }
100
+
101
+ implicitWidth: Number(renderer.prop("width", 420))
102
+ implicitHeight: Number(renderer.prop("height", 420))
103
+ clip: true
104
+ Component.onCompleted: {
105
+ synchronizeModelSource();
106
+ syncFromRenderer();
107
+ }
108
+
109
+ Rectangle {
110
+ anchors.fill: parent
111
+ color: renderer.prop("background", "transparent")
112
+ }
113
+
114
+ View3D {
115
+ id: scene
116
+
117
+ anchors.fill: parent
118
+
119
+ PerspectiveCamera {
120
+ id: camera
121
+
122
+ z: Number(renderer.prop("camera_distance", 460))
123
+ fieldOfView: Number(renderer.prop("field_of_view", 36))
124
+ clipNear: 0.5
125
+ clipFar: 5000
126
+ }
127
+
128
+ DirectionalLight {
129
+ eulerRotation: Qt.vector3d(-28, -34, 0)
130
+ color: renderer.prop("key_light_color", "#ffffff")
131
+ brightness: Number(renderer.prop("light_brightness", 1.35))
132
+ castsShadow: true
133
+ shadowFactor: 70
134
+ shadowMapQuality: Light.ShadowMapQualityHigh
135
+ }
136
+
137
+ PointLight {
138
+ position: Qt.vector3d(-180, 90, 240)
139
+ color: renderer.prop("fill_light_color", "#ffffff")
140
+ brightness: Number(renderer.prop("light_brightness", 1.35)) * 5
141
+ quadraticFade: 2e-05
142
+ linearFade: 0.003
143
+ }
144
+
145
+ Node {
146
+ id: orbitNode
147
+
148
+ eulerRotation: Qt.vector3d(modelViewRoot.currentPitch, modelViewRoot.currentYaw + modelViewRoot.automaticYaw, modelViewRoot.currentRoll)
149
+ scale: Qt.vector3d(modelViewRoot.fittedScale * modelViewRoot.currentZoom, modelViewRoot.fittedScale * modelViewRoot.currentZoom, modelViewRoot.fittedScale * modelViewRoot.currentZoom)
150
+
151
+ RuntimeLoader {
152
+ id: runtimeModel
153
+
154
+ source: ""
155
+ position: Qt.vector3d(-modelViewRoot.modelCenter.x, -modelViewRoot.modelCenter.y, -modelViewRoot.modelCenter.z)
156
+ onBoundsChanged: modelViewRoot.updateBounds()
157
+ onStatusChanged: {
158
+ modelViewRoot.event("status", {
159
+ "value": status,
160
+ "error": errorString
161
+ });
162
+ if (status === RuntimeLoader.Success) {
163
+ modelViewRoot.ready = true;
164
+ modelViewRoot.updateBounds();
165
+ modelViewRoot.event("loaded", {
166
+ "source": source,
167
+ "width": bounds.maximum.x - bounds.minimum.x,
168
+ "height": bounds.maximum.y - bounds.minimum.y,
169
+ "depth": bounds.maximum.z - bounds.minimum.z
170
+ });
171
+ } else if (status === RuntimeLoader.Error) {
172
+ modelViewRoot.ready = false;
173
+ renderer.componentError("model_load_failed", errorString, {
174
+ "source": source,
175
+ "status": status
176
+ });
177
+ }
178
+ }
179
+ }
180
+
181
+ }
182
+
183
+ environment: SceneEnvironment {
184
+ backgroundMode: SceneEnvironment.Transparent
185
+ antialiasingMode: String(renderer.prop("antialiasing", "msaa")) === "none" ? SceneEnvironment.NoAA : SceneEnvironment.MSAA
186
+ antialiasingQuality: SceneEnvironment.VeryHigh
187
+ temporalAAEnabled: false
188
+ aoStrength: 45
189
+ aoDistance: 12
190
+ tonemapMode: SceneEnvironment.TonemapModeAces
191
+ }
192
+
193
+ }
194
+
195
+ DragHandler {
196
+ id: orbitDrag
197
+
198
+ property real startingPitch: 0
199
+ property real startingYaw: 0
200
+
201
+ enabled: renderer.prop("interactive", true) !== false
202
+ target: null
203
+ acceptedButtons: Qt.LeftButton
204
+ onActiveChanged: {
205
+ if (active) {
206
+ startingPitch = modelViewRoot.currentPitch;
207
+ startingYaw = modelViewRoot.currentYaw;
208
+ } else {
209
+ modelViewRoot.sendRotation();
210
+ }
211
+ }
212
+ onTranslationChanged: {
213
+ if (!active)
214
+ return ;
215
+
216
+ modelViewRoot.currentYaw = startingYaw + translation.x * 0.48;
217
+ modelViewRoot.currentPitch = Math.max(-88, Math.min(88, startingPitch - translation.y * 0.42));
218
+ }
219
+ }
220
+
221
+ PinchHandler {
222
+ id: zoomPinch
223
+
224
+ property real startingZoom: 1
225
+
226
+ enabled: renderer.prop("interactive", true) !== false
227
+ target: null
228
+ minimumScale: Number(renderer.prop("minimum_zoom", 0.65))
229
+ maximumScale: Number(renderer.prop("maximum_zoom", 3.2))
230
+ onActiveChanged: {
231
+ if (active)
232
+ startingZoom = modelViewRoot.currentZoom;
233
+ else
234
+ modelViewRoot.event("zoom_change", {
235
+ "value": modelViewRoot.currentZoom
236
+ });
237
+ }
238
+ onActiveScaleChanged: {
239
+ if (active)
240
+ modelViewRoot.setZoom(startingZoom * activeScale, false);
241
+
242
+ }
243
+ }
244
+
245
+ WheelHandler {
246
+ id: zoomWheel
247
+
248
+ enabled: renderer.prop("interactive", true) !== false
249
+ acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
250
+ onWheel: function(event) {
251
+ modelViewRoot.setZoom(modelViewRoot.currentZoom * Math.exp(event.angleDelta.y / 900), true);
252
+ event.accepted = true;
253
+ }
254
+ }
255
+
256
+ TapHandler {
257
+ acceptedButtons: Qt.LeftButton
258
+ gesturePolicy: TapHandler.DragThreshold
259
+ onTapped: function(eventPoint) {
260
+ modelViewRoot.event("click", {
261
+ "x": eventPoint.position.x,
262
+ "y": eventPoint.position.y
263
+ });
264
+ }
265
+ onDoubleTapped: function(eventPoint) {
266
+ modelViewRoot.setZoom(modelViewRoot.currentZoom + 0.55, true);
267
+ modelViewRoot.event("double_click", {
268
+ "x": eventPoint.position.x,
269
+ "y": eventPoint.position.y,
270
+ "zoom": modelViewRoot.currentZoom
271
+ });
272
+ }
273
+ }
274
+
275
+ Connections {
276
+ function onNodeChanged() {
277
+ modelViewRoot.synchronizeModelSource();
278
+ modelViewRoot.syncFromRenderer();
279
+ }
280
+
281
+ target: renderer
282
+ }
283
+
284
+ NumberAnimation on automaticYaw {
285
+ from: 0
286
+ to: 360
287
+ duration: Math.max(1000, Math.round(360000 / Math.max(0.1, Number(renderer.prop("auto_rotate_speed", 4)))))
288
+ loops: Animation.Infinite
289
+ running: renderer.prop("auto_rotate", false) === true && !orbitDrag.active
290
+ }
291
+
292
+ }
@@ -0,0 +1,5 @@
1
+ .pragma library
2
+
3
+ // Optional QML modules are probed lazily. Remember a failed probe so state patches do not
4
+ // repeatedly ask the engine to import the same unavailable module.
5
+ var quick3dUnavailable = false
@@ -0,0 +1,231 @@
1
+ import QtQuick
2
+ import QtQuick.Controls as QQC
3
+ import QtQuick.Layouts
4
+ import "../../Theme"
5
+
6
+ QQC.SwipeDelegate {
7
+ id: swipeRoot
8
+
9
+ required property var renderer
10
+ readonly property bool selected: renderer.prop("selected", false) === true
11
+ readonly property bool hasLeftAction: String(renderer.prop("left_action", "")).length > 0
12
+ || String(renderer.prop("left_icon", "")).length > 0
13
+ readonly property bool hasRightAction: String(renderer.prop("right_action", "")).length > 0
14
+ || String(renderer.prop("right_icon", "")).length > 0
15
+ readonly property string requestedSide: String(renderer.prop("opened_side", "none"))
16
+
17
+ function eventPayload() {
18
+ return {
19
+ text: text,
20
+ value: renderer.prop("value", text),
21
+ selected: selected
22
+ }
23
+ }
24
+
25
+ function actionPayload(side) {
26
+ var isLeft = side === "left"
27
+ return {
28
+ side: side,
29
+ action: String(renderer.prop(isLeft ? "left_action" : "right_action", "")),
30
+ value: renderer.prop(isLeft ? "left_value" : "right_value",
31
+ renderer.prop("value", text)),
32
+ item_value: renderer.prop("value", text)
33
+ }
34
+ }
35
+
36
+ function triggerAction(side) {
37
+ renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
38
+ side === "left" ? "left_action" : "right_action", actionPayload(side))
39
+ if (renderer.prop("close_on_action", true) !== false) swipe.close()
40
+ }
41
+
42
+ function syncOpenedSide() {
43
+ if (!swipe.enabled) return
44
+ if (requestedSide === "left" && hasLeftAction) swipe.open(QQC.SwipeDelegate.Left)
45
+ else if (requestedSide === "right" && hasRightAction) swipe.open(QQC.SwipeDelegate.Right)
46
+ else if (requestedSide === "none" || requestedSide === "closed") swipe.close()
47
+ }
48
+
49
+ text: String(renderer.prop("text", ""))
50
+ highlighted: renderer.prop("highlighted", selected) === true
51
+ enabled: renderer.prop("enabled", true) !== false
52
+ visible: renderer.prop("visible", true) !== false
53
+ hoverEnabled: true
54
+ implicitWidth: Number(renderer.prop("width", 360))
55
+ implicitHeight: Number(renderer.prop("height", 60))
56
+ padding: Number(renderer.prop("padding", Style.spacing.md))
57
+ font.family: String(renderer.prop("font_family", renderer.fontFamily))
58
+ font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
59
+ Accessible.name: String(renderer.prop("accessible_name", text))
60
+
61
+ swipe.enabled: renderer.prop("swipe_enabled", true) !== false
62
+ swipe.left: hasLeftAction ? leftActionComponent : null
63
+ swipe.right: hasRightAction ? rightActionComponent : null
64
+ swipe.transition: Transition {
65
+ NumberAnimation {
66
+ properties: "x"
67
+ duration: renderer.prop("animated", true) !== false
68
+ ? Number(renderer.prop("duration", 180)) : 0
69
+ easing.type: Easing.InOutCubic
70
+ }
71
+ }
72
+
73
+ background: Rectangle {
74
+ color: swipeRoot.highlighted
75
+ ? renderer.prop("highlighted_background", renderer.prop("selected_background", Color.popups.background))
76
+ : (swipeRoot.selected
77
+ ? renderer.prop("selected_background", Color.popups.background)
78
+ : renderer.prop("background", Color.background))
79
+ radius: Number(renderer.prop("radius", Style.cornerRadius))
80
+ border.width: Number(renderer.prop("border_width",
81
+ String(renderer.prop("border_color", "")).length > 0 ? Style.normalBorderWidth : 0))
82
+ border.color: renderer.prop("border_color", "transparent")
83
+ }
84
+
85
+ contentItem: RowLayout {
86
+ spacing: Number(renderer.prop("spacing", Style.spacing.md))
87
+
88
+ Image {
89
+ Layout.preferredWidth: Number(renderer.prop("icon_size", 22))
90
+ Layout.preferredHeight: Number(renderer.prop("icon_size", 22))
91
+ Layout.alignment: Qt.AlignVCenter
92
+ visible: source.toString().length > 0
93
+ source: String(renderer.prop("icon_source", ""))
94
+ fillMode: Image.PreserveAspectFit
95
+ onStatusChanged: {
96
+ if (status === Image.Error)
97
+ renderer.componentError("swipe_delegate_icon_failed",
98
+ "Unable to load the declared swipe delegate icon image", { source: String(source) })
99
+ }
100
+ }
101
+
102
+ Text {
103
+ Layout.preferredWidth: Number(renderer.prop("icon_size", 22))
104
+ Layout.alignment: Qt.AlignVCenter
105
+ visible: text.length > 0 && String(renderer.prop("icon_source", "")).length === 0
106
+ text: String(renderer.prop("icon", "")).length > 0
107
+ ? renderer.iconGlyph(renderer.prop("icon", "")) : ""
108
+ color: renderer.prop("icon_color", renderer.prop("foreground", renderer.foreground))
109
+ font.family: renderer.fontFamily
110
+ font.pixelSize: Number(renderer.prop("icon_size", 22))
111
+ horizontalAlignment: Text.AlignHCenter
112
+ }
113
+
114
+ ColumnLayout {
115
+ Layout.fillWidth: true
116
+ spacing: Style.spacing.xs
117
+ Text {
118
+ Layout.fillWidth: true
119
+ text: swipeRoot.text
120
+ color: swipeRoot.selected
121
+ ? renderer.prop("selected_foreground", renderer.prop("foreground", renderer.foreground))
122
+ : renderer.prop("foreground", renderer.foreground)
123
+ font: swipeRoot.font
124
+ elide: Text.ElideRight
125
+ }
126
+ Text {
127
+ Layout.fillWidth: true
128
+ visible: text.length > 0
129
+ text: String(renderer.prop("description", ""))
130
+ color: renderer.prop("muted", Color.muted)
131
+ font.family: String(renderer.prop("font_family", renderer.fontFamily))
132
+ font.pixelSize: Number(renderer.prop("description_size", Style.font.caption))
133
+ elide: Text.ElideRight
134
+ }
135
+ }
136
+ }
137
+
138
+ Component {
139
+ id: leftActionComponent
140
+ Rectangle {
141
+ implicitWidth: Number(renderer.prop("action_width", 96))
142
+ color: renderer.prop("left_color", renderer.prop("accent", Color.accent))
143
+ Row {
144
+ anchors.centerIn: parent
145
+ spacing: Style.spacing.sm
146
+ Text {
147
+ visible: text.length > 0
148
+ text: renderer.iconGlyph(renderer.prop("left_icon", ""))
149
+ color: Color.background
150
+ font.family: renderer.fontFamily
151
+ font.pixelSize: Number(renderer.prop("icon_size", 22))
152
+ }
153
+ Text {
154
+ visible: text.length > 0
155
+ text: String(renderer.prop("left_action", ""))
156
+ color: Color.background
157
+ font.family: String(renderer.prop("font_family", renderer.fontFamily))
158
+ font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
159
+ }
160
+ }
161
+ QQC.SwipeDelegate.onClicked: swipeRoot.triggerAction("left")
162
+ }
163
+ }
164
+
165
+ Component {
166
+ id: rightActionComponent
167
+ Rectangle {
168
+ implicitWidth: Number(renderer.prop("action_width", 96))
169
+ color: renderer.prop("right_color", Color.urgent)
170
+ Row {
171
+ anchors.centerIn: parent
172
+ spacing: Style.spacing.sm
173
+ Text {
174
+ visible: text.length > 0
175
+ text: renderer.iconGlyph(renderer.prop("right_icon", ""))
176
+ color: Color.background
177
+ font.family: renderer.fontFamily
178
+ font.pixelSize: Number(renderer.prop("icon_size", 22))
179
+ }
180
+ Text {
181
+ visible: text.length > 0
182
+ text: String(renderer.prop("right_action", ""))
183
+ color: Color.background
184
+ font.family: String(renderer.prop("font_family", renderer.fontFamily))
185
+ font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
186
+ }
187
+ }
188
+ QQC.SwipeDelegate.onClicked: swipeRoot.triggerAction("right")
189
+ }
190
+ }
191
+
192
+ Connections {
193
+ target: swipeRoot.swipe
194
+ function onPositionChanged() {
195
+ renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "swipe_position", {
196
+ value: swipeRoot.swipe.position,
197
+ side: swipeRoot.swipe.position > 0 ? "left" : (swipeRoot.swipe.position < 0 ? "right" : "none")
198
+ })
199
+ }
200
+ function onCompleted() {
201
+ renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "swipe_complete", {
202
+ position: swipeRoot.swipe.position,
203
+ side: swipeRoot.swipe.position > 0 ? "left" : "right"
204
+ })
205
+ }
206
+ function onOpened() {
207
+ renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "swipe_open", {
208
+ side: swipeRoot.swipe.position > 0 ? "left" : "right"
209
+ })
210
+ }
211
+ function onClosed() {
212
+ renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "swipe_close", {})
213
+ }
214
+ }
215
+
216
+ Component.onCompleted: syncOpenedSide()
217
+ onRequestedSideChanged: syncOpenedSide()
218
+ onClicked: {
219
+ var payload = eventPayload()
220
+ renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "click", payload)
221
+ renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "activate", payload)
222
+ }
223
+ onPressed: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "press", eventPayload())
224
+ onReleased: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "release", eventPayload())
225
+ onHoveredChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
226
+ "hover", { value: hovered })
227
+ onActiveFocusChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
228
+ activeFocus ? "focus" : "blur", {})
229
+ onVisibleChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
230
+ visible ? "show" : "hide", {})
231
+ }
@@ -0,0 +1,69 @@
1
+ import QtQuick
2
+ import QtQuick.Controls as QQC
3
+ import "../../Theme"
4
+
5
+ QQC.SwipeView {
6
+ id: swipeRoot
7
+
8
+ required property var renderer
9
+ readonly property int requestedIndex: Number(renderer.prop("current_index", 0))
10
+ property bool synchronizing: false
11
+ property bool initialized: false
12
+
13
+ function boundedIndex(value) {
14
+ return count === 0 ? -1 : Math.max(0, Math.min(count - 1, Number(value)))
15
+ }
16
+
17
+ function syncSelection() {
18
+ var next = boundedIndex(requestedIndex)
19
+ if (currentIndex === next) return
20
+ synchronizing = true
21
+ currentIndex = next
22
+ synchronizing = false
23
+ }
24
+
25
+ implicitWidth: Number(renderer.prop("width", 640))
26
+ implicitHeight: Number(renderer.prop("height", 420))
27
+ enabled: renderer.prop("enabled", true) !== false
28
+ visible: renderer.prop("visible", true) !== false
29
+ interactive: renderer.prop("interactive", true) !== false
30
+ orientation: String(renderer.prop("orientation", "horizontal")) === "vertical"
31
+ ? Qt.Vertical : Qt.Horizontal
32
+ clip: renderer.prop("clip", true) !== false
33
+ LayoutMirroring.enabled: String(renderer.prop("layout_direction", "left_to_right")) === "right_to_left"
34
+ LayoutMirroring.childrenInherit: true
35
+
36
+ background: Rectangle {
37
+ color: renderer.prop("background", Color.background)
38
+ radius: Number(renderer.prop("radius", 0))
39
+ border.width: String(renderer.prop("border_color", "")).length > 0 ? Style.normalBorderWidth : 0
40
+ border.color: renderer.prop("border_color", "transparent")
41
+ }
42
+
43
+ Repeater {
44
+ model: renderer.node.children || []
45
+ delegate: renderer.childDelegateComponent
46
+ }
47
+
48
+ Component.onCompleted: {
49
+ initialized = true
50
+ syncSelection()
51
+ }
52
+ onRequestedIndexChanged: syncSelection()
53
+ onCountChanged: {
54
+ syncSelection()
55
+ if (initialized && renderer.subscribed("count_change"))
56
+ renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "count_change", { value: count })
57
+ }
58
+ onCurrentIndexChanged: {
59
+ if (synchronizing || currentIndex < 0) return
60
+ if (renderer.subscribed("input"))
61
+ renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "input", { value: currentIndex })
62
+ if (renderer.subscribed("change"))
63
+ renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", { value: currentIndex })
64
+ }
65
+ onVisibleChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
66
+ visible ? "show" : "hide", {})
67
+ onActiveFocusChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
68
+ activeFocus ? "focus" : "blur", {})
69
+ }