Commit Graph

77 Commits

Author SHA1 Message Date
Michał Cieślak 4f24ee0422 fix(ObjectProxyModel): source data change handling improved
- source dataChanged rage is checked and skipped if malformed
- dataChange is not propagated to delegate for rows not accessed so far
2024-06-19 16:36:18 +02:00
Lukáš Tinkl a12a6a4894 feat[UI - Wallet Stability] Create generic/reusable assets listview component
TLDR: later this should form a basic building block for a new
TokenSelector picker component, potentially replacing the current
HoldingSelector* and TokenListView components (support for collectibles
TBD as part of https://github.com/status-im/status-desktop/issues/15121)

- create reusable `TokenSelectorAssetDelegate` and `TokenSelectorView`
- add corresponding SB page, showcasing the flow/integration and the
separation of concerns between the view, adaptor and delegate layers
- add QML testcase for TokenSelectorView
- don't display crypto symbol for token balances per chain tags
- update the stores and SB pages
- add some missing formatter functions to LocaleUtils and CurrenciesStore

Fixes #14716
2024-06-18 23:09:20 +02:00
Michał Cieślak 958dc7c5ba chore(ObjectProxyModel): Generalized version of SubmodelProxyModel
Closes: #14893
2024-06-05 14:18:43 +02:00
Michał Cieślak 2868d22a3a fix(ModelSyncedContainer): Proper disconnection from previously used model 2024-06-05 14:18:43 +02:00
Alex Jbanca 4e81f8f220
feat(StatusQ.Models): Adding SingleModelItemData helper component (#14891)
SingleModelItemData is a generic component that can provide a live object extract from an arbitrary QAbstractItemModel*
2024-06-04 13:08:52 +03:00
Michał Cieślak 2dfb61fe1c fix(SubmodelProxyModel): Proxy model made non-intrusive
Now SubmodelProxyModel doesn't affect source model therefore it's
possible to safely use multiple SubmodelProxyModels over the same source
model.

Closes: #14550
2024-05-27 12:03:17 +02:00
Michał Cieślak d9707091d3 feat(StatusQ): ModelSyncedContainer utility 2024-05-27 12:03:17 +02:00
Michał Cieślak e4dffc60aa fix(TestModel): proper row count check 2024-05-27 12:03:17 +02:00
Michał Cieślak 587594f3b9 feat(StatusQ): General purpose js function-based aggregator
Closes: #14617
2024-05-13 15:54:03 +02:00
Michał Cieślak ae636ef5a7 fix(StatusQ/Aggregator): Proper recalculation on layout change removing rows
Closes: #14554
2024-05-13 15:53:00 +02:00
Michał Cieślak ed33f21828 fix(SubmodelProxyModel): model reset emitted properly when roles change
Closes: #14650
2024-05-13 11:12:09 +02:00
Michał Cieślak 27c53f4154 feat(StatusQ/SubmodelProxyModel): Exposing roles computed per submodel to the top-level model
Closes: #14390
2024-05-07 16:26:44 +02:00
Michał Cieślak e8a78e21b8 StatusQ(SubmodelProxyModel): Submodel type fixed
There was inconsistency in qvariant type of submodels depending if it
was initial call for a given row (creating proxy) or further calls
(returning cached object). It led to subtle issues in views - view was
reporting type errors and failing assigning submodels properly when used
with submodel proxy with already initialized and cached proxy submodels.

Closes: #14507
2024-04-24 11:24:13 +02:00
Michał Cieślak 173a02f1fc feat(StatusQ/SubmodelProxyModel): persistent submodels proxies
So far submodel's proxies were created on the fly, on every data(...)
call. Now, once created the proxy is persistent and reused whenever
needed.

Closes: #14389
2024-04-18 14:44:10 +02:00
Michał Cieślak 5d4380e4d9 feat(StatusQ/ConcatModel): Proper handling of source models layout change
Whenever source model emits layoutAboutToBeChanged/layoutChanged,
persisten model are updated appropriately, also scenario when items are
removed is covered.

Closes: #14244
Closes: #14245
2024-04-12 11:05:08 +02:00
Michał Cieślak 598a389c3e feat(StatusQ/TestHelpers): Add method to test model removing items and emiting layoutChanged 2024-04-12 11:05:08 +02:00
Michał Cieślak 0c34325841 feat(StatusQ/LeftJoinModel): Add possibility to explicitly define roles to be joined
The new property is added to allow indicating which roles from the right
model should be used. It prevents from unnecessary renamings.

Closes: #14298
2024-04-05 14:58:06 +02:00
Stefan a09defbef7 feat(wallet) skip picking flags in the random emoji picker function
Also add a test to validate the knowledge of the emoji picker function
about flags position

Closes #13715
2024-03-20 11:56:03 +01:00
Alex Jbanca 204bfb30b6 feat(WritableProxyModel): Add syncedRemoval flag to allow source to remove edited rows 2024-03-11 20:58:55 +02:00
Alex Jbanca 07ac4eb8a6 fix(StatusQ): Don't emit layoutChanged on source model reset in MovableModel
+ Update tests
2024-03-07 22:07:49 +02:00
Alex Jbanca 4d6082e806 feat(ProfileShowcase): Updates based on comments 2024-03-06 14:49:54 +02:00
Michał Cieślak 00af1d0e90 StatusQ(WritableProxyModel): Handling of layoutChanged/rowsMoved from source models fixed
Closes: #13601
2024-03-01 15:47:41 +02:00
Michał Cieślak 0497ecd82e StatusQ(LeftJoinModel): Handling of layoutChanged from source models fixed
Closes: #13683
2024-02-27 10:12:47 +02:00
Michał Cieślak 1639f1f9e7 feat(StatusQ/Testing): invert method added TestModel emiting valid layoutChanged 2024-02-27 10:12:47 +02:00
Michał Cieślak 0d4e7bd458 StatusQ(MovableModel): layoutChanged handling fixed
Closes: #13602
2024-02-22 14:39:31 +01:00
Michał Cieślak 1bcbb482a1 feat(StatusQ/Tests): Added isNotSame(...) method for comparing models
It works similarly as isSame(...) but doesn't print warnings when
mismatch is found. Thanks to that may be used conveniently whenever
we expect differing models in a test.
2024-02-22 14:39:31 +01:00
Michał Cieślak 6d502427e5 feat(StatusQ/Tests): Added utility for persistent indexes validation 2024-02-22 14:39:31 +01:00
Michał Cieślak b949fb7b3b StatusQ(MovableModel): Methods naming refactor, Storybook pages updated/improved 2024-02-21 09:42:05 +01:00
Michał Cieślak f747791f50 StatusQ(MovableModel): Add ability to restore and bypass original order of source model 2024-02-21 09:42:05 +01:00
Alex Jbanca a55dcf299e performance: Improve the wallet loading time
+ small bug fixes
2024-02-01 16:46:40 +02:00
Michał Cieślak e51667911d StatusQ: MovableModel proxy for setting custom order over source model
Proxy decorating source mode with additional method move(from, to, count)
similar to that available in ListModel. The custom order is stored within
a proxy, not altering the original model. May be useful whenever UI needs
to allow user to set custom order. Temporary state can be held in the
proxy, and send to the backend when changes are accepted.

Closes: #12686
2024-01-22 16:36:41 +01:00
Michał Cieślak 22dcf8269f StatusQ: SnapshotModel testing utility 2024-01-22 16:36:41 +01:00
Michał Cieślak 001e90a4c6 StatusQ: ModelSignalsSpy testing utility 2024-01-22 16:36:41 +01:00
Michał Cieślak 8ac6c21782 StatusQ: Add insert overload taking array as input 2024-01-22 16:36:41 +01:00
Michał Cieślak e053d267f0 fix(StatusQ): FastExpressionSorter's test fixed for mac
Threshold for acceptable accesses has been increased but also
additional check regarding roles has been introduced to ensure
expected behavior.

Closes: #13181
2024-01-11 13:35:05 +01:00
Alex Jbanca 56f194c96c fix: Updates based on comments 2024-01-09 20:20:04 +02:00
Alex Jbanca 6da897e733 StatusQ: Adding WritableProxyModel
WritableProxyModel is a QAbstractProxyModel that allows you to modify the data without modifying the source model.
It is useful for implementing a "dirty" state for a model, where you can modify the data and then commit the changes
to the source model.

Supported features (reimplemented):
- setData
- setItemData
- removeRows
- insertRows
- moveRows (TODO)
- toVariantMap
- to be continued...
2024-01-09 20:20:04 +02:00
Michał Cieślak 56493fa5e1 feat(StatusQ): Faster version of SFPM's ExpressionSorter
Provides FastExpressionSorter component compatible with
SortFilterProxyModel. In comparison to original ExpressionSorter it allows
to define which role values should be provided to the expression's
context and improves performance significantly.

Closes: #13062
2024-01-09 13:47:47 +01:00
Michał Cieślak a6cf37278c feat(StatusQ): Faster version of SFPM's ExpressionFilter
Provides FastExpressionFilter component compatible with
SortFilterProxyModel. In comparison to original ExpressionFilter it allows
to define which role values should be provided to the expression's
context and improves performance significantly.

Closes: #13063
2024-01-09 13:47:47 +01:00
Michał Cieślak a2aedb5c6a chore(StatusQ): Generic TestModel excluded to a separate file
Closes: #12843
2024-01-05 13:34:45 +01:00
Michał Cieślak 57ee01b239 chore(StatusQ): ListModelWrapper excluded to a separate file 2024-01-05 13:34:45 +01:00
Lukáš Tinkl e2fa5b756a feat(CollectiblesView): Add combobox/popup with custom filtering options
.. to filter by community or collection name

- make the HistoryView own filter button look like the other combos
- fix some cosmetic issues for StatusCombo in small/secondary mode
- fix StatusBaseInput bg color in dark mode (was invisible)
- update CollectiblesViewPage with options to include regular and/or
community collectibles

Fixes #12969
Fixes #12948
2024-01-04 12:32:41 +01:00
Michał Cieślak fbe6cc95d1 feat(StatusQ): Ability to change sources in LeftJoinModel
- ability to change left/right models
- improved handling of model deletion
- base class changed to QAbstractListModel, dataChanged signal
  emision improved

Closes: #12912
2023-12-21 14:19:10 +01:00
Michał Cieślak 6fe2067c22 fix(ConcatModel): Changed behavior on submodel destruction to not emit signals
The general rule should be to avoid any actions on destruction different
than setting relevant pointers to null. Other actions like emiting
signals are potentially dangerous when the whole objects hierarchy is
under destruction.

Closes: #13065
2023-12-21 14:11:14 +01:00
Michał Cieślak 1c4a936833 feat(StatusQ): Faster version of SFPM's ExpressionRole
Provides FastExpressionRole component compatible with
SortFilterProxyModel. In comparison to original ExpressionRole it allows
to define which role values should be provided to the expression's
context. This approach improves performance significantly in most cases.

Closes: #13047
2023-12-20 23:16:09 +01:00
Michał Cieślak 480673d8be feat(StatusQ): Test utility for tracking qt model access 2023-12-20 23:16:09 +01:00
Michał Cieślak 6ab6e4a26e feat(Storybook): Test library for common testing utils
StatusQ's test/CMakeLists.txt refactored:
- created library target for common test utils
- removed outdated cmake commands like add_definitions
- qml tests renamed from TestStatusQ to QmlTests
- qml test files made visible in QtCreator
- linking simplified
- unneeded cmake files removed from src dir

Closes: #13031
2023-12-19 10:41:42 +01:00
Michał Cieślak e8b1df696c chore(StatusQ): Qml unit tests file names unified/simplified 2023-12-19 10:41:42 +01:00
Michał Cieślak fd638de880 fix(StatusQ/ConcatModel): Handle source submodel reset properly, tests amended
Closes: #12974
2023-12-11 17:28:27 +01:00
Michał Cieślak e2fa702ec4 feat(StatusQ): QML-oriented proxy model concatenating source models vertically
Closes: #12682
2023-12-05 22:45:08 +01:00