Remove extra inline keywords

This commit is contained in:
Konstantinos Sideris 2017-10-22 19:03:55 +03:00
parent 160fe1d668
commit c0e55378c3
38 changed files with 159 additions and 640 deletions

View file

@ -3,7 +3,7 @@ Language: Cpp
AccessModifierOffset: -8
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: true
BasedOnStyle: Mozilla
ColumnLimit: 100
IndentCaseLabels: false

View file

@ -33,8 +33,8 @@ public:
QString nextBatchToken() const;
QMap<QString, RoomState> states();
inline void deleteData();
inline void unmount();
void deleteData();
void unmount() { isMounted_ = false; };
void removeRoom(const QString &roomid);
void setup();
@ -52,18 +52,3 @@ private:
QString userId_;
QString cacheDirectory_;
};
inline void
Cache::unmount()
{
isMounted_ = false;
}
inline void
Cache::deleteData()
{
qInfo() << "Deleting cache data";
if (!cacheDirectory_.isEmpty())
QDir(cacheDirectory_).removeRecursively();
}

View file

@ -39,7 +39,10 @@ signals:
void emojiSelected(const QString &emoji);
private slots:
inline void clickIndex(const QModelIndex &);
void clickIndex(const QModelIndex &index)
{
emit emojiSelected(index.data(Qt::UserRole).toString());
};
private:
QVBoxLayout *mainLayout_;
@ -52,9 +55,3 @@ private:
QLabel *category_;
};
inline void
EmojiCategory::clickIndex(const QModelIndex &index)
{
emit emojiSelected(index.data(Qt::UserRole).toString());
}

View file

@ -29,55 +29,25 @@ public:
QByteArray serialize() noexcept;
inline void setPassword(QString password);
inline void setUser(QString username);
void setPassword(QString password) { password_ = password; };
void setUser(QString username) { user_ = username; };
private:
QString user_;
QString password_;
};
inline void
LoginRequest::setPassword(QString password)
{
password_ = password;
}
inline void
LoginRequest::setUser(QString username)
{
user_ = username;
}
class LoginResponse : public Deserializable
{
public:
void deserialize(const QJsonDocument &data) override;
inline QString getAccessToken();
inline QString getHomeServer();
inline QString getUserId();
QString getAccessToken() { return access_token_; };
QString getHomeServer() { return home_server_; };
QString getUserId() { return user_id_; };
private:
QString access_token_;
QString home_server_;
QString user_id_;
};
inline QString
LoginResponse::getAccessToken()
{
return access_token_;
}
inline QString
LoginResponse::getHomeServer()
{
return home_server_;
}
inline QString
LoginResponse::getUserId()
{
return user_id_;
}

View file

@ -55,9 +55,9 @@ public:
void joinRoom(const QString &roomIdOrAlias);
void leaveRoom(const QString &roomId);
inline QUrl getHomeServer();
inline int transactionId();
inline void incrementTransactionId();
QUrl getHomeServer() { return server_; };
int transactionId() { return txn_id_; };
void incrementTransactionId() { txn_id_ += 1; };
void reset() noexcept;
@ -65,9 +65,12 @@ public slots:
void getOwnProfile() noexcept;
void logout() noexcept;
inline void setServer(const QString &server);
inline void setAccessToken(const QString &token);
inline void setNextBatchToken(const QString &next_batch);
void setServer(const QString &server)
{
server_ = QUrl(QString("https://%1").arg(server));
};
void setAccessToken(const QString &token) { token_ = token; };
void setNextBatchToken(const QString &next_batch) { next_batch_ = next_batch; };
signals:
void loginError(const QString &error);
@ -162,39 +165,3 @@ private:
// Token to be used for the next sync.
QString next_batch_;
};
inline QUrl
MatrixClient::getHomeServer()
{
return server_;
}
inline int
MatrixClient::transactionId()
{
return txn_id_;
}
inline void
MatrixClient::setServer(const QString &server)
{
server_ = QUrl(QString("https://%1").arg(server));
}
inline void
MatrixClient::setAccessToken(const QString &token)
{
token_ = token;
}
inline void
MatrixClient::setNextBatchToken(const QString &next_batch)
{
next_batch_ = next_batch;
}
inline void
MatrixClient::incrementTransactionId()
{
txn_id_ += 1;
}

