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,181 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import "../../Theme"
|
|
4
|
+
|
|
5
|
+
QQC.Popup {
|
|
6
|
+
id: snackbarRoot
|
|
7
|
+
|
|
8
|
+
required property var renderer
|
|
9
|
+
readonly property bool requestedOpen: renderer.prop("opened", false) === true
|
|
10
|
+
&& renderer.prop("visible", true) !== false
|
|
11
|
+
readonly property real popupMargin: Number(renderer.prop("margin", Style.spacing.lg))
|
|
12
|
+
readonly property real maximumWidth: Number(renderer.prop("max_width", 560))
|
|
13
|
+
readonly property string popupPosition: String(renderer.prop("position", "bottom_center"))
|
|
14
|
+
property real remainingDuration: 0
|
|
15
|
+
property double timeoutDeadline: 0
|
|
16
|
+
|
|
17
|
+
function syncOpenState() {
|
|
18
|
+
if (requestedOpen === opened) return
|
|
19
|
+
if (requestedOpen) open()
|
|
20
|
+
else close()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function timed() {
|
|
24
|
+
return renderer.prop("persistent", false) !== true
|
|
25
|
+
&& Number(renderer.prop("duration", 4000)) > 0
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function startTimeout() {
|
|
29
|
+
dismissTimer.stop()
|
|
30
|
+
if (!visible || !timed()) return
|
|
31
|
+
remainingDuration = Number(renderer.prop("duration", 4000))
|
|
32
|
+
resumeTimeout()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function pauseTimeout() {
|
|
36
|
+
if (!dismissTimer.running) return
|
|
37
|
+
remainingDuration = Math.max(1, timeoutDeadline - Date.now())
|
|
38
|
+
dismissTimer.stop()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function resumeTimeout() {
|
|
42
|
+
if (!visible || !timed() || remainingDuration <= 0) return
|
|
43
|
+
timeoutDeadline = Date.now() + remainingDuration
|
|
44
|
+
dismissTimer.interval = remainingDuration
|
|
45
|
+
dismissTimer.restart()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function dismiss(reason) {
|
|
49
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "dismiss", { reason: reason })
|
|
50
|
+
close()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
x: {
|
|
54
|
+
if (!parent) return popupMargin
|
|
55
|
+
if (popupPosition.indexOf("left") >= 0) return popupMargin
|
|
56
|
+
if (popupPosition.indexOf("right") >= 0) return parent.width - width - popupMargin
|
|
57
|
+
return Math.max(popupMargin, (parent.width - width) / 2)
|
|
58
|
+
}
|
|
59
|
+
y: {
|
|
60
|
+
if (!parent) return popupMargin
|
|
61
|
+
if (popupPosition.indexOf("top") === 0) return popupMargin
|
|
62
|
+
return parent.height - height - popupMargin
|
|
63
|
+
}
|
|
64
|
+
width: {
|
|
65
|
+
var available = parent ? Math.max(0, parent.width - popupMargin * 2) : maximumWidth
|
|
66
|
+
return Math.min(Number(renderer.prop("width", maximumWidth)), available, maximumWidth)
|
|
67
|
+
}
|
|
68
|
+
modal: false
|
|
69
|
+
dim: false
|
|
70
|
+
focus: false
|
|
71
|
+
closePolicy: QQC.Popup.NoAutoClose
|
|
72
|
+
enabled: renderer.prop("enabled", true) !== false
|
|
73
|
+
padding: Number(renderer.prop("padding", Style.spacing.md))
|
|
74
|
+
|
|
75
|
+
background: Rectangle {
|
|
76
|
+
color: renderer.prop("background", Color.popups.background)
|
|
77
|
+
radius: Number(renderer.prop("radius", Style.cornerRadius))
|
|
78
|
+
border.width: String(renderer.prop("border_color", "")).length > 0 ? Style.normalBorderWidth : 0
|
|
79
|
+
border.color: renderer.prop("border_color", "transparent")
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
contentItem: Row {
|
|
83
|
+
spacing: Number(renderer.prop("spacing", Style.spacing.md))
|
|
84
|
+
|
|
85
|
+
Text {
|
|
86
|
+
width: Math.max(0, parent.width - (actionButton.visible ? actionButton.width + parent.spacing : 0))
|
|
87
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
88
|
+
text: String(renderer.prop("message", ""))
|
|
89
|
+
color: renderer.prop("foreground", renderer.foreground)
|
|
90
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
91
|
+
font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
|
|
92
|
+
wrapMode: Text.Wrap
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
QQC.Button {
|
|
96
|
+
id: actionButton
|
|
97
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
98
|
+
visible: text.length > 0
|
|
99
|
+
text: String(renderer.prop("action_text", ""))
|
|
100
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
101
|
+
font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
|
|
102
|
+
contentItem: Text {
|
|
103
|
+
text: actionButton.text
|
|
104
|
+
color: renderer.prop("action_color", Color.accent)
|
|
105
|
+
font: actionButton.font
|
|
106
|
+
horizontalAlignment: Text.AlignHCenter
|
|
107
|
+
verticalAlignment: Text.AlignVCenter
|
|
108
|
+
}
|
|
109
|
+
background: Rectangle { color: "transparent" }
|
|
110
|
+
onClicked: {
|
|
111
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "action", {})
|
|
112
|
+
if (renderer.prop("close_on_action", true) !== false) snackbarRoot.dismiss("action")
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
HoverHandler {
|
|
118
|
+
enabled: renderer.prop("pause_on_hover", true) !== false
|
|
119
|
+
onHoveredChanged: {
|
|
120
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "hover", { value: hovered })
|
|
121
|
+
if (hovered) snackbarRoot.pauseTimeout()
|
|
122
|
+
else snackbarRoot.resumeTimeout()
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
Timer {
|
|
127
|
+
id: dismissTimer
|
|
128
|
+
repeat: false
|
|
129
|
+
onTriggered: {
|
|
130
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "timeout", {})
|
|
131
|
+
snackbarRoot.dismiss("timeout")
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
enter: Transition {
|
|
136
|
+
ParallelAnimation {
|
|
137
|
+
NumberAnimation {
|
|
138
|
+
property: "opacity"; from: 0; to: 1
|
|
139
|
+
duration: renderer.prop("animated", true) !== false
|
|
140
|
+
? Number(renderer.prop("animation_duration", 180)) : 0
|
|
141
|
+
easing.type: renderer.easingType(renderer.prop("easing", "out_cubic"))
|
|
142
|
+
}
|
|
143
|
+
NumberAnimation {
|
|
144
|
+
property: "scale"; from: 0.96; to: 1
|
|
145
|
+
duration: renderer.prop("animated", true) !== false
|
|
146
|
+
? Number(renderer.prop("animation_duration", 180)) : 0
|
|
147
|
+
easing.type: renderer.easingType(renderer.prop("easing", "out_cubic"))
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
exit: Transition {
|
|
153
|
+
ParallelAnimation {
|
|
154
|
+
NumberAnimation {
|
|
155
|
+
property: "opacity"; from: 1; to: 0
|
|
156
|
+
duration: renderer.prop("animated", true) !== false
|
|
157
|
+
? Number(renderer.prop("animation_duration", 140)) : 0
|
|
158
|
+
easing.type: renderer.easingType("in_cubic")
|
|
159
|
+
}
|
|
160
|
+
NumberAnimation {
|
|
161
|
+
property: "scale"; from: 1; to: 0.96
|
|
162
|
+
duration: renderer.prop("animated", true) !== false
|
|
163
|
+
? Number(renderer.prop("animation_duration", 140)) : 0
|
|
164
|
+
easing.type: renderer.easingType("in_cubic")
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
Component.onCompleted: syncOpenState()
|
|
170
|
+
onRequestedOpenChanged: syncOpenState()
|
|
171
|
+
onOpened: {
|
|
172
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "open", {})
|
|
173
|
+
startTimeout()
|
|
174
|
+
}
|
|
175
|
+
onClosed: {
|
|
176
|
+
dismissTimer.stop()
|
|
177
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "close", {})
|
|
178
|
+
}
|
|
179
|
+
onVisibleChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
180
|
+
visible ? "show" : "hide", {})
|
|
181
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQml.Models
|
|
3
|
+
|
|
4
|
+
Item {
|
|
5
|
+
id:proxyRoot;property var renderer:null;property alias model:nativeProxy
|
|
6
|
+
function rebuild(){sourceModel.clear();var items=renderer?renderer.prop("items",[]):[];var requested=String(renderer?renderer.prop("filter",""):"");var field=String(renderer?renderer.prop("filter_field","value"):"value");var sensitive=renderer&&renderer.prop("filter_case_sensitive",false)===true;for(var i=0;i<items.length;i++){var item=items[i];var row=item!==null&&typeof item==="object"&&!Array.isArray(item)?item:{value:item};var value=String(row[field]===undefined?"":row[field]);if(requested!==""&&(sensitive?value.indexOf(requested)<0:value.toLowerCase().indexOf(requested.toLowerCase())<0))continue;sourceModel.append(row)}nativeProxy.invalidate();if(renderer)renderer.bridge.sendEvent(renderer.surfaceName,renderer.controlId,"change",{count:nativeProxy.rowCount()})}
|
|
7
|
+
ListModel{id:sourceModel}
|
|
8
|
+
SortFilterProxyModel{
|
|
9
|
+
id:nativeProxy;model:sourceModel;dynamicSortFilter:!renderer||renderer.prop("dynamic",true)!==false;recursiveFiltering:renderer&&renderer.prop("recursive",false)===true;autoAcceptChildRows:renderer&&renderer.prop("auto_accept_children",false)===true
|
|
10
|
+
filters:[]
|
|
11
|
+
sorters:[StringSorter{enabled:renderer&&String(renderer.prop("sort_field",""))!=="";roleName:String(renderer?renderer.prop("sort_field","value"):"value");sortOrder:String(renderer?renderer.prop("sort_order","ascending"):"ascending")==="descending"?Qt.DescendingOrder:Qt.AscendingOrder;caseSensitivity:renderer&&renderer.prop("sort_case_sensitive",false)===true?Qt.CaseSensitive:Qt.CaseInsensitive}]
|
|
12
|
+
onRowsInserted:function(parent,first,last){if(renderer)renderer.bridge.sendEvent(renderer.surfaceName,renderer.controlId,"count_change",{value:rowCount()})}
|
|
13
|
+
onRowsRemoved:function(parent,first,last){if(renderer)renderer.bridge.sendEvent(renderer.surfaceName,renderer.controlId,"count_change",{value:rowCount()})}
|
|
14
|
+
}
|
|
15
|
+
Component.onCompleted:rebuild();Connections{target:renderer;function onNodeChanged(){proxyRoot.rebuild()}}
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtMultimedia
|
|
3
|
+
|
|
4
|
+
Item {
|
|
5
|
+
id:soundRoot;property var renderer:null;property alias soundEffect:nativeSound;property int handledCommandRevision:-1
|
|
6
|
+
function send(name,payload){if(renderer&&renderer.subscribed(name))renderer.bridge.sendEvent(renderer.surfaceName,renderer.controlId,name,payload||{})}
|
|
7
|
+
function command(){if(!renderer)return;var revision=Number(renderer.prop("command_revision",0));if(revision===handledCommandRevision)return;handledCommandRevision=revision;var value=String(renderer.prop("command",renderer.prop("playback","")));if(value==="play")nativeSound.play();else if(value==="stop")nativeSound.stop()}
|
|
8
|
+
SoundEffect{id:nativeSound;source:renderer?renderer.assetUrl(renderer.prop("source","")):"";loops:Number(renderer?renderer.prop("loops",1):1);volume:Math.max(0,Math.min(1,Number(renderer?renderer.prop("volume",1):1)));muted:renderer&&renderer.prop("muted",false)===true;onPlayingChanged:soundRoot.send(playing?"play":"stop",{});onStatusChanged:{soundRoot.send("status",{value:status});if(status===SoundEffect.Error)renderer.componentError("sound_effect_load_failed","Unable to load the declared sound effect",{source:String(source)})}onLoopsRemainingChanged:soundRoot.send("loops_remaining",{value:loopsRemaining})}
|
|
9
|
+
Component.onCompleted:command();Connections{target:renderer;function onNodeChanged(){soundRoot.command()}}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
implicitWidth: Number(renderer.prop("width", 0))
|
|
12
|
+
implicitHeight: Number(renderer.prop("height", Style.space(8)))
|
|
13
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
QQC.SpinBox {
|
|
10
|
+
required property var renderer
|
|
11
|
+
id: nativeSpinBox
|
|
12
|
+
from: Number(renderer.prop("minimum", 0))
|
|
13
|
+
to: Number(renderer.prop("maximum", 100))
|
|
14
|
+
value: Number(renderer.prop("value", from))
|
|
15
|
+
stepSize: Number(renderer.prop("step", 1))
|
|
16
|
+
editable: renderer.prop("editable", true) !== false
|
|
17
|
+
wrap: renderer.prop("wrap", false) === true
|
|
18
|
+
enabled: renderer.prop("enabled", true) !== false
|
|
19
|
+
implicitWidth: Number(renderer.prop("width", 140))
|
|
20
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
21
|
+
font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
|
|
22
|
+
palette.text: renderer.prop("foreground", renderer.foreground)
|
|
23
|
+
palette.buttonText: renderer.prop("foreground", renderer.foreground)
|
|
24
|
+
palette.button: renderer.prop("background", Color.popups.background)
|
|
25
|
+
palette.highlight: renderer.prop("accent", Color.accent)
|
|
26
|
+
textFromValue: function(value, locale) {
|
|
27
|
+
return String(renderer.prop("prefix", "")) + Number(value).toLocaleString(locale, "f", 0) + String(renderer.prop("suffix", ""))
|
|
28
|
+
}
|
|
29
|
+
valueFromText: function(text, locale) {
|
|
30
|
+
var prefix = String(renderer.prop("prefix", ""))
|
|
31
|
+
var suffix = String(renderer.prop("suffix", ""))
|
|
32
|
+
var numeric = String(text)
|
|
33
|
+
if (prefix.length > 0 && numeric.indexOf(prefix) === 0) numeric = numeric.slice(prefix.length)
|
|
34
|
+
if (suffix.length > 0 && numeric.lastIndexOf(suffix) === numeric.length - suffix.length) numeric = numeric.slice(0, -suffix.length)
|
|
35
|
+
return Number.fromLocaleString(locale, numeric)
|
|
36
|
+
}
|
|
37
|
+
onValueModified: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", { value: value })
|
|
38
|
+
up.onPressedChanged: {
|
|
39
|
+
if (up.pressed) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "increase", { value: value })
|
|
40
|
+
}
|
|
41
|
+
down.onPressedChanged: {
|
|
42
|
+
if (down.pressed) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "decrease", { value: value })
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
QQC.SplitView {
|
|
10
|
+
required property var renderer
|
|
11
|
+
implicitWidth: Number(renderer.prop("width", 560))
|
|
12
|
+
implicitHeight: Number(renderer.prop("height", 320))
|
|
13
|
+
orientation: String(renderer.prop("orientation", "horizontal")) === "vertical" ? Qt.Vertical : Qt.Horizontal
|
|
14
|
+
function currentSizes() {
|
|
15
|
+
var sizes = []
|
|
16
|
+
for (var index = 0; index < splitChildren.count; index++) {
|
|
17
|
+
var child = splitChildren.itemAt(index)
|
|
18
|
+
sizes.push(orientation === Qt.Horizontal ? child.width : child.height)
|
|
19
|
+
}
|
|
20
|
+
return sizes
|
|
21
|
+
}
|
|
22
|
+
onResizingChanged: {
|
|
23
|
+
if (!resizing && renderer.subscribed("resize"))
|
|
24
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "resize", { sizes: currentSizes() })
|
|
25
|
+
}
|
|
26
|
+
Repeater {
|
|
27
|
+
id: splitChildren
|
|
28
|
+
model: renderer.node.children || []
|
|
29
|
+
delegate: renderer.splitChildDelegateComponent
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
implicitWidth: childrenRect.width
|
|
12
|
+
implicitHeight: childrenRect.height
|
|
13
|
+
Repeater { model: renderer.node.children || []; delegate: renderer.childDelegateComponent }
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
StackLayout {
|
|
10
|
+
required property var renderer
|
|
11
|
+
implicitWidth: Number(renderer.prop("width", 420))
|
|
12
|
+
implicitHeight: Number(renderer.prop("height", 280))
|
|
13
|
+
currentIndex: Math.max(0, Math.min(count - 1, Number(renderer.prop("current_index", 0))))
|
|
14
|
+
onCurrentIndexChanged: {
|
|
15
|
+
if (renderer.subscribed("change"))
|
|
16
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", { value: currentIndex })
|
|
17
|
+
}
|
|
18
|
+
Repeater { model: renderer.node.children || []; delegate: renderer.layoutChildDelegateComponent }
|
|
19
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import "../../Theme"
|
|
4
|
+
|
|
5
|
+
QQC.StackView {
|
|
6
|
+
id: stackRoot
|
|
7
|
+
|
|
8
|
+
required property var renderer
|
|
9
|
+
readonly property int childCount: renderer.node && Array.isArray(renderer.node.children)
|
|
10
|
+
? renderer.node.children.length : 0
|
|
11
|
+
readonly property string childSignature: {
|
|
12
|
+
var ids = []
|
|
13
|
+
for (var index = 0; index < childCount; index++) ids.push(String(renderer.node.children[index].id))
|
|
14
|
+
return ids.join("\u001f")
|
|
15
|
+
}
|
|
16
|
+
readonly property int requestedIndex: Number(renderer.prop("current_index", 0))
|
|
17
|
+
property var pageObjects: []
|
|
18
|
+
property bool initialized: false
|
|
19
|
+
property bool rebuilding: false
|
|
20
|
+
|
|
21
|
+
function boundedIndex(value) {
|
|
22
|
+
return childCount === 0 ? -1 : Math.max(0, Math.min(childCount - 1, Number(value)))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function operationFor(target) {
|
|
26
|
+
return renderer.prop("animated", true) !== false && initialized
|
|
27
|
+
&& Math.abs(target - (depth - 1)) === 1
|
|
28
|
+
? QQC.StackView.PushTransition : QQC.StackView.Immediate
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function pageAt(index) {
|
|
32
|
+
if (pageObjects[index]) return pageObjects[index]
|
|
33
|
+
var page = renderer.childDelegateComponent.createObject(stackRoot, {
|
|
34
|
+
modelData: renderer.node.children[index]
|
|
35
|
+
})
|
|
36
|
+
if (!page) return null
|
|
37
|
+
var pages = pageObjects.slice(0)
|
|
38
|
+
pages[index] = page
|
|
39
|
+
pageObjects = pages
|
|
40
|
+
return page
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function syncNavigation() {
|
|
44
|
+
if (!initialized || rebuilding || busy) return
|
|
45
|
+
var target = boundedIndex(requestedIndex)
|
|
46
|
+
if (target < 0) {
|
|
47
|
+
if (depth > 0) clear(QQC.StackView.Immediate)
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var current = depth - 1
|
|
52
|
+
if (current < target) {
|
|
53
|
+
var nextIndex = current + 1
|
|
54
|
+
var page = pageAt(nextIndex)
|
|
55
|
+
if (!page) return
|
|
56
|
+
push(page, {}, operationFor(target))
|
|
57
|
+
if (renderer.subscribed("push"))
|
|
58
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "push",
|
|
59
|
+
{ value: nextIndex, depth: depth })
|
|
60
|
+
if (!busy) Qt.callLater(syncNavigation)
|
|
61
|
+
} else if (current > target) {
|
|
62
|
+
pop(operationFor(target) === QQC.StackView.PushTransition
|
|
63
|
+
? QQC.StackView.PopTransition : QQC.StackView.Immediate)
|
|
64
|
+
if (renderer.subscribed("pop"))
|
|
65
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "pop",
|
|
66
|
+
{ value: Math.max(-1, depth - 1), depth: depth })
|
|
67
|
+
if (!busy) Qt.callLater(syncNavigation)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function rebuildPages() {
|
|
72
|
+
if (!initialized) return
|
|
73
|
+
rebuilding = true
|
|
74
|
+
clear(QQC.StackView.Immediate)
|
|
75
|
+
var oldPages = pageObjects
|
|
76
|
+
pageObjects = []
|
|
77
|
+
for (var index = 0; index < oldPages.length; index++) {
|
|
78
|
+
if (oldPages[index]) oldPages[index].destroy()
|
|
79
|
+
}
|
|
80
|
+
rebuilding = false
|
|
81
|
+
Qt.callLater(syncNavigation)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
implicitWidth: Number(renderer.prop("width", 640))
|
|
85
|
+
implicitHeight: Number(renderer.prop("height", 420))
|
|
86
|
+
enabled: renderer.prop("enabled", true) !== false
|
|
87
|
+
visible: renderer.prop("visible", true) !== false
|
|
88
|
+
clip: renderer.prop("clip", true) !== false
|
|
89
|
+
|
|
90
|
+
background: Rectangle {
|
|
91
|
+
color: renderer.prop("background", Color.background)
|
|
92
|
+
radius: Number(renderer.prop("radius", 0))
|
|
93
|
+
border.width: String(renderer.prop("border_color", "")).length > 0 ? Style.normalBorderWidth : 0
|
|
94
|
+
border.color: renderer.prop("border_color", "transparent")
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
Component.onCompleted: {
|
|
98
|
+
initialized = true
|
|
99
|
+
syncNavigation()
|
|
100
|
+
}
|
|
101
|
+
onRequestedIndexChanged: syncNavigation()
|
|
102
|
+
onChildSignatureChanged: rebuildPages()
|
|
103
|
+
onBusyChanged: {
|
|
104
|
+
if (renderer.subscribed("busy_change"))
|
|
105
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "busy_change", { value: busy })
|
|
106
|
+
if (!busy) Qt.callLater(syncNavigation)
|
|
107
|
+
}
|
|
108
|
+
onDepthChanged: {
|
|
109
|
+
if (!initialized || rebuilding) return
|
|
110
|
+
var index = depth - 1
|
|
111
|
+
if (renderer.subscribed("depth_change"))
|
|
112
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "depth_change",
|
|
113
|
+
{ value: depth, index: index })
|
|
114
|
+
if (renderer.subscribed("change"))
|
|
115
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change",
|
|
116
|
+
{ value: index, depth: depth })
|
|
117
|
+
}
|
|
118
|
+
onVisibleChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
119
|
+
visible ? "show" : "hide", {})
|
|
120
|
+
onActiveFocusChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
121
|
+
activeFocus ? "focus" : "blur", {})
|
|
122
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtCore
|
|
3
|
+
|
|
4
|
+
Item {
|
|
5
|
+
id:pathsRoot;property var renderer:null
|
|
6
|
+
function locationType(){var name=String(renderer?renderer.prop("location","home"):"home");var values={desktop:StandardPaths.DesktopLocation,documents:StandardPaths.DocumentsLocation,fonts:StandardPaths.FontsLocation,applications:StandardPaths.ApplicationsLocation,music:StandardPaths.MusicLocation,movies:StandardPaths.MoviesLocation,pictures:StandardPaths.PicturesLocation,temp:StandardPaths.TempLocation,home:StandardPaths.HomeLocation,cache:StandardPaths.CacheLocation,generic_data:StandardPaths.GenericDataLocation,runtime:StandardPaths.RuntimeLocation,config:StandardPaths.ConfigLocation,download:StandardPaths.DownloadLocation,generic_cache:StandardPaths.GenericCacheLocation,generic_config:StandardPaths.GenericConfigLocation,app_data:StandardPaths.AppDataLocation,app_config:StandardPaths.AppConfigLocation};return values[name]===undefined?StandardPaths.HomeLocation:values[name]}
|
|
7
|
+
function resolve(){if(!renderer)return;var type=locationType();var payload={location:String(StandardPaths.writableLocation(type)),locations:StandardPaths.standardLocations(type).map(String),display_name:StandardPaths.displayName(type)};var file=String(renderer.prop("locate_file",""));if(file!=="")payload.located=String(StandardPaths.locate(type,file));var executable=String(renderer.prop("executable",""));if(executable!=="")payload.executable=String(StandardPaths.findExecutable(executable));renderer.bridge.sendEvent(renderer.surfaceName,renderer.controlId,"resolved",payload)}
|
|
8
|
+
Component.onCompleted:resolve();Connections{target:renderer;function onNodeChanged(){pathsRoot.resolve()}}
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
|
|
3
|
+
Item {
|
|
4
|
+
id: stateRoot
|
|
5
|
+
property var renderer: null
|
|
6
|
+
property bool active: false
|
|
7
|
+
property var previousValues: ({})
|
|
8
|
+
readonly property var targetItem: renderer ? renderer.findRenderedItem(renderer.prop("target", "")) : null
|
|
9
|
+
function applyProperties(values){if(!targetItem||!values||typeof values!=="object")return;for(var key in values)if(targetItem.hasOwnProperty(key))targetItem[key]=values[key]}
|
|
10
|
+
function synchronize(){if(!renderer||!targetItem)return;var shouldEnter=renderer.prop("when",true)===true;if(shouldEnter===active)return;if(shouldEnter){previousValues={};var inherited=renderer.prop("extend",{});var values={};if(inherited&&typeof inherited==="object")for(var inheritedKey in inherited)values[inheritedKey]=inherited[inheritedKey];var requested=renderer.prop("properties",{});for(var requestedKey in requested)values[requestedKey]=requested[requestedKey];for(var key in values)if(targetItem.hasOwnProperty(key))previousValues[key]=targetItem[key];applyProperties(values);active=true;renderer.bridge.sendEvent(renderer.surfaceName,renderer.controlId,"enter",{name:renderer.prop("name","")})}else{if(renderer.prop("restore_entry_values",true)!==false)applyProperties(previousValues);active=false;renderer.bridge.sendEvent(renderer.surfaceName,renderer.controlId,"exit",{name:renderer.prop("name","")})}renderer.bridge.sendEvent(renderer.surfaceName,renderer.controlId,"change",{value:active,name:renderer.prop("name","")})}
|
|
11
|
+
Connections{target:renderer;function onNodeChanged(){stateRoot.synchronize()}}
|
|
12
|
+
Component.onCompleted:synchronize()
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
|
|
3
|
+
Item {
|
|
4
|
+
id: groupRoot
|
|
5
|
+
property var renderer: null
|
|
6
|
+
property string activeState: ""
|
|
7
|
+
readonly property var targetItem: renderer ? renderer.findRenderedItem(renderer.prop("target", "")) : null
|
|
8
|
+
function synchronize(){if(!renderer||!targetItem)return;var name=String(renderer.prop("current",""));var states=renderer.prop("states",[]);for(var index=0;index<states.length;index++){var state=states[index]||{};if(String(state.name)===name){var values=state.properties||{};for(var key in values)if(targetItem.hasOwnProperty(key))targetItem[key]=values[key];break}}if(name!==activeState){var old=activeState;activeState=name;renderer.bridge.sendEvent(renderer.surfaceName,renderer.controlId,"change",{value:name,previous:old})}}
|
|
9
|
+
Connections{target:renderer;function onNodeChanged(){groupRoot.synchronize()}}
|
|
10
|
+
Component.onCompleted:synchronize()
|
|
11
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
|
|
3
|
+
Item {
|
|
4
|
+
id: driver
|
|
5
|
+
required property var renderer
|
|
6
|
+
required property string animationType
|
|
7
|
+
readonly property var targetItem: renderer ? renderer.findRenderedItem(renderer.prop("target", "")) : null
|
|
8
|
+
property bool requestedRunning: false
|
|
9
|
+
|
|
10
|
+
function send(name, payload) {
|
|
11
|
+
if (renderer && renderer.subscribed(name)) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, name, payload || {})
|
|
12
|
+
}
|
|
13
|
+
function loopsValue() {
|
|
14
|
+
var value = renderer.prop("loops", 1)
|
|
15
|
+
return String(value) === "infinite" || Number(value) < 0 ? Animation.Infinite : Math.max(1, Number(value))
|
|
16
|
+
}
|
|
17
|
+
function vectorValue(value) {
|
|
18
|
+
return Array.isArray(value) ? Qt.vector3d(Number(value[0] || 0), Number(value[1] || 0), Number(value[2] || 0)) : value
|
|
19
|
+
}
|
|
20
|
+
function currentAnimation() {
|
|
21
|
+
if (animationType === "number") return numberAnimation
|
|
22
|
+
if (animationType === "color") return colorAnimation
|
|
23
|
+
if (animationType === "rotation") return rotationAnimation
|
|
24
|
+
if (animationType === "vector") return vectorAnimation
|
|
25
|
+
if (animationType === "path") return pathAnimation
|
|
26
|
+
if (animationType === "spring") return springAnimation
|
|
27
|
+
if (animationType === "smoothed") return smoothedAnimation
|
|
28
|
+
if (animationType === "anchor") return anchorAnimation
|
|
29
|
+
if (animationType === "parent") return parentAnimation
|
|
30
|
+
if (animationType === "opacity_animator") return opacityAnimator
|
|
31
|
+
if (animationType === "rotation_animator") return rotationAnimator
|
|
32
|
+
if (animationType === "scale_animator") return scaleAnimator
|
|
33
|
+
if (animationType === "x_animator") return xAnimator
|
|
34
|
+
if (animationType === "y_animator") return yAnimator
|
|
35
|
+
if (animationType === "uniform_animator") return uniformAnimator
|
|
36
|
+
if (animationType === "pause") return pauseAnimation
|
|
37
|
+
return propertyAnimation
|
|
38
|
+
}
|
|
39
|
+
function synchronize(restart) {
|
|
40
|
+
var animation = currentAnimation(); if (!animation || !renderer) return
|
|
41
|
+
requestedRunning = renderer.prop("running", false) === true
|
|
42
|
+
if (renderer.prop("paused", false) === true) { animation.pause(); return }
|
|
43
|
+
if (!requestedRunning) { delayTimer.stop(); animation.stop(); return }
|
|
44
|
+
if (restart || !animation.running) {
|
|
45
|
+
animation.stop()
|
|
46
|
+
var delay = Math.max(0, Number(renderer.prop("delay", 0)))
|
|
47
|
+
if (delay > 0) { delayTimer.interval = delay; delayTimer.restart() } else animation.start()
|
|
48
|
+
} else if (animation.paused) animation.resume()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
Timer { id: delayTimer; repeat: false; onTriggered: if (driver.requestedRunning) driver.currentAnimation().start() }
|
|
52
|
+
Connections {
|
|
53
|
+
target: driver.currentAnimation()
|
|
54
|
+
function onStarted() { driver.send("start", {}) }
|
|
55
|
+
function onStopped() { driver.send("stop", {}) }
|
|
56
|
+
function onFinished() { driver.send("finish", {}) }
|
|
57
|
+
function onRunningChanged() { driver.send("running_change", { value: driver.currentAnimation().running }) }
|
|
58
|
+
}
|
|
59
|
+
Connections { target: renderer; function onNodeChanged() { driver.synchronize(true) } }
|
|
60
|
+
Component.onCompleted: synchronize(false)
|
|
61
|
+
|
|
62
|
+
PropertyAnimation { id: propertyAnimation; target: driver.targetItem; property: String(renderer.prop("property", "opacity")); from: renderer.prop("from", 0); to: renderer.prop("to", 1); duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")); loops: driver.loopsValue(); alwaysRunToEnd: renderer.prop("always_run", false) === true }
|
|
63
|
+
NumberAnimation { id: numberAnimation; target: driver.targetItem; property: String(renderer.prop("property", "opacity")); from: Number(renderer.prop("from", 0)); to: Number(renderer.prop("to", 1)); duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")); loops: driver.loopsValue() }
|
|
64
|
+
ColorAnimation { id: colorAnimation; target: driver.targetItem; property: String(renderer.prop("property", "color")); from: renderer.prop("from", "transparent"); to: renderer.prop("to", "white"); duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")); loops: driver.loopsValue() }
|
|
65
|
+
RotationAnimation { id: rotationAnimation; target: driver.targetItem; property: String(renderer.prop("property", "rotation")); from: Number(renderer.prop("from", 0)); to: Number(renderer.prop("to", 360)); duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")); direction: { var d=String(renderer.prop("direction","numerical"));if(d==="clockwise")return RotationAnimation.Clockwise;if(d==="counterclockwise")return RotationAnimation.Counterclockwise;if(d==="shortest")return RotationAnimation.Shortest;return RotationAnimation.Numerical } loops: driver.loopsValue() }
|
|
66
|
+
Vector3dAnimation { id: vectorAnimation; target: driver.targetItem; property: String(renderer.prop("property", "scale3d")); from: driver.vectorValue(renderer.prop("from", [0,0,0])); to: driver.vectorValue(renderer.prop("to", [1,1,1])); duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")); loops: driver.loopsValue() }
|
|
67
|
+
PathAnimation { id: pathAnimation; target: driver.targetItem; duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")); loops: driver.loopsValue(); anchorPoint: Qt.point(Number(renderer.prop("anchor_x", 0)), Number(renderer.prop("anchor_y", 0))); orientation: { var o=String(renderer.prop("orientation","fixed"));if(o==="right_first")return PathAnimation.RightFirst;if(o==="left_first")return PathAnimation.LeftFirst;if(o==="bottom_first")return PathAnimation.BottomFirst;if(o==="top_first")return PathAnimation.TopFirst;return PathAnimation.Fixed } path: Path { PathSvg { path: String(renderer.prop("path", "")) } } }
|
|
68
|
+
SpringAnimation { id: springAnimation; target: driver.targetItem; property: String(renderer.prop("property", "opacity")); from: Number(renderer.prop("from", 0)); to: Number(renderer.prop("to", 1)); spring: Number(renderer.prop("spring", 2)); damping: Number(renderer.prop("damping", 0.2)); epsilon: Number(renderer.prop("epsilon", 0.01)); mass: Number(renderer.prop("mass", 1)); modulus: Number(renderer.prop("modulus", 0)); velocity: Number(renderer.prop("velocity", 0)); loops: driver.loopsValue() }
|
|
69
|
+
SmoothedAnimation { id: smoothedAnimation; target: driver.targetItem; property: String(renderer.prop("property", "opacity")); from: Number(renderer.prop("from", 0)); to: Number(renderer.prop("to", 1)); velocity: Number(renderer.prop("velocity", 200)); duration: Number(renderer.prop("duration", -1)); reversingMode: { var m=String(renderer.prop("reversing_mode","eased"));if(m==="immediate")return SmoothedAnimation.Immediate;if(m==="sync")return SmoothedAnimation.Sync;return SmoothedAnimation.Eased } loops: driver.loopsValue() }
|
|
70
|
+
AnchorAnimation { id: anchorAnimation; targets: driver.targetItem ? [driver.targetItem] : []; duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")); loops: driver.loopsValue() }
|
|
71
|
+
ParentAnimation { id: parentAnimation; target: driver.targetItem; newParent: renderer.findRenderedItem(renderer.prop("new_parent", "")); via: renderer.findRenderedItem(renderer.prop("via", "")); loops: driver.loopsValue(); NumberAnimation { properties: "x,y,width,height,scale,rotation"; duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")) } }
|
|
72
|
+
OpacityAnimator { id: opacityAnimator; target: driver.targetItem; from: Number(renderer.prop("from", 0)); to: Number(renderer.prop("to", 1)); duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")); loops: driver.loopsValue() }
|
|
73
|
+
RotationAnimator { id: rotationAnimator; target: driver.targetItem; from: Number(renderer.prop("from", 0)); to: Number(renderer.prop("to", 360)); duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")); loops: driver.loopsValue() }
|
|
74
|
+
ScaleAnimator { id: scaleAnimator; target: driver.targetItem; from: Number(renderer.prop("from", 0)); to: Number(renderer.prop("to", 1)); duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")); loops: driver.loopsValue() }
|
|
75
|
+
XAnimator { id: xAnimator; target: driver.targetItem; from: Number(renderer.prop("from", 0)); to: Number(renderer.prop("to", 100)); duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")); loops: driver.loopsValue() }
|
|
76
|
+
YAnimator { id: yAnimator; target: driver.targetItem; from: Number(renderer.prop("from", 0)); to: Number(renderer.prop("to", 100)); duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")); loops: driver.loopsValue() }
|
|
77
|
+
UniformAnimator { id: uniformAnimator; target: driver.targetItem; uniform: String(renderer.prop("uniform", "progress")); from: Number(renderer.prop("from", 0)); to: Number(renderer.prop("to", 1)); duration: Number(renderer.prop("duration", 250)); easing.type: renderer.easingType(renderer.prop("easing", "in_out_quad")); loops: driver.loopsValue() }
|
|
78
|
+
PauseAnimation { id: pauseAnimation; duration: Number(renderer.prop("duration", 0)); loops: driver.loopsValue() }
|
|
79
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
|
|
3
|
+
Item {
|
|
4
|
+
id: groupRoot
|
|
5
|
+
required property var renderer
|
|
6
|
+
required property bool sequential
|
|
7
|
+
property var createdAnimations: []
|
|
8
|
+
|
|
9
|
+
function factoryFor(type) { if(type==="color")return colorFactory;if(type==="pause")return pauseFactory;if(type==="rotation")return rotationFactory;return numberFactory }
|
|
10
|
+
function rebuild() {
|
|
11
|
+
nativeGroup.stop(); for(var oldIndex=0;oldIndex<createdAnimations.length;oldIndex++)createdAnimations[oldIndex].destroy();createdAnimations=[]
|
|
12
|
+
var definitions=renderer.prop("animations",[]);if(!Array.isArray(definitions))return
|
|
13
|
+
for(var index=0;index<definitions.length;index++){
|
|
14
|
+
var definition=definitions[index]||{};var type=String(definition.type||"number");var properties={duration:Number(definition.duration||250)}
|
|
15
|
+
if(type!=="pause"){properties.target=renderer.findRenderedItem(definition.target||renderer.prop("target",""));properties.property=String(definition.property||"opacity");properties.from=definition.from===undefined?0:definition.from;properties.to=definition.to===undefined?1:definition.to}
|
|
16
|
+
var object=factoryFor(type).createObject(nativeGroup,properties)
|
|
17
|
+
nativeGroup.animations.push(object);createdAnimations.push(object)
|
|
18
|
+
}
|
|
19
|
+
nativeGroup.loops=String(renderer.prop("loops",1))==="infinite"?Animation.Infinite:Math.max(1,Number(renderer.prop("loops",1)))
|
|
20
|
+
if(renderer.prop("running",false)===true){nativeGroup.start();if(renderer.prop("paused",false)===true)nativeGroup.pause()}
|
|
21
|
+
}
|
|
22
|
+
function send(name,payload){if(renderer.subscribed(name))renderer.bridge.sendEvent(renderer.surfaceName,renderer.controlId,name,payload||{})}
|
|
23
|
+
Component { id:numberFactory; NumberAnimation{} }
|
|
24
|
+
Component { id:colorFactory; ColorAnimation{} }
|
|
25
|
+
Component { id:rotationFactory; RotationAnimation{} }
|
|
26
|
+
Component { id:pauseFactory; PauseAnimation{} }
|
|
27
|
+
ParallelAnimation { id:parallelGroup; onStarted:groupRoot.send("start",{});onStopped:groupRoot.send("stop",{});onFinished:groupRoot.send("finish",{}) }
|
|
28
|
+
SequentialAnimation { id:sequentialGroup; onStarted:groupRoot.send("start",{});onStopped:groupRoot.send("stop",{});onFinished:groupRoot.send("finish",{}) }
|
|
29
|
+
readonly property var nativeGroup: sequential ? sequentialGroup : parallelGroup
|
|
30
|
+
Connections{target:renderer;function onNodeChanged(){groupRoot.rebuild()}}
|
|
31
|
+
Component.onCompleted:rebuild()
|
|
32
|
+
}
|