forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move printer demo and energy-monitor into new top-level demos/ folder
These are showing off use-cases for Slint, but they're not examples showing individual Slint features. Also removed the old printerdemo while at it.
- Loading branch information
Showing
241 changed files
with
187 additions
and
982 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright © SixtyFPS GmbH <info@slint.dev> | ||
# SPDX-License-Identifier: MIT | ||
cmake_minimum_required(VERSION 3.21) | ||
project(SlintDemos LANGUAGES CXX) | ||
|
||
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") | ||
|
||
if (NOT TARGET Slint::Slint) | ||
find_package(Slint REQUIRED) | ||
include(FetchContent) | ||
endif() | ||
|
||
if (TARGET Slint::slint-compiler) | ||
add_subdirectory(printerdemo/cpp/) | ||
endif() | ||
if (SLINT_FEATURE_INTERPRETER) | ||
add_subdirectory(printerdemo/cpp_interpreted/) | ||
endif() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<!-- Copyright © SixtyFPS GmbH <info@slint.dev> ; SPDX-License-Identifier: MIT --> | ||
|
||
# Demos | ||
|
||
These demos showcase different complex use-cases for building UIs with Slint. | ||
|
||
|
||
|
||
| Thumbnail | Description | Demo | | ||
| --- | --- | --- | | ||
| [Printer UI ![Printer Demo image](https://github.com/user-attachments/assets/7e7400ad-283a-4404-b04a-8620ba4df452)](./printerdemo) | A fictional user interface for the touch screen of a printer. <br/> [Project...](./printerdemo) | [Wasm Demo](https://slint.dev/snapshots/master/demos/printerdemo/) | | ||
| [Energy Meter![Energy meter demo image](https://github.com/user-attachments/assets/abfe03e3-ded6-4ddc-82b7-8303ee45515c "Energy meter demo image")](./energy-monitor/) | A fictional user interface of a device that monitors energy consumption in a building. <br/> [Project...](./energy-monitor) | [Wasm Demo](https://slint.dev/snapshots/master/demos/energy-monitor/) | | ||
|
||
--- | ||
### Running the Rust Demos | ||
|
||
You can run the examples either by going into folder or into the rust sub-folder and use `cargo run`, for example: | ||
|
||
```sh | ||
cd demos/printerdemo/rust | ||
cargo run --release | ||
``` | ||
|
||
or you can run them from anywhere in the Cargo workspace by name: | ||
|
||
```sh | ||
cargo run --release --bin printerdemo | ||
``` | ||
|
||
--- | ||
### Wasm builds | ||
|
||
In order to make the wasm build of the example, you first need to edit the Cargo.toml | ||
files to uncomment the line starting with `#wasm#` (or use the `sed` line bellow) | ||
You can then use wasm-pack (which you may need to obtain with `cargo install wasm-pack`). | ||
This will generate the wasm in the `./pkg` directory, which the `index.html` file will open. | ||
Since wasm files cannot be served from `file://` URL, you need to open a wab server to serve | ||
the content | ||
|
||
```sh | ||
cd demos/printerdemo/rust | ||
sed -i "s/^#wasm# //" Cargo.toml | ||
wasm-pack build --release --target web | ||
python3 -m http.server | ||
``` | ||
|
||
--- | ||
### Running the C++ Examples | ||
|
||
* **When compiling Slint from sources:** If you follow the [C++ build instructions](/docs/building.md#c-build), this will build the C++ | ||
examples as well by default | ||
* **From [installed binary packages](/api/cpp/README.md#binary-packages):** Simply run cmake in one of the example directory containing a CMakeLists.txt | ||
|
||
```sh | ||
mkdir build && cd build | ||
cmake -GNinja -DCMAKE_PREFIX_PATH="<path to installed>" .. | ||
cmake --build . | ||
``` | ||
|
||
--- | ||
### Running the Node Examples | ||
|
||
You can run the examples by going into the node sub-folder and use `npm`, for example: | ||
|
||
```sh | ||
pushd api/node | ||
npm install | ||
npm run compile | ||
popd | ||
cd demos/printerdemo/node | ||
npm install | ||
npm start | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.