View file

@ -27,22 +27,10 @@ class ProfileResponse : public Deserializable
public:
void deserialize(const QJsonDocument &data) override;
inline QUrl getAvatarUrl();
inline QString getDisplayName();
QUrl getAvatarUrl() { return avatar_url_; };
QString getDisplayName() { return display_name_; };
private:
QUrl avatar_url_;
QString display_name_;
};
inline QUrl
ProfileResponse::getAvatarUrl()
{
return avatar_url_;
}
inline QString
ProfileResponse::getDisplayName()
{
return display_name_;
}

View file

@ -29,55 +29,25 @@ public:
QByteArray serialize() noexcept;
inline void setPassword(QString password);
inline void setUser(QString username);
void setPassword(QString password) { password_ = password; };
void setUser(QString username) { user_ = username; };
private:
QString user_;
QString password_;
};
inline void
RegisterRequest::setPassword(QString password)
{
password_ = password;
}
inline void
RegisterRequest::setUser(QString username)
{
user_ = username;
}
class RegisterResponse : public Deserializable
{
public:
void deserialize(const QJsonDocument &data) override;
inline QString getAccessToken();
inline QString getHomeServer();
inline QString getUserId();
QString getAccessToken() { return access_token_; };
QString getHomeServer() { return home_server_; };
QString getUserId() { return user_id_; };
private:
QString access_token_;
QString home_server_;
QString user_id_;
};
inline QString
RegisterResponse::getAccessToken()
{
return access_token_;
}
inline QString
RegisterResponse::getHomeServer()
{
return home_server_;
}
inline QString
RegisterResponse::getUserId()
{
return user_id_;
}

View file

@ -50,11 +50,12 @@ public:
void clearUnreadMessageCount();
void setState(const RoomState &state);
inline bool isPressed() const;
inline RoomState state() const;
inline void setAvatar(const QImage &avatar_image);
inline int unreadMessageCount() const;
inline void setDescriptionMessage(const DescInfo &info);
bool isPressed() const { return isPressed_; };
RoomState state() const { return state_; };
int unreadMessageCount() const { return unreadMsgCount_; };
void setAvatar(const QImage &avatar_image);
void setDescriptionMessage(const DescInfo &info);
signals:
void clicked(const QString &room_id);
@ -97,36 +98,3 @@ private:
int maxHeight_;
int unreadMsgCount_ = 0;
};
inline int
RoomInfoListItem::unreadMessageCount() const
{
return unreadMsgCount_;
}
inline bool
RoomInfoListItem::isPressed() const
{
return isPressed_;
}
inline RoomState
RoomInfoListItem::state() const
{
return state_;
}
inline void
RoomInfoListItem::setAvatar(const QImage &img)
{
roomAvatar_ = QPixmap::fromImage(
img.scaled(IconSize, IconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
update();
}
inline void
RoomInfoListItem::setDescriptionMessage(const DescInfo &info)
{
lastMsgInfo_ = info;
update();
}

View file

@ -27,30 +27,12 @@ class RoomMessages : public Deserializable
public:
void deserialize(const QJsonDocument &data) override;
inline QString start() const;
inline QString end() const;
inline QJsonArray chunk() const;
QString start() const { return start_; };
QString end() const { return end_; };
QJsonArray chunk() const { return chunk_; };
private:
QString start_;
QString end_;
QJsonArray chunk_;
};
inline QString
RoomMessages::start() const
{
return start_;
}
inline QString
RoomMessages::end() const
{
return end_;
}
inline QJsonArray
RoomMessages::chunk() const
{
return chunk_;
}

View file

@ -49,9 +49,9 @@ public:
void resolveAvatar();
void parse(const QJsonObject &object);
inline QUrl getAvatar() const;
inline QString getName() const;
inline QString getTopic() const;
QUrl getAvatar() const { return avatar_; };
QString getName() const { return name_; };
QString getTopic() const { return topic.content().topic().simplified(); };
void removeLeaveMemberships();
void update(const RoomState &state);
@ -81,21 +81,3 @@ private:
// avatar event this should be empty.
QString userAvatar_;
};
inline QString
RoomState::getTopic() const
{
return topic.content().topic().simplified();
}
inline QString
RoomState::getName() const
{
return name_;
}
inline QUrl
RoomState::getAvatar() const
{
return avatar_;
}

