summary refs log tree commit diff
path: root/src/RoomDirectoryModel.h
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2021-09-17 23:06:03 +0000
committerGitHub <noreply@github.com>2021-09-17 23:06:03 +0000
commitd1c8149d07b6c4be63cec581e5a7f5108ce56058 (patch)
tree32b92340908a9374214ec7b84c1fac7ea338f56d /src/RoomDirectoryModel.h
parentMerge pull request #728 from Thulinma/goto (diff)
parentChange indentation to 4 spaces (diff)
downloadnheko-d1c8149d07b6c4be63cec581e5a7f5108ce56058.tar.xz
Merge pull request #729 from Nheko-Reborn/reformat
Change indentation to 4 spaces
Diffstat (limited to 'src/RoomDirectoryModel.h')
-rw-r--r--src/RoomDirectoryModel.h94
1 files changed, 47 insertions, 47 deletions
diff --git a/src/RoomDirectoryModel.h b/src/RoomDirectoryModel.h

index 80c04612..4699474b 100644 --- a/src/RoomDirectoryModel.h +++ b/src/RoomDirectoryModel.h
@@ -25,74 +25,74 @@ struct PublicRooms; class RoomDirectoryModel : public QAbstractListModel { - Q_OBJECT + Q_OBJECT - Q_PROPERTY(bool loadingMoreRooms READ loadingMoreRooms NOTIFY loadingMoreRoomsChanged) - Q_PROPERTY(bool reachedEndOfPagination READ reachedEndOfPagination NOTIFY - reachedEndOfPaginationChanged) + Q_PROPERTY(bool loadingMoreRooms READ loadingMoreRooms NOTIFY loadingMoreRoomsChanged) + Q_PROPERTY( + bool reachedEndOfPagination READ reachedEndOfPagination NOTIFY reachedEndOfPaginationChanged) public: - explicit RoomDirectoryModel(QObject *parent = nullptr, const std::string &server = ""); + explicit RoomDirectoryModel(QObject *parent = nullptr, const std::string &server = ""); - enum Roles - { - Name = Qt::UserRole, - Id, - AvatarUrl, - Topic, - MemberCount, - Previewable, - CanJoin, - }; - QHash<int, QByteArray> roleNames() const override; + enum Roles + { + Name = Qt::UserRole, + Id, + AvatarUrl, + Topic, + MemberCount, + Previewable, + CanJoin, + }; + QHash<int, QByteArray> roleNames() const override; - QVariant data(const QModelIndex &index, int role) const override; + QVariant data(const QModelIndex &index, int role) const override; - inline int rowCount(const QModelIndex &parent = QModelIndex()) const override - { - (void)parent; - return static_cast<int>(publicRoomsData_.size()); - } + inline int rowCount(const QModelIndex &parent = QModelIndex()) const override + { + (void)parent; + return static_cast<int>(publicRoomsData_.size()); + } - bool canFetchMore(const QModelIndex &) const override { return canFetchMore_; } + bool canFetchMore(const QModelIndex &) const override { return canFetchMore_; } - bool loadingMoreRooms() const { return loadingMoreRooms_; } + bool loadingMoreRooms() const { return loadingMoreRooms_; } - bool reachedEndOfPagination() const { return reachedEndOfPagination_; } + bool reachedEndOfPagination() const { return reachedEndOfPagination_; } - void fetchMore(const QModelIndex &) override; + void fetchMore(const QModelIndex &) override; - Q_INVOKABLE void joinRoom(const int &index = -1); + Q_INVOKABLE void joinRoom(const int &index = -1); signals: - void fetchedRoomsBatch(std::vector<mtx::responses::PublicRoomsChunk> rooms, - const std::string &next_batch); - void loadingMoreRoomsChanged(); - void reachedEndOfPaginationChanged(); + void fetchedRoomsBatch(std::vector<mtx::responses::PublicRoomsChunk> rooms, + const std::string &next_batch); + void loadingMoreRoomsChanged(); + void reachedEndOfPaginationChanged(); public slots: - void setMatrixServer(const QString &s = ""); - void setSearchTerm(const QString &f); + void setMatrixServer(const QString &s = ""); + void setSearchTerm(const QString &f); private slots: - void displayRooms(std::vector<mtx::responses::PublicRoomsChunk> rooms, - const std::string &next_batch); + void displayRooms(std::vector<mtx::responses::PublicRoomsChunk> rooms, + const std::string &next_batch); private: - bool canJoinRoom(const QString &room) const; + bool canJoinRoom(const QString &room) const; - static constexpr size_t limit_ = 50; + static constexpr size_t limit_ = 50; - std::string server_; - std::string userSearchString_; - std::string prevBatch_; - std::string nextBatch_; - bool canFetchMore_{true}; - bool loadingMoreRooms_{false}; - bool reachedEndOfPagination_{false}; - std::vector<mtx::responses::PublicRoomsChunk> publicRoomsData_; + std::string server_; + std::string userSearchString_; + std::string prevBatch_; + std::string nextBatch_; + bool canFetchMore_{true}; + bool loadingMoreRooms_{false}; + bool reachedEndOfPagination_{false}; + std::vector<mtx::responses::PublicRoomsChunk> publicRoomsData_; - std::vector<std::string> getViasForRoom(const std::vector<std::string> &room); - void resetDisplayedData(); + std::vector<std::string> getViasForRoom(const std::vector<std::string> &room); + void resetDisplayedData(); };