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,211 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import "../../Theme"
|
|
4
|
+
|
|
5
|
+
QQC.Popup {
|
|
6
|
+
id: sheetRoot
|
|
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 string contentLayout: String(renderer.prop("layout", "column"))
|
|
12
|
+
readonly property real sheetMargin: Number(renderer.prop("margin", Style.spacing.md))
|
|
13
|
+
readonly property real maximumWidth: Number(renderer.prop("max_width", 720))
|
|
14
|
+
readonly property real restingX: parent ? Math.max(sheetMargin,
|
|
15
|
+
(parent.width - width) / 2) : sheetMargin
|
|
16
|
+
readonly property real restingY: parent ? Math.max(0, parent.height - height - sheetMargin) : 0
|
|
17
|
+
property real dragOffset: 0
|
|
18
|
+
property real dragStartOffset: 0
|
|
19
|
+
|
|
20
|
+
function closePolicyValue(value) {
|
|
21
|
+
if (renderer.prop("dismissible", true) === false) return QQC.Popup.NoAutoClose
|
|
22
|
+
var names = Array.isArray(value) ? value : [value || "escape_and_outside"]
|
|
23
|
+
var result = 0
|
|
24
|
+
for (var index = 0; index < names.length; index++) {
|
|
25
|
+
var name = String(names[index])
|
|
26
|
+
if (name === "none") continue
|
|
27
|
+
if (name === "escape" || name === "escape_and_outside") result |= QQC.Popup.CloseOnEscape
|
|
28
|
+
if (name === "outside" || name === "escape_and_outside") result |= QQC.Popup.CloseOnPressOutside
|
|
29
|
+
if (name === "outside_parent") result |= QQC.Popup.CloseOnPressOutsideParent
|
|
30
|
+
if (name === "release_outside") result |= QQC.Popup.CloseOnReleaseOutside
|
|
31
|
+
if (name === "release_outside_parent") result |= QQC.Popup.CloseOnReleaseOutsideParent
|
|
32
|
+
}
|
|
33
|
+
return result
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function syncOpenState() {
|
|
37
|
+
if (requestedOpen === opened) return
|
|
38
|
+
if (requestedOpen) open()
|
|
39
|
+
else close()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function updateDrag(value) {
|
|
43
|
+
dragOffset = Math.max(0, Math.min(height, value))
|
|
44
|
+
if (renderer.subscribed("drag"))
|
|
45
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "drag", {
|
|
46
|
+
offset: dragOffset, progress: height > 0 ? dragOffset / height : 0
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function finishDrag() {
|
|
51
|
+
var progress = height > 0 ? dragOffset / height : 0
|
|
52
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "drag_end", {
|
|
53
|
+
offset: dragOffset, progress: progress
|
|
54
|
+
})
|
|
55
|
+
if (renderer.prop("dismissible", true) !== false
|
|
56
|
+
&& progress >= Number(renderer.prop("dismiss_threshold", 0.3))) {
|
|
57
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "dismiss", {
|
|
58
|
+
offset: dragOffset, progress: progress
|
|
59
|
+
})
|
|
60
|
+
close()
|
|
61
|
+
} else {
|
|
62
|
+
dragReturn.restart()
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
x: restingX
|
|
67
|
+
y: restingY + dragOffset
|
|
68
|
+
width: {
|
|
69
|
+
var available = parent ? parent.width - sheetMargin * 2 : maximumWidth
|
|
70
|
+
var requested = Number(renderer.prop("width", Math.min(available, maximumWidth)))
|
|
71
|
+
return Math.max(0, Math.min(requested, available, maximumWidth))
|
|
72
|
+
}
|
|
73
|
+
height: Number(renderer.prop("height", 320))
|
|
74
|
+
modal: renderer.prop("modal", true) !== false
|
|
75
|
+
dim: renderer.prop("dim", modal) !== false
|
|
76
|
+
focus: true
|
|
77
|
+
closePolicy: closePolicyValue(renderer.prop("close_policy", "escape_and_outside"))
|
|
78
|
+
enabled: renderer.prop("enabled", true) !== false
|
|
79
|
+
padding: Number(renderer.prop("padding", Style.spacing.lg))
|
|
80
|
+
|
|
81
|
+
background: Rectangle {
|
|
82
|
+
color: renderer.prop("background", Color.background)
|
|
83
|
+
radius: Number(renderer.prop("radius", Style.cornerRadius))
|
|
84
|
+
border.width: String(renderer.prop("border_color", "")).length > 0 ? Style.normalBorderWidth : 0
|
|
85
|
+
border.color: renderer.prop("border_color", "transparent")
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
contentItem: Column {
|
|
89
|
+
spacing: Number(renderer.prop("spacing", Style.spacing.md))
|
|
90
|
+
|
|
91
|
+
Item {
|
|
92
|
+
width: parent.width
|
|
93
|
+
height: renderer.prop("handle_visible", true) !== false
|
|
94
|
+
? Math.max(Number(renderer.prop("handle_height", 4)) + Style.spacing.sm * 2, 24) : 0
|
|
95
|
+
visible: height > 0
|
|
96
|
+
|
|
97
|
+
Rectangle {
|
|
98
|
+
anchors.centerIn: parent
|
|
99
|
+
width: Number(renderer.prop("handle_width", 44))
|
|
100
|
+
height: Number(renderer.prop("handle_height", 4))
|
|
101
|
+
radius: height / 2
|
|
102
|
+
color: renderer.prop("muted", Color.muted)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
DragHandler {
|
|
106
|
+
id: sheetDragHandler
|
|
107
|
+
enabled: renderer.prop("draggable", true) !== false
|
|
108
|
+
&& renderer.prop("dismissible", true) !== false
|
|
109
|
+
target: null
|
|
110
|
+
xAxis.enabled: false
|
|
111
|
+
onActiveChanged: {
|
|
112
|
+
if (active) sheetRoot.dragStartOffset = sheetRoot.dragOffset
|
|
113
|
+
else sheetRoot.finishDrag()
|
|
114
|
+
}
|
|
115
|
+
onTranslationChanged: {
|
|
116
|
+
if (active) sheetRoot.updateDrag(sheetRoot.dragStartOffset + translation.y)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
Loader {
|
|
122
|
+
width: parent.width
|
|
123
|
+
height: Math.max(0, parent.height - y)
|
|
124
|
+
sourceComponent: sheetRoot.contentLayout === "row" ? rowContent
|
|
125
|
+
: (sheetRoot.contentLayout === "stack" ? stackContent : columnContent)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
Component {
|
|
130
|
+
id: columnContent
|
|
131
|
+
Column {
|
|
132
|
+
spacing: Number(renderer.prop("spacing", Style.spacing.md))
|
|
133
|
+
Repeater { model: renderer.node.children || []; delegate: renderer.childDelegateComponent }
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
Component {
|
|
138
|
+
id: rowContent
|
|
139
|
+
Row {
|
|
140
|
+
spacing: Number(renderer.prop("spacing", Style.spacing.md))
|
|
141
|
+
Repeater { model: renderer.node.children || []; delegate: renderer.childDelegateComponent }
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
Component {
|
|
146
|
+
id: stackContent
|
|
147
|
+
Item {
|
|
148
|
+
Repeater { model: renderer.node.children || []; delegate: renderer.childDelegateComponent }
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
NumberAnimation {
|
|
153
|
+
id: dragReturn
|
|
154
|
+
target: sheetRoot
|
|
155
|
+
property: "dragOffset"
|
|
156
|
+
to: 0
|
|
157
|
+
duration: renderer.prop("animated", true) !== false
|
|
158
|
+
? Number(renderer.prop("duration", 180)) : 0
|
|
159
|
+
easing.type: renderer.easingType(renderer.prop("easing", "out_cubic"))
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
enter: Transition {
|
|
163
|
+
ParallelAnimation {
|
|
164
|
+
NumberAnimation {
|
|
165
|
+
property: "opacity"; from: 0; to: 1
|
|
166
|
+
duration: renderer.prop("animated", true) !== false
|
|
167
|
+
? Number(renderer.prop("duration", 220)) : 0
|
|
168
|
+
easing.type: renderer.easingType(renderer.prop("easing", "out_cubic"))
|
|
169
|
+
}
|
|
170
|
+
NumberAnimation {
|
|
171
|
+
property: "y"; from: sheetRoot.parent ? sheetRoot.parent.height : sheetRoot.restingY
|
|
172
|
+
to: sheetRoot.restingY
|
|
173
|
+
duration: renderer.prop("animated", true) !== false
|
|
174
|
+
? Number(renderer.prop("duration", 220)) : 0
|
|
175
|
+
easing.type: renderer.easingType(renderer.prop("easing", "out_cubic"))
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
exit: Transition {
|
|
181
|
+
ParallelAnimation {
|
|
182
|
+
NumberAnimation {
|
|
183
|
+
property: "opacity"; from: 1; to: 0
|
|
184
|
+
duration: renderer.prop("animated", true) !== false
|
|
185
|
+
? Number(renderer.prop("duration", 180)) : 0
|
|
186
|
+
easing.type: renderer.easingType("in_cubic")
|
|
187
|
+
}
|
|
188
|
+
NumberAnimation {
|
|
189
|
+
property: "y"; from: sheetRoot.y
|
|
190
|
+
to: sheetRoot.parent ? sheetRoot.parent.height : sheetRoot.y + sheetRoot.height
|
|
191
|
+
duration: renderer.prop("animated", true) !== false
|
|
192
|
+
? Number(renderer.prop("duration", 180)) : 0
|
|
193
|
+
easing.type: renderer.easingType("in_cubic")
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
Component.onCompleted: syncOpenState()
|
|
199
|
+
onRequestedOpenChanged: syncOpenState()
|
|
200
|
+
onOpened: {
|
|
201
|
+
dragOffset = 0
|
|
202
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "open", {})
|
|
203
|
+
}
|
|
204
|
+
onClosed: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "close", {})
|
|
205
|
+
onAboutToShow: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "about_to_show", {})
|
|
206
|
+
onAboutToHide: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "about_to_hide", {})
|
|
207
|
+
onVisibleChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
208
|
+
visible ? "show" : "hide", {})
|
|
209
|
+
onActiveFocusChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
210
|
+
activeFocus ? "focus" : "blur", {})
|
|
211
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import "../../Theme"
|
|
4
|
+
|
|
5
|
+
QQC.Pane {
|
|
6
|
+
id: breadcrumbRoot
|
|
7
|
+
|
|
8
|
+
required property var renderer
|
|
9
|
+
readonly property var destinations: renderer.prop("items", [])
|
|
10
|
+
readonly property int requestedIndex: Number(renderer.prop("current_index",
|
|
11
|
+
Array.isArray(destinations) ? destinations.length - 1 : -1))
|
|
12
|
+
property int currentIndex: -1
|
|
13
|
+
property bool synchronizing: false
|
|
14
|
+
|
|
15
|
+
function itemAt(index) {
|
|
16
|
+
return Array.isArray(destinations) && index < destinations.length ? destinations[index] : null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function itemValue(index, name, fallback) {
|
|
20
|
+
var item = itemAt(index)
|
|
21
|
+
return item !== null && typeof item === "object" && item[name] !== undefined
|
|
22
|
+
? item[name] : fallback
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function itemLabel(index) {
|
|
26
|
+
var item = itemAt(index)
|
|
27
|
+
return item !== null && typeof item === "object"
|
|
28
|
+
? String(item.label === undefined ? (item.text === undefined ? "" : item.text) : item.label)
|
|
29
|
+
: String(item === null ? "" : item)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function itemPayload(index) {
|
|
33
|
+
return {
|
|
34
|
+
index: index,
|
|
35
|
+
label: itemLabel(index),
|
|
36
|
+
value: itemValue(index, "value", itemLabel(index))
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function boundedIndex(value) {
|
|
41
|
+
var count = Array.isArray(destinations) ? destinations.length : 0
|
|
42
|
+
return count === 0 ? -1 : Math.max(0, Math.min(count - 1, Number(value)))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function syncSelection() {
|
|
46
|
+
var next = boundedIndex(requestedIndex)
|
|
47
|
+
if (currentIndex === next) return
|
|
48
|
+
synchronizing = true
|
|
49
|
+
currentIndex = next
|
|
50
|
+
synchronizing = false
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
implicitWidth: Number(renderer.prop("width", 560))
|
|
54
|
+
implicitHeight: Number(renderer.prop("height", 48))
|
|
55
|
+
enabled: renderer.prop("enabled", true) !== false
|
|
56
|
+
visible: renderer.prop("visible", true) !== false
|
|
57
|
+
padding: Number(renderer.prop("padding", Style.spacing.sm))
|
|
58
|
+
|
|
59
|
+
background: Rectangle {
|
|
60
|
+
color: renderer.prop("background", "transparent")
|
|
61
|
+
radius: Number(renderer.prop("radius", 0))
|
|
62
|
+
border.width: String(renderer.prop("border_color", "")).length > 0 ? Style.normalBorderWidth : 0
|
|
63
|
+
border.color: renderer.prop("border_color", "transparent")
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
contentItem: Flickable {
|
|
67
|
+
clip: true
|
|
68
|
+
contentWidth: trail.implicitWidth
|
|
69
|
+
contentHeight: height
|
|
70
|
+
interactive: contentWidth > width
|
|
71
|
+
boundsBehavior: Flickable.StopAtBounds
|
|
72
|
+
|
|
73
|
+
Row {
|
|
74
|
+
id: trail
|
|
75
|
+
height: parent.height
|
|
76
|
+
spacing: Number(renderer.prop("spacing", Style.spacing.xs))
|
|
77
|
+
|
|
78
|
+
Repeater {
|
|
79
|
+
model: Array.isArray(breadcrumbRoot.destinations) ? breadcrumbRoot.destinations.length : 0
|
|
80
|
+
Row {
|
|
81
|
+
required property int index
|
|
82
|
+
height: trail.height
|
|
83
|
+
spacing: Number(renderer.prop("spacing", Style.spacing.xs))
|
|
84
|
+
|
|
85
|
+
QQC.ToolButton {
|
|
86
|
+
id: crumbButton
|
|
87
|
+
height: Number(renderer.prop("item_height", trail.height))
|
|
88
|
+
enabled: breadcrumbRoot.enabled && breadcrumbRoot.itemValue(index, "enabled", true) !== false
|
|
89
|
+
hoverEnabled: true
|
|
90
|
+
|
|
91
|
+
contentItem: Row {
|
|
92
|
+
anchors.centerIn: parent
|
|
93
|
+
spacing: Style.spacing.xs
|
|
94
|
+
|
|
95
|
+
Image {
|
|
96
|
+
visible: source.toString().length > 0
|
|
97
|
+
source: String(breadcrumbRoot.itemValue(index, "icon_source", ""))
|
|
98
|
+
width: Number(renderer.prop("icon_size", Style.font.icon))
|
|
99
|
+
height: width
|
|
100
|
+
fillMode: Image.PreserveAspectFit
|
|
101
|
+
onStatusChanged: {
|
|
102
|
+
if (status === Image.Error)
|
|
103
|
+
renderer.componentError("breadcrumb_icon_failed",
|
|
104
|
+
"Unable to load the declared breadcrumb icon image",
|
|
105
|
+
{ index: index, source: String(source) })
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
Text {
|
|
110
|
+
visible: String(breadcrumbRoot.itemValue(index, "icon", "")).length > 0
|
|
111
|
+
&& String(breadcrumbRoot.itemValue(index, "icon_source", "")).length === 0
|
|
112
|
+
text: renderer.iconGlyph(breadcrumbRoot.itemValue(index, "icon", ""))
|
|
113
|
+
color: crumbButton.enabled ? renderer.prop("foreground", renderer.foreground)
|
|
114
|
+
: renderer.prop("muted", Color.muted)
|
|
115
|
+
font.family: renderer.fontFamily
|
|
116
|
+
font.pixelSize: Number(renderer.prop("icon_size", Style.font.icon))
|
|
117
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
Text {
|
|
121
|
+
text: breadcrumbRoot.itemLabel(index)
|
|
122
|
+
color: !crumbButton.enabled ? renderer.prop("muted", Color.muted)
|
|
123
|
+
: (breadcrumbRoot.currentIndex === index ? renderer.prop("accent", Color.accent)
|
|
124
|
+
: renderer.prop("foreground", renderer.foreground))
|
|
125
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
126
|
+
font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
|
|
127
|
+
font.bold: breadcrumbRoot.currentIndex === index
|
|
128
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
background: Rectangle { color: "transparent" }
|
|
133
|
+
onClicked: {
|
|
134
|
+
breadcrumbRoot.currentIndex = index
|
|
135
|
+
if (renderer.subscribed("select"))
|
|
136
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
137
|
+
"select", breadcrumbRoot.itemPayload(index))
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
Text {
|
|
142
|
+
visible: index < breadcrumbRoot.destinations.length - 1
|
|
143
|
+
text: renderer.iconGlyph(renderer.prop("separator", "chevron_right"))
|
|
144
|
+
color: renderer.prop("muted", Color.muted)
|
|
145
|
+
font.family: renderer.fontFamily
|
|
146
|
+
font.pixelSize: Number(renderer.prop("icon_size", Style.font.icon))
|
|
147
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
onRequestedIndexChanged: syncSelection()
|
|
155
|
+
onDestinationsChanged: syncSelection()
|
|
156
|
+
Component.onCompleted: syncSelection()
|
|
157
|
+
onCurrentIndexChanged: {
|
|
158
|
+
if (synchronizing || currentIndex < 0) return
|
|
159
|
+
var payload = itemPayload(currentIndex)
|
|
160
|
+
if (renderer.subscribed("input"))
|
|
161
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "input", payload)
|
|
162
|
+
if (renderer.subscribed("change"))
|
|
163
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", payload)
|
|
164
|
+
}
|
|
165
|
+
onVisibleChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
166
|
+
visible ? "show" : "hide", {})
|
|
167
|
+
onActiveFocusChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
168
|
+
activeFocus ? "focus" : "blur", {})
|
|
169
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import "../../Theme"
|
|
4
|
+
|
|
5
|
+
QQC.BusyIndicator {
|
|
6
|
+
id: busyRoot
|
|
7
|
+
|
|
8
|
+
required property var renderer
|
|
9
|
+
|
|
10
|
+
running: renderer.prop("running", true) !== false
|
|
11
|
+
implicitWidth: Number(renderer.prop("width", 48))
|
|
12
|
+
implicitHeight: Number(renderer.prop("height", 48))
|
|
13
|
+
enabled: renderer.prop("enabled", true) !== false
|
|
14
|
+
opacity: Number(renderer.prop("opacity", enabled ? 1 : 0.5))
|
|
15
|
+
palette.highlight: renderer.prop("color", Color.accent)
|
|
16
|
+
palette.accent: renderer.prop("color", Color.accent)
|
|
17
|
+
Accessible.name: String(renderer.prop("accessible_name", "Loading"))
|
|
18
|
+
Accessible.role: Accessible.Indicator
|
|
19
|
+
|
|
20
|
+
onRunningChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
21
|
+
"running_change", { value: running })
|
|
22
|
+
onVisibleChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
23
|
+
visible ? "show" : "hide", {})
|
|
24
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
ZuiControls.Button {
|
|
10
|
+
required property var renderer
|
|
11
|
+
|
|
12
|
+
text: renderer.escapeAutoText(renderer.prop("text", ""))
|
|
13
|
+
iconText: renderer.iconGlyph(renderer.prop("icon", ""))
|
|
14
|
+
tooltipText: renderer.escapeAutoText(renderer.prop("tooltip", ""))
|
|
15
|
+
selected: renderer.prop("selected", false) === true
|
|
16
|
+
active: renderer.prop("active", false) === true
|
|
17
|
+
hasCursor: renderer.prop("cursor", false) === true
|
|
18
|
+
focusable: renderer.prop("focusable", true) !== false
|
|
19
|
+
bordered: renderer.prop("bordered", true) !== false
|
|
20
|
+
foreground: renderer.prop("foreground", renderer.foreground)
|
|
21
|
+
background: renderer.prop("background", "transparent")
|
|
22
|
+
accent: renderer.prop("accent", Color.accent)
|
|
23
|
+
fontFamily: String(renderer.prop("font_family", renderer.fontFamily))
|
|
24
|
+
fontSize: Number(renderer.prop("font_size", Style.font.body))
|
|
25
|
+
iconSize: Number(renderer.prop("icon_size", Style.font.icon))
|
|
26
|
+
iconRotation: Number(renderer.prop("icon_rotation", 0))
|
|
27
|
+
iconSpinning: renderer.prop("icon_spinning", false) === true
|
|
28
|
+
horizontalPadding: Number(renderer.prop("horizontal_padding", Style.spacing.controlPaddingX))
|
|
29
|
+
verticalPadding: Number(renderer.prop("vertical_padding", Style.spacing.controlPaddingY))
|
|
30
|
+
leftAlign: renderer.prop("left_align", false) === true
|
|
31
|
+
tooltipBackground: renderer.prop("tooltip_background", Color.tooltip.background)
|
|
32
|
+
tooltipForeground: renderer.prop("tooltip_foreground", Color.tooltip.text)
|
|
33
|
+
tooltipBorder: renderer.prop("tooltip_border", Color.tooltip.border)
|
|
34
|
+
onClicked: {
|
|
35
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "click", {
|
|
36
|
+
});
|
|
37
|
+
const url = String(renderer.prop("url", ""));
|
|
38
|
+
if (url.length > 0) {
|
|
39
|
+
const opened = Qt.openUrlExternally(url);
|
|
40
|
+
const eventName = opened ? "open" : "error";
|
|
41
|
+
if (renderer.subscribed(eventName))
|
|
42
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, eventName, {
|
|
43
|
+
"url": url
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
onRightClicked: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "right_click", {
|
|
49
|
+
})
|
|
50
|
+
onHovered: function(value) {
|
|
51
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "hover", {
|
|
52
|
+
"value": value
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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.ButtonGroup {
|
|
10
|
+
required property var renderer
|
|
11
|
+
value: String(renderer.prop("value", "")); options: renderer.prop("options", [])
|
|
12
|
+
foreground: renderer.prop("foreground", renderer.foreground); background: renderer.prop("background", Color.background)
|
|
13
|
+
accent: renderer.prop("accent", Color.accent); fontFamily: String(renderer.prop("font_family", renderer.fontFamily))
|
|
14
|
+
fontSize: Number(renderer.prop("font_size", Style.font.body)); focusable: renderer.prop("focusable", true) !== false
|
|
15
|
+
cursorIndex: Number(renderer.prop("cursor_index", -1))
|
|
16
|
+
onChanged: function(value) { renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", { value: value }) }
|
|
17
|
+
onHovered: function(index, value) { renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "hover", { index: index, value: value }) }
|
|
18
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import "../../Theme"
|
|
4
|
+
|
|
5
|
+
Rectangle {
|
|
6
|
+
id: calendarRoot
|
|
7
|
+
property var renderer: null
|
|
8
|
+
property date shownDate: requestedDate()
|
|
9
|
+
implicitWidth: Number(renderer ? renderer.prop("width", 360) : 360)
|
|
10
|
+
implicitHeight: Number(renderer ? renderer.prop("height", 360) : 360)
|
|
11
|
+
color: renderer ? renderer.prop("background", Color.background) : Color.background
|
|
12
|
+
radius: Number(renderer ? renderer.prop("radius", Style.cornerRadius) : Style.cornerRadius)
|
|
13
|
+
border.color: renderer ? renderer.prop("border_color", "transparent") : "transparent"
|
|
14
|
+
|
|
15
|
+
function parseDate(value) {
|
|
16
|
+
var parts = String(value || "").split("-")
|
|
17
|
+
return parts.length === 3 ? new Date(Number(parts[0]), Number(parts[1]) - 1, Number(parts[2])) : new Date()
|
|
18
|
+
}
|
|
19
|
+
function requestedDate() { var value=renderer?String(renderer.prop("date","")):"";if(value!=="")return parseDate(value);var now=new Date();return new Date(Number(renderer?renderer.prop("year",now.getFullYear()):now.getFullYear()),Number(renderer?renderer.prop("month",now.getMonth()+1):now.getMonth()+1)-1,now.getDate()) }
|
|
20
|
+
function dateAllowed(value) { var minimum=renderer?String(renderer.prop("minimum","")):"";var maximum=renderer?String(renderer.prop("maximum","")):"";var text=dateText(value);return (minimum===""||text>=minimum)&&(maximum===""||text<=maximum) }
|
|
21
|
+
function dateText(value) { return Qt.formatDate(value, "yyyy-MM-dd") }
|
|
22
|
+
function changeMonth(delta) {
|
|
23
|
+
shownDate = new Date(shownDate.getFullYear(), shownDate.getMonth() + delta, 1)
|
|
24
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "navigate", { month: shownDate.getMonth() + 1, year: shownDate.getFullYear() })
|
|
25
|
+
}
|
|
26
|
+
Column {
|
|
27
|
+
anchors.fill: parent; anchors.margins: 8; spacing: 4
|
|
28
|
+
Rectangle {
|
|
29
|
+
width: parent.width; height: 40; visible: renderer.prop("show_navigation", true) !== false
|
|
30
|
+
color: renderer.prop("header_background", "transparent")
|
|
31
|
+
QQC.ToolButton { anchors.left: parent.left; text: "‹"; onClicked: calendarRoot.changeMonth(-1) }
|
|
32
|
+
Text { anchors.fill: parent; anchors.leftMargin: 40; anchors.rightMargin: 40; text: Qt.formatDate(calendarRoot.shownDate, "MMMM yyyy"); color: renderer.prop("foreground", renderer.foreground); font.family: renderer.prop("font_family", renderer.fontFamily); font.pixelSize: Number(renderer.prop("font_size", Style.font.body)); font.bold: true; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter }
|
|
33
|
+
QQC.ToolButton { anchors.right: parent.right; text: "›"; onClicked: calendarRoot.changeMonth(1) }
|
|
34
|
+
}
|
|
35
|
+
Item {
|
|
36
|
+
width: parent.width; height: parent.height - y
|
|
37
|
+
readonly property real weekWidth: renderer.prop("show_week_numbers", false) === true ? 36 : 0
|
|
38
|
+
QQC.DayOfWeekRow { x: parent.weekWidth; width: parent.width - parent.weekWidth; height: 32; locale: Qt.locale(String(renderer.prop("locale", Qt.locale().name))) }
|
|
39
|
+
QQC.WeekNumberColumn { visible: parent.weekWidth > 0; width: parent.weekWidth; y: 32; height: parent.height - 32; month: calendarRoot.shownDate.getMonth(); year: calendarRoot.shownDate.getFullYear(); locale: Qt.locale(String(renderer.prop("locale", Qt.locale().name))); delegate: Text { required property var model; text: model.weekNumber; color: renderer.prop("muted", Color.muted); horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter } }
|
|
40
|
+
QQC.MonthGrid {
|
|
41
|
+
id: nativeGrid
|
|
42
|
+
x: parent.weekWidth; y: 32; width: parent.width - parent.weekWidth; height: parent.height - 32
|
|
43
|
+
month: calendarRoot.shownDate.getMonth(); year: calendarRoot.shownDate.getFullYear(); locale: Qt.locale(String(renderer.prop("locale", Qt.locale().name)))
|
|
44
|
+
delegate: Text {
|
|
45
|
+
required property var model
|
|
46
|
+
horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter
|
|
47
|
+
text: model.day; opacity: calendarRoot.dateAllowed(model.date) ? 1 : 0.35; color: model.month === nativeGrid.month ? renderer.prop("foreground", renderer.foreground) : renderer.prop("muted", Color.muted)
|
|
48
|
+
font.family: renderer.prop("font_family", renderer.fontFamily); font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
|
|
49
|
+
Rectangle { anchors.fill: parent; z: -1; radius: width / 2; color: calendarRoot.dateText(model.date) === calendarRoot.dateText(calendarRoot.shownDate) ? renderer.prop("selected_background", renderer.prop("accent", Color.accent)) : (calendarRoot.dateText(model.date) === calendarRoot.dateText(new Date()) ? renderer.prop("today_background", Color.popups.background) : "transparent") }
|
|
50
|
+
}
|
|
51
|
+
onClicked: function(date) { if(!calendarRoot.dateAllowed(date))return;calendarRoot.shownDate = date; var payload = { value: calendarRoot.dateText(date) }; renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "input", payload); renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", payload) }
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtMultimedia
|
|
3
|
+
|
|
4
|
+
Item {
|
|
5
|
+
id:cameraRoot;property var renderer:null;property alias camera:nativeCamera;property int handledCommandRevision:-1
|
|
6
|
+
function deviceValid(){var requested=String(renderer?renderer.prop("camera_device",""):"");if(requested==="")return true;var list=mediaDevices.videoInputs;for(var i=0;i<list.length;i++)if(String(list[i].id)===requested||list[i].description===requested)return true;if(renderer)renderer.componentError("camera_device_not_found","The declared camera device does not exist",{device:requested});return false}
|
|
7
|
+
function device(){var requested=String(renderer?renderer.prop("camera_device",""):"");var list=mediaDevices.videoInputs;if(requested==="")return mediaDevices.defaultVideoInput;for(var i=0;i<list.length;i++)if(String(list[i].id)===requested||list[i].description===requested)return list[i];return null}
|
|
8
|
+
function focusMode(){var value=String(renderer?renderer.prop("focus_mode","auto"):"auto");if(value==="auto_near")return Camera.FocusModeAutoNear;if(value==="auto_far")return Camera.FocusModeAutoFar;if(value==="hyperfocal")return Camera.FocusModeHyperfocal;if(value==="infinity")return Camera.FocusModeInfinity;if(value==="manual")return Camera.FocusModeManual;return Camera.FocusModeAuto}
|
|
9
|
+
function flashMode(){var value=String(renderer?renderer.prop("flash_mode","auto"):"auto");if(value==="off")return Camera.FlashOff;if(value==="on")return Camera.FlashOn;return Camera.FlashAuto}
|
|
10
|
+
function torchMode(){var value=String(renderer?renderer.prop("torch_mode","off"):"off");if(value==="on")return Camera.TorchOn;if(value==="auto")return Camera.TorchAuto;return Camera.TorchOff}
|
|
11
|
+
function exposureMode(){var value=String(renderer?renderer.prop("exposure_mode","auto"):"auto");var modes={manual:Camera.ExposureManual,portrait:Camera.ExposurePortrait,night:Camera.ExposureNight,sports:Camera.ExposureSports,snow:Camera.ExposureSnow,beach:Camera.ExposureBeach,action:Camera.ExposureAction,landscape:Camera.ExposureLandscape,night_portrait:Camera.ExposureNightPortrait,theatre:Camera.ExposureTheatre,sunset:Camera.ExposureSunset,steady_photo:Camera.ExposureSteadyPhoto,fireworks:Camera.ExposureFireworks,party:Camera.ExposureParty,candlelight:Camera.ExposureCandlelight,barcode:Camera.ExposureBarcode};return modes[value]===undefined?Camera.ExposureAuto:modes[value]}
|
|
12
|
+
function whiteBalanceMode(){var value=String(renderer?renderer.prop("white_balance_mode","auto"):"auto");var modes={manual:Camera.WhiteBalanceManual,sunlight:Camera.WhiteBalanceSunlight,cloudy:Camera.WhiteBalanceCloudy,shade:Camera.WhiteBalanceShade,tungsten:Camera.WhiteBalanceTungsten,fluorescent:Camera.WhiteBalanceFluorescent,flash:Camera.WhiteBalanceFlash,sunset:Camera.WhiteBalanceSunset};return modes[value]===undefined?Camera.WhiteBalanceAuto:modes[value]}
|
|
13
|
+
function send(name,payload){if(renderer&&renderer.subscribed(name))renderer.bridge.sendEvent(renderer.surfaceName,renderer.controlId,name,payload||{})}
|
|
14
|
+
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",""));if(value==="start")nativeCamera.start();else if(value==="stop")nativeCamera.stop()}
|
|
15
|
+
MediaDevices{id:mediaDevices}
|
|
16
|
+
Camera{id:nativeCamera;cameraDevice:cameraRoot.device();active:renderer&&renderer.prop("active",false)===true&&cameraRoot.deviceValid();focusMode:cameraRoot.focusMode();flashMode:cameraRoot.flashMode();torchMode:cameraRoot.torchMode();exposureMode:cameraRoot.exposureMode();exposureCompensation:Number(renderer?renderer.prop("exposure_compensation",0):0);manualIsoSensitivity:Number(renderer?renderer.prop("iso",-1):-1);manualExposureTime:Number(renderer?renderer.prop("shutter_speed",-1):-1);whiteBalanceMode:cameraRoot.whiteBalanceMode();colorTemperature:Number(renderer?renderer.prop("color_temperature",0):0);zoomFactor:Number(renderer?renderer.prop("zoom_factor",1):1);onActiveChanged:{cameraRoot.send(active?"start":"stop",{});cameraRoot.send("active_change",{value:active})} onFocusModeChanged:cameraRoot.send("focus",{mode:focusMode,distance:focusDistance});onExposureModeChanged:cameraRoot.send("exposure",{mode:exposureMode,compensation:exposureCompensation,iso:isoSensitivity,shutter_speed:exposureTime});onErrorOccurred:function(error,errorString){renderer.componentError("camera_failed",errorString,{native_code:error})}}
|
|
17
|
+
Component.onCompleted:command();Connections{target:renderer;function onNodeChanged(){cameraRoot.command()}}
|
|
18
|
+
}
|