View file

@ -27,15 +27,15 @@
class Event : public Deserializable
{
public:
inline QJsonObject content() const;
inline QJsonObject unsigned_content() const;
QJsonObject content() const { return content_; };
QJsonObject unsigned_content() const { return unsigned_; };
inline QString sender() const;
inline QString state_key() const;
inline QString type() const;
inline QString eventId() const;
QString sender() const { return sender_; };
QString state_key() const { return state_key_; };
QString type() const { return type_; };
QString eventId() const { return event_id_; };
inline uint64_t timestamp() const;
uint64_t timestamp() const { return origin_server_ts_; };
void deserialize(const QJsonValue &data) override;
@ -51,70 +51,22 @@ private:
uint64_t origin_server_ts_;
};
inline QJsonObject
Event::content() const
{
return content_;
}
inline QJsonObject
Event::unsigned_content() const
{
return unsigned_;
}
inline QString
Event::sender() const
{
return sender_;
}
inline QString
Event::state_key() const
{
return state_key_;
}
inline QString
Event::type() const
{
return type_;
}
inline QString
Event::eventId() const
{
return event_id_;
}
inline uint64_t
Event::timestamp() const
{
return origin_server_ts_;
}
class State : public Deserializable
{
public:
void deserialize(const QJsonValue &data) override;
inline QJsonArray events() const;
QJsonArray events() const { return events_; };
private:
QJsonArray events_;
};
inline QJsonArray
State::events() const
{
return events_;
}
class Timeline : public Deserializable
{
public:
inline QJsonArray events() const;
inline QString previousBatch() const;
inline bool limited() const;
QJsonArray events() const { return events_; };
QString previousBatch() const { return prev_batch_; };
bool limited() const { return limited_; };
void deserialize(const QJsonValue &data) override;
@ -124,31 +76,13 @@ private:
bool limited_;
};
inline QJsonArray
Timeline::events() const
{
return events_;
}
inline QString
Timeline::previousBatch() const
{
return prev_batch_;
}
inline bool
Timeline::limited() const
{
return limited_;
}
// TODO: Add support for account_data, undread_notifications
class JoinedRoom : public Deserializable
{
public:
inline State state() const;
inline Timeline timeline() const;
inline QList<QString> typingUserIDs() const;
State state() const { return state_; };
Timeline timeline() const { return timeline_; };
QList<QString> typingUserIDs() const { return typingUserIDs_; };
void deserialize(const QJsonValue &data) override;
@ -160,29 +94,11 @@ private:
/* UnreadNotifications unread_notifications_; */
};
inline QList<QString>
JoinedRoom::typingUserIDs() const
{
return typingUserIDs_;
}
inline State
JoinedRoom::state() const
{
return state_;
}
inline Timeline
JoinedRoom::timeline() const
{
return timeline_;
}
class LeftRoom : public Deserializable
{
public:
inline State state() const;
inline Timeline timeline() const;
State state() const { return state_; };
Timeline timeline() const { return timeline_; };
void deserialize(const QJsonValue &data) override;
@ -191,24 +107,12 @@ private:
Timeline timeline_;
};
inline State
LeftRoom::state() const
{
return state_;
}
inline Timeline
LeftRoom::timeline() const
{
return timeline_;
}
// TODO: Add support for invited and left rooms.
class Rooms : public Deserializable
{
public:
inline QMap<QString, JoinedRoom> join() const;
inline QMap<QString, LeftRoom> leave() const;
QMap<QString, JoinedRoom> join() const { return join_; };
QMap<QString, LeftRoom> leave() const { return leave_; };
void deserialize(const QJsonValue &data) override;
private:
@ -216,38 +120,14 @@ private:
QMap<QString, LeftRoom> leave_;
};
inline QMap<QString, JoinedRoom>
Rooms::join() const
{
return join_;
}
inline QMap<QString, LeftRoom>
Rooms::leave() const
{
return leave_;
}
class SyncResponse : public Deserializable
{
public:
void deserialize(const QJsonDocument &data) override;
inline QString nextBatch() const;
inline Rooms rooms() const;
QString nextBatch() const { return next_batch_; };
Rooms rooms() const { return rooms_; };
private:
QString next_batch_;
Rooms rooms_;
};
inline Rooms
SyncResponse::rooms() const
{
return rooms_;
}
inline QString
SyncResponse::nextBatch() const
{
return next_batch_;
}

