Commit graph

30 commits

Author SHA1 Message Date
Simon Hausmann
97ecbb3338 CI: Fix lifetime annotation warnings in model types
Amends de81fa1dba
2025-06-06 12:09:09 +02:00
Yuri Astrakhan
4ae2627ade A few more format arg inlining
Used these commands and some manual searching

```
cargo clippy --fix  --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::uninlined_format_args
cargo clippy --all-targets -- -A clippy::all -W clippy::uninlined_format_args
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2025-02-07 06:43:19 +01:00
Olivier Goffart
c98d234b9e Janitor: Always use `#![no_std] for runtime lib
And call `extern crate std` when the feature is enabled.
I've read this is the good practice on how to do it.
So that the std prelude is no longer included automatically.
There is then less difference between std and and no-std build which
should avoid surprises in the CI when we use things from the prelude.

The downside is that there is a bit of churn in the tests
2025-01-27 19:22:00 +01:00
Olivier Goffart
b9175072c7 Fix warning in nightly rust (non_local_definitions) 2024-09-26 08:42:59 +02:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Tobias Hunger
9873cfd7c0 janitor: Run cargo clippy --fix
Only the hand-picked sensible things, not all of it ;-)

Also fix a few typos that cspell complained about when I
tried to commit and some formatting changes that cargo fmt
insisted on when commiting.
2024-03-14 13:42:38 +01:00
Olivier Goffart
1a4528e447 Fix integrity of FilterModel and ReverseModel when removing or adding rows
The ReverseModel had a bug that it didn't compute the index correctly
when removing several rows at the time

The FilterModel didn't adust its internal mapping if the row that was
removed was filtered out.

That caused a bug that can be reproduced in the todo demo:
Check "hide done items" and "Sort by name", then click "Remove Done
Items", then add a new entry and it panicked.
2024-02-05 12:04:30 +01:00
Olivier Goffart
910aecea4d Models: Add an integrity check and fix overflow in the ReverseModel
Fix the ReverseModel: Querying the model out of bound
(which the iterator does) should return None
2024-02-05 12:04:30 +01:00
Olivier Goffart
d55803d290 Models: fix writing data doesn't update ListView model data property
This fixes a couple of bug:
 - Bug #3740 happens because `Repeater::model_set_row_data` did not use
   the inner.offset to get the instance (So that's the `val == 106` part
   of the test)
 - But I went ahead and also tested what happenned if you changed the
   model from the "outside" using the `model[i] = `, and that was not
   implemented, hence the move of the code from
   `Repeater::model_set_row_data` to `RepeaterTracker::row_changed`,
   That does need Pin though, so Pin was added everywhere
 - C++ is not affected by bug #3740, because because the C++ listview
   don't do the "allocate only visible" optimization. But the
   "val == 1106" part of the test would fail so this patch also moces
   the update from  `model_set_row_data` to `row_changed`.
   But following that we don't set the state as Dirty in `row_changed`,
   the write_to_model test started filling  because the `row_added`
   function was missing an update of the index on every further items

The change in the interpreter prevent a borrow_mut from causing trouble.
The Value really don't need to be in a RefCell anyway

Fix #3740
2023-10-31 13:41:31 +01:00
Guilhem Vallat
75b3a3e07b Implement Model:as_any() for all adapter models 2023-10-19 17:19:40 +02:00
Guilhem Vallat
dc43c6f620 Add source_model() to FilterModel, SortModel, ReverseModel and MapModel
As a mean of getting the inner model, useful to be able to push into the
underlying model.
2023-10-19 17:19:40 +02:00
Tobias Hunger
b12575a4c4 janitor: Go over our spell checking setup
* Extend the cspell word list
* Remove those extensions from individual source files
* white-list licenses and such as we should not meddle with those
* Fix spelling
2023-10-16 09:01:51 +02:00
Simon Hausmann
98a971666c API changes to ReverseModel and doc fixes
- Add missing documentation to various new functions
- Remove unused `inner_model()` function. We don't have an equivalent in the other model classes. C++ has source_model() though, but we can add that if needed.
2023-08-30 16:36:25 +02:00
Guilhem Vallat
49b3e15bc8 Add ReverseModel 2023-07-20 16:18:37 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Tobias Hunger
e02c360000 Clippy polish 2023-06-28 14:22:30 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Olivier Goffart
a3ec320bfb Remove some deprecated stuff
CC #2024
2023-01-26 11:19:21 +01:00
Olivier Goffart
473103dc95 Add a lifetime to ModelPeer
ModelPeer is a short lived object which is just used to register a view
to a ModelNotify.
Using a life time allow to save a heap allocation.

closes #1953
2023-01-26 11:02:32 +01:00
Florian Blasius
f2aab576f4
Add StandardTableView widget (#2032)
* Text only StandardTableView with column and rows
* Text editing of cells
* Sort by column ascending and descending
* Variants of the TableView for native, fluent and material
2023-01-12 19:41:12 +01:00
Florian Blasius
a4313c3e32
API changes for SortModel and FilterModel (rust and cpp) (#1768)
* Rust SortModel: Rename parameter `S` to `F`
* Rust SortModel: Rename parameter `apply_sorting` to `reset`
* Rust FilterModel: Rename parameter `apply_filter` to `reset`
* C++ SortModel: Rename parameter `sort_fn` to `comp`
* C++ SortModel: Add pub reset function
* C++ FilterModel: Rename parameter `apply_filter` to `reset`
2022-10-26 11:16:12 +02:00
Florian Blasius
129ee0acae
Florian/sort todo (#1721)
Implement `set_row_data` for `SortModel` and `FilterModel` (rust and cpp). Add sort and filter example to the todo example.
2022-10-11 18:58:00 +02:00
Florian Blasius
5fb31ace02
Florian/rust sorting model (#1712)
Add Rust version of SortModel
2022-10-07 16:24:48 +02:00
Olivier Goffart
396a2c5ecb Implement std::fmt::Write for SharedString and add a format! macro 2022-08-29 17:25:24 +02:00
Tobias Hunger
7bf5c7e28e janitor: Use is_empty over comparison with len 2022-05-22 11:59:00 +02:00
Lukas Jung
ff036d41ec Add model adapters
Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
2022-05-11 15:50:43 +02:00
Olivier Goffart
696ce933f7
Refactor the Model tracking in a module (#1223)
Contain the unsafe code in a smaller module.
Add an abstraction to make it easier to create change listener other
than the repeater.
2022-05-05 10:25:15 +02:00