WIP: feat: Add a callback to the message compose widget #16

Draft
warren wants to merge 17 commits from message-send-callback into main
Collaborator

This PR adds a global callback to the Slint UI that is triggered whenever the user hits "send" on the message compose widget.

main.rs is modified with a simple println! that is triggered by the callback, providing a starting point for further integration

This PR adds a global callback to the Slint UI that is triggered whenever the user hits "send" on the message compose widget. `main.rs` is modified with a simple println! that is triggered by the callback, providing a starting point for further integration
ChatView will need to accept data externally. Putting mock data straight into the slint file makes not much sense - we'll feed that from rust-land if need be.
Introduced `ChatData` struct to encapsulate both messages and chat title, and updated ChatData to use this struct, making the data better-encapsulated for feeding in through a larger data model.
Replaced hardcoded `ChatView` instances with dynamic rendering using `views` and `chat-data` properties, enabling better integration with Rust-land.
Added placeholder_data.rs which contains two sets of example chat messages with which to fill out the UI.
the `chat-data` and `views` properties were populated with placeholder data from Rust, demonstrating how information flows from Rust to Slint components.
Slint's types want an Image value, which underneath the hood uses a reference-counted value, but it was awkward to keep track of those references.

The cache makes it easier by just letting you get images from there by cache.
Slint types are annoyingly opinionated in terms of all the mechanics that are in there for observing and tracking data, none of which should end up in the networking code.

This commit introduces far more Vanilla Rust plain-old-data types that mirror the generated Slint types.
Replaced `SharedString` and `Image` with vanilla Rust `String` and `PathBuf`. Updated `ChatData` and `MessageData` to depend on plain data types.
Added the `Store` trait to handle long-term storage of user data, including methods for fetching all chat UUIDs and retrieving chat data by UUID.
Introduced a placeholder implementation of the `Store` trait with predefined chat data for testing and demonstration. Updated `store` module to include `placeholder_store`.
Replaced static chat data and views initialization with dynamic data retrieved using the new `PlaceholderStore` implementation.
Replaced raw `Uuid` usage with `ChatUuid` newtype across `Store` implementations to prevent mixing up identifiers.
Refactored `create_simple_sample_messages` and `create_complex_sample_messages` to return `ChatData` instead of `Vec<MessageData>`.
ChatData now has a uuid field rather than this being implicit in the store hashmap
Extended `ChatData` (in Slint) structure with a `uuid` field and updated the Rust conversion logic to populate it.
Integrated global `send-message` callback to capture text input, trigger on button click, and clear input field after sending.

This callback may later be used to send out a message in some broader context.
Modify main.rs to feature a proof-of-concept for sending information from the message compose widget into Rust.

At the moment it merely displays the message with a println!, from there we might go on to do something more interesting with it, such as adding it to a buffer or sending over the network.
warren changed title from feat: Add a callbackk to the message compose widget to WIP: feat: Add a callbackk to the message compose widget 2025-11-29 18:13:49 +00:00
warren changed title from WIP: feat: Add a callbackk to the message compose widget to WIP: feat: Add a callback to the message compose widget 2025-11-30 16:11:17 +00:00
warren changed title from WIP: feat: Add a callbackk to the message compose widget to WIP: feat: Add a callback to the message compose widget 2025-11-30 16:11:17 +00:00
warren force-pushed message-send-callback from 7e46714dfa to 6a61c67d66 2025-12-10 15:35:23 +00:00 Compare
warren force-pushed message-send-callback from 6a61c67d66 to 39bc8d2f48 2025-12-10 15:38:35 +00:00 Compare
warren force-pushed message-send-callback from 39bc8d2f48 to 5f8631b93b 2025-12-16 10:11:34 +00:00 Compare
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin message-send-callback:message-send-callback
git switch message-send-callback
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
nemalixi/chat-app!16
No description provided.