View file

@ -55,7 +55,7 @@ public slots:
void onSendButtonClicked();
void openFileSelection();
void hideUploadSpinner();
inline void focusLineEdit();
void focusLineEdit() { input_->setFocus(); };
private slots:
void addSelectedEmoji(const QString &emoji);
@ -80,9 +80,3 @@ private:
FlatButton *sendMessageBtn_;
EmojiPickButton *emojiBtn_;
};
inline void
TextInputWidget::focusLineEdit()
{
input_->setFocus();
}

View file

@ -65,7 +65,7 @@ public:
QWidget *parent);
void setUserAvatar(const QImage &pixmap);
inline DescInfo descriptionMessage() const;
DescInfo descriptionMessage() const { return descriptionMsg_; };
~TimelineItem();
@ -98,9 +98,3 @@ private:
QLabel *userName_;
QLabel *body_;
};
inline DescInfo
TimelineItem::descriptionMessage() const
{
return descriptionMsg_;
}

View file

@ -99,7 +99,7 @@ public slots:
void addBackwardsEvents(const QString &room_id, const RoomMessages &msgs);
// Whether or not the initial batch has been loaded.
bool hasLoaded();
bool hasLoaded() { return scroll_layout_->count() > 1 || isTimelineFinished; };
signals:
void updateLastTimelineMessage(const QString &user, const DescInfo &info);
@ -120,7 +120,7 @@ private:
const QString &userid);
void removePendingMessage(const QString &eventid, const QString &body);
inline bool isDuplicate(const QString &event_id);
bool isDuplicate(const QString &event_id) { return eventIds_.contains(event_id); };
// Return nullptr if the event couldn't be parsed.
TimelineItem *parseMessageEvent(const QJsonObject &event, TimelineDirection direction);
@ -160,15 +160,3 @@ private:
QList<PendingMessage> pending_msgs_;
QSharedPointer<MatrixClient> client_;
};
inline bool
TimelineView::isDuplicate(const QString &event_id)
{
return eventIds_.contains(event_id);
}
inline bool
TimelineView::hasLoaded()
{
return scroll_layout_->count() > 1 || isTimelineFinished;
}

View file

@ -45,10 +45,10 @@ public:
TopRoomBar(QWidget *parent = 0);
~TopRoomBar();
inline void updateRoomAvatar(const QImage &avatar_image);
inline void updateRoomAvatar(const QIcon &icon);
inline void updateRoomName(const QString &name);
inline void updateRoomTopic(QString topic);
void updateRoomAvatar(const QImage &avatar_image);
void updateRoomAvatar(const QIcon &icon);
void updateRoomName(const QString &name);
void updateRoomTopic(QString topic);
void updateRoomAvatarFromName(const QString &name);
void setRoomSettings(QSharedPointer<RoomSettings> settings);
@ -89,31 +89,3 @@ private:
QString roomName_;
QString roomTopic_;
};
inline void
TopRoomBar::updateRoomAvatar(const QImage &avatar_image)
{
avatar_->setImage(avatar_image);
update();
}
inline void
TopRoomBar::updateRoomAvatar(const QIcon &icon)
{
avatar_->setIcon(icon);
update();
}
inline void
TopRoomBar::updateRoomName(const QString &name)
{
roomName_ = name;
update();
}
inline void
TopRoomBar::updateRoomTopic(QString topic)
{
roomTopic_ = topic;
update();
}

