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.
- checksums.yaml +7 -0
- data/Components/Builtins/Accordion.qml +208 -0
- data/Components/Builtins/Action.qml +43 -0
- data/Components/Builtins/ActionButton.qml +19 -0
- data/Components/Builtins/ActionGroup.qml +81 -0
- data/Components/Builtins/AlertDialog.qml +398 -0
- data/Components/Builtins/AnchorAnimation.qml +3 -0
- data/Components/Builtins/AnchorChanges.qml +11 -0
- data/Components/Builtins/AnimatedImage.qml +39 -0
- data/Components/Builtins/Animation.qml +3 -0
- data/Components/Builtins/AnimationController.qml +11 -0
- data/Components/Builtins/ApplicationWindow.qml +103 -0
- data/Components/Builtins/AreaChart.qml +70 -0
- data/Components/Builtins/AspectRatio.qml +30 -0
- data/Components/Builtins/Audio.qml +85 -0
- data/Components/Builtins/AudioInput.qml +10 -0
- data/Components/Builtins/AudioOutput.qml +10 -0
- data/Components/Builtins/Avatar.qml +46 -0
- data/Components/Builtins/Badge.qml +38 -0
- data/Components/Builtins/Banner.qml +133 -0
- data/Components/Builtins/BarChart.qml +67 -0
- data/Components/Builtins/BarIconButton.qml +30 -0
- data/Components/Builtins/BarIndicator.qml +26 -0
- data/Components/Builtins/Behavior.qml +13 -0
- data/Components/Builtins/Blur.qml +14 -0
- data/Components/Builtins/BorderImage.qml +38 -0
- data/Components/Builtins/BorderOverlay.qml +25 -0
- data/Components/Builtins/BottomSheet.qml +211 -0
- data/Components/Builtins/Breadcrumb.qml +169 -0
- data/Components/Builtins/BubbleChart.qml +3 -0
- data/Components/Builtins/BusyIndicator.qml +24 -0
- data/Components/Builtins/Button.qml +55 -0
- data/Components/Builtins/ButtonGroup.qml +18 -0
- data/Components/Builtins/Calendar.qml +55 -0
- data/Components/Builtins/Camera.qml +18 -0
- data/Components/Builtins/CandlestickChart.qml +3 -0
- data/Components/Builtins/Canvas.qml +159 -0
- data/Components/Builtins/CaptureSession.qml +19 -0
- data/Components/Builtins/Card.qml +23 -0
- data/Components/Builtins/Carousel.qml +72 -0
- data/Components/Builtins/Center.qml +20 -0
- data/Components/Builtins/CheckDelegate.qml +132 -0
- data/Components/Builtins/Checkbox.qml +62 -0
- data/Components/Builtins/Chip.qml +65 -0
- data/Components/Builtins/Circle.qml +35 -0
- data/Components/Builtins/Clipboard.qml +29 -0
- data/Components/Builtins/ColorAnimation.qml +3 -0
- data/Components/Builtins/ColorPicker.qml +70 -0
- data/Components/Builtins/Colorize.qml +14 -0
- data/Components/Builtins/Column.qml +17 -0
- data/Components/Builtins/ColumnLayout.qml +13 -0
- data/Components/Builtins/ConfirmDialog.qml +20 -0
- data/Components/Builtins/ConstrainedBox.qml +28 -0
- data/Components/Builtins/Container.qml +30 -0
- data/Components/Builtins/ContextMenu.qml +140 -0
- data/Components/Builtins/CursorSurface.qml +18 -0
- data/Components/Builtins/DataTable.qml +69 -0
- data/Components/Builtins/DatePicker.qml +180 -0
- data/Components/Builtins/DayOfWeekRow.qml +11 -0
- data/Components/Builtins/DelayButton.qml +47 -0
- data/Components/Builtins/DelegateModel.qml +10 -0
- data/Components/Builtins/DelegateModelGroup.qml +10 -0
- data/Components/Builtins/Dial.qml +42 -0
- data/Components/Builtins/Dialog.qml +128 -0
- data/Components/Builtins/DialogButtonBox.qml +137 -0
- data/Components/Builtins/Divider.qml +26 -0
- data/Components/Builtins/DonutChart.qml +3 -0
- data/Components/Builtins/DoubleSpinBox.qml +58 -0
- data/Components/Builtins/DragArea.qml +43 -0
- data/Components/Builtins/Drawer.qml +107 -0
- data/Components/Builtins/DropArea.qml +19 -0
- data/Components/Builtins/DropShadow.qml +16 -0
- data/Components/Builtins/Dropdown.qml +19 -0
- data/Components/Builtins/ExpansionPanel.qml +157 -0
- data/Components/Builtins/FilePicker.qml +140 -0
- data/Components/Builtins/FittedBox.qml +40 -0
- data/Components/Builtins/Flickable.qml +40 -0
- data/Components/Builtins/Flipable.qml +45 -0
- data/Components/Builtins/Flow.qml +16 -0
- data/Components/Builtins/FocusScope.qml +29 -0
- data/Components/Builtins/FolderListModel.qml +9 -0
- data/Components/Builtins/FolderPicker.qml +93 -0
- data/Components/Builtins/FontLoader.qml +21 -0
- data/Components/Builtins/FontPicker.qml +91 -0
- data/Components/Builtins/Frame.qml +71 -0
- data/Components/Builtins/FrameAnimation.qml +13 -0
- data/Components/Builtins/Gauge.qml +3 -0
- data/Components/Builtins/Glow.qml +15 -0
- data/Components/Builtins/Gradient.qml +93 -0
- data/Components/Builtins/Grid.qml +16 -0
- data/Components/Builtins/GridLayout.qml +16 -0
- data/Components/Builtins/GridView.qml +226 -0
- data/Components/Builtins/GroupBox.qml +95 -0
- data/Components/Builtins/Heatmap.qml +3 -0
- data/Components/Builtins/Histogram.qml +3 -0
- data/Components/Builtins/HorizontalHeader.qml +23 -0
- data/Components/Builtins/HorizontalHeaderDelegate.qml +39 -0
- data/Components/Builtins/HoverArea.qml +19 -0
- data/Components/Builtins/Icon.qml +16 -0
- data/Components/Builtins/Image.qml +110 -0
- data/Components/Builtins/ImageCapture.qml +14 -0
- data/Components/Builtins/ItemDelegate.qml +152 -0
- data/Components/Builtins/KeyCatcher.qml +25 -0
- data/Components/Builtins/Label.qml +43 -0
- data/Components/Builtins/LayoutItemProxy.qml +51 -0
- data/Components/Builtins/Legend.qml +86 -0
- data/Components/Builtins/Line.qml +28 -0
- data/Components/Builtins/LineChart.qml +87 -0
- data/Components/Builtins/ListModel.qml +8 -0
- data/Components/Builtins/ListView.qml +65 -0
- data/Components/Builtins/Loader.qml +33 -0
- data/Components/Builtins/Markdown.qml +23 -0
- data/Components/Builtins/MediaDevices.qml +10 -0
- data/Components/Builtins/MediaPlayer.qml +27 -0
- data/Components/Builtins/MediaRecorder.qml +16 -0
- data/Components/Builtins/Menu.qml +119 -0
- data/Components/Builtins/MenuBar.qml +128 -0
- data/Components/Builtins/MenuItem.qml +77 -0
- data/Components/Builtins/MenuSeparator.qml +30 -0
- data/Components/Builtins/MessageDialog.qml +104 -0
- data/Components/Builtins/ModalSheet.qml +222 -0
- data/Components/Builtins/ModelView3d.qml +50 -0
- data/Components/Builtins/MonthGrid.qml +23 -0
- data/Components/Builtins/MultiEffect.qml +48 -0
- data/Components/Builtins/MultiSelect.qml +23 -0
- data/Components/Builtins/NavigationRail.qml +154 -0
- data/Components/Builtins/NumberAnimation.qml +3 -0
- data/Components/Builtins/NumberField.qml +18 -0
- data/Components/Builtins/OpacityAnimator.qml +3 -0
- data/Components/Builtins/OpacityMask.qml +21 -0
- data/Components/Builtins/OpticalGlyph.qml +16 -0
- data/Components/Builtins/Page.qml +111 -0
- data/Components/Builtins/PageIndicator.qml +63 -0
- data/Components/Builtins/Pagination.qml +158 -0
- data/Components/Builtins/Pane.qml +72 -0
- data/Components/Builtins/PanelHero.qml +15 -0
- data/Components/Builtins/ParallelAnimation.qml +3 -0
- data/Components/Builtins/ParentAnimation.qml +3 -0
- data/Components/Builtins/ParentChange.qml +10 -0
- data/Components/Builtins/ParticleSystem.qml +81 -0
- data/Components/Builtins/PasswordField.qml +58 -0
- data/Components/Builtins/Path.qml +35 -0
- data/Components/Builtins/PathAnimation.qml +3 -0
- data/Components/Builtins/PauseAnimation.qml +3 -0
- data/Components/Builtins/PieChart.qml +3 -0
- data/Components/Builtins/PinchArea.qml +23 -0
- data/Components/Builtins/Popup.qml +130 -0
- data/Components/Builtins/Progress.qml +15 -0
- data/Components/Builtins/ProgressRing.qml +120 -0
- data/Components/Builtins/PropertyAction.qml +11 -0
- data/Components/Builtins/PropertyAnimation.qml +3 -0
- data/Components/Builtins/PropertyChanges.qml +10 -0
- data/Components/Builtins/RadarChart.qml +3 -0
- data/Components/Builtins/RadialGauge.qml +3 -0
- data/Components/Builtins/RadioButton.qml +46 -0
- data/Components/Builtins/RadioDelegate.qml +115 -0
- data/Components/Builtins/RadioGroup.qml +58 -0
- data/Components/Builtins/RangeSlider.qml +39 -0
- data/Components/Builtins/Rectangle.qml +23 -0
- data/Components/Builtins/RectangularShadow.qml +23 -0
- data/Components/Builtins/ReorderableList.qml +204 -0
- data/Components/Builtins/RichText.qml +23 -0
- data/Components/Builtins/RotationAnimation.qml +3 -0
- data/Components/Builtins/RotationAnimator.qml +3 -0
- data/Components/Builtins/RoundButton.qml +42 -0
- data/Components/Builtins/Row.qml +17 -0
- data/Components/Builtins/RowLayout.qml +13 -0
- data/Components/Builtins/ScaleAnimator.qml +3 -0
- data/Components/Builtins/ScatterChart.qml +3 -0
- data/Components/Builtins/ScreenCapture.qml +78 -0
- data/Components/Builtins/ScriptAction.qml +15 -0
- data/Components/Builtins/Scroll.qml +18 -0
- data/Components/Builtins/ScrollBar.qml +18 -0
- data/Components/Builtins/ScrollIndicator.qml +15 -0
- data/Components/Builtins/SearchField.qml +178 -0
- data/Components/Builtins/SearchableDropdown.qml +21 -0
- data/Components/Builtins/SectionHeader.qml +14 -0
- data/Components/Builtins/SelectableText.qml +33 -0
- data/Components/Builtins/SelectionRectangle.qml +17 -0
- data/Components/Builtins/Separator.qml +13 -0
- data/Components/Builtins/SequentialAnimation.qml +3 -0
- data/Components/Builtins/Settings.qml +10 -0
- data/Components/Builtins/ShaderEffect.qml +115 -0
- data/Components/Builtins/ShaderEffectSource.qml +61 -0
- data/Components/Builtins/Shaders/grayscale.frag +14 -0
- data/Components/Builtins/Shaders/grayscale.frag.qsb +0 -0
- data/Components/Builtins/Shaders/passthrough.frag +11 -0
- data/Components/Builtins/Shaders/passthrough.frag.qsb +0 -0
- data/Components/Builtins/Shaders/pixelate.frag +16 -0
- data/Components/Builtins/Shaders/pixelate.frag.qsb +0 -0
- data/Components/Builtins/Shaders/vignette.frag +18 -0
- data/Components/Builtins/Shaders/vignette.frag.qsb +0 -0
- data/Components/Builtins/Shaders/wave.frag +18 -0
- data/Components/Builtins/Shaders/wave.frag.qsb +0 -0
- data/Components/Builtins/Shape.qml +53 -0
- data/Components/Builtins/Skeleton.qml +78 -0
- data/Components/Builtins/Slider.qml +21 -0
- data/Components/Builtins/SmoothedAnimation.qml +3 -0
- data/Components/Builtins/Snackbar.qml +181 -0
- data/Components/Builtins/SortFilterProxyModel.qml +16 -0
- data/Components/Builtins/SoundEffect.qml +10 -0
- data/Components/Builtins/Spacer.qml +13 -0
- data/Components/Builtins/Sparkline.qml +3 -0
- data/Components/Builtins/SpinBox.qml +44 -0
- data/Components/Builtins/SplitView.qml +31 -0
- data/Components/Builtins/SpringAnimation.qml +3 -0
- data/Components/Builtins/Stack.qml +14 -0
- data/Components/Builtins/StackLayout.qml +19 -0
- data/Components/Builtins/StackView.qml +122 -0
- data/Components/Builtins/StackedBarChart.qml +3 -0
- data/Components/Builtins/StandardPaths.qml +9 -0
- data/Components/Builtins/State.qml +13 -0
- data/Components/Builtins/StateGroup.qml +11 -0
- data/Components/Builtins/Support/AnimationDriver.qml +79 -0
- data/Components/Builtins/Support/AnimationGroupDriver.qml +32 -0
- data/Components/Builtins/Support/ChartCanvas.qml +629 -0
- data/Components/Builtins/Support/ModelView3dScene.qml +292 -0
- data/Components/Builtins/Support/OptionalModuleState.js +5 -0
- data/Components/Builtins/SwipeDelegate.qml +231 -0
- data/Components/Builtins/SwipeView.qml +69 -0
- data/Components/Builtins/SwitchDelegate.qml +140 -0
- data/Components/Builtins/TabBar.qml +117 -0
- data/Components/Builtins/TabButton.qml +105 -0
- data/Components/Builtins/TableView.qml +388 -0
- data/Components/Builtins/TableViewDelegate.qml +17 -0
- data/Components/Builtins/Tabs.qml +138 -0
- data/Components/Builtins/Text.qml +24 -0
- data/Components/Builtins/TextArea.qml +59 -0
- data/Components/Builtins/TextField.qml +21 -0
- data/Components/Builtins/TextMetrics.qml +39 -0
- data/Components/Builtins/TimePicker.qml +213 -0
- data/Components/Builtins/Timer.qml +13 -0
- data/Components/Builtins/Toast.qml +213 -0
- data/Components/Builtins/Toggle.qml +19 -0
- data/Components/Builtins/ToggleSwitch.qml +22 -0
- data/Components/Builtins/ToolBar.qml +61 -0
- data/Components/Builtins/ToolButton.qml +41 -0
- data/Components/Builtins/ToolSeparator.qml +36 -0
- data/Components/Builtins/Tooltip.qml +20 -0
- data/Components/Builtins/Transition.qml +3 -0
- data/Components/Builtins/TreeView.qml +423 -0
- data/Components/Builtins/TreeViewDelegate.qml +46 -0
- data/Components/Builtins/Tumbler.qml +18 -0
- data/Components/Builtins/UniformAnimator.qml +3 -0
- data/Components/Builtins/VectorAnimation.qml +3 -0
- data/Components/Builtins/VectorImage.qml +62 -0
- data/Components/Builtins/VerticalHeader.qml +21 -0
- data/Components/Builtins/VerticalHeaderDelegate.qml +35 -0
- data/Components/Builtins/Video.qml +54 -0
- data/Components/Builtins/VideoOutput.qml +54 -0
- data/Components/Builtins/WebView.qml +57 -0
- data/Components/Builtins/WeekNumberColumn.qml +13 -0
- data/Components/Builtins/WidgetButton.qml +26 -0
- data/Components/Builtins/Window.qml +90 -0
- data/Components/Builtins/WindowCapture.qml +11 -0
- data/Components/Builtins/Wrap.qml +18 -0
- data/Components/Builtins/XAnimator.qml +3 -0
- data/Components/Builtins/YAnimator.qml +3 -0
- data/Components/README.md +45 -0
- data/ControlNode.qml +1369 -0
- data/Controls/BarIconButton.qml +27 -0
- data/Controls/BarIndicator.qml +22 -0
- data/Controls/BorderOverlay.qml +10 -0
- data/Controls/BorderSurface.qml +10 -0
- data/Controls/Button.qml +78 -0
- data/Controls/ButtonGroup.qml +19 -0
- data/Controls/ConfirmDialog.qml +37 -0
- data/Controls/CursorSurface.qml +29 -0
- data/Controls/Dropdown.qml +59 -0
- data/Controls/MultiSelect.qml +32 -0
- data/Controls/NumberField.qml +24 -0
- data/Controls/OpticalGlyph.qml +14 -0
- data/Controls/PanelActionButton.qml +10 -0
- data/Controls/PanelHero.qml +18 -0
- data/Controls/PanelKeyCatcher.qml +25 -0
- data/Controls/PanelSectionHeader.qml +11 -0
- data/Controls/PanelSeparator.qml +10 -0
- data/Controls/PanelSlider.qml +36 -0
- data/Controls/PanelToolTip.qml +13 -0
- data/Controls/SearchableDropdown.qml +11 -0
- data/Controls/TextField.qml +25 -0
- data/Controls/Toggle.qml +22 -0
- data/Controls/ToggleSwitch.qml +26 -0
- data/Controls/WidgetButton.qml +35 -0
- data/Controls/qmldir +25 -0
- data/Desktop.qml +76 -0
- data/LICENSE +22 -0
- data/README.md +112 -0
- data/Service.qml +430 -0
- data/Theme/Border.qml +22 -0
- data/Theme/Color.qml +22 -0
- data/Theme/Style.qml +47 -0
- data/Theme/Util.qml +6 -0
- data/Theme/qmldir +5 -0
- data/bin/zui +7 -0
- data/lib/zui/animation.rb +24 -0
- data/lib/zui/application.rb +327 -0
- data/lib/zui/builder.rb +725 -0
- data/lib/zui/cli.rb +91 -0
- data/lib/zui/command.rb +101 -0
- data/lib/zui/component_registry.rb +91 -0
- data/lib/zui/components.rb +262 -0
- data/lib/zui/distribution.rb +200 -0
- data/lib/zui/generator.rb +84 -0
- data/lib/zui/host.rb +123 -0
- data/lib/zui/node.rb +30 -0
- data/lib/zui/platform.rb +40 -0
- data/lib/zui/protocol.rb +29 -0
- data/lib/zui/runner.rb +37 -0
- data/lib/zui/runtime.rb +23 -0
- data/lib/zui/scheduler.rb +136 -0
- data/lib/zui/source_bundle.rb +63 -0
- data/lib/zui/state_store.rb +100 -0
- data/lib/zui/value.rb +44 -0
- data/lib/zui.rb +33 -0
- data/native/CMakeLists.txt +45 -0
- data/native/ZuiClipboard.cpp +16 -0
- data/native/ZuiClipboard.h +16 -0
- data/native/ZuiProcess.cpp +84 -0
- data/native/ZuiProcess.h +34 -0
- data/native/main.cpp +64 -0
- data/vendor/host/linux-x86_64/PROVENANCE.md +15 -0
- data/vendor/host/linux-x86_64/zui-host +0 -0
- data/vendor/host/linux-x86_64/zui-host.sha256 +1 -0
- metadata +365 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import "../../Theme"
|
|
3
|
+
|
|
4
|
+
Item {
|
|
5
|
+
id: canvasRoot
|
|
6
|
+
required property var renderer
|
|
7
|
+
|
|
8
|
+
implicitWidth: Number(renderer.prop("width", 320))
|
|
9
|
+
implicitHeight: Number(renderer.prop("height", 200))
|
|
10
|
+
|
|
11
|
+
function styleValue(context, value) {
|
|
12
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return value
|
|
13
|
+
var kind = String(value.type || "linear")
|
|
14
|
+
var gradient
|
|
15
|
+
if (kind === "radial") {
|
|
16
|
+
gradient = context.createRadialGradient(
|
|
17
|
+
Number(value.x0 || 0), Number(value.y0 || 0), Number(value.r0 || 0),
|
|
18
|
+
Number(value.x1 === undefined ? nativeCanvas.width : value.x1),
|
|
19
|
+
Number(value.y1 === undefined ? nativeCanvas.height : value.y1),
|
|
20
|
+
Number(value.r1 === undefined ? Math.max(nativeCanvas.width, nativeCanvas.height) : value.r1))
|
|
21
|
+
} else {
|
|
22
|
+
gradient = context.createLinearGradient(
|
|
23
|
+
Number(value.x0 || 0), Number(value.y0 || 0),
|
|
24
|
+
Number(value.x1 === undefined ? nativeCanvas.width : value.x1),
|
|
25
|
+
Number(value.y1 || 0))
|
|
26
|
+
}
|
|
27
|
+
var stops = Array.isArray(value.stops) ? value.stops : []
|
|
28
|
+
for (var index = 0; index < stops.length; index++) {
|
|
29
|
+
var stop = stops[index]
|
|
30
|
+
if (Array.isArray(stop)) gradient.addColorStop(Number(stop[0]), String(stop[1]))
|
|
31
|
+
else if (stop && typeof stop === "object") gradient.addColorStop(Number(stop.position), String(stop.color))
|
|
32
|
+
}
|
|
33
|
+
return gradient
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function applyStyle(context, command) {
|
|
37
|
+
if (command.fill_style !== undefined) context.fillStyle = styleValue(context, command.fill_style)
|
|
38
|
+
if (command.stroke_style !== undefined) context.strokeStyle = styleValue(context, command.stroke_style)
|
|
39
|
+
if (command.line_width !== undefined) context.lineWidth = Number(command.line_width)
|
|
40
|
+
if (command.line_cap !== undefined) context.lineCap = String(command.line_cap)
|
|
41
|
+
if (command.line_join !== undefined) context.lineJoin = String(command.line_join)
|
|
42
|
+
if (command.miter_limit !== undefined) context.miterLimit = Number(command.miter_limit)
|
|
43
|
+
if (command.alpha !== undefined) context.globalAlpha = Number(command.alpha)
|
|
44
|
+
if (command.composite !== undefined) context.globalCompositeOperation = String(command.composite)
|
|
45
|
+
if (command.font !== undefined) context.font = String(command.font)
|
|
46
|
+
if (command.text_align !== undefined) context.textAlign = String(command.text_align)
|
|
47
|
+
if (command.text_baseline !== undefined) context.textBaseline = String(command.text_baseline)
|
|
48
|
+
if (command.shadow_color !== undefined) context.shadowColor = String(command.shadow_color)
|
|
49
|
+
if (command.shadow_blur !== undefined) context.shadowBlur = Number(command.shadow_blur)
|
|
50
|
+
if (command.shadow_offset_x !== undefined) context.shadowOffsetX = Number(command.shadow_offset_x)
|
|
51
|
+
if (command.shadow_offset_y !== undefined) context.shadowOffsetY = Number(command.shadow_offset_y)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function roundedRect(context, command) {
|
|
55
|
+
var x = Number(command.x || 0)
|
|
56
|
+
var y = Number(command.y || 0)
|
|
57
|
+
var width = Number(command.width || 0)
|
|
58
|
+
var height = Number(command.height || 0)
|
|
59
|
+
var radius = Math.max(0, Math.min(Number(command.radius || 0), Math.min(Math.abs(width), Math.abs(height)) / 2))
|
|
60
|
+
context.moveTo(x + radius, y)
|
|
61
|
+
context.lineTo(x + width - radius, y)
|
|
62
|
+
context.quadraticCurveTo(x + width, y, x + width, y + radius)
|
|
63
|
+
context.lineTo(x + width, y + height - radius)
|
|
64
|
+
context.quadraticCurveTo(x + width, y + height, x + width - radius, y + height)
|
|
65
|
+
context.lineTo(x + radius, y + height)
|
|
66
|
+
context.quadraticCurveTo(x, y + height, x, y + height - radius)
|
|
67
|
+
context.lineTo(x, y + radius)
|
|
68
|
+
context.quadraticCurveTo(x, y, x + radius, y)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function draw(context, command) {
|
|
72
|
+
if (!command || typeof command !== "object") return
|
|
73
|
+
applyStyle(context, command)
|
|
74
|
+
var operation = String(command.op || command.type || "")
|
|
75
|
+
if (operation === "save") context.save()
|
|
76
|
+
else if (operation === "restore") context.restore()
|
|
77
|
+
else if (operation === "begin_path") context.beginPath()
|
|
78
|
+
else if (operation === "close_path") context.closePath()
|
|
79
|
+
else if (operation === "move_to") context.moveTo(Number(command.x || 0), Number(command.y || 0))
|
|
80
|
+
else if (operation === "line_to") context.lineTo(Number(command.x || 0), Number(command.y || 0))
|
|
81
|
+
else if (operation === "bezier_curve_to") context.bezierCurveTo(Number(command.cp1x || 0), Number(command.cp1y || 0), Number(command.cp2x || 0), Number(command.cp2y || 0), Number(command.x || 0), Number(command.y || 0))
|
|
82
|
+
else if (operation === "quadratic_curve_to") context.quadraticCurveTo(Number(command.cpx || 0), Number(command.cpy || 0), Number(command.x || 0), Number(command.y || 0))
|
|
83
|
+
else if (operation === "arc") context.arc(Number(command.x || 0), Number(command.y || 0), Number(command.radius || 0), Number(command.start_angle || 0), Number(command.end_angle === undefined ? Math.PI * 2 : command.end_angle), command.counterclockwise === true)
|
|
84
|
+
else if (operation === "arc_to") context.arcTo(Number(command.x1 || 0), Number(command.y1 || 0), Number(command.x2 || 0), Number(command.y2 || 0), Number(command.radius || 0))
|
|
85
|
+
else if (operation === "rect") context.rect(Number(command.x || 0), Number(command.y || 0), Number(command.width || 0), Number(command.height || 0))
|
|
86
|
+
else if (operation === "rounded_rect") roundedRect(context, command)
|
|
87
|
+
else if (operation === "fill") context.fill(String(command.fill_rule || "nonzero"))
|
|
88
|
+
else if (operation === "stroke") context.stroke()
|
|
89
|
+
else if (operation === "clip") context.clip()
|
|
90
|
+
else if (operation === "clear_rect") context.clearRect(Number(command.x || 0), Number(command.y || 0), Number(command.width === undefined ? nativeCanvas.width : command.width), Number(command.height === undefined ? nativeCanvas.height : command.height))
|
|
91
|
+
else if (operation === "fill_rect") context.fillRect(Number(command.x || 0), Number(command.y || 0), Number(command.width || 0), Number(command.height || 0))
|
|
92
|
+
else if (operation === "stroke_rect") context.strokeRect(Number(command.x || 0), Number(command.y || 0), Number(command.width || 0), Number(command.height || 0))
|
|
93
|
+
else if (operation === "fill_text") context.fillText(String(command.text || ""), Number(command.x || 0), Number(command.y || 0), command.max_width === undefined ? 1e9 : Number(command.max_width))
|
|
94
|
+
else if (operation === "stroke_text") context.strokeText(String(command.text || ""), Number(command.x || 0), Number(command.y || 0), command.max_width === undefined ? 1e9 : Number(command.max_width))
|
|
95
|
+
else if (operation === "translate") context.translate(Number(command.x || 0), Number(command.y || 0))
|
|
96
|
+
else if (operation === "rotate") context.rotate(Number(command.angle || 0))
|
|
97
|
+
else if (operation === "scale") context.scale(Number(command.x === undefined ? 1 : command.x), Number(command.y === undefined ? 1 : command.y))
|
|
98
|
+
else if (operation === "transform") context.transform(Number(command.a === undefined ? 1 : command.a), Number(command.b || 0), Number(command.c || 0), Number(command.d === undefined ? 1 : command.d), Number(command.e || 0), Number(command.f || 0))
|
|
99
|
+
else if (operation === "set_transform") context.setTransform(Number(command.a === undefined ? 1 : command.a), Number(command.b || 0), Number(command.c || 0), Number(command.d === undefined ? 1 : command.d), Number(command.e || 0), Number(command.f || 0))
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
Rectangle {
|
|
103
|
+
anchors.fill: parent
|
|
104
|
+
color: renderer.prop("background", "transparent")
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
Canvas {
|
|
108
|
+
id: nativeCanvas
|
|
109
|
+
anchors.fill: parent
|
|
110
|
+
antialiasing: renderer.prop("antialiasing", true) !== false
|
|
111
|
+
smooth: renderer.prop("smooth", true) !== false
|
|
112
|
+
canvasSize: Qt.size(Number(renderer.prop("canvas_width", width)), Number(renderer.prop("canvas_height", height)))
|
|
113
|
+
tileSize: Qt.size(Number(renderer.prop("tile_width", 0)), Number(renderer.prop("tile_height", 0)))
|
|
114
|
+
renderTarget: String(renderer.prop("render_target", "image")) === "framebuffer" ? Canvas.FramebufferObject : Canvas.Image
|
|
115
|
+
renderStrategy: {
|
|
116
|
+
var strategy = String(renderer.prop("render_strategy", "immediate"))
|
|
117
|
+
if (strategy === "threaded") return Canvas.Threaded
|
|
118
|
+
if (strategy === "cooperative") return Canvas.Cooperative
|
|
119
|
+
return Canvas.Immediate
|
|
120
|
+
}
|
|
121
|
+
onPaint: {
|
|
122
|
+
var context = getContext("2d")
|
|
123
|
+
try {
|
|
124
|
+
context.reset()
|
|
125
|
+
context.clearRect(0, 0, width, height)
|
|
126
|
+
var commands = renderer.prop("commands", [])
|
|
127
|
+
if (Array.isArray(commands)) {
|
|
128
|
+
for (var index = 0; index < commands.length; index++) canvasRoot.draw(context, commands[index])
|
|
129
|
+
}
|
|
130
|
+
if (renderer.subscribed("paint")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "paint", { commands: Array.isArray(commands) ? commands.length : 0 })
|
|
131
|
+
} catch (error) {
|
|
132
|
+
if (renderer.subscribed("error")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "error", { message: String(error) })
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
Connections {
|
|
138
|
+
target: renderer
|
|
139
|
+
function onNodeChanged() { nativeCanvas.requestPaint() }
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
Timer {
|
|
143
|
+
interval: Math.max(1, Math.round(1000 / Math.max(1, Number(renderer.prop("fps", 60)))))
|
|
144
|
+
repeat: true
|
|
145
|
+
running: renderer.prop("continuous", false) === true
|
|
146
|
+
onTriggered: nativeCanvas.requestPaint()
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
MouseArea {
|
|
150
|
+
anchors.fill: parent
|
|
151
|
+
hoverEnabled: renderer.subscribed("hover")
|
|
152
|
+
function payload(mouse) { return { x: mouse.x, y: mouse.y, button: mouse.button } }
|
|
153
|
+
onClicked: function(mouse) { if (renderer.subscribed("click")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "click", payload(mouse)) }
|
|
154
|
+
onDoubleClicked: function(mouse) { if (renderer.subscribed("double_click")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "double_click", payload(mouse)) }
|
|
155
|
+
onPressed: function(mouse) { if (renderer.subscribed("press")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "press", payload(mouse)) }
|
|
156
|
+
onReleased: function(mouse) { if (renderer.subscribed("release")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "release", payload(mouse)) }
|
|
157
|
+
onPositionChanged: function(mouse) { if (renderer.subscribed("hover")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "hover", payload(mouse)) }
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtMultimedia
|
|
3
|
+
|
|
4
|
+
Item {
|
|
5
|
+
id:sessionRoot;property var renderer:null;property alias captureSession:nativeSession;property alias camera:nativeCamera;property alias imageCapture:nativeImageCapture;property alias mediaRecorder:nativeRecorder;property alias audioInput:nativeAudioInput;property alias audioOutput:nativeAudioOutput
|
|
6
|
+
function deviceValid(list,requested,kind){var value=String(requested||"");if(value==="")return true;for(var index=0;index<list.length;index++)if(String(list[index].id)===value||list[index].description===value)return true;if(renderer)renderer.componentError(kind+"_device_not_found","The declared "+kind.replace("_"," ")+" device does not exist",{device:value});return false}
|
|
7
|
+
function device(list,requested,defaultDevice){var value=String(requested||"");if(value==="")return defaultDevice;for(var index=0;index<list.length;index++)if(String(list[index].id)===value||list[index].description===value)return list[index];return null}
|
|
8
|
+
implicitWidth:Number(renderer?renderer.prop("width",640):640);implicitHeight:Number(renderer?renderer.prop("height",360):360)
|
|
9
|
+
Camera{id:nativeCamera;active:renderer&&renderer.prop("camera_active",false)===true}
|
|
10
|
+
MediaDevices{id:nativeDevices}
|
|
11
|
+
AudioInput{id:nativeAudioInput;device:sessionRoot.device(nativeDevices.audioInputs,renderer?renderer.prop("audio_input_device",""):"",nativeDevices.defaultAudioInput);muted:!sessionRoot.deviceValid(nativeDevices.audioInputs,renderer?renderer.prop("audio_input_device",""):"","audio_input")}
|
|
12
|
+
AudioOutput{id:nativeAudioOutput;device:sessionRoot.device(nativeDevices.audioOutputs,renderer?renderer.prop("audio_output_device",""):"",nativeDevices.defaultAudioOutput);muted:!sessionRoot.deviceValid(nativeDevices.audioOutputs,renderer?renderer.prop("audio_output_device",""):"","audio_output")}
|
|
13
|
+
ImageCapture{id:nativeImageCapture}
|
|
14
|
+
MediaRecorder{id:nativeRecorder}
|
|
15
|
+
CaptureSession{id:nativeSession;camera:nativeCamera;audioInput:sessionRoot.deviceValid(nativeDevices.audioInputs,renderer?renderer.prop("audio_input_device",""):"","audio_input")?nativeAudioInput:null;audioOutput:sessionRoot.deviceValid(nativeDevices.audioOutputs,renderer?renderer.prop("audio_output_device",""):"","audio_output")?nativeAudioOutput:null;imageCapture:nativeImageCapture;recorder:nativeRecorder;videoOutput:renderer&&renderer.prop("video_output_enabled",true)!==false?nativeVideoOutput:null}
|
|
16
|
+
VideoOutput{id:nativeVideoOutput;anchors.fill:parent;visible:renderer&&renderer.prop("video_output_enabled",true)!==false}
|
|
17
|
+
Item{anchors.fill:parent;Repeater{model:renderer?(renderer.node.children||[]):[];delegate:renderer.childDelegateComponent}}
|
|
18
|
+
Component.onCompleted:if(renderer)renderer.bridge.sendEvent(renderer.surfaceName,renderer.controlId,"ready",{})
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import QtQuick.Layouts
|
|
4
|
+
import QtMultimedia
|
|
5
|
+
import QtQuick.VectorImage
|
|
6
|
+
import "../../Theme"
|
|
7
|
+
import "../../Controls" as ZuiControls
|
|
8
|
+
|
|
9
|
+
ZuiControls.BorderSurface {
|
|
10
|
+
required property var renderer
|
|
11
|
+
readonly property int pad: Number(renderer.prop("padding", Style.space(16)))
|
|
12
|
+
implicitWidth: cardContent.implicitWidth + pad * 2
|
|
13
|
+
implicitHeight: cardContent.implicitHeight + pad * 2
|
|
14
|
+
color: renderer.prop("color", Color.popups.background)
|
|
15
|
+
radius: Number(renderer.prop("radius", Style.cornerRadius))
|
|
16
|
+
borderSpec: Border.controlSpec("normal", renderer.prop("border_color", renderer.foreground), renderer.prop("accent", Color.accent))
|
|
17
|
+
Column {
|
|
18
|
+
id: cardContent
|
|
19
|
+
anchors.centerIn: parent
|
|
20
|
+
spacing: Number(renderer.prop("spacing", Style.spacing.panelGap))
|
|
21
|
+
Repeater { model: renderer.node.children || []; delegate: renderer.childDelegateComponent }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import "../../Theme"
|
|
3
|
+
|
|
4
|
+
Rectangle {
|
|
5
|
+
id: carouselRoot
|
|
6
|
+
property var renderer: null
|
|
7
|
+
readonly property var items: renderer ? renderer.prop("items", []) : []
|
|
8
|
+
implicitWidth: Number(renderer ? renderer.prop("width", 640) : 640)
|
|
9
|
+
implicitHeight: Number(renderer ? renderer.prop("height", 320) : 320)
|
|
10
|
+
color: renderer ? renderer.prop("background", "transparent") : "transparent"
|
|
11
|
+
|
|
12
|
+
function field(item, propertyName, fallback) {
|
|
13
|
+
if (item !== null && typeof item === "object" && !Array.isArray(item)) {
|
|
14
|
+
var key = String(renderer.prop(propertyName, fallback)); return item[key]
|
|
15
|
+
}
|
|
16
|
+
return item
|
|
17
|
+
}
|
|
18
|
+
PathView {
|
|
19
|
+
id: pathControl
|
|
20
|
+
anchors.fill: parent
|
|
21
|
+
model: carouselRoot.items
|
|
22
|
+
currentIndex: Number(renderer.prop("current_index", 0))
|
|
23
|
+
interactive: renderer.prop("interactive", true) !== false
|
|
24
|
+
preferredHighlightBegin: { var value=renderer.prop("highlight_range",0.5);return Array.isArray(value)?Number(value[0]):Number(value) }
|
|
25
|
+
preferredHighlightEnd: { var value=renderer.prop("highlight_range",0.5);return Array.isArray(value)?Number(value[value.length-1]):Number(value) }
|
|
26
|
+
highlightRangeMode: { var mode=String(renderer.prop("snap_mode","strict"));if(mode==="none")return PathView.NoHighlightRange;if(mode==="apply")return PathView.ApplyRange;return PathView.StrictlyEnforceRange }
|
|
27
|
+
pathItemCount: Math.min(carouselRoot.items.length, 7)
|
|
28
|
+
path: Path {
|
|
29
|
+
startX: 0; startY: carouselRoot.height / 2
|
|
30
|
+
PathCubic {
|
|
31
|
+
x: carouselRoot.width
|
|
32
|
+
y: carouselRoot.height / 2
|
|
33
|
+
control1X: carouselRoot.width * 0.25
|
|
34
|
+
control1Y: carouselRoot.height / 2 - Number(renderer.prop("path_radius", 72))
|
|
35
|
+
control2X: carouselRoot.width * 0.75
|
|
36
|
+
control2Y: carouselRoot.height / 2 - Number(renderer.prop("path_radius", 72))
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
delegate: Rectangle {
|
|
40
|
+
required property int index; required property var modelData
|
|
41
|
+
width: Number(renderer.prop("item_width", 220)); height: Number(renderer.prop("item_height", 240))
|
|
42
|
+
scale: PathView.isCurrentItem ? 1.0 : 0.72; opacity: PathView.isCurrentItem ? 1.0 : 0.45
|
|
43
|
+
color: Color.popups.background; radius: Style.cornerRadius; border.color: index === pathControl.currentIndex ? renderer.prop("accent", Color.accent) : "transparent"
|
|
44
|
+
Column {
|
|
45
|
+
anchors.fill: parent; anchors.margins: 12; spacing: 8
|
|
46
|
+
Image {
|
|
47
|
+
width: parent.width
|
|
48
|
+
height: parent.height - 76
|
|
49
|
+
fillMode: Image.PreserveAspectCrop
|
|
50
|
+
source: renderer.assetUrl(carouselRoot.field(modelData, "image_field", "image") || "")
|
|
51
|
+
visible: source !== ""
|
|
52
|
+
onStatusChanged: {
|
|
53
|
+
if (status === Image.Error)
|
|
54
|
+
renderer.componentError("carousel_image_failed",
|
|
55
|
+
"Unable to load the declared carousel image",
|
|
56
|
+
{ index: index, source: String(source) })
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
Text { width: parent.width; text: String(carouselRoot.field(modelData, "label_field", "label") || modelData); color: renderer.prop("foreground", renderer.foreground); font.family: renderer.prop("font_family", renderer.fontFamily); font.pixelSize: Number(renderer.prop("font_size", Style.font.body)); horizontalAlignment: Text.AlignHCenter; elide: Text.ElideRight }
|
|
60
|
+
Text { width: parent.width; text: String(carouselRoot.field(modelData,"description_field","description")||"");color:renderer.prop("muted",renderer.foreground);font.family:renderer.prop("font_family",renderer.fontFamily);font.pixelSize:Math.max(9,Number(renderer.prop("font_size",Style.font.body))-2);horizontalAlignment:Text.AlignHCenter;elide:Text.ElideRight }
|
|
61
|
+
}
|
|
62
|
+
TapHandler { onTapped: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "activate", { index: index, item: modelData, value: carouselRoot.field(modelData, "key_field", "id") }) }
|
|
63
|
+
}
|
|
64
|
+
onCurrentIndexChanged: {
|
|
65
|
+
var payload = { value: currentIndex, item: currentIndex >= 0 && currentIndex < carouselRoot.items.length ? carouselRoot.items[currentIndex] : null }
|
|
66
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "input", payload)
|
|
67
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", payload)
|
|
68
|
+
}
|
|
69
|
+
onMovementStarted: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "movement_start", {})
|
|
70
|
+
onMovementEnded: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "movement_end", { value: currentIndex })
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import QtQuick.Layouts
|
|
4
|
+
import QtMultimedia
|
|
5
|
+
import QtQuick.VectorImage
|
|
6
|
+
import "../../Theme"
|
|
7
|
+
import "../../Controls" as ZuiControls
|
|
8
|
+
|
|
9
|
+
Item {
|
|
10
|
+
required property var renderer
|
|
11
|
+
readonly property int pad: Number(renderer.prop("padding", 0))
|
|
12
|
+
implicitWidth: centeredContent.implicitWidth + pad * 2
|
|
13
|
+
implicitHeight: centeredContent.implicitHeight + pad * 2
|
|
14
|
+
Column {
|
|
15
|
+
id: centeredContent
|
|
16
|
+
anchors.centerIn: parent
|
|
17
|
+
spacing: Number(renderer.prop("spacing", Style.spacing.panelGap))
|
|
18
|
+
Repeater { model: renderer.node.children || []; delegate: renderer.childDelegateComponent }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import QtQuick.Layouts
|
|
4
|
+
import "../../Theme"
|
|
5
|
+
|
|
6
|
+
QQC.CheckDelegate {
|
|
7
|
+
id: checkRoot
|
|
8
|
+
|
|
9
|
+
required property var renderer
|
|
10
|
+
readonly property bool selected: renderer.prop("selected", false) === true
|
|
11
|
+
readonly property real indicatorSize: Number(renderer.prop("indicator_size", 22))
|
|
12
|
+
|
|
13
|
+
function checkStateValue(value) {
|
|
14
|
+
if (value === Qt.Checked || String(value) === "checked" || value === true) return Qt.Checked
|
|
15
|
+
if (value === Qt.PartiallyChecked || String(value) === "partial"
|
|
16
|
+
|| String(value) === "partially_checked") return Qt.PartiallyChecked
|
|
17
|
+
return Qt.Unchecked
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function checkStateName() {
|
|
21
|
+
if (checkState === Qt.Checked) return "checked"
|
|
22
|
+
if (checkState === Qt.PartiallyChecked) return "partial"
|
|
23
|
+
return "unchecked"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function eventPayload() {
|
|
27
|
+
return {
|
|
28
|
+
text: text,
|
|
29
|
+
value: renderer.prop("value", text),
|
|
30
|
+
checked: checkState === Qt.Checked,
|
|
31
|
+
check_state: checkStateName(),
|
|
32
|
+
selected: selected
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
text: String(renderer.prop("text", ""))
|
|
37
|
+
tristate: renderer.prop("tristate", false) === true
|
|
38
|
+
checkState: checkStateValue(renderer.prop("check_state",
|
|
39
|
+
renderer.prop("checked", false) === true ? "checked" : "unchecked"))
|
|
40
|
+
highlighted: renderer.prop("highlighted", selected) === true
|
|
41
|
+
enabled: renderer.prop("enabled", true) !== false
|
|
42
|
+
visible: renderer.prop("visible", true) !== false
|
|
43
|
+
hoverEnabled: true
|
|
44
|
+
implicitWidth: Number(renderer.prop("width", 320))
|
|
45
|
+
implicitHeight: Number(renderer.prop("height", 56))
|
|
46
|
+
padding: Number(renderer.prop("padding", Style.spacing.md))
|
|
47
|
+
rightPadding: padding + indicatorSize + Number(renderer.prop("spacing", Style.spacing.md))
|
|
48
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
49
|
+
font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
|
|
50
|
+
Accessible.name: String(renderer.prop("accessible_name", text))
|
|
51
|
+
|
|
52
|
+
background: Rectangle {
|
|
53
|
+
color: checkRoot.highlighted
|
|
54
|
+
? renderer.prop("highlighted_background", renderer.prop("selected_background", Color.popups.background))
|
|
55
|
+
: (checkRoot.selected
|
|
56
|
+
? renderer.prop("selected_background", Color.popups.background)
|
|
57
|
+
: renderer.prop("background", "transparent"))
|
|
58
|
+
radius: Number(renderer.prop("radius", Style.cornerRadius))
|
|
59
|
+
border.width: Number(renderer.prop("border_width",
|
|
60
|
+
String(renderer.prop("border_color", "")).length > 0 ? Style.normalBorderWidth : 0))
|
|
61
|
+
border.color: renderer.prop("border_color", "transparent")
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
contentItem: ColumnLayout {
|
|
65
|
+
spacing: Style.spacing.xs
|
|
66
|
+
|
|
67
|
+
Text {
|
|
68
|
+
Layout.fillWidth: true
|
|
69
|
+
text: checkRoot.text
|
|
70
|
+
textFormat: Text.PlainText
|
|
71
|
+
color: checkRoot.selected
|
|
72
|
+
? renderer.prop("selected_foreground", renderer.prop("foreground", renderer.foreground))
|
|
73
|
+
: renderer.prop("foreground", renderer.foreground)
|
|
74
|
+
font: checkRoot.font
|
|
75
|
+
elide: Text.ElideRight
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
Text {
|
|
79
|
+
Layout.fillWidth: true
|
|
80
|
+
visible: text.length > 0
|
|
81
|
+
text: String(renderer.prop("description", ""))
|
|
82
|
+
textFormat: Text.PlainText
|
|
83
|
+
color: renderer.prop("muted", Color.muted)
|
|
84
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
85
|
+
font.pixelSize: Number(renderer.prop("description_size", Style.font.caption))
|
|
86
|
+
elide: Text.ElideRight
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
indicator: Rectangle {
|
|
91
|
+
x: checkRoot.width - checkRoot.rightPadding + Number(renderer.prop("spacing", Style.spacing.md))
|
|
92
|
+
y: (checkRoot.height - height) / 2
|
|
93
|
+
width: checkRoot.indicatorSize
|
|
94
|
+
height: checkRoot.indicatorSize
|
|
95
|
+
radius: Number(renderer.prop("radius", 4))
|
|
96
|
+
color: checkRoot.checkState === Qt.Unchecked
|
|
97
|
+
? renderer.prop("indicator_background", "transparent")
|
|
98
|
+
: renderer.prop("accent", Color.accent)
|
|
99
|
+
border.width: Style.normalBorderWidth
|
|
100
|
+
border.color: renderer.prop("indicator_border",
|
|
101
|
+
checkRoot.checkState === Qt.Unchecked ? renderer.foreground : renderer.prop("accent", Color.accent))
|
|
102
|
+
|
|
103
|
+
Text {
|
|
104
|
+
anchors.centerIn: parent
|
|
105
|
+
visible: checkRoot.checkState !== Qt.Unchecked
|
|
106
|
+
text: checkRoot.checkState === Qt.PartiallyChecked ? "−" : renderer.iconGlyph("check")
|
|
107
|
+
color: renderer.prop("check_color", Color.background)
|
|
108
|
+
font.family: renderer.fontFamily
|
|
109
|
+
font.pixelSize: Math.max(10, parent.height * 0.62)
|
|
110
|
+
font.bold: true
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
onClicked: {
|
|
115
|
+
var payload = eventPayload()
|
|
116
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "click", payload)
|
|
117
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "activate", payload)
|
|
118
|
+
}
|
|
119
|
+
onCheckStateChanged: {
|
|
120
|
+
var payload = eventPayload()
|
|
121
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "toggle", payload)
|
|
122
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", payload)
|
|
123
|
+
}
|
|
124
|
+
onPressed: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "press", eventPayload())
|
|
125
|
+
onReleased: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "release", eventPayload())
|
|
126
|
+
onHoveredChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
127
|
+
"hover", { value: hovered })
|
|
128
|
+
onActiveFocusChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
129
|
+
activeFocus ? "focus" : "blur", {})
|
|
130
|
+
onVisibleChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
131
|
+
visible ? "show" : "hide", {})
|
|
132
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import QtMultimedia
|
|
2
|
+
import QtQuick
|
|
3
|
+
import QtQuick.Controls as QQC
|
|
4
|
+
import QtQuick.Layouts
|
|
5
|
+
import QtQuick.VectorImage
|
|
6
|
+
import "../../Theme"
|
|
7
|
+
import "../../Controls" as ZuiControls
|
|
8
|
+
|
|
9
|
+
QQC.CheckBox {
|
|
10
|
+
id: checkControl
|
|
11
|
+
|
|
12
|
+
required property var renderer
|
|
13
|
+
|
|
14
|
+
text: renderer.escapeAutoText(renderer.prop("label", ""))
|
|
15
|
+
checked: renderer.prop("checked", false) === true
|
|
16
|
+
hoverEnabled: true
|
|
17
|
+
spacing: Number(renderer.prop("spacing", Style.spacing.controlGap))
|
|
18
|
+
leftPadding: 0
|
|
19
|
+
rightPadding: 0
|
|
20
|
+
onToggled: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", {
|
|
21
|
+
"value": checked
|
|
22
|
+
})
|
|
23
|
+
onHoveredChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "hover", {
|
|
24
|
+
"value": hovered
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
HoverHandler {
|
|
28
|
+
cursorShape: renderer.cursorShape(renderer.prop("cursor", "pointing_hand"))
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
indicator: Rectangle {
|
|
32
|
+
implicitWidth: Number(renderer.prop("indicator_size", Style.space(20)))
|
|
33
|
+
implicitHeight: implicitWidth
|
|
34
|
+
x: checkControl.leftPadding
|
|
35
|
+
y: checkControl.topPadding + (checkControl.availableHeight - height) / 2
|
|
36
|
+
radius: Math.min(Style.cornerRadius, width / 4)
|
|
37
|
+
color: checkControl.checked ? renderer.prop("accent", Color.accent) : renderer.prop("background", "transparent")
|
|
38
|
+
border.width: Style.normalBorderWidth
|
|
39
|
+
border.color: checkControl.checked ? renderer.prop("accent", Color.accent) : renderer.prop("foreground", renderer.foreground)
|
|
40
|
+
|
|
41
|
+
Text {
|
|
42
|
+
anchors.centerIn: parent
|
|
43
|
+
text: checkControl.checked ? renderer.iconGlyph("check") : ""
|
|
44
|
+
textFormat: Text.PlainText
|
|
45
|
+
color: Color.background
|
|
46
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
47
|
+
font.pixelSize: parent.width * 0.7
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
contentItem: Text {
|
|
53
|
+
leftPadding: checkControl.indicator.width + checkControl.spacing
|
|
54
|
+
text: checkControl.text
|
|
55
|
+
textFormat: Text.PlainText
|
|
56
|
+
color: renderer.prop("foreground", renderer.foreground)
|
|
57
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
58
|
+
font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
|
|
59
|
+
verticalAlignment: Text.AlignVCenter
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import QtQuick.Layouts
|
|
4
|
+
import QtMultimedia
|
|
5
|
+
import QtQuick.VectorImage
|
|
6
|
+
import "../../Theme"
|
|
7
|
+
import "../../Controls" as ZuiControls
|
|
8
|
+
|
|
9
|
+
Rectangle {
|
|
10
|
+
required property var renderer
|
|
11
|
+
id: chipRoot
|
|
12
|
+
readonly property bool selected: renderer.prop("selected", false) === true
|
|
13
|
+
readonly property bool deletable: renderer.prop("deletable", false) === true
|
|
14
|
+
readonly property bool interactive: renderer.prop("enabled", true) !== false
|
|
15
|
+
implicitWidth: chipRow.implicitWidth + Number(renderer.prop("horizontal_padding", 12)) * 2
|
|
16
|
+
implicitHeight: Number(renderer.prop("height", 30))
|
|
17
|
+
radius: Number(renderer.prop("radius", height / 2))
|
|
18
|
+
color: selected ? renderer.prop("selected_background", Color.accent) : renderer.prop("background", Color.popups.background)
|
|
19
|
+
border.width: Style.normalBorderWidth
|
|
20
|
+
border.color: selected ? renderer.prop("accent", Color.accent) : renderer.foreground
|
|
21
|
+
opacity: interactive ? 1 : 0.5
|
|
22
|
+
Row {
|
|
23
|
+
id: chipRow
|
|
24
|
+
anchors.centerIn: parent
|
|
25
|
+
spacing: Number(renderer.prop("spacing", 7))
|
|
26
|
+
Text {
|
|
27
|
+
visible: String(renderer.prop("icon", "")).length > 0
|
|
28
|
+
text: renderer.iconGlyph(renderer.prop("icon", ""))
|
|
29
|
+
textFormat: Text.PlainText
|
|
30
|
+
color: chipRoot.selected ? renderer.prop("selected_foreground", Color.background) : renderer.prop("foreground", renderer.foreground)
|
|
31
|
+
font.family: renderer.fontFamily
|
|
32
|
+
font.pixelSize: Number(renderer.prop("icon_size", Style.font.icon))
|
|
33
|
+
}
|
|
34
|
+
Text {
|
|
35
|
+
text: String(renderer.prop("text", ""))
|
|
36
|
+
textFormat: Text.PlainText
|
|
37
|
+
color: chipRoot.selected ? renderer.prop("selected_foreground", Color.background) : renderer.prop("foreground", renderer.foreground)
|
|
38
|
+
font.family: renderer.fontFamily
|
|
39
|
+
font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
|
|
40
|
+
}
|
|
41
|
+
Text {
|
|
42
|
+
visible: chipRoot.deletable
|
|
43
|
+
text: renderer.iconGlyph("xmark")
|
|
44
|
+
textFormat: Text.PlainText
|
|
45
|
+
color: chipRoot.selected ? renderer.prop("selected_foreground", Color.background) : renderer.prop("foreground", renderer.foreground)
|
|
46
|
+
font.family: renderer.fontFamily
|
|
47
|
+
font.pixelSize: Number(renderer.prop("icon_size", Style.font.icon))
|
|
48
|
+
MouseArea {
|
|
49
|
+
anchors.fill: parent
|
|
50
|
+
enabled: chipRoot.interactive
|
|
51
|
+
onClicked: function(mouse) {
|
|
52
|
+
mouse.accepted = true
|
|
53
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "delete", {})
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
TapHandler {
|
|
59
|
+
enabled: chipRoot.interactive
|
|
60
|
+
onTapped: {
|
|
61
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "click", {})
|
|
62
|
+
if (renderer.subscribed("change")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", { value: !chipRoot.selected })
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Shapes
|
|
3
|
+
|
|
4
|
+
Shape {
|
|
5
|
+
id: circleRoot
|
|
6
|
+
required property var renderer
|
|
7
|
+
readonly property real circleRadius: Number(renderer.prop("radius", 50))
|
|
8
|
+
implicitWidth: Number(renderer.prop("width", circleRadius * 2 + Number(renderer.prop("stroke_width", 1))))
|
|
9
|
+
implicitHeight: Number(renderer.prop("height", circleRadius * 2 + Number(renderer.prop("stroke_width", 1))))
|
|
10
|
+
antialiasing: renderer.prop("antialiasing", true) !== false
|
|
11
|
+
ShapePath {
|
|
12
|
+
strokeColor: renderer.prop("stroke", renderer.foreground)
|
|
13
|
+
fillColor: renderer.prop("fill", "transparent")
|
|
14
|
+
strokeWidth: Number(renderer.prop("stroke_width", 1))
|
|
15
|
+
capStyle: String(renderer.prop("cap", "round")) === "flat" ? ShapePath.FlatCap : (String(renderer.prop("cap", "round")) === "square" ? ShapePath.SquareCap : ShapePath.RoundCap)
|
|
16
|
+
strokeStyle: Array.isArray(renderer.prop("dash_pattern", [])) && renderer.prop("dash_pattern", []).length > 0 ? ShapePath.DashLine : ShapePath.SolidLine
|
|
17
|
+
dashPattern: renderer.prop("dash_pattern", [])
|
|
18
|
+
dashOffset: Number(renderer.prop("dash_offset", 0))
|
|
19
|
+
PathAngleArc {
|
|
20
|
+
centerX: Number(renderer.prop("center_x", circleRoot.width / 2))
|
|
21
|
+
centerY: Number(renderer.prop("center_y", circleRoot.height / 2))
|
|
22
|
+
radiusX: circleRoot.circleRadius
|
|
23
|
+
radiusY: circleRoot.circleRadius
|
|
24
|
+
startAngle: Number(renderer.prop("start_angle", 0))
|
|
25
|
+
sweepAngle: Number(renderer.prop("sweep_angle", 360))
|
|
26
|
+
moveToStart: true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
MouseArea {
|
|
30
|
+
anchors.fill: parent
|
|
31
|
+
hoverEnabled: renderer.subscribed("hover")
|
|
32
|
+
onClicked: function(mouse) { if (renderer.subscribed("click")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "click", { x: mouse.x, y: mouse.y }) }
|
|
33
|
+
onPositionChanged: function(mouse) { if (renderer.subscribed("hover")) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "hover", { x: mouse.x, y: mouse.y }) }
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
|
|
3
|
+
Item {
|
|
4
|
+
required property var renderer
|
|
5
|
+
property int handledRevision: -1
|
|
6
|
+
|
|
7
|
+
function synchronize() {
|
|
8
|
+
var revision = Number(renderer.prop("revision", 0))
|
|
9
|
+
var requested = renderer.prop("text", null)
|
|
10
|
+
if (requested === null || revision === handledRevision) return
|
|
11
|
+
handledRevision = revision
|
|
12
|
+
zuiClipboard.text = String(requested)
|
|
13
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "copied", {
|
|
14
|
+
value: String(requested), revision: revision
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
Component.onCompleted: synchronize()
|
|
19
|
+
Connections { target: renderer; function onNodeChanged() { synchronize() } }
|
|
20
|
+
Connections {
|
|
21
|
+
target: zuiClipboard
|
|
22
|
+
enabled: renderer.prop("watch", true) !== false
|
|
23
|
+
function onTextChanged() {
|
|
24
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", {
|
|
25
|
+
value: zuiClipboard.text
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|