Merge the UI foundation: Voelin design system, desktop and phone shells
Theme tokens from the mockups, Inter, Lucide icons and Twemoji (with their notices and About credits), a component library, desktop and phone shells, today's screens re-skinned, view models and bindings split out of app.rs, an image cache and live ui.* settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
No files matched your search
@@ -9276,6 +9276,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"dirs",
|
||||
"miniz_oxide 0.8.9",
|
||||
"png",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -9285,6 +9286,7 @@ dependencies = [
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"tsclientlib",
|
||||
"unicode-segmentation",
|
||||
"voelin-audio",
|
||||
"voelin-core",
|
||||
"voelin-model",
|
||||
|
||||
@@ -41,7 +41,8 @@ Done so far (milestones M0–M4 and the first part of M5 of [the plan](docs/arch
|
||||
- `crates/voelin-ui` (`voelin`): Slint desktop app: servers, channel tree with talking indicators,
|
||||
chat tabs (own channel via voice, other channels via relay), connect / observe invisibly, mute, push-to-talk
|
||||
(in the window and as a global hotkey), audio settings with a level meter, per-client volume, and on
|
||||
TeamSpeak 6 streams: watch in a viewer, share the screen with sound
|
||||
TeamSpeak 6 streams: watch in a viewer, share the screen with sound. Desktop and phone layouts
|
||||
from one design system, dark and light themes, text size, emoji ([docs/ui.md](docs/ui.md))
|
||||
- `crates/voelin-stream`: TeamSpeak 6 streams: stream commands and notifications, JSON signalling,
|
||||
WebRTC peers (str0m) with host and STUN candidates. A live test streams VP8 + Opus between two
|
||||
clients through a TS6 server
|
||||
@@ -58,11 +59,14 @@ Done so far (milestones M0–M4 and the first part of M5 of [the plan](docs/arch
|
||||
Screen sharing works between our clients through a TeamSpeak 6 server (VP8 video, Opus audio);
|
||||
interop with the official TeamSpeak 6 client is not verified yet.
|
||||
|
||||
| Connected with voice | Observing invisibly through the gateway |
|
||||
The UI (design system, desktop and phone layouts, emoji, how to add a screen) is described in
|
||||
[docs/ui.md](docs/ui.md). Screenshots with sample data (`VOELIN_DEMO_UI=1`):
|
||||
|
||||
| Server, chat and people in the channel | Watching a stream |
|
||||
|---|---|
|
||||
|  |  |
|
||||
| **Watching a stream** | **Sharing the screen** |
|
||||
|  |  |
|
||||
|  |  |
|
||||
| **Settings** | **Phone layout** |
|
||||
|  |  |
|
||||
|
||||
## Try it
|
||||
|
||||
@@ -102,8 +106,10 @@ Other commands: `voelinctl identity new`, `voelinctl versions`, `voelinctl conne
|
||||
|
||||
Development switches of the desktop app (environment variables): `VOELIN_DATA_DIR` (database),
|
||||
`VOELIN_AUTOCONNECT=voice|observe`, `VOELIN_SCREENSHOT=<png>` (with `VOELIN_SCREENSHOT_DELAY`),
|
||||
`VOELIN_DEMO_STREAM=1` (a local test stream in the viewer, no server needed),
|
||||
`VOELIN_OPEN=share|settings[:<tab>]|about|client`, `VOELIN_AUTOWATCH=1`, `VOELIN_AUTOSHARE=test-pattern`.
|
||||
`VOELIN_WINDOW_SIZE=<w>x<h>`, `VOELIN_DEMO_UI=1` (sample servers and chat, no server needed),
|
||||
`VOELIN_DEMO_STREAM=1` (a local test stream in the viewer),
|
||||
`VOELIN_OPEN=home|settings[:<section>]|about|share|bookmark|emoji|client|tab:<tab>` (comma-separated),
|
||||
`VOELIN_AUTOWATCH=1`, `VOELIN_AUTOSHARE=test-pattern`; details in [docs/ui.md](docs/ui.md).
|
||||
|
||||
Ready-made packages (Linux `.tar.gz`/`.deb`/Flatpak, Windows zip and installer, Android APK,
|
||||
and the `tsgw` gateway for Linux servers) come from the release workflow (version tags, or run by
|
||||
@@ -123,6 +129,7 @@ the same terms in `Cargo.toml`.
|
||||
Third-party notices: [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md), generated from
|
||||
`Cargo.lock` by `scripts/notices.sh` and shown in the app's About page. The UI toolkit,
|
||||
Slint, is used under its royalty-free license, which requires an attribution in the
|
||||
About page.
|
||||
About page. The UI bundles the Inter font (SIL OFL 1.1), Lucide icons (ISC) and Twemoji
|
||||
graphics (CC-BY 4.0); `scripts/notices.sh` appends their notices from `about-assets.md`.
|
||||
|
||||
Security issues: see [SECURITY.md](SECURITY.md). Releases: [docs/release.md](docs/release.md).
|
||||
@@ -11634,3 +11634,164 @@ bzip2/libbzip2 version 1.1.0 of 6 September 2010
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
````
|
||||
|
||||
## Bundled fonts, icons and emoji
|
||||
|
||||
<!-- From about-assets.md, appended by scripts/notices.sh. -->
|
||||
|
||||
The user interface bundles these assets (in crates/voelin-ui):
|
||||
|
||||
- Inter (the UI font), Copyright (c) 2016 The Inter Project Authors, under
|
||||
the SIL Open Font License 1.1 (OFL-1.1; text below).
|
||||
- Lucide icons (lucide-static 1.48.0), Copyright (c) Lucide Icons and
|
||||
Contributors, under the ISC License; the icons derived from Feather are
|
||||
Copyright (c) 2013-present Cole Bemis, under the MIT License (texts below).
|
||||
- Twemoji 15.0 (the emoji images): Twemoji graphics by Twitter, Inc and other
|
||||
contributors, licensed under CC-BY 4.0
|
||||
(https://creativecommons.org/licenses/by/4.0/). The SVG files are packed
|
||||
into one archive; their content is unchanged.
|
||||
|
||||
### OFL-1.1 (Inter)
|
||||
|
||||
````text
|
||||
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION AND CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
````
|
||||
|
||||
### ISC and MIT (Lucide, Feather)
|
||||
|
||||
````text
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2026 Lucide Icons and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
---
|
||||
|
||||
The following Lucide icons are derived from the Feather project:
|
||||
|
||||
airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
|
||||
|
||||
The MIT License (MIT) (for the icons listed above)
|
||||
|
||||
Copyright (c) 2013-present Cole Bemis
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
````
|
||||
@@ -0,0 +1,161 @@
|
||||
|
||||
## Bundled fonts, icons and emoji
|
||||
|
||||
<!-- From about-assets.md, appended by scripts/notices.sh. -->
|
||||
|
||||
The user interface bundles these assets (in crates/voelin-ui):
|
||||
|
||||
- Inter (the UI font), Copyright (c) 2016 The Inter Project Authors, under
|
||||
the SIL Open Font License 1.1 (OFL-1.1; text below).
|
||||
- Lucide icons (lucide-static 1.48.0), Copyright (c) Lucide Icons and
|
||||
Contributors, under the ISC License; the icons derived from Feather are
|
||||
Copyright (c) 2013-present Cole Bemis, under the MIT License (texts below).
|
||||
- Twemoji 15.0 (the emoji images): Twemoji graphics by Twitter, Inc and other
|
||||
contributors, licensed under CC-BY 4.0
|
||||
(https://creativecommons.org/licenses/by/4.0/). The SVG files are packed
|
||||
into one archive; their content is unchanged.
|
||||
|
||||
### OFL-1.1 (Inter)
|
||||
|
||||
````text
|
||||
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION AND CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
````
|
||||
|
||||
### ISC and MIT (Lucide, Feather)
|
||||
|
||||
````text
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2026 Lucide Icons and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
---
|
||||
|
||||
The following Lucide icons are derived from the Feather project:
|
||||
|
||||
airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
|
||||
|
||||
The MIT License (MIT) (for the icons listed above)
|
||||
|
||||
Copyright (c) 2013-present Cole Bemis
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
````
|
||||
@@ -20,11 +20,15 @@ path = "src/main.rs"
|
||||
anyhow = "1.0.104"
|
||||
chrono = { version = "0.4.45", default-features = false, features = ["clock"] }
|
||||
dirs = "6"
|
||||
# Twemoji archive blocks (raw deflate); already used by png.
|
||||
miniz_oxide = "0.8"
|
||||
png = "0.18"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
tokio = { version = "1.53.1", features = ["rt-multi-thread", "macros", "time", "sync"] }
|
||||
tracing = "0.1.44"
|
||||
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
|
||||
# Grapheme clusters for emoji in chat text.
|
||||
unicode-segmentation = "1.13"
|
||||
voelin-audio = { path = "../voelin-audio" }
|
||||
voelin-core = { path = "../voelin-core", default-features = false, features = ["audio-device"] }
|
||||
voelin-model = { path = "../voelin-model" }
|
||||
@@ -43,10 +47,12 @@ voelin-platform = { path = "../voelin-platform" }
|
||||
voelin-store = { path = "../voelin-store", features = ["keyring"] }
|
||||
|
||||
# Android (voelin-android): no keyring backend (the app passes Keystore-backed
|
||||
# secrets), no winit/femtovg (the app picks Slint's Android backend), stream
|
||||
# media through MediaCodec and the app's capture source.
|
||||
# secrets), no winit/femtovg, stream media through MediaCodec and the app's
|
||||
# capture source. Slint's Android backend (the one the app runs) also brings
|
||||
# the SVG and image decoders the icons and emoji need, so this crate builds
|
||||
# alone for Android too.
|
||||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
slint = { version = "1.18", default-features = false, features = ["std", "compat-1-2", "renderer-software"] }
|
||||
slint = { version = "1.18", default-features = false, features = ["std", "compat-1-2", "renderer-software", "backend-android-activity-06"] }
|
||||
voelin-core = { path = "../voelin-core", default-features = false, features = ["media"] }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# Bundled assets
|
||||
|
||||
- `twemoji.bin`: the Twemoji 15.0 SVGs (3720 emoji, from the `@twemoji/svg`
|
||||
15.0.0 package) packed by `scripts/pack-twemoji.py` into blocks of raw
|
||||
deflate with an index; `src/emoji.rs` reads it. Twemoji graphics by Twitter,
|
||||
Inc and other contributors, licensed under CC-BY 4.0
|
||||
(https://creativecommons.org/licenses/by/4.0/). The files are unchanged
|
||||
apart from surrounding whitespace.
|
||||
|
||||
The fonts (Inter, SIL OFL 1.1) and icons (Lucide, ISC) that the Slint files
|
||||
import are under `ui/assets/`, each with its license. All three are credited
|
||||
in `THIRD_PARTY_NOTICES.md` and the About page.
|
||||
@@ -1,7 +1,7 @@
|
||||
fn main() {
|
||||
slint_build::compile_with_config(
|
||||
"ui/app.slint",
|
||||
slint_build::CompilerConfiguration::new().with_style("fluent-dark".into()),
|
||||
slint_build::CompilerConfiguration::new().with_style("fluent".into()),
|
||||
)
|
||||
.expect("slint compile");
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
//! Appearance settings (`ui.theme`, `ui.font_scale`, `ui.narrow_breakpoint`,
|
||||
//! `ui.image_cache_mb`): applied to the Theme and Nav globals and the image
|
||||
//! cache whenever they change, from the settings page or elsewhere.
|
||||
|
||||
use slint::ComponentHandle;
|
||||
use tracing::warn;
|
||||
|
||||
use crate::app::{App, AppearanceForm, Bridge, Nav, Theme};
|
||||
use crate::images;
|
||||
use crate::settings::{
|
||||
ThemeChoice, UI_FONT_SCALE, UI_IMAGE_CACHE_MB, UI_NARROW_BREAKPOINT, UI_THEME,
|
||||
};
|
||||
|
||||
impl App {
|
||||
/// Show the current values of the appearance keys.
|
||||
pub(crate) fn apply_appearance(&self) {
|
||||
let theme = self.prefs.get(&UI_THEME);
|
||||
let scale = self.prefs.get(&UI_FONT_SCALE);
|
||||
let breakpoint = self.prefs.get(&UI_NARROW_BREAKPOINT);
|
||||
let cache_mb = self.prefs.get(&UI_IMAGE_CACHE_MB);
|
||||
images::set_budget_mb(cache_mb);
|
||||
let Some(ui) = self.ui.upgrade() else { return };
|
||||
let t = ui.global::<Theme>();
|
||||
t.set_mode(theme.as_str().into());
|
||||
t.set_font_scale(scale);
|
||||
ui.global::<Nav>().set_narrow_breakpoint(breakpoint as f32);
|
||||
let bridge = ui.global::<Bridge>();
|
||||
bridge.set_appearance(AppearanceForm {
|
||||
theme: theme.as_str().into(),
|
||||
font_scale: scale,
|
||||
narrow_breakpoint: breakpoint as f32,
|
||||
image_cache_mb: cache_mb as f32,
|
||||
});
|
||||
bridge.set_image_cache_usage(images::usage_text().into());
|
||||
}
|
||||
|
||||
/// The settings page changed the form: store the keys (they apply
|
||||
/// through the change events).
|
||||
pub(crate) fn appearance_changed(&mut self, form: &AppearanceForm) {
|
||||
let results = [
|
||||
self.prefs.set(&UI_THEME, ThemeChoice::parse(&form.theme)),
|
||||
self.prefs.set(&UI_FONT_SCALE, form.font_scale),
|
||||
self.prefs.set(&UI_NARROW_BREAKPOINT, form.narrow_breakpoint.max(0.0).round() as u32),
|
||||
self.prefs.set(&UI_IMAGE_CACHE_MB, form.image_cache_mb.max(0.0).round() as u32),
|
||||
];
|
||||
for result in results {
|
||||
if let Err(e) = result {
|
||||
warn!(%e, "appearance setting rejected");
|
||||
self.set_status(e.to_string());
|
||||
}
|
||||
}
|
||||
// Applied now too: change events come through the engine, which
|
||||
// may not run the settings service (tests, a hosted engine).
|
||||
self.apply_appearance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//! The chat view.
|
||||
|
||||
use slint::ComponentHandle;
|
||||
use voelin_model::{ChannelId, ChatTarget};
|
||||
|
||||
use crate::app::{Bridge, MainWindow, with_app};
|
||||
|
||||
pub(super) fn wire(ui: &MainWindow) {
|
||||
let bridge = ui.global::<Bridge>();
|
||||
bridge.on_open_channel_chat(|cid| {
|
||||
with_app(|app| app.open_chat(ChatTarget::Channel(cid as ChannelId), true));
|
||||
});
|
||||
bridge.on_select_tab(|i| {
|
||||
with_app(|app| app.select_tab(i as usize));
|
||||
});
|
||||
bridge.on_close_tab(|i| {
|
||||
with_app(|app| app.close_tab(i as usize));
|
||||
});
|
||||
bridge.on_send_message(|text| {
|
||||
with_app(|app| app.send_message(text.to_string()));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
//! Emoji: images for the `Images` global, and the picker's rows.
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
use slint::{ComponentHandle, Model, ModelRc, VecModel};
|
||||
|
||||
use crate::app::{Emoji, EmojiCell, EmojiRow, Images, MainWindow};
|
||||
use crate::emoji::{self, PickerEmoji};
|
||||
use crate::images;
|
||||
|
||||
/// Rows of `columns` cells.
|
||||
fn rows(emoji: Vec<PickerEmoji>, columns: usize) -> Vec<EmojiRow> {
|
||||
emoji
|
||||
.chunks(columns.max(1))
|
||||
.map(|chunk| EmojiRow {
|
||||
cells: ModelRc::from(Rc::new(VecModel::from(
|
||||
chunk
|
||||
.iter()
|
||||
.map(|e| EmojiCell {
|
||||
key: e.key.into(),
|
||||
name: e.name.into(),
|
||||
text: e.text.clone().into(),
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
))),
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn show(ui: &MainWindow, category: i32, list: Vec<PickerEmoji>) {
|
||||
let global = ui.global::<Emoji>();
|
||||
let columns = usize::try_from(global.get_columns()).unwrap_or(8);
|
||||
global.set_category(category);
|
||||
global.set_rows(ModelRc::from(Rc::new(VecModel::from(rows(list, columns)))));
|
||||
}
|
||||
|
||||
pub(super) fn wire(ui: &MainWindow) {
|
||||
ui.global::<Images>().on_emoji(|key| images::emoji(&key));
|
||||
let global = ui.global::<Emoji>();
|
||||
let weak = ui.as_weak();
|
||||
global.on_load(move || {
|
||||
if let Some(ui) = weak.upgrade()
|
||||
&& ui.global::<Emoji>().get_rows().row_count() == 0
|
||||
{
|
||||
let category = ui.global::<Emoji>().get_category().max(0);
|
||||
show(&ui, category, emoji::archive().category(category as usize));
|
||||
}
|
||||
});
|
||||
let weak = ui.as_weak();
|
||||
global.on_show_category(move |category| {
|
||||
if let Some(ui) = weak.upgrade() {
|
||||
show(&ui, category, emoji::archive().category(category.max(0) as usize));
|
||||
}
|
||||
});
|
||||
let weak = ui.as_weak();
|
||||
global.on_search(move |text| {
|
||||
let Some(ui) = weak.upgrade() else { return };
|
||||
if text.trim().is_empty() {
|
||||
let category = ui.global::<Emoji>().get_category().max(0);
|
||||
show(&ui, category, emoji::archive().category(category as usize));
|
||||
} else {
|
||||
show(&ui, -1, emoji::archive().search(&text));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn rows_of_cells() {
|
||||
let list = emoji::archive().category(0);
|
||||
let n = list.len();
|
||||
let rows = rows(list, 8);
|
||||
assert_eq!(rows.len(), n.div_ceil(8));
|
||||
assert_eq!(rows[0].cells.row_count(), 8);
|
||||
assert_eq!(rows[0].cells.row_data(0).unwrap().key, "1f600");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//! Callbacks of the screens, wired to the app. One module per screen or
|
||||
//! area; each has a `wire` that the window calls once.
|
||||
|
||||
mod chat;
|
||||
mod emoji;
|
||||
mod servers;
|
||||
mod settings;
|
||||
mod streams;
|
||||
|
||||
use crate::app::MainWindow;
|
||||
|
||||
/// Connect every callback of the window.
|
||||
pub(crate) fn wire(ui: &MainWindow) {
|
||||
servers::wire(ui);
|
||||
chat::wire(ui);
|
||||
streams::wire(ui);
|
||||
settings::wire(ui);
|
||||
emoji::wire(ui);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//! The rail, the server card, the channel tree and the voice controls.
|
||||
|
||||
use slint::ComponentHandle;
|
||||
use voelin_core::Command;
|
||||
use voelin_model::ChannelId;
|
||||
|
||||
use crate::app::{Bridge, MainWindow, with_app};
|
||||
|
||||
pub(super) fn wire(ui: &MainWindow) {
|
||||
let bridge = ui.global::<Bridge>();
|
||||
bridge.on_select_server(|id| {
|
||||
with_app(|app| app.select_server(id as i64));
|
||||
});
|
||||
bridge.on_search(|text| {
|
||||
with_app(|app| app.search(text.to_string()));
|
||||
});
|
||||
bridge.on_connect_voice(|| {
|
||||
with_app(|app| app.connect_voice());
|
||||
});
|
||||
bridge.on_disconnect_voice(|| {
|
||||
with_app(|app| app.command(|session| Command::DisconnectVoice { session }));
|
||||
});
|
||||
bridge.on_toggle_observe(|| {
|
||||
with_app(|app| app.toggle_observe());
|
||||
});
|
||||
bridge.on_join_channel(|cid| {
|
||||
with_app(|app| {
|
||||
app.command(|session| Command::MoveToChannel {
|
||||
session,
|
||||
channel: cid as ChannelId,
|
||||
password: None,
|
||||
})
|
||||
});
|
||||
});
|
||||
bridge.on_toggle_collapse(|cid| {
|
||||
with_app(|app| app.toggle_collapse(cid as ChannelId));
|
||||
});
|
||||
bridge.on_set_input_muted(|muted| {
|
||||
with_app(|app| app.command(|session| Command::SetInputMuted { session, muted }));
|
||||
});
|
||||
bridge.on_set_output_muted(|muted| {
|
||||
with_app(|app| app.command(|session| Command::SetOutputMuted { session, muted }));
|
||||
});
|
||||
bridge.on_push_to_talk(|on| {
|
||||
with_app(|app| app.command(|session| Command::SetTransmitting { session, on }));
|
||||
});
|
||||
bridge.on_edit_bookmark(|id| with_app(|app| app.bookmark_form(id as i64)).unwrap_or_default());
|
||||
bridge.on_save_bookmark(|form| {
|
||||
with_app(|app| app.save_bookmark(form));
|
||||
});
|
||||
bridge.on_delete_bookmark(|id| {
|
||||
with_app(|app| app.delete_bookmark(id as i64));
|
||||
});
|
||||
bridge.on_open_client(|id| with_app(|app| app.open_client(id as u16)).unwrap_or(false));
|
||||
bridge.on_client_audio_changed(|form| {
|
||||
with_app(|app| app.client_playback_changed(&form));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
//! The settings page, crash reports and About.
|
||||
|
||||
use slint::{ComponentHandle, SharedString};
|
||||
|
||||
use crate::app::{Bridge, MainWindow, with_app};
|
||||
|
||||
pub(super) fn wire(ui: &MainWindow) {
|
||||
let bridge = ui.global::<Bridge>();
|
||||
bridge.on_open_settings(|| {
|
||||
with_app(|app| app.open_settings());
|
||||
});
|
||||
bridge.on_close_settings(|| {
|
||||
with_app(|app| app.close_settings());
|
||||
});
|
||||
bridge.on_audio_changed(|form| {
|
||||
with_app(|app| app.audio_changed(&form));
|
||||
});
|
||||
bridge.on_toggle_mic_test(|| {
|
||||
with_app(|app| app.set_mic_test(!app.mic_test));
|
||||
});
|
||||
bridge.on_apply_ptt(|enabled, key| {
|
||||
with_app(|app| app.apply_ptt(enabled, key.to_string()));
|
||||
});
|
||||
bridge.on_set_h264(|enabled| {
|
||||
with_app(|app| app.set_h264(enabled));
|
||||
});
|
||||
bridge.on_download_h264(|| {
|
||||
with_app(|app| app.download_h264());
|
||||
});
|
||||
bridge.on_appearance_changed(|form| {
|
||||
with_app(|app| app.appearance_changed(&form));
|
||||
});
|
||||
bridge.on_set_crash_reports(|enabled| {
|
||||
with_app(|app| app.set_crash_reports(enabled));
|
||||
});
|
||||
bridge.on_open_crash_folder(|| {
|
||||
with_app(|app| app.open_crash_folder());
|
||||
});
|
||||
bridge.on_delete_crash_reports(|| {
|
||||
with_app(|app| app.delete_crash_reports());
|
||||
});
|
||||
bridge.on_dismiss_crash_notice(|| {
|
||||
with_app(|app| {
|
||||
if let Some(ui) = app.ui.upgrade() {
|
||||
ui.global::<Bridge>().set_crash_notice(SharedString::new());
|
||||
}
|
||||
});
|
||||
});
|
||||
bridge.on_open_about(|| {
|
||||
with_app(|app| app.load_notices());
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
//! The streams panel, the share dialog and the viewer.
|
||||
|
||||
use slint::ComponentHandle;
|
||||
|
||||
use crate::app::{Bridge, MainWindow, with_app};
|
||||
|
||||
pub(super) fn wire(ui: &MainWindow) {
|
||||
let bridge = ui.global::<Bridge>();
|
||||
bridge.on_open_share(|| with_app(|app| app.open_share()).unwrap_or_default());
|
||||
bridge.on_start_share(|form| {
|
||||
with_app(|app| app.start_share(form));
|
||||
});
|
||||
bridge.on_stop_share(|| {
|
||||
with_app(|app| app.stop_share());
|
||||
});
|
||||
bridge.on_respond_viewer(|viewer, accept| {
|
||||
with_app(|app| app.respond_viewer(viewer as u16, accept));
|
||||
});
|
||||
bridge.on_kick_viewer(|viewer| {
|
||||
with_app(|app| app.kick_viewer(viewer as u16));
|
||||
});
|
||||
bridge.on_watch_stream(|id| {
|
||||
with_app(|app| app.watch_stream(id.to_string()));
|
||||
});
|
||||
bridge.on_show_viewer(|| {
|
||||
with_app(|app| app.show_viewer(true));
|
||||
});
|
||||
bridge.on_hide_viewer(|| {
|
||||
with_app(|app| app.show_viewer(false));
|
||||
});
|
||||
bridge.on_leave_stream(|| {
|
||||
with_app(|app| app.leave_stream());
|
||||
});
|
||||
bridge.on_set_stream_volume(|volume| {
|
||||
with_app(|app| app.set_stream_volume(volume));
|
||||
});
|
||||
bridge.on_toggle_fullscreen(|| {
|
||||
with_app(|app| app.toggle_fullscreen());
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
//! Chat: tabs per session (server, channels, private chats) and their
|
||||
//! messages. Each tab keeps its lines as a model; the chat view shows the
|
||||
//! selected tab's model, so a new message appends one row.
|
||||
|
||||
use slint::{ComponentHandle, ModelRc};
|
||||
use voelin_core::Command;
|
||||
use voelin_model::{ChatMessage, ChatTarget};
|
||||
|
||||
use crate::app::{App, Bridge, ChatTab, Tab};
|
||||
use crate::vm;
|
||||
|
||||
impl App {
|
||||
pub(crate) fn open_chat(&mut self, target: ChatTarget, focus: bool) {
|
||||
let Some(id) = self.current else { return };
|
||||
let title = match &target {
|
||||
ChatTarget::Channel(cid) => {
|
||||
let name = self
|
||||
.sessions
|
||||
.get(&id)
|
||||
.and_then(|v| v.presence.channels.get(cid).map(|c| c.name.clone()));
|
||||
format!("#{}", name.unwrap_or_else(|| cid.to_string()))
|
||||
}
|
||||
ChatTarget::Server => "Server".into(),
|
||||
ChatTarget::Private(uid) => format!("@{uid}"),
|
||||
};
|
||||
let view = self.sessions.entry(id).or_default();
|
||||
let index = match view.tabs.iter().position(|t| t.target == target) {
|
||||
Some(i) => i,
|
||||
None => {
|
||||
view.tabs.push(Tab::new(target.clone(), title));
|
||||
if !self.demo_ui {
|
||||
self.engine.send(Command::OpenChat { session: id as u64, target });
|
||||
}
|
||||
view.tabs.len() - 1
|
||||
}
|
||||
};
|
||||
if focus {
|
||||
view.current_tab = index;
|
||||
view.tabs[index].unread = 0;
|
||||
}
|
||||
self.refresh_chat();
|
||||
self.refresh_servers();
|
||||
}
|
||||
|
||||
pub(crate) fn select_tab(&mut self, index: usize) {
|
||||
if let Some(view) = self.view_mut()
|
||||
&& index < view.tabs.len()
|
||||
{
|
||||
view.current_tab = index;
|
||||
view.tabs[index].unread = 0;
|
||||
}
|
||||
self.refresh_chat();
|
||||
self.refresh_servers();
|
||||
}
|
||||
|
||||
pub(crate) fn close_tab(&mut self, index: usize) {
|
||||
let Some(id) = self.current else { return };
|
||||
let view = self.sessions.entry(id).or_default();
|
||||
if index == 0 || index >= view.tabs.len() {
|
||||
return;
|
||||
}
|
||||
let tab = view.tabs.remove(index);
|
||||
view.current_tab = view.current_tab.min(view.tabs.len() - 1);
|
||||
self.engine.send(Command::CloseChat { session: id as u64, target: tab.target });
|
||||
self.refresh_chat();
|
||||
}
|
||||
|
||||
pub(crate) fn send_message(&mut self, text: String) {
|
||||
let Some(id) = self.current else { return };
|
||||
let Some(view) = self.sessions.get(&id) else { return };
|
||||
let target = view.tabs[view.current_tab].target.clone();
|
||||
self.engine.send(Command::SendChat { session: id as u64, target, text });
|
||||
}
|
||||
|
||||
pub(crate) fn add_message(&mut self, id: i64, message: ChatMessage) {
|
||||
let current = self.current == Some(id);
|
||||
let view = self.sessions.entry(id).or_default();
|
||||
let index = match view.tabs.iter().position(|t| t.target == message.target) {
|
||||
Some(i) => i,
|
||||
None => {
|
||||
let title = match &message.target {
|
||||
ChatTarget::Channel(cid) => format!(
|
||||
"#{}",
|
||||
view.presence
|
||||
.channels
|
||||
.get(cid)
|
||||
.map(|c| c.name.clone())
|
||||
.unwrap_or_else(|| cid.to_string())
|
||||
),
|
||||
ChatTarget::Private(_) => format!("@{}", message.author_name),
|
||||
ChatTarget::Server => "Server".into(),
|
||||
};
|
||||
view.tabs.push(Tab::new(message.target.clone(), title));
|
||||
view.tabs.len() - 1
|
||||
}
|
||||
};
|
||||
let shown = current && view.current_tab == index;
|
||||
let tab = &mut view.tabs[index];
|
||||
let line = vm::chat::line(&message, tab.last.as_ref());
|
||||
tab.last = Some(vm::chat::Previous::of(&message));
|
||||
tab.lines.push(line);
|
||||
if !shown {
|
||||
tab.unread += 1;
|
||||
}
|
||||
if current {
|
||||
self.refresh_chat();
|
||||
}
|
||||
if !shown {
|
||||
self.refresh_servers();
|
||||
}
|
||||
}
|
||||
|
||||
/// Tabs and the shown tab's messages.
|
||||
pub(crate) fn refresh_chat(&self) {
|
||||
let Some(ui) = self.ui.upgrade() else { return };
|
||||
let bridge = ui.global::<Bridge>();
|
||||
let (tabs, lines) = match self.view() {
|
||||
None => (
|
||||
vec![ChatTab { title: "Server".into(), ..Default::default() }],
|
||||
ModelRc::from(self.models.no_chat.clone()),
|
||||
),
|
||||
Some(view) => {
|
||||
let tabs: Vec<ChatTab> = view
|
||||
.tabs
|
||||
.iter()
|
||||
.map(|t| ChatTab {
|
||||
title: t.title.clone().into(),
|
||||
name: t.title.trim_start_matches(['#', '@']).into(),
|
||||
kind: match t.target {
|
||||
ChatTarget::Server => 0,
|
||||
ChatTarget::Channel(_) => 1,
|
||||
ChatTarget::Private(_) => 2,
|
||||
},
|
||||
id: match t.target {
|
||||
ChatTarget::Channel(cid) => cid as i32,
|
||||
_ => 0,
|
||||
},
|
||||
unread: t.unread,
|
||||
topic: match t.target {
|
||||
ChatTarget::Channel(cid) => view
|
||||
.presence
|
||||
.channels
|
||||
.get(&cid)
|
||||
.and_then(|c| c.topic.clone())
|
||||
.unwrap_or_default()
|
||||
.into(),
|
||||
_ => Default::default(),
|
||||
},
|
||||
})
|
||||
.collect();
|
||||
(tabs, ModelRc::from(view.tabs[view.current_tab].lines.clone()))
|
||||
}
|
||||
};
|
||||
vm::list::sync(&self.models.tabs, &tabs);
|
||||
let current = self.view().map_or(0, |v| v.current_tab as i32);
|
||||
if bridge.get_current_tab() != current {
|
||||
bridge.set_current_tab(current);
|
||||
}
|
||||
// Swap the model only when another tab is shown.
|
||||
if bridge.get_messages() != lines {
|
||||
bridge.set_messages(lines);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,340 @@
|
||||
//! Development switches (environment variables), for trying screens and
|
||||
//! taking screenshots without a server:
|
||||
//!
|
||||
//! - `VOELIN_DATA_DIR=<dir>`: the database (app.rs).
|
||||
//! - `VOELIN_AUTOCONNECT=voice|observe`: connect the first bookmark on start.
|
||||
//! - `VOELIN_SCREENSHOT=<png>`: save the window after
|
||||
//! `VOELIN_SCREENSHOT_DELAY` seconds (default 4) and exit.
|
||||
//! - `VOELIN_WINDOW_SIZE=<w>x<h>`: the window's size (e.g. `390x844` for the
|
||||
//! phone layout).
|
||||
//! - `VOELIN_DEMO_UI=1`: sample servers, channels, chat and streams, no
|
||||
//! server needed (nothing is stored).
|
||||
//! - `VOELIN_DEMO_STREAM=1`: a local test stream in the viewer.
|
||||
//! - `VOELIN_OPEN=<what>[,<what>...]`: open screens on start: `home`,
|
||||
//! `server`, `settings[:<section>]` (voice, keybinds, streaming, privacy,
|
||||
//! appearance, or 0-4), `about`, `share`, `bookmark` (add a server),
|
||||
//! `emoji` (the picker), `client` (the volume dialog of the first other
|
||||
//! client once connected), `panel` / `no-panel` (the right panel),
|
||||
//! `tab:<home|servers|chat|activity|you>` (phone layout).
|
||||
//! - `VOELIN_AUTOWATCH=1`: watch the first stream that shows up.
|
||||
//! - `VOELIN_AUTOSHARE=test-pattern`: share the test pattern (accepting
|
||||
//! everyone) once connected to a TeamSpeak 6 server.
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::Result;
|
||||
use slint::ComponentHandle;
|
||||
use voelin_core::stream::{StreamInfo, StreamKind};
|
||||
use voelin_core::{Event, ObserveState, SessionState, Source, VoiceState};
|
||||
use voelin_model::{ChannelInfo, ChatMessage, ChatTarget, ClientInfo, Presence, ServerFlavor};
|
||||
use voelin_store::Bookmark;
|
||||
|
||||
use crate::app::{App, MainWindow, MobileTab, Nav, Page, SettingsSection, with_app};
|
||||
|
||||
/// The switches read at start.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub(crate) struct Switches {
|
||||
pub demo_stream: bool,
|
||||
pub demo_ui: bool,
|
||||
pub autoshare: bool,
|
||||
pub open_client: bool,
|
||||
open: Vec<String>,
|
||||
autoconnect: Option<String>,
|
||||
screenshot: Option<std::path::PathBuf>,
|
||||
screenshot_delay: u64,
|
||||
window_size: Option<(f32, f32)>,
|
||||
}
|
||||
|
||||
fn flag(name: &str) -> bool {
|
||||
std::env::var(name).is_ok_and(|v| v == "1")
|
||||
}
|
||||
|
||||
/// `390x844` → (390, 844).
|
||||
fn parse_size(text: &str) -> Option<(f32, f32)> {
|
||||
let (w, h) = text.split_once(['x', 'X'])?;
|
||||
Some((w.trim().parse().ok()?, h.trim().parse().ok()?))
|
||||
}
|
||||
|
||||
impl Switches {
|
||||
pub fn from_env() -> Self {
|
||||
let open: Vec<String> = std::env::var("VOELIN_OPEN")
|
||||
.unwrap_or_default()
|
||||
.split(',')
|
||||
.map(|s| s.trim().to_owned())
|
||||
.filter(|s| !s.is_empty())
|
||||
.collect();
|
||||
Self {
|
||||
demo_stream: flag("VOELIN_DEMO_STREAM"),
|
||||
demo_ui: flag("VOELIN_DEMO_UI"),
|
||||
autoshare: std::env::var("VOELIN_AUTOSHARE").is_ok_and(|v| v == "test-pattern"),
|
||||
open_client: open.iter().any(|o| o == "client"),
|
||||
open,
|
||||
autoconnect: std::env::var("VOELIN_AUTOCONNECT").ok(),
|
||||
screenshot: std::env::var_os("VOELIN_SCREENSHOT").map(Into::into),
|
||||
screenshot_delay: std::env::var("VOELIN_SCREENSHOT_DELAY")
|
||||
.ok()
|
||||
.and_then(|d| d.parse().ok())
|
||||
.unwrap_or(4),
|
||||
window_size: std::env::var("VOELIN_WINDOW_SIZE").ok().as_deref().and_then(parse_size),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn section(name: &str) -> SettingsSection {
|
||||
match name {
|
||||
"1" | "keybinds" | "ptt" => SettingsSection::Keybinds,
|
||||
"2" | "streaming" => SettingsSection::Streaming,
|
||||
"3" | "privacy" => SettingsSection::Privacy,
|
||||
"4" | "appearance" => SettingsSection::Appearance,
|
||||
_ => SettingsSection::Voice,
|
||||
}
|
||||
}
|
||||
|
||||
fn mobile_tab(name: &str) -> MobileTab {
|
||||
match name {
|
||||
"home" => MobileTab::Home,
|
||||
"servers" => MobileTab::Servers,
|
||||
"activity" => MobileTab::Activity,
|
||||
"you" => MobileTab::You,
|
||||
_ => MobileTab::Chat,
|
||||
}
|
||||
}
|
||||
|
||||
/// Timers that must live while the window runs.
|
||||
pub(crate) struct Running {
|
||||
_screenshot: Option<slint::Timer>,
|
||||
}
|
||||
|
||||
/// Apply the switches once the app is set up.
|
||||
pub(crate) fn start(ui: &MainWindow, switches: &Switches) -> Running {
|
||||
if let Some((w, h)) = switches.window_size {
|
||||
ui.window().set_size(slint::LogicalSize::new(w, h));
|
||||
}
|
||||
if switches.demo_ui {
|
||||
with_app(demo_ui);
|
||||
}
|
||||
match switches.autoconnect.as_deref() {
|
||||
Some("voice") => {
|
||||
with_app(|app| app.connect_voice());
|
||||
}
|
||||
Some("observe") => {
|
||||
with_app(|app| app.toggle_observe());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
let nav = ui.global::<Nav>();
|
||||
for open in &switches.open {
|
||||
let (what, arg) = open.split_once(':').unwrap_or((open.as_str(), ""));
|
||||
match what {
|
||||
"home" => nav.invoke_show(Page::Home),
|
||||
"server" => nav.invoke_show(Page::Server),
|
||||
"settings" => nav.invoke_open_settings(section(arg)),
|
||||
"about" => nav.invoke_open_about(),
|
||||
"share" => nav.invoke_open_share(),
|
||||
"bookmark" => nav.invoke_add_server(),
|
||||
"emoji" => nav.set_emoji_open(true),
|
||||
"panel" => nav.set_right_panel_open(true),
|
||||
"no-panel" => nav.set_right_panel_open(false),
|
||||
"tab" => nav.set_mobile_tab(mobile_tab(arg)),
|
||||
// Opened once connected (settings_page.rs).
|
||||
"client" => {}
|
||||
other => eprintln!("VOELIN_OPEN: unknown screen {other:?}"),
|
||||
}
|
||||
}
|
||||
let screenshot = switches.screenshot.clone().map(|path| {
|
||||
let weak = ui.as_weak();
|
||||
let timer = slint::Timer::default();
|
||||
timer.start(
|
||||
slint::TimerMode::SingleShot,
|
||||
Duration::from_secs(switches.screenshot_delay),
|
||||
move || {
|
||||
if let Some(ui) = weak.upgrade() {
|
||||
if let Err(e) = save_screenshot(&ui, &path) {
|
||||
eprintln!("screenshot failed: {e}");
|
||||
}
|
||||
let _ = ui.hide();
|
||||
}
|
||||
},
|
||||
);
|
||||
timer
|
||||
});
|
||||
Running { _screenshot: screenshot }
|
||||
}
|
||||
|
||||
fn save_screenshot(ui: &MainWindow, path: &std::path::Path) -> Result<()> {
|
||||
let image = ui.window().take_snapshot()?;
|
||||
let file = std::io::BufWriter::new(std::fs::File::create(path)?);
|
||||
let mut encoder = png::Encoder::new(file, image.width(), image.height());
|
||||
encoder.set_color(png::ColorType::Rgba);
|
||||
encoder.set_depth(png::BitDepth::Eight);
|
||||
encoder.write_header()?.write_image_data(image.as_bytes())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
const DEMO: i64 = 9001;
|
||||
|
||||
fn channel(id: u64, parent: u64, order: u64, name: &str) -> ChannelInfo {
|
||||
ChannelInfo { id, parent, order, name: name.into(), ..Default::default() }
|
||||
}
|
||||
|
||||
fn client(id: u16, channel: u64, name: &str) -> ClientInfo {
|
||||
ClientInfo {
|
||||
id,
|
||||
channel,
|
||||
nickname: name.into(),
|
||||
uid: Some(format!("demo-{id}")),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
/// Sample data through the same events a server would send.
|
||||
fn demo_ui(app: &mut App) {
|
||||
let bookmark = |id: i64, name: &str, address: &str| Bookmark {
|
||||
id,
|
||||
name: name.into(),
|
||||
address: address.into(),
|
||||
nickname: "Nova".into(),
|
||||
identity: None,
|
||||
default_channel: None,
|
||||
gateway_url: None,
|
||||
query: None,
|
||||
client_version: None,
|
||||
};
|
||||
app.bookmarks = vec![
|
||||
bookmark(DEMO, "Nightfall Guild", "ts.nightfall.example:9987"),
|
||||
bookmark(DEMO + 1, "Pixel Lounge", "pixel.example"),
|
||||
bookmark(DEMO + 2, "Dev TS3", "127.0.0.1:9987"),
|
||||
];
|
||||
app.current = Some(DEMO);
|
||||
let session = DEMO as u64;
|
||||
|
||||
let mut p = Presence { server_name: "Nightfall Guild".into(), ..Default::default() };
|
||||
let mut chill = channel(2, 0, 1, "Chill Zone");
|
||||
chill.max_clients = Some(50);
|
||||
chill.topic = Some("Hang out, chat, and explore the worlds beyond.".into());
|
||||
let mut locked = channel(7, 0, 6, "Officers");
|
||||
locked.has_password = true;
|
||||
for c in [
|
||||
channel(1, 0, 0, "Lobby"),
|
||||
chill,
|
||||
channel(3, 0, 2, "Gaming"),
|
||||
channel(4, 3, 0, "Raid Night"),
|
||||
channel(5, 0, 3, "Music"),
|
||||
channel(6, 0, 5, "AFK"),
|
||||
locked,
|
||||
] {
|
||||
p.channels.insert(c.id, c);
|
||||
}
|
||||
let mut clients = vec![
|
||||
client(1, 2, "Nova"),
|
||||
client(2, 2, "Lumen"),
|
||||
client(3, 2, "Kairo"),
|
||||
client(4, 2, "Mira"),
|
||||
client(5, 2, "dex"),
|
||||
client(6, 3, "Talon"),
|
||||
client(7, 4, "Zeph"),
|
||||
client(8, 6, "Blaze"),
|
||||
client(9, 1, "Rin"),
|
||||
];
|
||||
clients[1].streaming = Some(true);
|
||||
clients[4].input_muted = true;
|
||||
clients[7].away = Some("brb".into());
|
||||
clients[8].output_muted = true;
|
||||
for c in clients {
|
||||
p.clients.insert(c.id, c);
|
||||
}
|
||||
|
||||
let flavor = ServerFlavor::from_version_string("6.0.0-beta13.1 [Build: 1]");
|
||||
let capabilities = flavor.capabilities();
|
||||
let events = [
|
||||
Event::ServerInfo { session, name: "Nightfall Guild".into(), flavor, capabilities },
|
||||
Event::Presence { session, presence: Arc::new(p) },
|
||||
Event::State {
|
||||
session,
|
||||
state: SessionState {
|
||||
voice: VoiceState::Connected,
|
||||
presence_source: Some(Source::Voice),
|
||||
own_channel: Some(2),
|
||||
own_client: Some(1),
|
||||
..Default::default()
|
||||
},
|
||||
},
|
||||
Event::Talking { session, client: 3, talking: true },
|
||||
Event::StreamsChanged {
|
||||
session,
|
||||
streams: vec![StreamInfo {
|
||||
id: "demo-stream".into(),
|
||||
streamer: tsclientlib::ClientId(2),
|
||||
name: "Exploring the Lands Between".into(),
|
||||
kind: StreamKind::Screen,
|
||||
bitrate: 8000,
|
||||
viewer_limit: 0,
|
||||
audio: true,
|
||||
}],
|
||||
},
|
||||
Event::State {
|
||||
session: session + 1,
|
||||
state: SessionState { observe: ObserveState::Observing, ..Default::default() },
|
||||
},
|
||||
];
|
||||
for event in events {
|
||||
app.handle_event(event);
|
||||
}
|
||||
let now = chrono::Utc::now().timestamp_millis();
|
||||
let lines = [
|
||||
(
|
||||
DEMO,
|
||||
ChatTarget::Channel(2),
|
||||
"Nova",
|
||||
"Beautiful morning for a game. Who's up for a session later? ☀️",
|
||||
0,
|
||||
false,
|
||||
),
|
||||
(DEMO, ChatTarget::Channel(2), "Kairo", "Definitely! I'll be on after lunch.", 4, false),
|
||||
(DEMO, ChatTarget::Channel(2), "Kairo", "Bringing snacks 🍕🍩", 4, false),
|
||||
(
|
||||
DEMO,
|
||||
ChatTarget::Channel(2),
|
||||
"Mira",
|
||||
"Working on a new video today — here's a sneak peek soon! 🎬",
|
||||
7,
|
||||
false,
|
||||
),
|
||||
(
|
||||
DEMO,
|
||||
ChatTarget::Channel(2),
|
||||
"Lumen",
|
||||
"Going live in Chill Zone — exploring the Lands Between. Come hang! 🔥🗡️",
|
||||
48,
|
||||
false,
|
||||
),
|
||||
(DEMO, ChatTarget::Channel(2), "dex", "🎉🎉", 50, false),
|
||||
(
|
||||
DEMO,
|
||||
ChatTarget::Channel(2),
|
||||
"Ari",
|
||||
"Anyone want to run some co-op later? 👀 Posting from the web.",
|
||||
55,
|
||||
true,
|
||||
),
|
||||
(DEMO, ChatTarget::Server, "Talon", "Server restart tonight at 23:00.", 20, false),
|
||||
(DEMO + 1, ChatTarget::Server, "Ivy", "Welcome to the lounge!", 30, false),
|
||||
(DEMO + 1, ChatTarget::Server, "Ivy", "New channel for artists 🎨", 31, false),
|
||||
];
|
||||
for (id, target, author, text, minute, relay) in lines {
|
||||
let message = ChatMessage {
|
||||
target,
|
||||
author_name: author.into(),
|
||||
author_uid: None,
|
||||
author_id: None,
|
||||
text: text.into(),
|
||||
ts_ms: now - (60 - minute) * 60_000,
|
||||
via_relay: relay,
|
||||
};
|
||||
app.add_message(id, message);
|
||||
}
|
||||
// No toast over the screenshots.
|
||||
app.set_status("");
|
||||
app.refresh_all();
|
||||
}
|
||||
@@ -0,0 +1,411 @@
|
||||
//! Twemoji as images. The software renderer draws no colour glyphs, so the
|
||||
//! UI shows emoji as pictures: this module reads the packed archive
|
||||
//! (`assets/twemoji.bin`, made by `scripts/pack-twemoji.py`), finds the
|
||||
//! picture of a grapheme cluster, splits text into runs of text and emoji,
|
||||
//! and lists emoji for the picker. Decoding the SVGs into images is
|
||||
//! `images.rs`' job.
|
||||
|
||||
use std::sync::{Arc, Mutex, OnceLock};
|
||||
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
|
||||
static DATA: &[u8] = include_bytes!("../assets/twemoji.bin");
|
||||
|
||||
const MAGIC: &[u8; 8] = b"VTWEMOJ1";
|
||||
const ENTRY_SIZE: usize = 28;
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
struct Block {
|
||||
offset: u32,
|
||||
len: u32,
|
||||
raw_len: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
struct Entry {
|
||||
key: (u32, u16),
|
||||
category: u16,
|
||||
block: u32,
|
||||
offset: u32,
|
||||
len: u32,
|
||||
name: (u32, u16),
|
||||
picker: bool,
|
||||
}
|
||||
|
||||
/// An emoji of the picker.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct PickerEmoji {
|
||||
/// The archive key (`1f600`).
|
||||
pub key: &'static str,
|
||||
/// Lower-case name for search and screen readers.
|
||||
pub name: &'static str,
|
||||
/// The characters picking it inserts.
|
||||
pub text: String,
|
||||
}
|
||||
|
||||
/// The packed Twemoji: an index sorted by key and deflate blocks.
|
||||
pub struct Archive {
|
||||
entries: Vec<Entry>,
|
||||
blocks: Vec<Block>,
|
||||
strings: &'static [u8],
|
||||
data: &'static [u8],
|
||||
/// Picker entries (indices into `entries`) in picker order.
|
||||
picker: Vec<u32>,
|
||||
/// The last decompressed block: neighbours are often wanted together.
|
||||
last: Mutex<Option<(u32, Arc<[u8]>)>>,
|
||||
}
|
||||
|
||||
fn u32_at(b: &[u8], at: usize) -> Option<u32> {
|
||||
Some(u32::from_le_bytes(b.get(at..at + 4)?.try_into().ok()?))
|
||||
}
|
||||
|
||||
fn u16_at(b: &[u8], at: usize) -> Option<u16> {
|
||||
Some(u16::from_le_bytes(b.get(at..at + 2)?.try_into().ok()?))
|
||||
}
|
||||
|
||||
impl Archive {
|
||||
/// Parse the index of an archive; `None` if it is malformed.
|
||||
pub fn parse(bytes: &'static [u8]) -> Option<Self> {
|
||||
if bytes.get(..8)? != MAGIC {
|
||||
return None;
|
||||
}
|
||||
let count = u32_at(bytes, 8)? as usize;
|
||||
let block_count = u32_at(bytes, 12)? as usize;
|
||||
let strings_len = u32_at(bytes, 16)? as usize;
|
||||
let mut at = 20;
|
||||
let mut blocks = Vec::with_capacity(block_count);
|
||||
for _ in 0..block_count {
|
||||
blocks.push(Block {
|
||||
offset: u32_at(bytes, at)?,
|
||||
len: u32_at(bytes, at + 4)?,
|
||||
raw_len: u32_at(bytes, at + 8)?,
|
||||
});
|
||||
at += 12;
|
||||
}
|
||||
let mut entries = Vec::with_capacity(count);
|
||||
for _ in 0..count {
|
||||
entries.push(Entry {
|
||||
key: (u32_at(bytes, at)?, u16_at(bytes, at + 4)?),
|
||||
category: u16_at(bytes, at + 6)?,
|
||||
block: u32_at(bytes, at + 8)?,
|
||||
offset: u32_at(bytes, at + 12)?,
|
||||
len: u32_at(bytes, at + 16)?,
|
||||
name: (u32_at(bytes, at + 20)?, u16_at(bytes, at + 24)?),
|
||||
picker: u16_at(bytes, at + 26)? & 1 == 1,
|
||||
});
|
||||
at += ENTRY_SIZE;
|
||||
}
|
||||
let strings = bytes.get(at..at + strings_len)?;
|
||||
let data = bytes.get(at + strings_len..)?;
|
||||
let mut picker: Vec<u32> =
|
||||
(0..entries.len() as u32).filter(|&i| entries[i as usize].picker).collect();
|
||||
picker.sort_by_key(|&i| {
|
||||
let e = &entries[i as usize];
|
||||
(e.category, e.block, e.offset)
|
||||
});
|
||||
Some(Self { entries, blocks, strings, data, picker, last: Mutex::new(None) })
|
||||
}
|
||||
|
||||
fn string(&self, (offset, len): (u32, u16)) -> &'static str {
|
||||
let (offset, len) = (offset as usize, len as usize);
|
||||
let strings: &'static [u8] = self.strings;
|
||||
strings.get(offset..offset + len).and_then(|b| std::str::from_utf8(b).ok()).unwrap_or("")
|
||||
}
|
||||
|
||||
fn find(&self, key: &str) -> Option<&Entry> {
|
||||
self.entries
|
||||
.binary_search_by(|e| self.string(e.key).cmp(key))
|
||||
.ok()
|
||||
.map(|i| &self.entries[i])
|
||||
}
|
||||
|
||||
/// Number of emoji in the archive.
|
||||
#[cfg(test)]
|
||||
pub fn len(&self) -> usize {
|
||||
self.entries.len()
|
||||
}
|
||||
|
||||
pub fn contains(&self, key: &str) -> bool {
|
||||
self.find(key).is_some()
|
||||
}
|
||||
|
||||
/// The name of an emoji (lower case), if the archive has it.
|
||||
#[allow(dead_code, reason = "for screens that label emoji (reactions)")]
|
||||
pub fn name(&self, key: &str) -> Option<&'static str> {
|
||||
self.find(key).map(|e| self.string(e.name))
|
||||
}
|
||||
|
||||
/// The SVG of an emoji.
|
||||
pub fn svg(&self, key: &str) -> Option<Vec<u8>> {
|
||||
let entry = *self.find(key)?;
|
||||
let block = self.block(entry.block)?;
|
||||
let (start, len) = (entry.offset as usize, entry.len as usize);
|
||||
block.get(start..start + len).map(<[u8]>::to_vec)
|
||||
}
|
||||
|
||||
fn block(&self, index: u32) -> Option<Arc<[u8]>> {
|
||||
let mut last = self.last.lock().unwrap_or_else(|e| e.into_inner());
|
||||
if let Some((i, block)) = last.as_ref()
|
||||
&& *i == index
|
||||
{
|
||||
return Some(block.clone());
|
||||
}
|
||||
let b = self.blocks.get(index as usize)?;
|
||||
let compressed = self.data.get(b.offset as usize..(b.offset + b.len) as usize)?;
|
||||
let raw =
|
||||
miniz_oxide::inflate::decompress_to_vec_with_limit(compressed, b.raw_len as usize)
|
||||
.ok()?;
|
||||
let raw: Arc<[u8]> = raw.into();
|
||||
*last = Some((index, raw.clone()));
|
||||
Some(raw)
|
||||
}
|
||||
|
||||
fn picker_emoji(&self, entry: &Entry) -> PickerEmoji {
|
||||
let key = self.string(entry.key);
|
||||
PickerEmoji { key, name: self.string(entry.name), text: text_of(key) }
|
||||
}
|
||||
|
||||
/// The picker's emoji of a category: smileys, people, nature, food,
|
||||
/// activities, travel, objects, symbols, flags (0-8).
|
||||
pub fn category(&self, category: usize) -> Vec<PickerEmoji> {
|
||||
self.picker
|
||||
.iter()
|
||||
.map(|&i| &self.entries[i as usize])
|
||||
.filter(|e| e.category as usize == category)
|
||||
.map(|e| self.picker_emoji(e))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Picker emoji whose name has every word of `query` (case-insensitive).
|
||||
pub fn search(&self, query: &str) -> Vec<PickerEmoji> {
|
||||
let words: Vec<String> = query.split_whitespace().map(str::to_lowercase).collect();
|
||||
if words.is_empty() {
|
||||
return Vec::new();
|
||||
}
|
||||
self.picker
|
||||
.iter()
|
||||
.map(|&i| &self.entries[i as usize])
|
||||
.filter(|e| {
|
||||
let name = self.string(e.name);
|
||||
words.iter().all(|w| name.contains(w.as_str()))
|
||||
})
|
||||
.map(|e| self.picker_emoji(e))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// The archive in the binary.
|
||||
pub fn archive() -> &'static Archive {
|
||||
static ARCHIVE: OnceLock<Archive> = OnceLock::new();
|
||||
ARCHIVE.get_or_init(|| Archive::parse(DATA).expect("the bundled emoji archive is valid"))
|
||||
}
|
||||
|
||||
/// Characters shown as emoji even without U+FE0F: Emoji_Presentation=Yes
|
||||
/// below U+1F000 (above it nearly everything is).
|
||||
const PRESENTATION_BMP: &[(u32, u32)] = &[
|
||||
(0x231A, 0x231B),
|
||||
(0x23E9, 0x23EC),
|
||||
(0x23F0, 0x23F0),
|
||||
(0x23F3, 0x23F3),
|
||||
(0x25FD, 0x25FE),
|
||||
(0x2614, 0x2615),
|
||||
(0x2648, 0x2653),
|
||||
(0x267F, 0x267F),
|
||||
(0x2693, 0x2693),
|
||||
(0x26A1, 0x26A1),
|
||||
(0x26AA, 0x26AB),
|
||||
(0x26BD, 0x26BE),
|
||||
(0x26C4, 0x26C5),
|
||||
(0x26CE, 0x26CE),
|
||||
(0x26D4, 0x26D4),
|
||||
(0x26EA, 0x26EA),
|
||||
(0x26F2, 0x26F3),
|
||||
(0x26F5, 0x26F5),
|
||||
(0x26FA, 0x26FA),
|
||||
(0x26FD, 0x26FD),
|
||||
(0x2705, 0x2705),
|
||||
(0x270A, 0x270B),
|
||||
(0x2728, 0x2728),
|
||||
(0x274C, 0x274C),
|
||||
(0x274E, 0x274E),
|
||||
(0x2753, 0x2755),
|
||||
(0x2757, 0x2757),
|
||||
(0x2795, 0x2797),
|
||||
(0x27B0, 0x27B0),
|
||||
(0x27BF, 0x27BF),
|
||||
(0x2B1B, 0x2B1C),
|
||||
(0x2B50, 0x2B50),
|
||||
(0x2B55, 0x2B55),
|
||||
];
|
||||
|
||||
fn emoji_presentation(cp: u32) -> bool {
|
||||
cp >= 0x1F000 || PRESENTATION_BMP.iter().any(|&(lo, hi)| (lo..=hi).contains(&cp))
|
||||
}
|
||||
|
||||
/// Whether a character can start an emoji; text without any is plain.
|
||||
fn may_be_emoji(c: char) -> bool {
|
||||
c as u32 >= 0x2000 || c == '\u{FE0F}' || c == '\u{20E3}' || c == '\u{a9}' || c == '\u{ae}'
|
||||
}
|
||||
|
||||
fn key_of(cps: &[u32]) -> String {
|
||||
cps.iter().map(|cp| format!("{cp:x}")).collect::<Vec<_>>().join("-")
|
||||
}
|
||||
|
||||
/// The characters of an archive key, with U+FE0F after a lone character
|
||||
/// that is text by default, so other clients show an emoji too.
|
||||
fn text_of(key: &str) -> String {
|
||||
let cps: Vec<u32> = key.split('-').filter_map(|p| u32::from_str_radix(p, 16).ok()).collect();
|
||||
let mut text: String = cps.iter().filter_map(|&cp| char::from_u32(cp)).collect();
|
||||
if cps.len() == 1 && !emoji_presentation(cps[0]) {
|
||||
text.push('\u{FE0F}');
|
||||
}
|
||||
text
|
||||
}
|
||||
|
||||
/// The archive key of a grapheme cluster that is an emoji: code points in
|
||||
/// hex joined by `-`, without U+FE0F unless the sequence has a ZWJ (as
|
||||
/// Twemoji names its files).
|
||||
pub fn key_for(grapheme: &str) -> Option<String> {
|
||||
let cps: Vec<u32> = grapheme.chars().map(|c| c as u32).collect();
|
||||
let first = *cps.first()?;
|
||||
let has_vs = cps.contains(&0xFE0F);
|
||||
let has_keycap = cps.contains(&0x20E3);
|
||||
// Text characters (digits, ©, ↔) are emoji only with U+FE0F or a keycap.
|
||||
if cps.len() == 1 && !emoji_presentation(first) {
|
||||
return None;
|
||||
}
|
||||
if first < 0x2000 && !has_vs && !has_keycap && first != 0xA9 && first != 0xAE {
|
||||
return None;
|
||||
}
|
||||
if (first == 0xA9 || first == 0xAE) && !has_vs {
|
||||
return None;
|
||||
}
|
||||
let archive = archive();
|
||||
let key = if cps.contains(&0x200D) {
|
||||
key_of(&cps)
|
||||
} else {
|
||||
key_of(&cps.iter().copied().filter(|&cp| cp != 0xFE0F).collect::<Vec<_>>())
|
||||
};
|
||||
if archive.contains(&key) {
|
||||
return Some(key);
|
||||
}
|
||||
// Some ZWJ sequences are named without their U+FE0F.
|
||||
let bare = key_of(&cps.iter().copied().filter(|&cp| cp != 0xFE0F).collect::<Vec<_>>());
|
||||
archive.contains(&bare).then_some(bare)
|
||||
}
|
||||
|
||||
/// A piece of text: plain, or one emoji (`emoji` is its key).
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Run {
|
||||
pub text: String,
|
||||
pub emoji: Option<String>,
|
||||
}
|
||||
|
||||
/// Text split into runs for a wrapping layout: a run per word (with the
|
||||
/// space after it) and per emoji. `None` if the text has no emoji (show it
|
||||
/// as one text). Line breaks become spaces.
|
||||
pub fn runs(text: &str) -> Option<Vec<Run>> {
|
||||
if !text.chars().any(may_be_emoji) {
|
||||
return None;
|
||||
}
|
||||
let mut out: Vec<Run> = Vec::new();
|
||||
let mut word = String::new();
|
||||
let mut any = false;
|
||||
for g in text.graphemes(true) {
|
||||
if let Some(key) = key_for(g) {
|
||||
if !word.is_empty() {
|
||||
out.push(Run { text: std::mem::take(&mut word), emoji: None });
|
||||
}
|
||||
out.push(Run { text: g.to_owned(), emoji: Some(key) });
|
||||
any = true;
|
||||
continue;
|
||||
}
|
||||
let space = g.chars().all(char::is_whitespace);
|
||||
if space {
|
||||
// Spaces stay with the word before them (or stand alone after
|
||||
// an emoji).
|
||||
word.push(' ');
|
||||
out.push(Run { text: std::mem::take(&mut word), emoji: None });
|
||||
} else {
|
||||
word.push_str(g);
|
||||
}
|
||||
}
|
||||
if !word.is_empty() {
|
||||
out.push(Run { text: word, emoji: None });
|
||||
}
|
||||
any.then_some(out)
|
||||
}
|
||||
|
||||
/// One to three emoji and nothing else but spaces: shown large.
|
||||
pub fn is_jumbo(runs: &[Run]) -> bool {
|
||||
let emoji = runs.iter().filter(|r| r.emoji.is_some()).count();
|
||||
(1..=3).contains(&emoji) && runs.iter().all(|r| r.emoji.is_some() || r.text.trim().is_empty())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn archive_opens() {
|
||||
let a = archive();
|
||||
assert!(a.len() > 3000);
|
||||
assert!(a.contains("1f600"));
|
||||
assert!(!a.contains("zzz"));
|
||||
assert_eq!(a.name("1f600"), Some("grinning face"));
|
||||
let svg = a.svg("1f600").unwrap();
|
||||
assert!(svg.starts_with(b"<svg"), "{:?}", String::from_utf8_lossy(&svg[..20]));
|
||||
assert!(svg.ends_with(b"</svg>"));
|
||||
// Twice (the cached block).
|
||||
assert_eq!(a.svg("1f600").unwrap(), svg);
|
||||
let zwj = a.svg("1f468-200d-1f4bb").unwrap();
|
||||
assert!(zwj.starts_with(b"<svg"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keys_of_graphemes() {
|
||||
assert_eq!(key_for("😀").as_deref(), Some("1f600"));
|
||||
// U+FE0F dropped outside ZWJ sequences.
|
||||
assert_eq!(key_for("❤\u{FE0F}").as_deref(), Some("2764"));
|
||||
// Keycap.
|
||||
assert_eq!(key_for("1\u{FE0F}\u{20E3}").as_deref(), Some("31-20e3"));
|
||||
// Skin tone.
|
||||
assert_eq!(key_for("👍🏽").as_deref(), Some("1f44d-1f3fd"));
|
||||
// ZWJ sequence.
|
||||
assert_eq!(key_for("👨\u{200D}💻").as_deref(), Some("1f468-200d-1f4bb"));
|
||||
// Flag.
|
||||
assert_eq!(key_for("🇩🇪").as_deref(), Some("1f1e9-1f1ea"));
|
||||
// Text stays text.
|
||||
assert_eq!(key_for("a"), None);
|
||||
assert_eq!(key_for("1"), None);
|
||||
assert_eq!(key_for("©"), None);
|
||||
assert_eq!(key_for("❤"), None);
|
||||
assert_eq!(key_for("—"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn text_runs() {
|
||||
assert_eq!(runs("plain text, no emoji"), None);
|
||||
assert_eq!(runs("em — dash"), None);
|
||||
let r = runs("hi 👋 there").unwrap();
|
||||
let texts: Vec<_> = r.iter().map(|r| (r.text.as_str(), r.emoji.as_deref())).collect();
|
||||
assert_eq!(texts, [("hi ", None), ("👋", Some("1f44b")), (" ", None), ("there", None)]);
|
||||
assert!(!is_jumbo(&r));
|
||||
let r = runs("🔥🔥 ").unwrap();
|
||||
assert!(is_jumbo(&r));
|
||||
assert!(!is_jumbo(&runs("🔥🔥🔥🔥").unwrap()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn picker() {
|
||||
let a = archive();
|
||||
let smileys = a.category(0);
|
||||
assert!(smileys.len() > 50);
|
||||
assert_eq!(smileys[0].key, "1f600");
|
||||
assert_eq!(smileys[0].text, "😀");
|
||||
assert!(a.category(1).iter().all(|e| !e.key.contains("1f3fb")), "no skin tone variants");
|
||||
let hearts = a.search("red heart");
|
||||
assert!(hearts.iter().any(|e| e.key == "2764" && e.text == "❤\u{FE0F}"));
|
||||
assert!(a.search(" ").is_empty());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
//! Decoded images by key (emoji now; avatars and server icons later): each
|
||||
//! is decoded once and kept while it fits the budget (setting
|
||||
//! `ui.image_cache_mb`); the least recently used go first.
|
||||
//!
|
||||
//! The cache lives on the UI thread apart from the app state, because Slint
|
||||
//! asks for images (`Images.emoji`) while it evaluates bindings, which may
|
||||
//! happen while the app state is borrowed.
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
|
||||
use slint::Image;
|
||||
|
||||
use crate::emoji;
|
||||
|
||||
/// An LRU map with a byte budget. Generic over the value for tests.
|
||||
pub struct Lru<V> {
|
||||
budget: usize,
|
||||
used: usize,
|
||||
tick: u64,
|
||||
entries: HashMap<String, (V, usize, u64)>,
|
||||
/// Keys by last use.
|
||||
order: BTreeMap<u64, String>,
|
||||
}
|
||||
|
||||
impl<V: Clone> Lru<V> {
|
||||
pub fn new(budget: usize) -> Self {
|
||||
Self { budget, used: 0, tick: 0, entries: HashMap::new(), order: BTreeMap::new() }
|
||||
}
|
||||
|
||||
/// Bytes in use and the budget.
|
||||
pub fn usage(&self) -> (usize, usize) {
|
||||
(self.used, self.budget)
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.entries.len()
|
||||
}
|
||||
|
||||
pub fn set_budget(&mut self, budget: usize) {
|
||||
self.budget = budget;
|
||||
self.evict();
|
||||
}
|
||||
|
||||
/// The value of `key`, or the loaded one (`load` gives it with its cost
|
||||
/// in bytes). A value larger than the budget is returned but not kept.
|
||||
pub fn get_or_load(
|
||||
&mut self,
|
||||
key: &str,
|
||||
load: impl FnOnce() -> Option<(V, usize)>,
|
||||
) -> Option<V> {
|
||||
self.tick += 1;
|
||||
let tick = self.tick;
|
||||
if let Some((value, _, last)) = self.entries.get_mut(key) {
|
||||
self.order.remove(last);
|
||||
*last = tick;
|
||||
self.order.insert(tick, key.to_owned());
|
||||
return Some(value.clone());
|
||||
}
|
||||
let (value, cost) = load()?;
|
||||
if cost <= self.budget {
|
||||
self.entries.insert(key.to_owned(), (value.clone(), cost, tick));
|
||||
self.order.insert(tick, key.to_owned());
|
||||
self.used += cost;
|
||||
self.evict();
|
||||
}
|
||||
Some(value)
|
||||
}
|
||||
|
||||
fn evict(&mut self) {
|
||||
while self.used > self.budget {
|
||||
let Some((_, key)) = self.order.pop_first() else { break };
|
||||
if let Some((_, cost, _)) = self.entries.remove(&key) {
|
||||
self.used -= cost;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// What an SVG costs in the cache: the renderer keeps rasterized copies at
|
||||
/// the sizes shown, so count a 64×64 RGBA picture besides the source.
|
||||
fn svg_cost(svg_len: usize) -> usize {
|
||||
svg_len + 64 * 64 * 4
|
||||
}
|
||||
|
||||
thread_local! {
|
||||
static CACHE: RefCell<Lru<Image>> = RefCell::new(Lru::new(64 << 20));
|
||||
}
|
||||
|
||||
/// Set the budget in megabytes.
|
||||
pub fn set_budget_mb(mb: u32) {
|
||||
CACHE.with(|c| c.borrow_mut().set_budget(mb as usize * (1 << 20)));
|
||||
}
|
||||
|
||||
/// "3.2 of 64 MB (120 images)"
|
||||
pub fn usage_text() -> String {
|
||||
CACHE.with(|c| {
|
||||
let c = c.borrow();
|
||||
let (used, budget) = c.usage();
|
||||
format!("{:.1} of {} MB ({} images)", used as f64 / (1 << 20) as f64, budget >> 20, c.len())
|
||||
})
|
||||
}
|
||||
|
||||
/// A Twemoji by key; an empty image if there is none.
|
||||
pub fn emoji(key: &str) -> Image {
|
||||
if key.is_empty() {
|
||||
return Image::default();
|
||||
}
|
||||
let cache_key = format!("emoji:{key}");
|
||||
CACHE
|
||||
.with(|c| {
|
||||
c.borrow_mut().get_or_load(&cache_key, || {
|
||||
let svg = emoji::archive().svg(key)?;
|
||||
let image = Image::load_from_svg_data(&svg).ok()?;
|
||||
Some((image, svg_cost(svg.len())))
|
||||
})
|
||||
})
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn lru_budget() {
|
||||
let mut lru: Lru<u32> = Lru::new(10);
|
||||
let loads = std::cell::Cell::new(0);
|
||||
let get = |lru: &mut Lru<u32>, k: &str, cost: usize| {
|
||||
lru.get_or_load(k, || {
|
||||
loads.set(loads.get() + 1);
|
||||
Some((k.len() as u32, cost))
|
||||
})
|
||||
};
|
||||
get(&mut lru, "a", 4);
|
||||
get(&mut lru, "b", 4);
|
||||
get(&mut lru, "a", 4); // a is now newer than b
|
||||
get(&mut lru, "c", 4); // evicts b
|
||||
assert_eq!(lru.usage(), (8, 10));
|
||||
assert_eq!(lru.len(), 2);
|
||||
get(&mut lru, "a", 4);
|
||||
get(&mut lru, "b", 4); // loaded again
|
||||
// Too large to keep, still returned.
|
||||
assert_eq!(get(&mut lru, "huge", 100), Some(4));
|
||||
assert!(lru.len() <= 2);
|
||||
assert_eq!(loads.get(), 5);
|
||||
lru.set_budget(0);
|
||||
assert_eq!(lru.usage(), (0, 0));
|
||||
// Unknown keys are not cached.
|
||||
assert_eq!(lru.get_or_load("none", || None), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn emoji_images_decode() {
|
||||
let image = emoji("1f600");
|
||||
assert!(image.size().width > 0);
|
||||
assert_eq!(emoji("nope").size().width, 0);
|
||||
assert!(usage_text().contains("of 64 MB"));
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,18 @@
|
||||
//! Slint user interface shared by the desktop binary and the mobile apps.
|
||||
|
||||
mod app;
|
||||
mod appearance;
|
||||
mod bind;
|
||||
mod chat;
|
||||
mod dev;
|
||||
mod emoji;
|
||||
mod hotkey;
|
||||
mod images;
|
||||
mod servers;
|
||||
mod settings;
|
||||
mod settings_page;
|
||||
mod streams;
|
||||
mod video;
|
||||
mod vm;
|
||||
|
||||
pub use app::{HostedEngine, RunOptions, run};
|
||||
@@ -0,0 +1,299 @@
|
||||
//! Servers: bookmarks, connecting and observing, the rail, the sidebar's
|
||||
//! server card and the channel tree.
|
||||
|
||||
use slint::{ComponentHandle, SharedString};
|
||||
use tracing::warn;
|
||||
use voelin_core::{Command, ObserveState, Source, VoiceOptions, VoiceState};
|
||||
use voelin_store::{Bookmark, QueryConfig, QueryTransport};
|
||||
|
||||
use crate::app::{App, BookmarkForm, Bridge};
|
||||
use crate::vm;
|
||||
|
||||
impl App {
|
||||
pub(crate) fn connect_voice(&mut self) {
|
||||
let Some(b) = self.current.and_then(|id| self.bookmark(id)).cloned() else { return };
|
||||
let mut options = VoiceOptions::new(&b.address, &b.nickname);
|
||||
options.identity = Some(self.identity.clone());
|
||||
options.server_password = self.secrets.get(&b.server_password_key()).ok().flatten();
|
||||
options.channel = b.default_channel.clone();
|
||||
options.audio = true;
|
||||
options.stream_peer = self.video.peer_config(options.stream_peer);
|
||||
self.engine
|
||||
.send(Command::ConnectVoice { session: b.id as u64, options: Box::new(options) });
|
||||
self.set_status(format!("Connecting to {}…", b.address));
|
||||
}
|
||||
|
||||
pub(crate) fn toggle_observe(&mut self) {
|
||||
let Some(b) = self.current.and_then(|id| self.bookmark(id)).cloned() else { return };
|
||||
let session = b.id as u64;
|
||||
let observing =
|
||||
self.sessions.get(&b.id).is_some_and(|v| v.state.observe != ObserveState::Off);
|
||||
if observing {
|
||||
self.engine.send(Command::StopObserving { session });
|
||||
return;
|
||||
}
|
||||
if let Some(url) = &b.gateway_url {
|
||||
self.engine.send(Command::ObserveGateway {
|
||||
session,
|
||||
url: url.clone(),
|
||||
identity: Box::new(self.identity.clone()),
|
||||
});
|
||||
} else if let Some(q) = &b.query {
|
||||
let secret = self.secrets.get(&b.query_password_key()).ok().flatten();
|
||||
let transport = match q.transport {
|
||||
QueryTransport::Raw => voelin_query::Transport::Raw,
|
||||
QueryTransport::Ssh => voelin_query::Transport::Ssh,
|
||||
QueryTransport::Http => voelin_query::Transport::Http,
|
||||
};
|
||||
let connect = voelin_query::Connect {
|
||||
transport,
|
||||
addr: format!("{}:{}", q.host, q.port),
|
||||
user: q.user.clone(),
|
||||
secret,
|
||||
server_port: q.server_port,
|
||||
server_id: None,
|
||||
line: Default::default(),
|
||||
};
|
||||
self.engine.send(Command::ObserveQuery { session, connect: Box::new(connect) });
|
||||
}
|
||||
self.set_status("Observing invisibly…");
|
||||
}
|
||||
|
||||
pub(crate) fn select_server(&mut self, id: i64) {
|
||||
self.current = Some(id);
|
||||
self.refresh_all();
|
||||
}
|
||||
|
||||
pub(crate) fn bookmark_form(&self, id: i64) -> BookmarkForm {
|
||||
let Some(b) = self.bookmark(id) else {
|
||||
return BookmarkForm {
|
||||
id: -1,
|
||||
nickname: std::env::var("USER").unwrap_or_default().into(),
|
||||
query_transport: "none".into(),
|
||||
query_user: "serveradmin".into(),
|
||||
..Default::default()
|
||||
};
|
||||
};
|
||||
let secret = |key: String| -> SharedString {
|
||||
self.secrets.get(&key).ok().flatten().unwrap_or_default().into()
|
||||
};
|
||||
let (transport, addr, user) = match &b.query {
|
||||
Some(q) => (
|
||||
match q.transport {
|
||||
QueryTransport::Raw => "raw",
|
||||
QueryTransport::Ssh => "ssh",
|
||||
QueryTransport::Http => "http",
|
||||
},
|
||||
format!("{}:{}", q.host, q.port),
|
||||
q.user.clone(),
|
||||
),
|
||||
None => ("none", String::new(), "serveradmin".to_string()),
|
||||
};
|
||||
BookmarkForm {
|
||||
id: b.id as i32,
|
||||
name: b.name.clone().into(),
|
||||
address: b.address.clone().into(),
|
||||
nickname: b.nickname.clone().into(),
|
||||
server_password: secret(b.server_password_key()),
|
||||
gateway_url: b.gateway_url.clone().unwrap_or_default().into(),
|
||||
query_transport: transport.into(),
|
||||
query_addr: addr.into(),
|
||||
query_user: user.into(),
|
||||
query_password: secret(b.query_password_key()),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn save_bookmark(&mut self, form: BookmarkForm) {
|
||||
let query = match form.query_transport.as_str() {
|
||||
"none" | "" => None,
|
||||
t => {
|
||||
let (host, port) = form
|
||||
.query_addr
|
||||
.rsplit_once(':')
|
||||
.map_or((form.query_addr.to_string(), None), |(h, p)| {
|
||||
(h.to_string(), p.parse().ok())
|
||||
});
|
||||
let transport = match t {
|
||||
"raw" => QueryTransport::Raw,
|
||||
"http" => QueryTransport::Http,
|
||||
_ => QueryTransport::Ssh,
|
||||
};
|
||||
let default_port = match transport {
|
||||
QueryTransport::Raw => 10011,
|
||||
QueryTransport::Ssh => 10022,
|
||||
QueryTransport::Http => 10080,
|
||||
};
|
||||
Some(QueryConfig {
|
||||
transport,
|
||||
host,
|
||||
port: port.unwrap_or(default_port),
|
||||
user: form.query_user.to_string(),
|
||||
server_port: None,
|
||||
})
|
||||
}
|
||||
};
|
||||
let mut bookmark = Bookmark {
|
||||
id: form.id as i64,
|
||||
name: if form.name.is_empty() {
|
||||
form.address.to_string()
|
||||
} else {
|
||||
form.name.to_string()
|
||||
},
|
||||
address: form.address.to_string(),
|
||||
nickname: form.nickname.to_string(),
|
||||
identity: None,
|
||||
default_channel: None,
|
||||
gateway_url: Some(form.gateway_url.to_string()).filter(|u| !u.is_empty()),
|
||||
query,
|
||||
client_version: None,
|
||||
};
|
||||
let result = if bookmark.id < 0 {
|
||||
self.store.add_bookmark(&bookmark).map(|id| bookmark.id = id)
|
||||
} else {
|
||||
self.store.update_bookmark(&bookmark)
|
||||
};
|
||||
if let Err(e) = result {
|
||||
self.set_status(format!("Could not save: {e}"));
|
||||
return;
|
||||
}
|
||||
for (key, value) in [
|
||||
(bookmark.server_password_key(), &form.server_password),
|
||||
(bookmark.query_password_key(), &form.query_password),
|
||||
] {
|
||||
let result = if value.is_empty() {
|
||||
self.secrets.delete(&key)
|
||||
} else {
|
||||
self.secrets.set(&key, value)
|
||||
};
|
||||
if let Err(e) = result {
|
||||
warn!(%e, "could not store secret");
|
||||
}
|
||||
}
|
||||
self.current = Some(bookmark.id);
|
||||
self.bookmarks = self.store.bookmarks().unwrap_or_default();
|
||||
self.refresh_all();
|
||||
}
|
||||
|
||||
pub(crate) fn delete_bookmark(&mut self, id: i64) {
|
||||
self.engine.send(Command::CloseSession { session: id as u64 });
|
||||
if let Some(b) = self.bookmark(id).cloned() {
|
||||
let _ = self.secrets.delete(&b.server_password_key());
|
||||
let _ = self.secrets.delete(&b.query_password_key());
|
||||
}
|
||||
let _ = self.store.delete_bookmark(id);
|
||||
self.sessions.remove(&id);
|
||||
self.bookmarks = self.store.bookmarks().unwrap_or_default();
|
||||
self.current = self.bookmarks.first().map(|b| b.id);
|
||||
self.refresh_all();
|
||||
}
|
||||
|
||||
/// The rail: servers with their state, unread count and streams.
|
||||
pub(crate) fn refresh_servers(&self) {
|
||||
let Some(ui) = self.ui.upgrade() else { return };
|
||||
let bridge = ui.global::<Bridge>();
|
||||
let items: Vec<_> = self
|
||||
.bookmarks
|
||||
.iter()
|
||||
.map(|b| {
|
||||
let view = self.sessions.get(&b.id);
|
||||
let state = view.map(|v| v.state.clone()).unwrap_or_default();
|
||||
let unread = view.map_or(0, |v| v.unread());
|
||||
let live = view.is_some_and(|v| v.streams_available() && !v.streams.is_empty());
|
||||
vm::servers::item(b, &state, unread, live)
|
||||
})
|
||||
.collect();
|
||||
vm::list::sync(&self.models.servers, &items);
|
||||
bridge.set_current_server(self.current.map_or(-1, |id| id as i32));
|
||||
bridge.set_unread_total(self.view().map_or(0, |v| v.unread()));
|
||||
}
|
||||
|
||||
/// The server card, the voice controls and who we are.
|
||||
pub(crate) fn refresh_toolbar(&self) {
|
||||
let Some(ui) = self.ui.upgrade() else { return };
|
||||
let bridge = ui.global::<Bridge>();
|
||||
let bookmark = self.current.and_then(|id| self.bookmark(id));
|
||||
let view = self.view();
|
||||
let state = view.map(|v| v.state.clone()).unwrap_or_default();
|
||||
bridge.set_server_title(
|
||||
bookmark.map_or("No server selected".into(), |b| b.name.clone()).into(),
|
||||
);
|
||||
let has_presence = view.is_some_and(|v| !v.presence.channels.is_empty())
|
||||
&& (state.voice == VoiceState::Connected || state.observe == ObserveState::Observing);
|
||||
bridge.set_server_stats(
|
||||
view.filter(|_| has_presence)
|
||||
.map(|v| vm::tree::stats(&v.presence))
|
||||
.unwrap_or_default()
|
||||
.into(),
|
||||
);
|
||||
bridge.set_nickname(bookmark.map(|b| b.nickname.clone()).unwrap_or_default().into());
|
||||
let own_channel = view
|
||||
.and_then(|v| state.own_channel.and_then(|c| v.presence.channels.get(&c)))
|
||||
.map(|c| c.name.clone())
|
||||
.unwrap_or_default();
|
||||
bridge.set_own_channel(own_channel.into());
|
||||
bridge.set_voice_connected(state.voice == VoiceState::Connected);
|
||||
bridge.set_voice_connecting(state.voice == VoiceState::Connecting);
|
||||
bridge.set_observing(state.observe != ObserveState::Off);
|
||||
bridge.set_can_observe(
|
||||
bookmark.is_some_and(|b| b.gateway_url.is_some() || b.query.is_some()),
|
||||
);
|
||||
bridge.set_input_muted(state.input_muted);
|
||||
bridge.set_output_muted(state.output_muted);
|
||||
bridge.set_transmitting(state.transmitting);
|
||||
bridge.set_presence_source(
|
||||
match state.presence_source {
|
||||
Some(Source::Voice) => "live (voice)",
|
||||
Some(Source::Gateway) => "invisible (gateway)",
|
||||
Some(Source::Query) => "invisible (query)",
|
||||
None => "",
|
||||
}
|
||||
.into(),
|
||||
);
|
||||
if state.voice != VoiceState::Connected {
|
||||
bridge.set_input_level(-100.0);
|
||||
bridge.set_input_sending(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// The channel tree and the members of our channel.
|
||||
pub(crate) fn refresh_tree(&self) {
|
||||
let Some(view) = self.view() else {
|
||||
vm::list::sync(&self.models.tree, &[]);
|
||||
vm::list::sync(&self.models.members, &[]);
|
||||
return;
|
||||
};
|
||||
let input = vm::tree::TreeInput {
|
||||
presence: &view.presence,
|
||||
collapsed: &view.collapsed,
|
||||
talking: &view.talking,
|
||||
playback: &self.playback,
|
||||
own_channel: view.state.own_channel,
|
||||
own_client: view.state.own_client,
|
||||
filter: &self.tree_filter,
|
||||
};
|
||||
vm::list::sync(&self.models.tree, &vm::tree::rows(&input));
|
||||
let members = if view.state.voice == VoiceState::Connected {
|
||||
vm::tree::members(&input)
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
vm::list::sync(&self.models.members, &members);
|
||||
}
|
||||
|
||||
pub(crate) fn toggle_collapse(&mut self, channel: u64) {
|
||||
if let Some(view) = self.view_mut()
|
||||
&& !view.collapsed.remove(&channel)
|
||||
{
|
||||
view.collapsed.insert(channel);
|
||||
}
|
||||
self.refresh_tree();
|
||||
}
|
||||
|
||||
/// The top bar's search.
|
||||
pub(crate) fn search(&mut self, text: String) {
|
||||
if self.tree_filter != text {
|
||||
self.tree_filter = text;
|
||||
self.refresh_tree();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,75 @@ pub static CLIENT_PLAYBACK: Key<ClientPlaybackMap> = Key::new(
|
||||
ClientPlaybackMap::new,
|
||||
);
|
||||
|
||||
/// Colours of the window.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ThemeChoice {
|
||||
#[default]
|
||||
Dark,
|
||||
Light,
|
||||
/// The system's light or dark scheme.
|
||||
System,
|
||||
}
|
||||
|
||||
impl ThemeChoice {
|
||||
pub fn as_str(self) -> &'static str {
|
||||
match self {
|
||||
Self::Dark => "dark",
|
||||
Self::Light => "light",
|
||||
Self::System => "system",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse(text: &str) -> Self {
|
||||
match text {
|
||||
"light" => Self::Light,
|
||||
"system" => Self::System,
|
||||
_ => Self::Dark,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// `ui.theme`. (In a config file write `"ui.theme" = "light"` at the top:
|
||||
/// a `[ui]` table would be read as the `ui` blob.)
|
||||
pub static UI_THEME: Key<ThemeChoice> = Key::new(
|
||||
"ui.theme",
|
||||
Kind::Choice(&["dark", "light", "system"]),
|
||||
"Colours of the window: dark, light, or the system's scheme.",
|
||||
ThemeChoice::default,
|
||||
);
|
||||
|
||||
fn positive_scale(v: &f32) -> Result<(), String> {
|
||||
if v.is_finite() && *v > 0.0 { Ok(()) } else { Err("must be a number above 0".into()) }
|
||||
}
|
||||
|
||||
/// `ui.font_scale`: text size, 1 = normal (no upper limit).
|
||||
pub static UI_FONT_SCALE: Key<f32> =
|
||||
Key::new("ui.font_scale", Kind::Json, "Text size as a factor (a number; 1 = normal).", || 1.0)
|
||||
.validated(positive_scale);
|
||||
|
||||
/// `ui.narrow_breakpoint`: below this window width (logical pixels) the
|
||||
/// phone layout is used.
|
||||
pub static UI_NARROW_BREAKPOINT: Key<u32> = Key::new(
|
||||
"ui.narrow_breakpoint",
|
||||
Kind::UInt { min: 0 },
|
||||
"Window width in pixels below which the phone layout is used.",
|
||||
|| 800,
|
||||
);
|
||||
|
||||
/// `ui.image_cache_mb`: memory for decoded images (avatars, icons, emoji).
|
||||
pub static UI_IMAGE_CACHE_MB: Key<u32> = Key::new(
|
||||
"ui.image_cache_mb",
|
||||
Kind::UInt { min: 0 },
|
||||
"Memory in MB for decoded images (avatars, icons, emoji); 0 keeps none.",
|
||||
|| 64,
|
||||
);
|
||||
|
||||
/// The UI's keys besides [`UI`] and [`CLIENT_PLAYBACK`], for registering.
|
||||
pub fn appearance_keys() -> [&'static dyn voelin_core::settings::Setting; 4] {
|
||||
[&UI_THEME, &UI_FONT_SCALE, &UI_NARROW_BREAKPOINT, &UI_IMAGE_CACHE_MB]
|
||||
}
|
||||
|
||||
/// Frame rates and bitrates (kbit/s) the share dialog offers; any other
|
||||
/// value can be typed in.
|
||||
pub const FPS_CHOICES: [u32; 3] = [15, 30, 60];
|
||||
@@ -293,6 +362,11 @@ mod tests {
|
||||
assert!(!parsed.crash_reports, "crash reports are opt-in");
|
||||
assert_eq!(parsed.ptt_key, "Ctrl+Shift+T");
|
||||
assert_eq!(parsed.share, ShareDefaults::default());
|
||||
assert_eq!(serde_json::to_value(ThemeChoice::System).unwrap(), "system");
|
||||
assert_eq!(ThemeChoice::parse("light"), ThemeChoice::Light);
|
||||
assert_eq!(ThemeChoice::parse("??"), ThemeChoice::Dark);
|
||||
assert!(UI_FONT_SCALE.validate(&0.0).is_err());
|
||||
assert!(UI_FONT_SCALE.validate(&3.5).is_ok());
|
||||
let map: ClientPlaybackMap =
|
||||
serde_json::from_str(r#"{"uid=":{"volume":0.5,"muted":false}}"#).unwrap();
|
||||
assert_eq!(map["uid="].volume, 0.5);
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
//! The settings page (audio, push-to-talk, H.264, crash reports), the
|
||||
//! About page's notices, and the local volume of clients.
|
||||
|
||||
use slint::{ComponentHandle, SharedString};
|
||||
use tracing::warn;
|
||||
use voelin_core::settings::{AUDIO, CRASH_REPORTS};
|
||||
use voelin_core::{Command, Source, VoiceState};
|
||||
use voelin_platform::{crash, notices};
|
||||
|
||||
use crate::app::{App, AudioForm, Bridge, ClientAudio, later, model};
|
||||
use crate::settings::{self, CLIENT_PLAYBACK, ClientPlayback, DeviceChoices};
|
||||
|
||||
impl App {
|
||||
pub(crate) fn open_settings(&mut self) {
|
||||
let list = |devices: voelin_audio::Result<Vec<voelin_audio::device::DeviceInfo>>,
|
||||
input: bool| {
|
||||
let devices = devices.unwrap_or_else(|e| {
|
||||
warn!("cannot list audio devices: {e}");
|
||||
Vec::new()
|
||||
});
|
||||
devices
|
||||
.into_iter()
|
||||
.map(|d| {
|
||||
let default = if input { d.default_input } else { d.default_output };
|
||||
(d.id, d.name, default)
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
};
|
||||
let inputs = list(voelin_audio::device::input_devices(), true);
|
||||
let outputs = list(voelin_audio::device::output_devices(), false);
|
||||
self.inputs = DeviceChoices::new(&inputs, self.audio.input_device.as_deref());
|
||||
self.outputs = DeviceChoices::new(&outputs, self.audio.output_device.as_deref());
|
||||
let Some(ui) = self.ui.upgrade() else { return };
|
||||
let bridge = ui.global::<Bridge>();
|
||||
let names = |c: &DeviceChoices| model(c.names.iter().map(SharedString::from).collect());
|
||||
bridge.set_input_devices(names(&self.inputs));
|
||||
bridge.set_output_devices(names(&self.outputs));
|
||||
bridge.set_audio(settings::audio_form(&self.audio, &self.inputs, &self.outputs));
|
||||
bridge.set_global_ptt(self.settings.global_ptt);
|
||||
bridge.set_ptt_key(self.settings.ptt_key.clone().into());
|
||||
bridge.set_h264_enabled(self.settings.openh264);
|
||||
bridge.set_image_cache_usage(crate::images::usage_text().into());
|
||||
self.refresh_h264();
|
||||
}
|
||||
|
||||
pub(crate) fn close_settings(&mut self) {
|
||||
self.set_mic_test(false);
|
||||
self.save_audio();
|
||||
}
|
||||
|
||||
pub(crate) fn audio_changed(&mut self, form: &AudioForm) {
|
||||
let audio = settings::apply_audio_form(form, &self.audio, &self.inputs, &self.outputs);
|
||||
if audio == self.audio {
|
||||
return;
|
||||
}
|
||||
self.audio = audio;
|
||||
self.audio_dirty = true;
|
||||
self.engine.send(Command::SetAudioSettings(Box::new(self.audio.clone())));
|
||||
}
|
||||
|
||||
pub(crate) fn save_audio(&mut self) {
|
||||
if !self.audio_dirty {
|
||||
return;
|
||||
}
|
||||
self.audio_dirty = false;
|
||||
if let Err(e) = self.prefs.set(&AUDIO, self.audio.clone()) {
|
||||
warn!(%e, "could not store audio settings");
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn set_mic_test(&mut self, on: bool) {
|
||||
if self.mic_test == on {
|
||||
return;
|
||||
}
|
||||
self.mic_test = on;
|
||||
self.engine.send(Command::TestMicrophone { on });
|
||||
if let Some(ui) = self.ui.upgrade() {
|
||||
let bridge = ui.global::<Bridge>();
|
||||
bridge.set_mic_test(on);
|
||||
if !on {
|
||||
bridge.set_input_level(-100.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn apply_ptt(&mut self, enabled: bool, key: String) {
|
||||
let key = key.trim().to_owned();
|
||||
self.settings.global_ptt = enabled;
|
||||
if !key.is_empty() {
|
||||
self.settings.ptt_key = key.clone();
|
||||
}
|
||||
self.store_settings();
|
||||
self.ptt.set((enabled && !key.is_empty()).then_some(key));
|
||||
}
|
||||
|
||||
pub(crate) fn set_ptt_status(&mut self, status: String) {
|
||||
if let Some(ui) = self.ui.upgrade() {
|
||||
ui.global::<Bridge>().set_ptt_status(status.into());
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn set_h264(&mut self, enabled: bool) {
|
||||
self.settings.openh264 = enabled;
|
||||
self.store_settings();
|
||||
self.video.set_h264(enabled);
|
||||
self.refresh_h264();
|
||||
}
|
||||
|
||||
pub(crate) fn download_h264(&mut self) {
|
||||
let runtime = self.engine.runtime().clone();
|
||||
self.video.download_h264(&runtime, |download| {
|
||||
later(move |app| {
|
||||
app.video.downloaded(download, app.settings.openh264);
|
||||
app.refresh_h264();
|
||||
});
|
||||
});
|
||||
self.refresh_h264();
|
||||
}
|
||||
|
||||
fn refresh_h264(&self) {
|
||||
let Some(ui) = self.ui.upgrade() else { return };
|
||||
let bridge = ui.global::<Bridge>();
|
||||
let (loaded, status) = self.video.h264_status();
|
||||
bridge.set_h264_loaded(loaded);
|
||||
bridge.set_h264_busy(status.starts_with("Downloading"));
|
||||
bridge.set_h264_status(status.into());
|
||||
}
|
||||
|
||||
/// Switches the About page and the settings show.
|
||||
pub(crate) fn refresh_settings_flags(&self) {
|
||||
let Some(ui) = self.ui.upgrade() else { return };
|
||||
let bridge = ui.global::<Bridge>();
|
||||
bridge.set_h264_enabled(self.settings.openh264);
|
||||
bridge.set_h264_attribution(notices::OPENH264_ATTRIBUTION.into());
|
||||
bridge.set_crash_reports(self.settings.crash_reports);
|
||||
}
|
||||
|
||||
pub(crate) fn set_crash_reports(&mut self, enabled: bool) {
|
||||
self.settings.crash_reports = enabled;
|
||||
// Also in the blob, for older versions.
|
||||
self.store_settings();
|
||||
if let Err(e) = self.prefs.set(&CRASH_REPORTS, enabled) {
|
||||
warn!(%e, "could not store the crash report setting");
|
||||
}
|
||||
crash::set_enabled(enabled);
|
||||
}
|
||||
|
||||
/// A notice while crash reports are on disk.
|
||||
pub(crate) fn refresh_crash_notice(&self) {
|
||||
let Some(ui) = self.ui.upgrade() else { return };
|
||||
let text = match crash::pending_reports() {
|
||||
Ok(reports) if !reports.is_empty() => {
|
||||
let newest = &reports[reports.len() - 1];
|
||||
let saved = match reports.len() {
|
||||
1 => "1 crash report is saved".to_owned(),
|
||||
n => format!("{n} crash reports are saved"),
|
||||
};
|
||||
format!("The app crashed earlier ({}). {saved} on this device.", newest.summary)
|
||||
}
|
||||
_ => String::new(),
|
||||
};
|
||||
ui.global::<Bridge>().set_crash_notice(text.into());
|
||||
}
|
||||
|
||||
pub(crate) fn open_crash_folder(&mut self) {
|
||||
let result = crash::dir().ok_or_else(|| "no crash report folder".to_owned());
|
||||
if let Err(e) =
|
||||
result.and_then(|dir| crate::app::open_path(&dir).map_err(|e| e.to_string()))
|
||||
{
|
||||
self.set_status(format!("Cannot open the crash report folder: {e}"));
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn delete_crash_reports(&mut self) {
|
||||
match crash::clear() {
|
||||
Ok(n) => self.set_status(format!("Deleted {n} crash reports")),
|
||||
Err(e) => self.set_status(format!("Cannot delete the crash reports: {e}")),
|
||||
}
|
||||
self.refresh_crash_notice();
|
||||
}
|
||||
|
||||
/// The third-party notices, one model entry per line.
|
||||
pub(crate) fn load_notices(&mut self) {
|
||||
if self.notices_loaded {
|
||||
return;
|
||||
}
|
||||
let Some(ui) = self.ui.upgrade() else { return };
|
||||
let lines: Vec<SharedString> = notices::text().lines().map(SharedString::from).collect();
|
||||
ui.global::<Bridge>().set_notices(model(lines));
|
||||
self.notices_loaded = true;
|
||||
}
|
||||
|
||||
// Local volume and mute of clients.
|
||||
|
||||
/// Fill the volume dialog for `client` of the current session.
|
||||
pub(crate) fn open_client(&mut self, client: u16) -> bool {
|
||||
let Some(id) = self.current else { return false };
|
||||
let Some(info) = self.view().and_then(|v| v.presence.clients.get(&client)).cloned() else {
|
||||
return false;
|
||||
};
|
||||
let playback =
|
||||
info.uid.as_ref().and_then(|uid| self.playback.get(uid)).copied().unwrap_or_default();
|
||||
self.playback_dialog = Some((id, client, info.uid.clone()));
|
||||
if let Some(ui) = self.ui.upgrade() {
|
||||
ui.global::<Bridge>().set_client_audio(ClientAudio {
|
||||
id: client as i32,
|
||||
name: info.nickname.into(),
|
||||
volume: playback.volume * 100.0,
|
||||
muted: playback.muted,
|
||||
});
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) fn client_playback_changed(&mut self, form: &ClientAudio) {
|
||||
let Some((session, client, uid)) = self.playback_dialog.clone() else { return };
|
||||
let playback =
|
||||
ClientPlayback { volume: (form.volume / 100.0).clamp(0.0, 4.0), muted: form.muted };
|
||||
let session = session as u64;
|
||||
self.engine.send(Command::SetClientVolume { session, client, volume: playback.volume });
|
||||
self.engine.send(Command::SetClientMuted { session, client, muted: playback.muted });
|
||||
// Kept by unique id; clients without one only for this connection.
|
||||
if let Some(uid) = uid {
|
||||
if playback.is_default() {
|
||||
self.playback.remove(&uid);
|
||||
} else {
|
||||
self.playback.insert(uid, playback);
|
||||
}
|
||||
if let Err(e) = self.prefs.set(&CLIENT_PLAYBACK, self.playback.clone()) {
|
||||
warn!(%e, "could not store client volumes");
|
||||
}
|
||||
}
|
||||
self.refresh_tree();
|
||||
}
|
||||
|
||||
/// `VOELIN_OPEN=client`: the volume dialog of the first client that is not us.
|
||||
pub(crate) fn open_first_client(&mut self) {
|
||||
let Some(view) = self.view().filter(|v| v.state.own_client.is_some()) else { return };
|
||||
let own = view.state.own_client;
|
||||
let mut others: Vec<_> =
|
||||
view.presence.clients.values().filter(|c| Some(c.id) != own && !c.is_query).collect();
|
||||
others.sort_by_key(|c| c.id);
|
||||
let Some(id) = others.first().map(|c| c.id) else { return };
|
||||
self.open_client_pending = false;
|
||||
if self.open_client(id)
|
||||
&& let Some(ui) = self.ui.upgrade()
|
||||
{
|
||||
ui.global::<crate::app::Nav>().set_client_open(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// Send the stored volumes of clients that appeared in a voice session.
|
||||
pub(crate) fn apply_client_playback(&mut self, session: i64) {
|
||||
let Some(view) = self.sessions.get_mut(&session) else { return };
|
||||
if view.state.voice != VoiceState::Connected
|
||||
|| view.state.presence_source != Some(Source::Voice)
|
||||
{
|
||||
return;
|
||||
}
|
||||
let presence = view.presence.clone();
|
||||
view.applied_playback.retain(|id| presence.clients.contains_key(id));
|
||||
for client in presence.clients.values() {
|
||||
if !view.applied_playback.insert(client.id) {
|
||||
continue;
|
||||
}
|
||||
let stored = client.uid.as_ref().and_then(|uid| self.playback.get(uid));
|
||||
let Some(playback) = stored else { continue };
|
||||
let (s, c) = (session as u64, client.id);
|
||||
self.engine.send(Command::SetClientVolume {
|
||||
session: s,
|
||||
client: c,
|
||||
volume: playback.volume,
|
||||
});
|
||||
if playback.muted {
|
||||
self.engine.send(Command::SetClientMuted { session: s, client: c, muted: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,7 @@ impl App {
|
||||
.map(|s| s.id.clone());
|
||||
view.streams = streams;
|
||||
self.refresh_streams();
|
||||
self.refresh_servers();
|
||||
if autowatch && let Some(id) = first {
|
||||
self.watch_stream(id);
|
||||
}
|
||||
@@ -208,7 +209,7 @@ impl App {
|
||||
});
|
||||
}
|
||||
bridge.set_streams_available(self.demo || view.is_some_and(|v| v.streams_available()));
|
||||
bridge.set_streams(model(items));
|
||||
crate::vm::list::sync(&self.models.streams, &items);
|
||||
bridge.set_can_share(video::AVAILABLE);
|
||||
|
||||
let share = self.share.as_ref().filter(|s| Some(s.session) == current);
|
||||
@@ -243,7 +244,7 @@ impl App {
|
||||
.unwrap_or_default();
|
||||
let requests = viewers.iter().filter(|v| v.state == "requested").count();
|
||||
bridge.set_share_requests(requests as i32);
|
||||
bridge.set_share_viewers(model(viewers));
|
||||
crate::vm::list::sync(&self.models.viewers, &viewers);
|
||||
let status = match share {
|
||||
Some(s) if s.live => s.capture.status(),
|
||||
Some(s) => format!("Starting the stream of {}…", s.capture.source_name()),
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
//! Avatars without pictures: initials on a colour from the name.
|
||||
|
||||
use slint::Color;
|
||||
|
||||
/// Background colours for initials; white text reads on all of them.
|
||||
const TINTS: [u32; 10] = [
|
||||
0x2d6bff, 0x7c4dff, 0xc2379a, 0xe0572e, 0xd08a00, 0x1f9d6b, 0x0c93b8, 0x5865f2, 0xa0439e,
|
||||
0x3a7d44,
|
||||
];
|
||||
|
||||
/// Up to two letters: the first letters of the first two words, or the
|
||||
/// first two of a single word ("Nova Star" → "NS", "dex" → "DE").
|
||||
pub fn initials(name: &str) -> String {
|
||||
let words: Vec<&str> = name
|
||||
.split(|c: char| c.is_whitespace() || c == '_' || c == '-' || c == '.')
|
||||
.filter(|w| w.chars().any(char::is_alphanumeric))
|
||||
.collect();
|
||||
let first = |w: &str| w.chars().find(|c| c.is_alphanumeric());
|
||||
let letters: String = match words.as_slice() {
|
||||
[] => String::new(),
|
||||
[one] => one.chars().filter(|c| c.is_alphanumeric()).take(2).collect(),
|
||||
[a, b, ..] => first(a).into_iter().chain(first(b)).collect(),
|
||||
};
|
||||
letters.to_uppercase()
|
||||
}
|
||||
|
||||
/// A stable colour for a name (FNV-1a).
|
||||
pub fn tint(name: &str) -> Color {
|
||||
let mut hash: u32 = 0x811c_9dc5;
|
||||
for b in name.to_lowercase().bytes() {
|
||||
hash ^= u32::from(b);
|
||||
hash = hash.wrapping_mul(0x0100_0193);
|
||||
}
|
||||
let rgb = TINTS[(hash % TINTS.len() as u32) as usize];
|
||||
Color::from_rgb_u8((rgb >> 16) as u8, (rgb >> 8) as u8, rgb as u8)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn initials_of_names() {
|
||||
assert_eq!(initials("Nova Star"), "NS");
|
||||
assert_eq!(initials("dex"), "DE");
|
||||
assert_eq!(initials("x"), "X");
|
||||
assert_eq!(initials("dark_knight"), "DK");
|
||||
assert_eq!(initials(" "), "");
|
||||
assert_eq!(initials("[Bot] Relay"), "BR");
|
||||
assert_eq!(initials("Ärger über"), "ÄÜ");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tints_are_stable() {
|
||||
assert_eq!(tint("Alice"), tint("alice"));
|
||||
let distinct: std::collections::HashSet<_> =
|
||||
["Alice", "Bob", "Carol", "Dave", "Eve", "Mallory"]
|
||||
.iter()
|
||||
.map(|n| tint(n).as_argb_encoded())
|
||||
.collect();
|
||||
assert!(distinct.len() > 2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
//! Chat lines.
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
use slint::{ModelRc, VecModel};
|
||||
use voelin_model::ChatMessage;
|
||||
|
||||
use crate::app::{ChatLine, TextRun};
|
||||
use crate::emoji;
|
||||
use crate::vm::avatar;
|
||||
|
||||
/// Lines of the same author within this time are grouped (no header).
|
||||
const GROUP_MS: i64 = 5 * 60 * 1000;
|
||||
|
||||
/// The author and time of the line before, for grouping.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct Previous {
|
||||
pub author: String,
|
||||
pub relayed: bool,
|
||||
pub ts_ms: i64,
|
||||
}
|
||||
|
||||
impl Previous {
|
||||
pub fn of(message: &ChatMessage) -> Self {
|
||||
Self {
|
||||
author: message.author_name.clone(),
|
||||
relayed: message.via_relay,
|
||||
ts_ms: message.ts_ms,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn time_of(ts_ms: i64) -> String {
|
||||
chrono::DateTime::from_timestamp_millis(ts_ms)
|
||||
.map(|t| t.with_timezone(&chrono::Local).format("%H:%M").to_string())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// The line of a message; `previous` is the line before it in the chat.
|
||||
pub fn line(message: &ChatMessage, previous: Option<&Previous>) -> ChatLine {
|
||||
let continued = previous.is_some_and(|p| {
|
||||
p.author == message.author_name
|
||||
&& p.relayed == message.via_relay
|
||||
&& (0..GROUP_MS).contains(&(message.ts_ms - p.ts_ms))
|
||||
});
|
||||
let runs = emoji::runs(&message.text);
|
||||
let jumbo = runs.as_deref().is_some_and(emoji::is_jumbo);
|
||||
let runs_model = match &runs {
|
||||
Some(runs) => ModelRc::from(Rc::new(VecModel::from(
|
||||
runs.iter()
|
||||
.map(|r| TextRun {
|
||||
text: r.text.clone().into(),
|
||||
emoji: r.emoji.clone().unwrap_or_default().into(),
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
))),
|
||||
None => ModelRc::default(),
|
||||
};
|
||||
ChatLine {
|
||||
author: message.author_name.clone().into(),
|
||||
text: message.text.clone().into(),
|
||||
time: time_of(message.ts_ms).into(),
|
||||
relayed: message.via_relay,
|
||||
runs: runs_model,
|
||||
rich: runs.is_some(),
|
||||
jumbo,
|
||||
continued,
|
||||
initials: avatar::initials(&message.author_name).into(),
|
||||
tint: avatar::tint(&message.author_name),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use slint::Model;
|
||||
use voelin_model::ChatTarget;
|
||||
|
||||
use super::*;
|
||||
|
||||
fn message(author: &str, text: &str, ts_ms: i64) -> ChatMessage {
|
||||
ChatMessage {
|
||||
target: ChatTarget::Server,
|
||||
author_name: author.into(),
|
||||
author_uid: None,
|
||||
author_id: None,
|
||||
text: text.into(),
|
||||
ts_ms,
|
||||
via_relay: false,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grouping() {
|
||||
let first = message("Alice", "hi", 1_000_000);
|
||||
let a = line(&first, None);
|
||||
assert!(!a.continued);
|
||||
assert_eq!(a.initials, "AL");
|
||||
let prev = Previous::of(&first);
|
||||
assert!(line(&message("Alice", "again", 1_060_000), Some(&prev)).continued);
|
||||
assert!(!line(&message("Bob", "me", 1_060_000), Some(&prev)).continued);
|
||||
assert!(!line(&message("Alice", "later", 1_000_000 + GROUP_MS), Some(&prev)).continued);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn emoji_runs() {
|
||||
let plain = line(&message("A", "no emoji here", 0), None);
|
||||
assert!(!plain.rich && plain.runs.row_count() == 0);
|
||||
let rich = line(&message("A", "gg 🎉", 0), None);
|
||||
assert!(rich.rich && !rich.jumbo);
|
||||
assert_eq!(rich.runs.row_count(), 2);
|
||||
assert_eq!(rich.runs.row_data(1).unwrap().emoji, "1f389");
|
||||
assert!(line(&message("A", "🎉", 0), None).jumbo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
//! Incremental model updates.
|
||||
|
||||
use slint::{Model, VecModel};
|
||||
|
||||
/// Row operations [`sync`] applied (for tests and tracing).
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
pub struct Changes {
|
||||
pub set: usize,
|
||||
pub inserted: usize,
|
||||
pub removed: usize,
|
||||
}
|
||||
|
||||
/// Make `model` hold `new` with few row operations: the rows both share at
|
||||
/// the start and the end stay, rows in between are changed in place where
|
||||
/// they differ, and the rest inserted or removed. Views redraw only the
|
||||
/// rows that changed (a client that starts talking is one `set_row_data`).
|
||||
pub fn sync<T: Clone + PartialEq + 'static>(model: &VecModel<T>, new: &[T]) -> Changes {
|
||||
let old_len = model.row_count();
|
||||
let new_len = new.len();
|
||||
let min = old_len.min(new_len);
|
||||
let mut prefix = 0;
|
||||
while prefix < min && model.row_data(prefix).as_ref() == Some(&new[prefix]) {
|
||||
prefix += 1;
|
||||
}
|
||||
let mut suffix = 0;
|
||||
while suffix < min - prefix
|
||||
&& model.row_data(old_len - 1 - suffix).as_ref() == Some(&new[new_len - 1 - suffix])
|
||||
{
|
||||
suffix += 1;
|
||||
}
|
||||
let old_mid = old_len - prefix - suffix;
|
||||
let new_mid = new_len - prefix - suffix;
|
||||
let common = old_mid.min(new_mid);
|
||||
let mut changes = Changes::default();
|
||||
for (i, row) in new.iter().enumerate().skip(prefix).take(common) {
|
||||
if model.row_data(i).as_ref() != Some(row) {
|
||||
model.set_row_data(i, row.clone());
|
||||
changes.set += 1;
|
||||
}
|
||||
}
|
||||
let at = prefix + common;
|
||||
for _ in new_mid..old_mid {
|
||||
model.remove(at);
|
||||
changes.removed += 1;
|
||||
}
|
||||
for (k, row) in new[at..at + new_mid.saturating_sub(old_mid)].iter().enumerate() {
|
||||
model.insert(at + k, row.clone());
|
||||
changes.inserted += 1;
|
||||
}
|
||||
changes
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn run(old: &[i32], new: &[i32]) -> Changes {
|
||||
let model = VecModel::from(old.to_vec());
|
||||
let changes = sync(&model, new);
|
||||
assert_eq!(model.iter().collect::<Vec<_>>(), new, "{old:?} -> {new:?}");
|
||||
changes
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn minimal_changes() {
|
||||
assert_eq!(run(&[1, 2, 3], &[1, 2, 3]), Changes::default());
|
||||
assert_eq!(run(&[1, 2, 3], &[1, 9, 3]), Changes { set: 1, ..Default::default() });
|
||||
assert_eq!(run(&[1, 2, 3], &[1, 2, 7, 3]), Changes { inserted: 1, ..Default::default() });
|
||||
assert_eq!(run(&[1, 2, 3], &[1, 3]), Changes { removed: 1, ..Default::default() });
|
||||
assert_eq!(run(&[], &[1, 2]), Changes { inserted: 2, ..Default::default() });
|
||||
assert_eq!(run(&[1, 2], &[]), Changes { removed: 2, ..Default::default() });
|
||||
assert_eq!(run(&[1, 2, 3, 4], &[5, 6]).set, 2);
|
||||
run(&[1, 1, 1], &[1, 1]);
|
||||
run(&[1, 2, 1], &[1, 1, 2, 1]);
|
||||
run(&[4, 5, 6], &[1, 2, 3, 4, 5, 6, 7]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//! View models: engine state turned into the Slint structs the screens
|
||||
//! show. Pure functions (no window, no engine), unit-tested here; the
|
||||
//! models live in `crate::models` and are updated row by row with
|
||||
//! [`list::sync`], so a small change redraws only what changed.
|
||||
|
||||
pub mod avatar;
|
||||
pub mod chat;
|
||||
pub mod list;
|
||||
pub mod servers;
|
||||
pub mod tree;
|
||||
@@ -0,0 +1,49 @@
|
||||
//! The server rail.
|
||||
|
||||
use voelin_core::{ObserveState, SessionState, VoiceState};
|
||||
use voelin_store::Bookmark;
|
||||
|
||||
use crate::app::ServerItem;
|
||||
use crate::vm::avatar;
|
||||
|
||||
/// "offline", "connecting", "observing" or "connected".
|
||||
pub fn status(state: &SessionState) -> &'static str {
|
||||
match (state.voice, state.observe) {
|
||||
(VoiceState::Connected, _) => "connected",
|
||||
(VoiceState::Connecting, _) | (_, ObserveState::Connecting) => "connecting",
|
||||
(_, ObserveState::Observing) => "observing",
|
||||
_ => "offline",
|
||||
}
|
||||
}
|
||||
|
||||
/// A server of the rail. `unread`: messages in its chats; `live`:
|
||||
/// streams in our channel there.
|
||||
pub fn item(bookmark: &Bookmark, state: &SessionState, unread: i32, live: bool) -> ServerItem {
|
||||
ServerItem {
|
||||
id: bookmark.id as i32,
|
||||
name: bookmark.name.clone().into(),
|
||||
address: bookmark.address.clone().into(),
|
||||
status: status(state).into(),
|
||||
initials: avatar::initials(&bookmark.name).into(),
|
||||
tint: avatar::tint(&bookmark.name),
|
||||
unread,
|
||||
live,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn states() {
|
||||
let mut s = SessionState::default();
|
||||
assert_eq!(status(&s), "offline");
|
||||
s.observe = ObserveState::Observing;
|
||||
assert_eq!(status(&s), "observing");
|
||||
s.voice = VoiceState::Connecting;
|
||||
assert_eq!(status(&s), "connecting");
|
||||
s.voice = VoiceState::Connected;
|
||||
assert_eq!(status(&s), "connected");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
//! The channel tree and the members of our channel.
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
use voelin_model::{ChannelId, ClientInfo, Presence, TreeRow, tree_rows};
|
||||
|
||||
use crate::app::{MemberItem, TreeItem};
|
||||
use crate::settings::ClientPlaybackMap;
|
||||
use crate::vm::avatar;
|
||||
|
||||
/// What the tree shows besides the presence.
|
||||
pub struct TreeInput<'a> {
|
||||
pub presence: &'a Presence,
|
||||
pub collapsed: &'a HashSet<ChannelId>,
|
||||
pub talking: &'a HashSet<u16>,
|
||||
pub playback: &'a ClientPlaybackMap,
|
||||
pub own_channel: Option<ChannelId>,
|
||||
pub own_client: Option<u16>,
|
||||
/// Search text: only matching channels and clients (and the channels
|
||||
/// above them) are shown. Empty: everything.
|
||||
pub filter: &'a str,
|
||||
}
|
||||
|
||||
fn talking(input: &TreeInput, client: &ClientInfo) -> bool {
|
||||
input.talking.contains(&client.id) || client.talking == Some(true)
|
||||
}
|
||||
|
||||
/// The rows of the tree, channels with their clients below.
|
||||
pub fn rows(input: &TreeInput) -> Vec<TreeItem> {
|
||||
let p = input.presence;
|
||||
let rows: Vec<TreeItem> = tree_rows(p, &|cid| input.collapsed.contains(&cid))
|
||||
.into_iter()
|
||||
.map(|row| match row {
|
||||
TreeRow::Channel { depth, channel } => TreeItem {
|
||||
is_channel: true,
|
||||
depth: depth as i32,
|
||||
id: channel.id as i32,
|
||||
name: channel.name.clone().into(),
|
||||
own: input.own_channel == Some(channel.id),
|
||||
locked: channel.has_password,
|
||||
collapsed: input.collapsed.contains(&channel.id),
|
||||
local_volume: 100,
|
||||
members: p.members(channel.id).count() as i32,
|
||||
max_members: channel.max_clients.filter(|m| *m >= 0).unwrap_or(-1),
|
||||
..Default::default()
|
||||
},
|
||||
TreeRow::Client { depth, client } => {
|
||||
let playback = client
|
||||
.uid
|
||||
.as_ref()
|
||||
.and_then(|uid| input.playback.get(uid))
|
||||
.copied()
|
||||
.unwrap_or_default();
|
||||
TreeItem {
|
||||
is_channel: false,
|
||||
depth: depth as i32,
|
||||
id: client.id as i32,
|
||||
name: client.nickname.clone().into(),
|
||||
talking: talking(input, client),
|
||||
muted: client.input_muted,
|
||||
sound_off: client.output_muted,
|
||||
away: client.away.is_some(),
|
||||
streaming: client.streaming == Some(true),
|
||||
local_muted: playback.muted,
|
||||
local_volume: (playback.volume * 100.0).round() as i32,
|
||||
myself: input.own_client == Some(client.id),
|
||||
initials: avatar::initials(&client.nickname).into(),
|
||||
tint: avatar::tint(&client.nickname),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
filter(rows, input.filter)
|
||||
}
|
||||
|
||||
/// Rows that match `query`, and the channels above them.
|
||||
fn filter(rows: Vec<TreeItem>, query: &str) -> Vec<TreeItem> {
|
||||
let query = query.trim().to_lowercase();
|
||||
if query.is_empty() {
|
||||
return rows;
|
||||
}
|
||||
let matches: Vec<bool> =
|
||||
rows.iter().map(|r| r.name.to_lowercase().contains(query.as_str())).collect();
|
||||
let mut keep = matches.clone();
|
||||
// A channel stays if anything below it matches.
|
||||
for i in 0..rows.len() {
|
||||
if !rows[i].is_channel || keep[i] {
|
||||
continue;
|
||||
}
|
||||
let depth = rows[i].depth;
|
||||
keep[i] = rows[i + 1..]
|
||||
.iter()
|
||||
.zip(&matches[i + 1..])
|
||||
.take_while(|(r, _)| r.depth > depth)
|
||||
.any(|(_, m)| *m);
|
||||
}
|
||||
rows.into_iter().zip(keep).filter_map(|(r, k)| k.then_some(r)).collect()
|
||||
}
|
||||
|
||||
/// "12 online · 8 channels"
|
||||
pub fn stats(p: &Presence) -> String {
|
||||
let online = p.clients.values().filter(|c| !c.is_query).count();
|
||||
let channels = p.channels.len();
|
||||
format!("{online} online · {channels} {}", if channels == 1 { "channel" } else { "channels" })
|
||||
}
|
||||
|
||||
/// The clients in our channel, for the members panel, by name.
|
||||
pub fn members(input: &TreeInput) -> Vec<MemberItem> {
|
||||
let Some(channel) = input.own_channel else { return Vec::new() };
|
||||
let mut clients: Vec<&ClientInfo> = input.presence.members(channel).collect();
|
||||
clients.sort_by_key(|c| c.nickname.to_lowercase());
|
||||
clients
|
||||
.into_iter()
|
||||
.map(|c| {
|
||||
let talking = talking(input, c);
|
||||
let status = if talking {
|
||||
"Speaking".to_owned()
|
||||
} else if c.streaming == Some(true) {
|
||||
"Streaming".to_owned()
|
||||
} else if let Some(message) = &c.away {
|
||||
if message.is_empty() { "Away".to_owned() } else { format!("Away: {message}") }
|
||||
} else if c.output_muted {
|
||||
"Sound off".to_owned()
|
||||
} else if c.input_muted {
|
||||
"Muted".to_owned()
|
||||
} else {
|
||||
"Listening".to_owned()
|
||||
};
|
||||
MemberItem {
|
||||
id: c.id as i32,
|
||||
name: c.nickname.clone().into(),
|
||||
initials: avatar::initials(&c.nickname).into(),
|
||||
tint: avatar::tint(&c.nickname),
|
||||
talking,
|
||||
muted: c.input_muted,
|
||||
sound_off: c.output_muted,
|
||||
away: c.away.is_some(),
|
||||
streaming: c.streaming == Some(true),
|
||||
myself: input.own_client == Some(c.id),
|
||||
status: status.into(),
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use voelin_model::ChannelInfo;
|
||||
|
||||
use super::*;
|
||||
|
||||
fn presence() -> Presence {
|
||||
let channel = |id, parent, order, name: &str| ChannelInfo {
|
||||
id,
|
||||
parent,
|
||||
order,
|
||||
name: name.into(),
|
||||
max_clients: if id == 2 { Some(5) } else { None },
|
||||
..Default::default()
|
||||
};
|
||||
let client = |id, channel, name: &str| ClientInfo {
|
||||
id,
|
||||
channel,
|
||||
nickname: name.into(),
|
||||
..Default::default()
|
||||
};
|
||||
let mut p = Presence::default();
|
||||
for c in [channel(1, 0, 0, "Lobby"), channel(2, 0, 1, "Games"), channel(3, 2, 0, "Chess")] {
|
||||
p.channels.insert(c.id, c);
|
||||
}
|
||||
for c in [client(10, 1, "Alice"), client(11, 2, "bob"), client(12, 3, "Carol")] {
|
||||
p.clients.insert(c.id, c);
|
||||
}
|
||||
let mut query = client(13, 1, "serveradmin");
|
||||
query.is_query = true;
|
||||
p.clients.insert(13, query);
|
||||
p
|
||||
}
|
||||
|
||||
fn input<'a>(
|
||||
p: &'a Presence,
|
||||
talking: &'a HashSet<u16>,
|
||||
collapsed: &'a HashSet<ChannelId>,
|
||||
playback: &'a ClientPlaybackMap,
|
||||
filter: &'a str,
|
||||
) -> TreeInput<'a> {
|
||||
TreeInput {
|
||||
presence: p,
|
||||
collapsed,
|
||||
talking,
|
||||
playback,
|
||||
own_channel: Some(2),
|
||||
own_client: Some(11),
|
||||
filter,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tree_rows_and_counts() {
|
||||
let p = presence();
|
||||
let (t, c, pb) = (HashSet::from([11]), HashSet::new(), ClientPlaybackMap::new());
|
||||
let rows = rows(&input(&p, &t, &c, &pb, ""));
|
||||
let names: Vec<_> = rows.iter().map(|r| r.name.as_str()).collect();
|
||||
assert_eq!(names, ["Lobby", "Alice", "Games", "bob", "Chess", "Carol"]);
|
||||
assert_eq!((rows[0].members, rows[0].max_members), (1, -1));
|
||||
assert_eq!((rows[2].members, rows[2].max_members, rows[2].own), (1, 5, true));
|
||||
assert!(rows[3].talking && rows[3].myself);
|
||||
assert_eq!(rows[3].initials, "BO");
|
||||
assert_eq!(stats(&p), "3 online · 3 channels");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn search_keeps_parents() {
|
||||
let p = presence();
|
||||
let (t, c, pb) = (HashSet::new(), HashSet::new(), ClientPlaybackMap::new());
|
||||
let rows = rows(&input(&p, &t, &c, &pb, "car"));
|
||||
let names: Vec<_> = rows.iter().map(|r| r.name.as_str()).collect();
|
||||
assert_eq!(names, ["Games", "Chess", "Carol"]);
|
||||
let rows = super::rows(&input(&p, &t, &c, &pb, "LOBBY"));
|
||||
assert_eq!(rows.len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn members_of_our_channel() {
|
||||
let mut p = presence();
|
||||
p.clients.get_mut(&12).unwrap().channel = 2;
|
||||
p.clients.get_mut(&12).unwrap().away = Some(String::new());
|
||||
let (t, c, pb) = (HashSet::new(), HashSet::new(), ClientPlaybackMap::new());
|
||||
let members = members(&input(&p, &t, &c, &pb, ""));
|
||||
let names: Vec<_> = members.iter().map(|m| (m.name.as_str(), m.status.as_str())).collect();
|
||||
assert_eq!(names, [("bob", "Listening"), ("Carol", "Away")]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION AND CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@@ -0,0 +1,43 @@
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2026 Lucide Icons and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
---
|
||||
|
||||
The following Lucide icons are derived from the Feather project:
|
||||
|
||||
airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
|
||||
|
||||
The MIT License (MIT) (for the icons listed above)
|
||||
|
||||
Copyright (c) 2013-present Cole Bemis
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-activity"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 425 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-arrow-left"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m12 19-7-7 7-7" />
|
||||
<path d="M19 12H5" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 343 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-arrow-right"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M5 12h14" />
|
||||
<path d="m12 5 7 7-7 7" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 343 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-at-sign"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="12" r="4" />
|
||||
<path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 377 B |
@@ -0,0 +1,20 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-audio-lines"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M2 10v3" />
|
||||
<path d="M6 6v11" />
|
||||
<path d="M10 3v18" />
|
||||
<path d="M14 8v7" />
|
||||
<path d="M18 5v13" />
|
||||
<path d="M22 10v3" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 431 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-bell"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M10.268 21a2 2 0 0 0 3.464 0" />
|
||||
<path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 468 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-bookmark"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 421 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-calendar"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M8 2v3" />
|
||||
<path d="M16 2v3" />
|
||||
<rect x="3" y="3" width="18" height="18" rx="2" />
|
||||
<path d="M3 9h18" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 408 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-camera"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z" />
|
||||
<circle cx="12" cy="13" r="3" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 514 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-cast"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6" />
|
||||
<path d="M2 12a9 9 0 0 1 8 8" />
|
||||
<path d="M2 16a5 5 0 0 1 4 4" />
|
||||
<line x1="2" x2="2.01" y1="20" y2="20" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 470 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-check"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M20 6 9 17l-5-5" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 315 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-chevron-down"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m6 9 6 6 6-6" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 319 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-chevron-left"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m15 18-6-6 6-6" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 321 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-chevron-right"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m9 18 6-6-6-6" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 321 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-chevron-up"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m18 15-6-6-6 6" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 319 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-circle-alert"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<line x1="12" x2="12" y1="8" y2="12" />
|
||||
<line x1="12" x2="12.01" y1="16" y2="16" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 415 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-circle-dot"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="12" r="1" />
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 360 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-circle-help"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" />
|
||||
<path d="M12 17h.01" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 404 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-circle"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 321 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-clock"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<path d="M12 6v6l4 2" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 347 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-coffee"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M10 2v2" />
|
||||
<path d="M14 2v2" />
|
||||
<path d="M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1" />
|
||||
<path d="M6 2v2" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 456 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-compass"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<path d="m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 429 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-copy"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
|
||||
<path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 414 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-crown"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z" />
|
||||
<path d="M5 21h14" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 540 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-download"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M12 15V3" />
|
||||
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
|
||||
<path d="m7 10 5 5 5-5" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 397 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-ellipsis-vertical"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="12" r="1" />
|
||||
<circle cx="12" cy="5" r="1" />
|
||||
<circle cx="12" cy="19" r="1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 400 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-ellipsis"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="12" r="1" />
|
||||
<circle cx="19" cy="12" r="1" />
|
||||
<circle cx="5" cy="12" r="1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 391 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-external-link"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M15 3h6v6" />
|
||||
<path d="M10 14 21 3" />
|
||||
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 416 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-eye-off"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" />
|
||||
<path d="M14.084 14.158a3 3 0 0 1-4.242-4.242" />
|
||||
<path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" />
|
||||
<path d="m2 2 20 20" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 582 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-eye"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" />
|
||||
<circle cx="12" cy="12" r="3" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 434 B |
@@ -0,0 +1,19 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-file-text"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" />
|
||||
<path d="M14 2v5a1 1 0 0 0 1 1h5" />
|
||||
<path d="M10 9H8" />
|
||||
<path d="M16 13H8" />
|
||||
<path d="M16 17H8" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 524 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-file"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" />
|
||||
<path d="M14 2v5a1 1 0 0 0 1 1h5" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 448 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-flag"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 445 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-flame"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 390 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-folder-open"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 483 B |
@@ -0,0 +1,19 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-gamepad-2"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<line x1="6" x2="10" y1="11" y2="11" />
|
||||
<line x1="8" x2="8" y1="9" y2="13" />
|
||||
<line x1="15" x2="15.01" y1="12" y2="12" />
|
||||
<line x1="18" x2="18.01" y1="10" y2="10" />
|
||||
<path d="M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 760 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-gift"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M12 7v14" />
|
||||
<path d="M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8" />
|
||||
<path d="M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5" />
|
||||
<rect x="3" y="7" width="18" height="4" rx="1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 501 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-globe"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" />
|
||||
<path d="M2 12h20" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 407 B |
@@ -0,0 +1,20 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-grip-vertical"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="9" cy="12" r="1" />
|
||||
<circle cx="9" cy="5" r="1" />
|
||||
<circle cx="9" cy="19" r="1" />
|
||||
<circle cx="15" cy="12" r="1" />
|
||||
<circle cx="15" cy="5" r="1" />
|
||||
<circle cx="15" cy="19" r="1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 497 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-hand"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2" />
|
||||
<path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2" />
|
||||
<path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8" />
|
||||
<path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 558 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-hard-drive"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M10 16h.01" />
|
||||
<path d="M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" />
|
||||
<path d="M21.946 12.013H2.054" />
|
||||
<path d="M6 16h.01" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 540 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-hash"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<line x1="4" x2="20" y1="9" y2="9" />
|
||||
<line x1="4" x2="20" y1="15" y2="15" />
|
||||
<line x1="10" x2="8" y1="3" y2="21" />
|
||||
<line x1="16" x2="14" y1="3" y2="21" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 448 B |
@@ -0,0 +1,19 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-headphone-off"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M21 14h-1.343" />
|
||||
<path d="M9.128 3.47A9 9 0 0 1 21 12v3.343" />
|
||||
<path d="m2 2 20 20" />
|
||||
<path d="M20.414 20.414A2 2 0 0 1 19 21h-1a2 2 0 0 1-2-2v-3" />
|
||||
<path d="M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 2.636-6.364" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 556 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-headphones"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 428 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-heart"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 449 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-house"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8" />
|
||||
<path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 459 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-image"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<rect width="18" height="18" x="3" y="3" rx="2" ry="2" />
|
||||
<circle cx="9" cy="9" r="2" />
|
||||
<path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 434 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-info"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<path d="M12 16v-4" />
|
||||
<path d="M12 8h.01" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 369 B |
@@ -0,0 +1,23 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-keyboard"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M10 8h.01" />
|
||||
<path d="M12 12h.01" />
|
||||
<path d="M14 8h.01" />
|
||||
<path d="M16 12h.01" />
|
||||
<path d="M18 8h.01" />
|
||||
<path d="M6 8h.01" />
|
||||
<path d="M7 16h10" />
|
||||
<path d="M8 12h.01" />
|
||||
<rect width="20" height="16" x="2" y="4" rx="2" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 540 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-layout-grid"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<rect width="7" height="7" x="3" y="3" rx="1" />
|
||||
<rect width="7" height="7" x="14" y="3" rx="1" />
|
||||
<rect width="7" height="7" x="14" y="14" rx="1" />
|
||||
<rect width="7" height="7" x="3" y="14" rx="1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 498 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-leaf"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M11 20a10 10 0 0010-10 25.9 25.9 0 00-1.04-7.281 1 1 0 00-1.755-.325C15.833 5.5 13 5.5 9.8 6.1A7 7 0 0011 20" />
|
||||
<path d="M2 21a5 5 0 012.911-4.544C7.613 15.212 8.351 15.24 11 13" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 479 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-library"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m16 6 4 14" />
|
||||
<path d="M12 6v14" />
|
||||
<path d="M8 8v12" />
|
||||
<path d="M4 4v16" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 382 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-lightbulb"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5" />
|
||||
<path d="M9 18h6" />
|
||||
<path d="M10 22h4" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 451 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-link"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
|
||||
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 434 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-loader-circle"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 335 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-lock"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<rect width="18" height="11" x="3" y="11" rx="2" ry="2" />
|
||||
<path d="M7 11V7a5 5 0 0 1 10 0v4" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 384 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-log-in"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m10 17 5-5-5-5" />
|
||||
<path d="M15 12H3" />
|
||||
<path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 396 B |
@@ -0,0 +1,17 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-log-out"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="m16 17 5-5-5-5" />
|
||||
<path d="M21 12H9" />
|
||||
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 395 B |
@@ -0,0 +1,18 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-maximize"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M8 3H5a2 2 0 0 0-2 2v3" />
|
||||
<path d="M21 8V5a2 2 0 0 0-2-2h-3" />
|
||||
<path d="M3 16v3a2 2 0 0 0 2 2h3" />
|
||||
<path d="M16 21h3a2 2 0 0 0 2-2v-3" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 445 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-message-circle"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 432 B |
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-message-square"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 424 B |