View file

@ -32,16 +32,11 @@ public:
void deserialize(const QJsonValue &data) override;
QJsonObject serialize() const override;
inline QList<QString> aliases() const;
QList<QString> aliases() const { return aliases_; };
private:
QList<QString> aliases_;
};
inline QList<QString>
AliasesEventContent::aliases() const
{
return aliases_;
}
} // namespace events
} // namespace matrix

View file

@ -36,16 +36,11 @@ public:
void deserialize(const QJsonValue &data) override;
QJsonObject serialize() const override;
inline QUrl url() const;
QUrl url() const { return url_; };
private:
QUrl url_;
};
inline QUrl
AvatarEventContent::url() const
{
return url_;
}
} // namespace events
} // namespace matrix

View file

@ -38,16 +38,11 @@ public:
void deserialize(const QJsonValue &data) override;
QJsonObject serialize() const override;
inline QString alias() const;
QString alias() const { return alias_; };
private:
QString alias_;
};
inline QString
CanonicalAliasEventContent::alias() const
{
return alias_;
}
} // namespace events
} // namespace matrix

View file

@ -36,17 +36,12 @@ public:
void deserialize(const QJsonValue &data) override;
QJsonObject serialize() const override;
inline QString creator() const;
QString creator() const { return creator_; };
private:
// The user_id of the room creator. This is set by the homeserver.
QString creator_;
};
inline QString
CreateEventContent::creator() const
{
return creator_;
}
} // namespace events
} // namespace matrix

View file

@ -66,8 +66,8 @@ class Event
, public Serializable
{
public:
inline Content content() const;
inline EventType eventType() const;
Content content() const;
EventType eventType() const;
void deserialize(const QJsonValue &data) override;
QJsonObject serialize() const override;

View file

@ -36,7 +36,7 @@ class HistoryVisibilityEventContent
, public Serializable
{
public:
inline HistoryVisibility historyVisibility() const;
HistoryVisibility historyVisibility() const { return history_visibility_; };
void deserialize(const QJsonValue &data) override;
QJsonObject serialize() const override;
@ -45,10 +45,5 @@ private:
HistoryVisibility history_visibility_;
};
inline HistoryVisibility
HistoryVisibilityEventContent::historyVisibility() const
{
return history_visibility_;
}
} // namespace events
} // namespace matrix

View file

@ -51,16 +51,11 @@ public:
void deserialize(const QJsonValue &data) override;
QJsonObject serialize() const override;
inline JoinRule joinRule() const;
JoinRule joinRule() const { return join_rule_; };
private:
JoinRule join_rule_;
};
inline JoinRule
JoinRulesEventContent::joinRule() const
{
return join_rule_;
}
} // namespace events
} // namespace matrix

View file

@ -54,9 +54,9 @@ public:
void deserialize(const QJsonValue &data) override;
QJsonObject serialize() const override;
inline QUrl avatarUrl() const;
inline QString displayName() const;
inline Membership membershipState() const;
QUrl avatarUrl() const { return avatar_url_; };
QString displayName() const { return display_name_; };
Membership membershipState() const { return membership_state_; };
private:
QUrl avatar_url_;
@ -64,22 +64,5 @@ private:
Membership membership_state_;
};
inline QUrl
MemberEventContent::avatarUrl() const
{
return avatar_url_;
}
inline QString
MemberEventContent::displayName() const
{
return display_name_;
}
inline Membership
MemberEventContent::membershipState() const
{
return membership_state_;
}
} // namespace events
} // namespace matrix

View file

@ -26,7 +26,7 @@ template<class MsgContent>
class MessageEvent : public RoomEvent<MessageEventContent>
{
public:
inline MsgContent msgContent() const;
MsgContent msgContent() const;
void deserialize(const QJsonValue &data) override;

View file

@ -64,16 +64,11 @@ public:
void deserialize(const QJsonValue &data) override;
QJsonObject serialize() const override;
inline QString body() const;
QString body() const { return body_; };
private:
QString body_;
};
inline QString
MessageEventContent::body() const
{
return body_;
}
} // namespace events
} // namespace matrix

View file

@ -35,16 +35,11 @@ public:
void deserialize(const QJsonValue &data) override;
QJsonObject serialize() const override;
inline QString name() const;
QString name() const { return name_; };
private:
QString name_;
};
inline QString
NameEventContent::name() const
{
return name_;
}
} // namespace events
} // namespace matrix

View file

@ -43,14 +43,14 @@ public:
void deserialize(const QJsonValue &data) override;
QJsonObject serialize() const override;
inline int banLevel() const;
inline int inviteLevel() const;
inline int kickLevel() const;
inline int redactLevel() const;
int banLevel() const { return ban_; };
int inviteLevel() const { return invite_; };
int kickLevel() const { return kick_; };
int redactLevel() const { return redact_; };
inline int eventsDefaultLevel() const;
inline int stateDefaultLevel() const;
inline int usersDefaultLevel() const;
int eventsDefaultLevel() const { return events_default_; };
int stateDefaultLevel() const { return state_default_; };
int usersDefaultLevel() const { return users_default_; };
int eventLevel(QString event_type) const;
int userLevel(QString user_id) const;
@ -69,46 +69,5 @@ private:
QMap<QString, int> users_;
};
inline int
PowerLevelsEventContent::banLevel() const
{
return ban_;
}
inline int
PowerLevelsEventContent::inviteLevel() const
{
return invite_;
}
inline int
PowerLevelsEventContent::kickLevel() const
{
return kick_;
}
inline int
PowerLevelsEventContent::redactLevel() const
{
return redact_;
}
inline int
PowerLevelsEventContent::eventsDefaultLevel() const
{
return events_default_;
}
inline int
PowerLevelsEventContent::stateDefaultLevel() const
{
return state_default_;
}
inline int
PowerLevelsEventContent::usersDefaultLevel() const
{
return users_default_;
}
} // namespace events
} // namespace matrix

View file

@ -28,10 +28,10 @@ template<class Content>
class RoomEvent : public Event<Content>
{
public:
inline QString eventId() const;
inline QString roomId() const;
inline QString sender() const;
inline uint64_t timestamp() const;
QString eventId() const;
QString roomId() const;
QString sender() const;
uint64_t timestamp() const;
void deserialize(const QJsonValue &data) override;
QJsonObject serialize() const override;

View file

@ -27,8 +27,8 @@ template<class Content>
class StateEvent : public RoomEvent<Content>
{
public:
inline QString stateKey() const;
inline Content previousContent() const;
QString stateKey() const;
Content previousContent() const;
void deserialize(const QJsonValue &data);
QJsonObject serialize() const;

View file

@ -36,16 +36,11 @@ public:
void deserialize(const QJsonValue &data) override;
QJsonObject serialize() const override;
inline QString topic() const;
QString topic() const { return topic_; };
private:
QString topic_;
};
inline QString
TopicEventContent::topic() const
{
return topic_;
}
} // namespace events
} // namespace matrix

View file

@ -35,8 +35,8 @@ struct AudioInfo
class Audio : public Deserializable
{
public:
inline QString url() const;
inline AudioInfo info() const;
QString url() const { return url_; };
AudioInfo info() const { return info_; };
void deserialize(const QJsonObject &object) override;
@ -45,18 +45,6 @@ private:
AudioInfo info_;
};
inline QString
Audio::url() const
{
return url_;
}
inline AudioInfo
Audio::info() const
{
return info_;
}
} // namespace messages
} // namespace events
} // namespace matrix

