diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-05-20 00:31:47 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-05-20 00:57:52 +0200 |
commit | 62844facf7995f8d730a0f94a6d8a8559ac5410b (patch) | |
tree | ed513a8f2bd82c9368592fb3fb9563fd3173f7b8 /src/GridImagePackModel.h | |
parent | Fix StickerPicker padding and names of unnamed packs (diff) | |
download | nheko-62844facf7995f8d730a0f94a6d8a8559ac5410b.tar.xz |
Allow scrolling to specific sections and order packs in sticker search by match quality
Diffstat (limited to 'src/GridImagePackModel.h')
-rw-r--r-- | src/GridImagePackModel.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/GridImagePackModel.h b/src/GridImagePackModel.h index 8da61b8e..c6be3346 100644 --- a/src/GridImagePackModel.h +++ b/src/GridImagePackModel.h @@ -41,10 +41,24 @@ public: std::vector<std::string> descriptor_; // roomid, statekey, shortcode }; +struct SectionDescription +{ + Q_GADGET + Q_PROPERTY(QString url MEMBER url CONSTANT) + Q_PROPERTY(QString name MEMBER name CONSTANT) + Q_PROPERTY(int firstRowWith MEMBER firstRowWith CONSTANT) + +public: + QString name; + QString url; + int firstRowWith = 0; +}; + class GridImagePackModel final : public QAbstractListModel { Q_OBJECT Q_PROPERTY(QString searchString READ searchString WRITE setSearchString NOTIFY newSearchString) + Q_PROPERTY(QList<SectionDescription> sections READ sections NOTIFY newSearchString) public: enum Roles @@ -61,6 +75,8 @@ public: QString searchString() const { return searchString_; } void setSearchString(QString newValue); + QList<SectionDescription> sections() const; + signals: void newSearchString(); @@ -87,4 +103,5 @@ private: std::vector<std::size_t> rowToFirstRowEntryFromSearch; QString nameFromPack(const PackDesc &pack) const; + QString avatarFromPack(const PackDesc &pack) const; }; |