Re-enable groups
This commit is contained in:
parent
4f41c0df4d
commit
73dbd3c8dd
14 changed files with 142 additions and 159 deletions
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
#include "Cache.h"
|
||||
#include "CommunitiesList.h"
|
||||
#include "Community.h"
|
||||
#include "MatrixClient.h"
|
||||
#include "notifications/Manager.h"
|
||||
|
||||
|
|
@ -149,10 +148,11 @@ signals:
|
|||
const QString &message,
|
||||
const QImage &icon);
|
||||
|
||||
void updateGroupsInfo(const mtx::responses::JoinedGroups &groups);
|
||||
|
||||
private slots:
|
||||
void showUnreadMessageNotification(int count);
|
||||
void updateTopBarAvatar(const QString &roomid, const QPixmap &img);
|
||||
void updateOwnCommunitiesInfo(const QList<QString> &own_communities);
|
||||
void changeTopRoomInfo(const QString &room_id);
|
||||
void logout();
|
||||
void removeRoom(const QString &room_id);
|
||||
|
|
@ -233,8 +233,6 @@ private:
|
|||
|
||||
UserInfoWidget *user_info_widget_;
|
||||
|
||||
std::map<QString, QSharedPointer<Community>> communities_;
|
||||
|
||||
// Keeps track of the users currently typing on each room.
|
||||
std::map<QString, QList<QString>> typingUsers_;
|
||||
QTimer *typingRefresher_;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include <QVBoxLayout>
|
||||
|
||||
#include "CommunitiesListItem.h"
|
||||
#include "Community.h"
|
||||
#include "ui/Theme.h"
|
||||
|
||||
class CommunitiesList : public QWidget
|
||||
|
|
@ -15,26 +14,29 @@ class CommunitiesList : public QWidget
|
|||
public:
|
||||
CommunitiesList(QWidget *parent = nullptr);
|
||||
|
||||
void setCommunities(const std::map<QString, QSharedPointer<Community>> &communities);
|
||||
void clear() { communities_.clear(); }
|
||||
|
||||
void addCommunity(QSharedPointer<Community> community, const QString &id);
|
||||
void addCommunity(const std::string &id);
|
||||
void removeCommunity(const QString &id) { communities_.erase(id); };
|
||||
std::vector<QString> roomList(const QString &id) const;
|
||||
|
||||
signals:
|
||||
void communityChanged(const QString &id);
|
||||
void avatarRetrieved(const QString &id, const QPixmap &img);
|
||||
void groupProfileRetrieved(const QString &group_id, const mtx::responses::GroupProfile &);
|
||||
void groupRoomsRetrieved(const QString &group_id, const std::vector<QString> &res);
|
||||
|
||||
public slots:
|
||||
void updateCommunityAvatar(const QString &id, const QPixmap &img);
|
||||
void highlightSelectedCommunity(const QString &id);
|
||||
void setCommunities(const mtx::responses::JoinedGroups &groups);
|
||||
|
||||
private:
|
||||
void fetchCommunityAvatar(const QString &id, const QString &avatarUrl);
|
||||
void addGlobalItem() { addCommunity(QSharedPointer<Community>(new Community), "world"); }
|
||||
void addGlobalItem() { addCommunity("world"); }
|
||||
|
||||
//! Check whether or not a community id is currently managed.
|
||||
bool communityExists(const QString &id)
|
||||
bool communityExists(const QString &id) const
|
||||
{
|
||||
return communities_.find(id) != communities_.end();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
#include <QSharedPointer>
|
||||
#include <QWidget>
|
||||
|
||||
#include "Community.h"
|
||||
#include <mtx/responses/groups.hpp>
|
||||
|
||||
#include "Config.h"
|
||||
#include "ui/Theme.h"
|
||||
|
||||
|
|
@ -25,15 +26,15 @@ class CommunitiesListItem : public QWidget
|
|||
Q_PROPERTY(QColor avatarBgColor READ avatarBgColor WRITE setAvatarBgColor)
|
||||
|
||||
public:
|
||||
CommunitiesListItem(QSharedPointer<Community> community,
|
||||
QString community_id,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
void setCommunity(QSharedPointer<Community> community) { community_ = community; };
|
||||
CommunitiesListItem(QString group_id, QWidget *parent = nullptr);
|
||||
|
||||
void setName(QString name) { name_ = name; }
|
||||
bool isPressed() const { return isPressed_; }
|
||||
void setAvatar(const QImage &img);
|
||||
|
||||
void setRooms(std::vector<QString> room_ids) { room_ids_ = std::move(room_ids); }
|
||||
std::vector<QString> rooms() const { return room_ids_; }
|
||||
|
||||
QColor highlightedBackgroundColor() const { return highlightedBackgroundColor_; }
|
||||
QColor hoverBackgroundColor() const { return hoverBackgroundColor_; }
|
||||
QColor backgroundColor() const { return backgroundColor_; }
|
||||
|
|
@ -54,7 +55,7 @@ public:
|
|||
}
|
||||
|
||||
signals:
|
||||
void clicked(const QString &community_id);
|
||||
void clicked(const QString &group_id);
|
||||
|
||||
public slots:
|
||||
void setPressedState(bool state);
|
||||
|
|
@ -66,12 +67,13 @@ protected:
|
|||
private:
|
||||
const int IconSize = 36;
|
||||
|
||||
QSharedPointer<Community> community_;
|
||||
QString communityId_;
|
||||
QString communityName_;
|
||||
QString communityShortDescription;
|
||||
QString resolveName() const;
|
||||
|
||||
QPixmap communityAvatar_;
|
||||
std::vector<QString> room_ids_;
|
||||
|
||||
QString name_;
|
||||
QString groupId_;
|
||||
QPixmap avatar_;
|
||||
|
||||
QColor highlightedBackgroundColor_;
|
||||
QColor hoverBackgroundColor_;
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <vector>
|
||||
|
||||
struct Community
|
||||
{
|
||||
void parseProfile(const QJsonObject &profile);
|
||||
void parseRooms(const QJsonObject &rooms);
|
||||
|
||||
QUrl getAvatar() const { return avatar_; }
|
||||
QString getName() const { return name_; }
|
||||
QString getShortDescription() const { return short_description_; }
|
||||
QString getLongDescription() const { return long_description_; }
|
||||
std::vector<QString> getRoomList() const { return rooms_; }
|
||||
|
||||
QUrl avatar_;
|
||||
QString name_;
|
||||
QString short_description_;
|
||||
QString long_description_;
|
||||
|
||||
std::vector<QString> rooms_;
|
||||
};
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
|
||||
#include <mtx/responses.hpp>
|
||||
#include <mtxclient/http/client.hpp>
|
||||
|
|
@ -10,8 +11,11 @@ Q_DECLARE_METATYPE(mtx::responses::Messages)
|
|||
Q_DECLARE_METATYPE(mtx::responses::Notifications)
|
||||
Q_DECLARE_METATYPE(mtx::responses::Rooms)
|
||||
Q_DECLARE_METATYPE(mtx::responses::Sync)
|
||||
Q_DECLARE_METATYPE(mtx::responses::JoinedGroups)
|
||||
Q_DECLARE_METATYPE(mtx::responses::GroupProfile)
|
||||
Q_DECLARE_METATYPE(std::string)
|
||||
Q_DECLARE_METATYPE(std::vector<std::string>)
|
||||
Q_DECLARE_METATYPE(std::vector<QString>)
|
||||
|
||||
namespace http {
|
||||
namespace v2 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue