Autosearch

Make the user search automatically. This includes a timer to ensure that we aren't constantly pinging the server as the user types, the search is started 0.5s after the user stops typing. The `PublicRoomListModel` is upgraded to work in the same manner as it was architected slightly differently.
This commit is contained in:
James Graham
2024-01-21 11:24:40 +00:00
parent 538cfbee8d
commit f48c2a21d9
5 changed files with 63 additions and 23 deletions

View File

@@ -108,6 +108,13 @@ public:
[[nodiscard]] bool searching() const;
/**
* @brief Search the room directory.
*
* @param limit the maximum number of rooms to load.
*/
Q_INVOKABLE void search(int limit = 50);
private:
QPointer<Quotient::Connection> m_connection = nullptr;
QString m_server;
@@ -117,9 +124,9 @@ private:
/**
* @brief Load the next set of rooms.
*
* @param count the maximum number of rooms to load.
* @param limit the maximum number of rooms to load.
*/
void next(int count = 50);
void next(int limit = 50);
bool canFetchMore(const QModelIndex &parent) const override;
void fetchMore(const QModelIndex &parent) override;