View file

@ -37,10 +37,9 @@ struct FileInfo
class File : public Deserializable
{
public:
inline QString url() const;
inline QString filename() const;
inline FileInfo info() const;
QString url() const { return url_; };
QString filename() const { return filename_; };
FileInfo info() const { return info_; };
void deserialize(const QJsonObject &object) override;
@ -51,24 +50,6 @@ private:
FileInfo info_;
};
inline QString
File::filename() const
{
return filename_;
}
inline QString
File::url() const
{
return url_;
}
inline FileInfo
File::info() const
{
return info_;
}
} // namespace messages
} // namespace events
} // namespace matrix

View file

@ -39,8 +39,8 @@ struct ImageInfo
class Image : public Deserializable
{
public:
inline QString url() const;
inline ImageInfo info() const;
QString url() const { return url_; };
ImageInfo info() const { return info_; };
void deserialize(const QJsonObject &object) override;
@ -49,18 +49,6 @@ private:
ImageInfo info_;
};
inline QString
Image::url() const
{
return url_;
}
inline ImageInfo
Image::info() const
{
return info_;
}
} // namespace messages
} // namespace events
} // namespace matrix

View file

@ -34,8 +34,8 @@ struct LocationInfo
class Location : public Deserializable
{
public:
inline QString geoUri() const;
inline LocationInfo info() const;
QString geoUri() const { return geo_uri_; };
LocationInfo info() const { return info_; };
void deserialize(const QJsonObject &object) override;
@ -45,18 +45,6 @@ private:
LocationInfo info_;
};
inline QString
Location::geoUri() const
{
return geo_uri_;
}
inline LocationInfo
Location::info() const
{
return info_;
}
} // namespace messages
} // namespace events
} // namespace matrix

View file

@ -40,8 +40,8 @@ struct VideoInfo
class Video : public Deserializable
{
public:
inline QString url() const;
inline VideoInfo info() const;
QString url() const { return url_; };
VideoInfo info() const { return info_; };
void deserialize(const QJsonObject &object) override;
@ -50,18 +50,6 @@ private:
VideoInfo info_;
};
inline QString
Video::url() const
{
return url_;
}
inline VideoInfo
Video::info() const
{
return info_;
}
} // namespace messages
} // namespace events
} // namespace matrix

View file

@ -272,3 +272,12 @@ Cache::nextBatchToken() const
return QString::fromUtf8(token.data(), token.size());
}
void
Cache::deleteData()
{
qInfo() << "Deleting cache data";
if (!cacheDirectory_.isEmpty())
QDir(cacheDirectory_).removeRecursively();
}

View file

@ -313,4 +313,19 @@ RoomInfoListItem::mousePressEvent(QMouseEvent *event)
ripple_overlay_->addRipple(ripple);
}
void
RoomInfoListItem::setAvatar(const QImage &img)
{
roomAvatar_ = QPixmap::fromImage(
img.scaled(IconSize, IconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
update();
}
void
RoomInfoListItem::setDescriptionMessage(const DescInfo &info)
{
lastMsgInfo_ = info;
update();
}
RoomInfoListItem::~RoomInfoListItem() {}

View file

@ -202,4 +202,32 @@ TopRoomBar::setRoomSettings(QSharedPointer<RoomSettings> settings)
roomSettings_ = settings;
}
void
TopRoomBar::updateRoomAvatar(const QImage &avatar_image)
{
avatar_->setImage(avatar_image);
update();
}
void
TopRoomBar::updateRoomAvatar(const QIcon &icon)
{
avatar_->setIcon(icon);
update();
}
void
TopRoomBar::updateRoomName(const QString &name)
{
roomName_ = name;
update();
}
void
TopRoomBar::updateRoomTopic(QString topic)
{
roomTopic_ = topic;
update();
}
TopRoomBar::~TopRoomBar() {}