zui 0.0.1 → 0.0.3
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 +4 -4
- data/Components/Builtins/Accordion.qml +1 -1
- data/Components/Builtins/ActionButton.qml +1 -3
- data/Components/Builtins/AlertDialog.qml +2 -1
- data/Components/Builtins/AnimatedImage.qml +0 -2
- data/Components/Builtins/AreaChart.qml +0 -2
- data/Components/Builtins/AspectRatio.qml +0 -2
- data/Components/Builtins/Avatar.qml +0 -2
- data/Components/Builtins/Badge.qml +0 -2
- data/Components/Builtins/Banner.qml +2 -2
- data/Components/Builtins/BarChart.qml +0 -2
- data/Components/Builtins/BarIconButton.qml +1 -3
- data/Components/Builtins/BarIndicator.qml +3 -3
- data/Components/Builtins/BorderImage.qml +0 -2
- data/Components/Builtins/BorderOverlay.qml +0 -2
- data/Components/Builtins/Breadcrumb.qml +2 -2
- data/Components/Builtins/Button.qml +1 -2
- data/Components/Builtins/ButtonGroup.qml +0 -2
- data/Components/Builtins/Card.qml +0 -2
- data/Components/Builtins/Center.qml +0 -2
- data/Components/Builtins/CheckDelegate.qml +2 -1
- data/Components/Builtins/Checkbox.qml +1 -3
- data/Components/Builtins/Chip.qml +2 -4
- data/Components/Builtins/Column.qml +0 -2
- data/Components/Builtins/ColumnLayout.qml +0 -2
- data/Components/Builtins/ConfirmDialog.qml +0 -2
- data/Components/Builtins/ConstrainedBox.qml +0 -2
- data/Components/Builtins/Container.qml +0 -2
- data/Components/Builtins/CursorSurface.qml +0 -2
- data/Components/Builtins/DelayButton.qml +0 -2
- data/Components/Builtins/Dial.qml +0 -2
- data/Components/Builtins/Divider.qml +0 -2
- data/Components/Builtins/Dropdown.qml +0 -2
- data/Components/Builtins/ExpansionPanel.qml +1 -1
- data/Components/Builtins/FittedBox.qml +0 -2
- data/Components/Builtins/Flickable.qml +0 -2
- data/Components/Builtins/Flipable.qml +0 -2
- data/Components/Builtins/Flow.qml +0 -2
- data/Components/Builtins/FocusScope.qml +0 -2
- data/Components/Builtins/FontLoader.qml +0 -2
- data/Components/Builtins/Grid.qml +0 -2
- data/Components/Builtins/GridLayout.qml +0 -2
- data/Components/Builtins/GridView.qml +1 -1
- data/Components/Builtins/Icon.qml +1 -3
- data/Components/Builtins/Image.qml +0 -2
- data/Components/Builtins/ItemDelegate.qml +2 -2
- data/Components/Builtins/KeyCatcher.qml +0 -2
- data/Components/Builtins/Label.qml +0 -2
- data/Components/Builtins/LineChart.qml +0 -2
- data/Components/Builtins/ListView.qml +1 -3
- data/Components/Builtins/Loader.qml +0 -2
- data/Components/Builtins/Markdown.qml +0 -2
- data/Components/Builtins/ModalSheet.qml +1 -1
- data/Components/Builtins/MultiSelect.qml +0 -2
- data/Components/Builtins/NavigationRail.qml +1 -1
- data/Components/Builtins/NumberField.qml +0 -2
- data/Components/Builtins/OpticalGlyph.qml +1 -3
- data/Components/Builtins/PanelHero.qml +0 -2
- data/Components/Builtins/PasswordField.qml +1 -3
- data/Components/Builtins/Progress.qml +0 -2
- data/Components/Builtins/RadioButton.qml +0 -2
- data/Components/Builtins/RadioGroup.qml +0 -2
- data/Components/Builtins/RangeSlider.qml +0 -2
- data/Components/Builtins/Rectangle.qml +0 -2
- data/Components/Builtins/RichText.qml +0 -2
- data/Components/Builtins/RoundButton.qml +3 -3
- data/Components/Builtins/Row.qml +0 -2
- data/Components/Builtins/RowLayout.qml +0 -2
- data/Components/Builtins/ScreenCapture.qml +1 -1
- data/Components/Builtins/Scroll.qml +0 -2
- data/Components/Builtins/SearchableDropdown.qml +0 -2
- data/Components/Builtins/SectionHeader.qml +0 -2
- data/Components/Builtins/SelectableText.qml +0 -2
- data/Components/Builtins/Separator.qml +0 -2
- data/Components/Builtins/Slider.qml +0 -2
- data/Components/Builtins/Spacer.qml +0 -2
- data/Components/Builtins/SpinBox.qml +0 -2
- data/Components/Builtins/SplitView.qml +0 -2
- data/Components/Builtins/Stack.qml +0 -2
- data/Components/Builtins/StackLayout.qml +0 -2
- data/Components/Builtins/SwipeDelegate.qml +3 -3
- data/Components/Builtins/TabButton.qml +1 -1
- data/Components/Builtins/Text.qml +0 -2
- data/Components/Builtins/TextArea.qml +0 -2
- data/Components/Builtins/TextField.qml +0 -2
- data/Components/Builtins/TextMetrics.qml +0 -2
- data/Components/Builtins/Toast.qml +1 -1
- data/Components/Builtins/Toggle.qml +0 -2
- data/Components/Builtins/ToggleSwitch.qml +0 -2
- data/Components/Builtins/ToolButton.qml +3 -3
- data/Components/Builtins/Tooltip.qml +0 -2
- data/Components/Builtins/VectorImage.qml +1 -2
- data/Components/Builtins/Video.qml +1 -2
- data/Components/Builtins/WidgetButton.qml +0 -2
- data/Components/Builtins/Wrap.qml +0 -2
- data/ControlNode.qml +10 -22
- data/Controls/BarIconButton.qml +1 -1
- data/Controls/BarIndicator.qml +1 -1
- data/Controls/Button.qml +2 -1
- data/Controls/OpticalGlyph.qml +1 -1
- data/Desktop.qml +7 -3
- data/Fonts/FontAwesome-Brands.otf +0 -0
- data/Fonts/FontAwesome-Solid.otf +0 -0
- data/Fonts/LICENSE-FontAwesome.txt +165 -0
- data/Fonts/LICENSE-RobotoMono.txt +93 -0
- data/Fonts/RobotoMono-Bold.otf +0 -0
- data/Fonts/RobotoMono-Regular.otf +0 -0
- data/README.md +27 -14
- data/Service.qml +30 -6
- data/THIRD_PARTY_NOTICES.md +14 -0
- data/Theme/Fonts.qml +32 -0
- data/Theme/Style.qml +1 -1
- data/Theme/qmldir +1 -0
- data/lib/zui/application.rb +28 -3
- data/lib/zui/builder.rb +0 -1
- data/lib/zui/cli.rb +36 -6
- data/lib/zui/client.rb +349 -0
- data/lib/zui/components.rb +0 -1
- data/lib/zui/distribution.rb +53 -16
- data/lib/zui/generator.rb +1 -0
- data/lib/zui/host.rb +16 -94
- data/lib/zui/runner.rb +1 -1
- data/lib/zui/runtime.rb +1 -1
- data/lib/zui.rb +2 -1
- metadata +13 -13
- data/Components/Builtins/WebView.qml +0 -57
- data/native/CMakeLists.txt +0 -45
- data/native/ZuiClipboard.cpp +0 -16
- data/native/ZuiClipboard.h +0 -16
- data/native/ZuiProcess.cpp +0 -84
- data/native/ZuiProcess.h +0 -34
- data/native/main.cpp +0 -64
- data/vendor/host/linux-x86_64/PROVENANCE.md +0 -15
- data/vendor/host/linux-x86_64/zui-host +0 -0
- data/vendor/host/linux-x86_64/zui-host.sha256 +0 -1
data/lib/zui/runner.rb
CHANGED
data/lib/zui/runtime.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Zui
|
|
|
7
7
|
module_function
|
|
8
8
|
|
|
9
9
|
QML_FILES = %w[Desktop.qml Service.qml ControlNode.qml].freeze
|
|
10
|
-
QML_DIRECTORIES = %w[Components Controls Theme].freeze
|
|
10
|
+
QML_DIRECTORIES = %w[Components Controls Theme Fonts].freeze
|
|
11
11
|
|
|
12
12
|
def install_qml(destination, framework_root: FRAMEWORK_ROOT)
|
|
13
13
|
FileUtils.mkdir_p(destination)
|
data/lib/zui.rb
CHANGED
|
@@ -14,13 +14,14 @@ require_relative "zui/application"
|
|
|
14
14
|
require_relative "zui/source_bundle"
|
|
15
15
|
require_relative "zui/platform"
|
|
16
16
|
require_relative "zui/runtime"
|
|
17
|
+
require_relative "zui/client"
|
|
17
18
|
require_relative "zui/host"
|
|
18
19
|
require_relative "zui/runner"
|
|
19
20
|
require_relative "zui/generator"
|
|
20
21
|
require_relative "zui/distribution"
|
|
21
22
|
|
|
22
23
|
module Zui
|
|
23
|
-
VERSION = "0.0.
|
|
24
|
+
VERSION = "0.0.3"
|
|
24
25
|
FRAMEWORK_ROOT = File.expand_path("..", __dir__)
|
|
25
26
|
|
|
26
27
|
def self.app(&definition)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adam Moussa Ali
|
|
@@ -9,7 +9,8 @@ bindir: bin
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
|
-
description:
|
|
12
|
+
description: First-class UI, state, events, animation, media, GPU effects, and 3D
|
|
13
|
+
for Ruby desktop applications.
|
|
13
14
|
executables:
|
|
14
15
|
- zui
|
|
15
16
|
extensions: []
|
|
@@ -264,7 +265,6 @@ files:
|
|
|
264
265
|
- Components/Builtins/VerticalHeaderDelegate.qml
|
|
265
266
|
- Components/Builtins/Video.qml
|
|
266
267
|
- Components/Builtins/VideoOutput.qml
|
|
267
|
-
- Components/Builtins/WebView.qml
|
|
268
268
|
- Components/Builtins/WeekNumberColumn.qml
|
|
269
269
|
- Components/Builtins/WidgetButton.qml
|
|
270
270
|
- Components/Builtins/Window.qml
|
|
@@ -300,11 +300,19 @@ files:
|
|
|
300
300
|
- Controls/WidgetButton.qml
|
|
301
301
|
- Controls/qmldir
|
|
302
302
|
- Desktop.qml
|
|
303
|
+
- Fonts/FontAwesome-Brands.otf
|
|
304
|
+
- Fonts/FontAwesome-Solid.otf
|
|
305
|
+
- Fonts/LICENSE-FontAwesome.txt
|
|
306
|
+
- Fonts/LICENSE-RobotoMono.txt
|
|
307
|
+
- Fonts/RobotoMono-Bold.otf
|
|
308
|
+
- Fonts/RobotoMono-Regular.otf
|
|
303
309
|
- LICENSE
|
|
304
310
|
- README.md
|
|
305
311
|
- Service.qml
|
|
312
|
+
- THIRD_PARTY_NOTICES.md
|
|
306
313
|
- Theme/Border.qml
|
|
307
314
|
- Theme/Color.qml
|
|
315
|
+
- Theme/Fonts.qml
|
|
308
316
|
- Theme/Style.qml
|
|
309
317
|
- Theme/Util.qml
|
|
310
318
|
- Theme/qmldir
|
|
@@ -314,6 +322,7 @@ files:
|
|
|
314
322
|
- lib/zui/application.rb
|
|
315
323
|
- lib/zui/builder.rb
|
|
316
324
|
- lib/zui/cli.rb
|
|
325
|
+
- lib/zui/client.rb
|
|
317
326
|
- lib/zui/command.rb
|
|
318
327
|
- lib/zui/component_registry.rb
|
|
319
328
|
- lib/zui/components.rb
|
|
@@ -329,15 +338,6 @@ files:
|
|
|
329
338
|
- lib/zui/source_bundle.rb
|
|
330
339
|
- lib/zui/state_store.rb
|
|
331
340
|
- lib/zui/value.rb
|
|
332
|
-
- native/CMakeLists.txt
|
|
333
|
-
- native/ZuiClipboard.cpp
|
|
334
|
-
- native/ZuiClipboard.h
|
|
335
|
-
- native/ZuiProcess.cpp
|
|
336
|
-
- native/ZuiProcess.h
|
|
337
|
-
- native/main.cpp
|
|
338
|
-
- vendor/host/linux-x86_64/PROVENANCE.md
|
|
339
|
-
- vendor/host/linux-x86_64/zui-host
|
|
340
|
-
- vendor/host/linux-x86_64/zui-host.sha256
|
|
341
341
|
homepage: https://github.com/AdamMusa/zui
|
|
342
342
|
licenses:
|
|
343
343
|
- MIT
|
|
@@ -361,5 +361,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
361
361
|
requirements: []
|
|
362
362
|
rubygems_version: 4.0.18
|
|
363
363
|
specification_version: 4
|
|
364
|
-
summary: Build
|
|
364
|
+
summary: Build beautiful native desktop applications in pure Ruby
|
|
365
365
|
test_files: []
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import QtQuick
|
|
2
|
-
import QtWebEngine
|
|
3
|
-
|
|
4
|
-
WebEngineView {
|
|
5
|
-
id: webRoot
|
|
6
|
-
property var renderer: null
|
|
7
|
-
property int handledCommandRevision: -1
|
|
8
|
-
implicitWidth: Number(renderer ? renderer.prop("width", 800) : 800)
|
|
9
|
-
implicitHeight: Number(renderer ? renderer.prop("height", 600) : 600)
|
|
10
|
-
url: renderer ? renderer.assetUrl(renderer.prop("url", "about:blank")) : "about:blank"
|
|
11
|
-
zoomFactor: Number(renderer ? renderer.prop("zoom_factor", 1) : 1)
|
|
12
|
-
backgroundColor: renderer ? renderer.prop("background_color", "white") : "white"
|
|
13
|
-
activeFocusOnPress: !renderer || renderer.prop("active_focus_on_press", true) !== false
|
|
14
|
-
settings.javascriptEnabled: !renderer || renderer.prop("javascript_enabled", true) !== false
|
|
15
|
-
settings.localStorageEnabled: !renderer || renderer.prop("local_storage_enabled", true) !== false
|
|
16
|
-
settings.autoLoadImages: !renderer || renderer.prop("auto_load_images", true) !== false
|
|
17
|
-
settings.fullScreenSupportEnabled: renderer && renderer.prop("full_screen_support", false) === true
|
|
18
|
-
|
|
19
|
-
function send(name, payload) {
|
|
20
|
-
if (renderer && renderer.subscribed(name)) renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, name, payload || {})
|
|
21
|
-
}
|
|
22
|
-
function handleCommand() {
|
|
23
|
-
if (!renderer) return
|
|
24
|
-
var revision = Number(renderer.prop("command_revision", 0))
|
|
25
|
-
if (revision === handledCommandRevision) return
|
|
26
|
-
handledCommandRevision = revision
|
|
27
|
-
var command = String(renderer.prop("command", ""))
|
|
28
|
-
if (command === "back" && canGoBack) goBack()
|
|
29
|
-
else if (command === "forward" && canGoForward) goForward()
|
|
30
|
-
else if (command === "reload") reload()
|
|
31
|
-
else if (command === "stop") stop()
|
|
32
|
-
}
|
|
33
|
-
function loadHtmlIfNeeded() {
|
|
34
|
-
if (!renderer) return
|
|
35
|
-
var markup = String(renderer.prop("html", ""))
|
|
36
|
-
if (markup !== "") loadHtml(markup, String(renderer.prop("base_url", "")))
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
onLoadingChanged: function(request) {
|
|
40
|
-
if (request.status === WebEngineLoadingInfo.LoadStartedStatus) send("load_start", { url: String(request.url) })
|
|
41
|
-
else if (request.status === WebEngineLoadingInfo.LoadSucceededStatus) send("load_success", { url: String(request.url) })
|
|
42
|
-
else if (request.status === WebEngineLoadingInfo.LoadFailedStatus) {
|
|
43
|
-
var payload = { url: String(request.url), native_code: request.errorCode }
|
|
44
|
-
if (renderer) renderer.componentError("web_load_failed", request.errorString, payload)
|
|
45
|
-
send("load_failure", { url: String(request.url), code: request.errorCode, message: request.errorString })
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
onLoadProgressChanged: send("load_progress", { value: loadProgress })
|
|
49
|
-
onUrlChanged: send("url_change", { value: String(url), can_go_back: canGoBack, can_go_forward: canGoForward })
|
|
50
|
-
onTitleChanged: send("title_change", { value: title })
|
|
51
|
-
onNavigationRequested: function(request) { send("navigation", { url: String(request.url), navigation_type: request.navigationType, main_frame: request.isMainFrame }) }
|
|
52
|
-
onFullScreenRequested: function(request) { send("full_screen", { value: request.toggleOn }); request.accept() }
|
|
53
|
-
onPermissionRequested: function(permission) { send("permission", { origin: String(permission.origin), type: permission.permissionType }) }
|
|
54
|
-
onNewWindowRequested: function(request) { send("new_window", { url: String(request.requestedUrl), disposition: request.destination }) }
|
|
55
|
-
Component.onCompleted: { loadHtmlIfNeeded(); handleCommand() }
|
|
56
|
-
Connections { target: renderer; function onNodeChanged() { webRoot.loadHtmlIfNeeded(); webRoot.handleCommand() } }
|
|
57
|
-
}
|
data/native/CMakeLists.txt
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
cmake_minimum_required(VERSION 3.21)
|
|
2
|
-
project(zui-host VERSION 0.1.0 LANGUAGES CXX)
|
|
3
|
-
|
|
4
|
-
set(CMAKE_CXX_STANDARD 17)
|
|
5
|
-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
6
|
-
set(CMAKE_AUTOMOC ON)
|
|
7
|
-
|
|
8
|
-
find_package(Qt6 6.8 REQUIRED COMPONENTS
|
|
9
|
-
Core
|
|
10
|
-
Gui
|
|
11
|
-
Multimedia
|
|
12
|
-
Qml
|
|
13
|
-
Quick
|
|
14
|
-
QuickControls2
|
|
15
|
-
QuickVectorImage
|
|
16
|
-
)
|
|
17
|
-
find_package(Qt6 6.8 QUIET COMPONENTS WebEngineQuick)
|
|
18
|
-
|
|
19
|
-
qt_add_executable(zui-host
|
|
20
|
-
main.cpp
|
|
21
|
-
ZuiClipboard.cpp
|
|
22
|
-
ZuiClipboard.h
|
|
23
|
-
ZuiProcess.cpp
|
|
24
|
-
ZuiProcess.h
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
target_link_libraries(zui-host PRIVATE
|
|
28
|
-
Qt6::Core
|
|
29
|
-
Qt6::Gui
|
|
30
|
-
Qt6::Multimedia
|
|
31
|
-
Qt6::Qml
|
|
32
|
-
Qt6::Quick
|
|
33
|
-
Qt6::QuickControls2
|
|
34
|
-
Qt6::QuickVectorImage
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
if(TARGET Qt6::WebEngineQuick)
|
|
38
|
-
target_link_libraries(zui-host PRIVATE Qt6::WebEngineQuick)
|
|
39
|
-
target_compile_definitions(zui-host PRIVATE ZUI_HAS_WEBENGINE=1)
|
|
40
|
-
endif()
|
|
41
|
-
|
|
42
|
-
install(TARGETS zui-host
|
|
43
|
-
BUNDLE DESTINATION .
|
|
44
|
-
RUNTIME DESTINATION bin
|
|
45
|
-
)
|
data/native/ZuiClipboard.cpp
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#include "ZuiClipboard.h"
|
|
2
|
-
|
|
3
|
-
#include <QGuiApplication>
|
|
4
|
-
#include <QClipboard>
|
|
5
|
-
|
|
6
|
-
ZuiClipboard::ZuiClipboard(QObject *parent) : QObject(parent) {
|
|
7
|
-
connect(QGuiApplication::clipboard(), &QClipboard::dataChanged, this, &ZuiClipboard::textChanged);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
QString ZuiClipboard::text() const { return QGuiApplication::clipboard()->text(); }
|
|
11
|
-
|
|
12
|
-
void ZuiClipboard::setText(const QString &text) {
|
|
13
|
-
if (this->text() == text)
|
|
14
|
-
return;
|
|
15
|
-
QGuiApplication::clipboard()->setText(text);
|
|
16
|
-
}
|
data/native/ZuiClipboard.h
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <QObject>
|
|
4
|
-
|
|
5
|
-
class ZuiClipboard final : public QObject {
|
|
6
|
-
Q_OBJECT
|
|
7
|
-
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
|
|
8
|
-
|
|
9
|
-
public:
|
|
10
|
-
explicit ZuiClipboard(QObject *parent = nullptr);
|
|
11
|
-
QString text() const;
|
|
12
|
-
void setText(const QString &text);
|
|
13
|
-
|
|
14
|
-
signals:
|
|
15
|
-
void textChanged();
|
|
16
|
-
};
|
data/native/ZuiProcess.cpp
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
#include "ZuiProcess.h"
|
|
2
|
-
|
|
3
|
-
#include <QProcessEnvironment>
|
|
4
|
-
#include <QTimer>
|
|
5
|
-
|
|
6
|
-
ZuiProcess::ZuiProcess(QObject *parent) : QObject(parent) {
|
|
7
|
-
connect(&m_process, &QProcess::stateChanged, this, [this] { emit runningChanged(); });
|
|
8
|
-
connect(&m_process, &QProcess::readyReadStandardOutput, this, [this] {
|
|
9
|
-
m_stdoutBuffer += m_process.readAllStandardOutput();
|
|
10
|
-
consume(m_stdoutBuffer, false);
|
|
11
|
-
});
|
|
12
|
-
connect(&m_process, &QProcess::readyReadStandardError, this, [this] {
|
|
13
|
-
m_stderrBuffer += m_process.readAllStandardError();
|
|
14
|
-
consume(m_stderrBuffer, true);
|
|
15
|
-
});
|
|
16
|
-
connect(&m_process, &QProcess::errorOccurred, this, [this](QProcess::ProcessError) {
|
|
17
|
-
emit errorLineReceived(m_process.errorString());
|
|
18
|
-
});
|
|
19
|
-
connect(&m_process, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this,
|
|
20
|
-
[this](int exitCode, QProcess::ExitStatus) {
|
|
21
|
-
m_stdoutBuffer += m_process.readAllStandardOutput();
|
|
22
|
-
m_stderrBuffer += m_process.readAllStandardError();
|
|
23
|
-
flush(m_stdoutBuffer, false);
|
|
24
|
-
flush(m_stderrBuffer, true);
|
|
25
|
-
emit exited(exitCode);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
ZuiProcess::~ZuiProcess() { stop(); }
|
|
30
|
-
|
|
31
|
-
bool ZuiProcess::running() const { return m_process.state() != QProcess::NotRunning; }
|
|
32
|
-
|
|
33
|
-
void ZuiProcess::start(const QString &executable, const QString &program,
|
|
34
|
-
const QString &workingDirectory, const QString &loadPath) {
|
|
35
|
-
if (running() || executable.isEmpty() || program.isEmpty())
|
|
36
|
-
return;
|
|
37
|
-
|
|
38
|
-
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
|
39
|
-
environment.insert(QStringLiteral("ZUI_PROJECT_DIR"), workingDirectory);
|
|
40
|
-
m_process.setProcessEnvironment(environment);
|
|
41
|
-
m_process.setWorkingDirectory(workingDirectory);
|
|
42
|
-
m_process.setProcessChannelMode(QProcess::SeparateChannels);
|
|
43
|
-
|
|
44
|
-
QStringList arguments;
|
|
45
|
-
if (!loadPath.isEmpty())
|
|
46
|
-
arguments << QStringLiteral("-I") << loadPath;
|
|
47
|
-
arguments << program;
|
|
48
|
-
m_process.start(executable, arguments, QIODevice::ReadWrite);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
void ZuiProcess::write(const QString &data) {
|
|
52
|
-
if (!running())
|
|
53
|
-
return;
|
|
54
|
-
m_process.write(data.toUtf8());
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
void ZuiProcess::stop() {
|
|
58
|
-
if (!running())
|
|
59
|
-
return;
|
|
60
|
-
m_process.closeWriteChannel();
|
|
61
|
-
m_process.terminate();
|
|
62
|
-
if (!m_process.waitForFinished(1000)) {
|
|
63
|
-
m_process.kill();
|
|
64
|
-
m_process.waitForFinished(1000);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
void ZuiProcess::consume(QByteArray &buffer, bool errorStream) {
|
|
69
|
-
qsizetype newline = -1;
|
|
70
|
-
while ((newline = buffer.indexOf('\n')) >= 0) {
|
|
71
|
-
const QString line = QString::fromUtf8(buffer.left(newline));
|
|
72
|
-
buffer.remove(0, newline + 1);
|
|
73
|
-
errorStream ? emit errorLineReceived(line) : emit lineReceived(line);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
void ZuiProcess::flush(QByteArray &buffer, bool errorStream) {
|
|
78
|
-
consume(buffer, errorStream);
|
|
79
|
-
if (buffer.isEmpty())
|
|
80
|
-
return;
|
|
81
|
-
const QString line = QString::fromUtf8(buffer);
|
|
82
|
-
buffer.clear();
|
|
83
|
-
errorStream ? emit errorLineReceived(line) : emit lineReceived(line);
|
|
84
|
-
}
|
data/native/ZuiProcess.h
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <QObject>
|
|
4
|
-
#include <QProcess>
|
|
5
|
-
|
|
6
|
-
class ZuiProcess final : public QObject {
|
|
7
|
-
Q_OBJECT
|
|
8
|
-
Q_PROPERTY(bool running READ running NOTIFY runningChanged)
|
|
9
|
-
|
|
10
|
-
public:
|
|
11
|
-
explicit ZuiProcess(QObject *parent = nullptr);
|
|
12
|
-
~ZuiProcess() override;
|
|
13
|
-
|
|
14
|
-
bool running() const;
|
|
15
|
-
|
|
16
|
-
Q_INVOKABLE void start(const QString &executable, const QString &program,
|
|
17
|
-
const QString &workingDirectory, const QString &loadPath);
|
|
18
|
-
Q_INVOKABLE void write(const QString &data);
|
|
19
|
-
Q_INVOKABLE void stop();
|
|
20
|
-
|
|
21
|
-
signals:
|
|
22
|
-
void runningChanged();
|
|
23
|
-
void lineReceived(const QString &line);
|
|
24
|
-
void errorLineReceived(const QString &line);
|
|
25
|
-
void exited(int exitCode);
|
|
26
|
-
|
|
27
|
-
private:
|
|
28
|
-
void consume(QByteArray &buffer, bool errorStream);
|
|
29
|
-
void flush(QByteArray &buffer, bool errorStream);
|
|
30
|
-
|
|
31
|
-
QProcess m_process;
|
|
32
|
-
QByteArray m_stdoutBuffer;
|
|
33
|
-
QByteArray m_stderrBuffer;
|
|
34
|
-
};
|
data/native/main.cpp
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
#include "ZuiClipboard.h"
|
|
2
|
-
#include "ZuiProcess.h"
|
|
3
|
-
|
|
4
|
-
#include <QCommandLineParser>
|
|
5
|
-
#include <QDir>
|
|
6
|
-
#include <QFileInfo>
|
|
7
|
-
#include <QGuiApplication>
|
|
8
|
-
#include <QQmlApplicationEngine>
|
|
9
|
-
#include <QQmlContext>
|
|
10
|
-
#include <QQuickStyle>
|
|
11
|
-
|
|
12
|
-
#ifdef ZUI_HAS_WEBENGINE
|
|
13
|
-
#include <QtWebEngineQuick/qtwebenginequickglobal.h>
|
|
14
|
-
#endif
|
|
15
|
-
|
|
16
|
-
int main(int argc, char *argv[]) {
|
|
17
|
-
#ifdef ZUI_HAS_WEBENGINE
|
|
18
|
-
QtWebEngineQuick::initialize();
|
|
19
|
-
#endif
|
|
20
|
-
QGuiApplication application(argc, argv);
|
|
21
|
-
QCoreApplication::setApplicationName(QStringLiteral("Zui"));
|
|
22
|
-
QCoreApplication::setOrganizationName(QStringLiteral("Zui"));
|
|
23
|
-
QQuickStyle::setStyle(QStringLiteral("Fusion"));
|
|
24
|
-
|
|
25
|
-
QCommandLineParser parser;
|
|
26
|
-
parser.setApplicationDescription(QStringLiteral("Zui cross-platform Qt host"));
|
|
27
|
-
parser.addHelpOption();
|
|
28
|
-
parser.addOption({QStringLiteral("qml-root"), QStringLiteral("Zui QML runtime directory"), QStringLiteral("path")});
|
|
29
|
-
parser.addOption({QStringLiteral("project"), QStringLiteral("Application project directory"), QStringLiteral("path")});
|
|
30
|
-
parser.addOption({QStringLiteral("program"), QStringLiteral("Ruby application entrypoint"), QStringLiteral("path")});
|
|
31
|
-
parser.addOption({QStringLiteral("ruby"), QStringLiteral("Ruby executable"), QStringLiteral("path"), QStringLiteral("ruby")});
|
|
32
|
-
parser.addOption({QStringLiteral("load-path"), QStringLiteral("Ruby framework load path"), QStringLiteral("path")});
|
|
33
|
-
parser.addOption({QStringLiteral("name"), QStringLiteral("Application name"), QStringLiteral("name"), QStringLiteral("Zui Application")});
|
|
34
|
-
parser.process(application);
|
|
35
|
-
|
|
36
|
-
const QString qmlRootValue = parser.value(QStringLiteral("qml-root"));
|
|
37
|
-
const QString projectValue = parser.value(QStringLiteral("project"));
|
|
38
|
-
const QString programValue = parser.value(QStringLiteral("program"));
|
|
39
|
-
const QString qmlRoot = QFileInfo(qmlRootValue).absoluteFilePath();
|
|
40
|
-
const QString project = QFileInfo(projectValue).absoluteFilePath();
|
|
41
|
-
const QString program = QFileInfo(programValue).absoluteFilePath();
|
|
42
|
-
const QFileInfo desktopFile(QDir(qmlRoot).filePath(QStringLiteral("Desktop.qml")));
|
|
43
|
-
if (qmlRootValue.isEmpty() || projectValue.isEmpty() || programValue.isEmpty()
|
|
44
|
-
|| !desktopFile.isFile() || !QFileInfo(project).isDir() || !QFileInfo(program).isFile())
|
|
45
|
-
parser.showHelp(64);
|
|
46
|
-
|
|
47
|
-
ZuiProcess process;
|
|
48
|
-
ZuiClipboard clipboard;
|
|
49
|
-
QQmlApplicationEngine engine;
|
|
50
|
-
engine.rootContext()->setContextProperty(QStringLiteral("zuiProcess"), &process);
|
|
51
|
-
engine.rootContext()->setContextProperty(QStringLiteral("zuiClipboard"), &clipboard);
|
|
52
|
-
engine.rootContext()->setContextProperty(QStringLiteral("zuiProjectDir"), project);
|
|
53
|
-
engine.rootContext()->setContextProperty(QStringLiteral("zuiComponentDir"), QDir(qmlRoot).filePath(QStringLiteral("Components/Builtins")));
|
|
54
|
-
engine.rootContext()->setContextProperty(QStringLiteral("zuiRubyExecutable"), parser.value(QStringLiteral("ruby")));
|
|
55
|
-
engine.rootContext()->setContextProperty(QStringLiteral("zuiRubyProgram"), program);
|
|
56
|
-
engine.rootContext()->setContextProperty(QStringLiteral("zuiRubyLoadPath"), parser.value(QStringLiteral("load-path")));
|
|
57
|
-
engine.rootContext()->setContextProperty(QStringLiteral("zuiApplicationName"), parser.value(QStringLiteral("name")));
|
|
58
|
-
engine.addImportPath(qmlRoot);
|
|
59
|
-
|
|
60
|
-
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, &application,
|
|
61
|
-
[] { QCoreApplication::exit(1); }, Qt::QueuedConnection);
|
|
62
|
-
engine.load(QUrl::fromLocalFile(QDir(qmlRoot).filePath(QStringLiteral("Desktop.qml"))));
|
|
63
|
-
return application.exec();
|
|
64
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Zui Linux host provenance
|
|
2
|
-
|
|
3
|
-
- Target: Linux x86-64
|
|
4
|
-
- Source: `native/` in this repository
|
|
5
|
-
- Framework version: Zui 0.1.0
|
|
6
|
-
- Compiler: GNU C++ 16.2.1
|
|
7
|
-
- Qt: 6.11.2
|
|
8
|
-
- Build type: CMake `Release`
|
|
9
|
-
|
|
10
|
-
The binary is reproducible from the checked-in C++ sources with:
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
cmake -S native -B build -DCMAKE_BUILD_TYPE=Release
|
|
14
|
-
cmake --build build --parallel
|
|
15
|
-
```
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
de446bb598f922a7a58fe30127d88cae9602cf54bd819aa2b5c84447a51da7a4 zui-host
|