diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2017-08-20 13:47:22 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2017-08-20 13:47:22 +0300 |
commit | 2644e4accaf7487ad51b205040163e42b76de3a4 (patch) | |
tree | 523db09ee380e05838bfb2a5eee60ca88aad6e52 /include | |
parent | Add missing destructors (diff) | |
download | nheko-2644e4accaf7487ad51b205040163e42b76de3a4.tar.xz |
Small style change
Diffstat (limited to 'include')
49 files changed, 460 insertions, 306 deletions
diff --git a/include/Cache.h b/include/Cache.h index dc9583ac..a64f0514 100644 --- a/include/Cache.h +++ b/include/Cache.h @@ -46,12 +46,14 @@ private: QString userId_; }; -inline void Cache::unmount() +inline void +Cache::unmount() { isMounted_ = false; } -inline QString Cache::memberDbName(const QString &roomid) +inline QString +Cache::memberDbName(const QString &roomid) { return QString("m.%1").arg(roomid); } diff --git a/include/Config.h b/include/Config.h index e12fac85..2fdeef83 100644 --- a/include/Config.h +++ b/include/Config.h @@ -36,8 +36,8 @@ namespace fonts static const int heading = 13; static const int badge = 10; static const int bubble = 20; -} // namespace fonts -} // namespace roomlist +} // namespace fonts +} // namespace roomlist namespace userInfoWidget { @@ -45,8 +45,8 @@ namespace fonts { static const int displayName = 16; static const int userid = 14; -} // namespace fonts -} // namespace userInfoWidget +} // namespace fonts +} // namespace userInfoWidget namespace topRoomBar { @@ -54,8 +54,8 @@ namespace fonts { static const int roomName = 15; static const int roomDescription = 13; -} // namespace fonts -} // namespace topRoomBar +} // namespace fonts +} // namespace topRoomBar namespace timeline { @@ -70,4 +70,4 @@ static const int timestamp = 9; } } -} // namespace conf +} // namespace conf diff --git a/include/EmojiCategory.h b/include/EmojiCategory.h index 9cf0a177..3a4e4e1e 100644 --- a/include/EmojiCategory.h +++ b/include/EmojiCategory.h @@ -53,7 +53,8 @@ private: QLabel *category_; }; -inline void EmojiCategory::clickIndex(const QModelIndex &index) +inline void +EmojiCategory::clickIndex(const QModelIndex &index) { emit emojiSelected(index.data(Qt::UserRole).toString()); } diff --git a/include/Login.h b/include/Login.h index c00eb6d2..09f62a71 100644 --- a/include/Login.h +++ b/include/Login.h @@ -37,12 +37,14 @@ private: QString password_; }; -inline void LoginRequest::setPassword(QString password) +inline void +LoginRequest::setPassword(QString password) { password_ = password; } -inline void LoginRequest::setUser(QString username) +inline void +LoginRequest::setUser(QString username) { user_ = username; } @@ -62,17 +64,20 @@ private: QString user_id_; }; -inline QString LoginResponse::getAccessToken() +inline QString +LoginResponse::getAccessToken() { return access_token_; } -inline QString LoginResponse::getHomeServer() +inline QString +LoginResponse::getHomeServer() { return home_server_; } -inline QString LoginResponse::getUserId() +inline QString +LoginResponse::getUserId() { return user_id_; } diff --git a/include/MatrixClient.h b/include/MatrixClient.h index e3613ab7..c20d02cc 100644 --- a/include/MatrixClient.h +++ b/include/MatrixClient.h @@ -136,32 +136,38 @@ private: QString next_batch_; }; -inline QUrl MatrixClient::getHomeServer() +inline QUrl +MatrixClient::getHomeServer() { return server_; } -inline int MatrixClient::transactionId() +inline int +MatrixClient::transactionId() { return txn_id_; } -inline void MatrixClient::setServer(const QString &server) +inline void +MatrixClient::setServer(const QString &server) { server_ = QUrl(QString("https://%1").arg(server)); } -inline void MatrixClient::setAccessToken(const QString &token) +inline void +MatrixClient::setAccessToken(const QString &token) { token_ = token; } -inline void MatrixClient::setNextBatchToken(const QString &next_batch) +inline void +MatrixClient::setNextBatchToken(const QString &next_batch) { next_batch_ = next_batch; } -inline void MatrixClient::incrementTransactionId() +inline void +MatrixClient::incrementTransactionId() { txn_id_ += 1; } diff --git a/include/Profile.h b/include/Profile.h index 54016509..7bb3deaa 100644 --- a/include/Profile.h +++ b/include/Profile.h @@ -35,12 +35,14 @@ private: QString display_name_; }; -inline QUrl ProfileResponse::getAvatarUrl() +inline QUrl +ProfileResponse::getAvatarUrl() { return avatar_url_; } -inline QString ProfileResponse::getDisplayName() +inline QString +ProfileResponse::getDisplayName() { return display_name_; } diff --git a/include/Register.h b/include/Register.h index 71b3a15a..695595a8 100644 --- a/include/Register.h +++ b/include/Register.h @@ -37,12 +37,14 @@ private: QString password_; }; -inline void RegisterRequest::setPassword(QString password) +inline void +RegisterRequest::setPassword(QString password) { password_ = password; } -inline void RegisterRequest::setUser(QString username) +inline void +RegisterRequest::setUser(QString username) { user_ = username; } @@ -62,17 +64,20 @@ private: QString user_id_; }; -inline QString RegisterResponse::getAccessToken() +inline QString +RegisterResponse::getAccessToken() { return access_token_; } -inline QString RegisterResponse::getHomeServer() +inline QString +RegisterResponse::getHomeServer() { return home_server_; } -inline QString RegisterResponse::getUserId() +inline QString +RegisterResponse::getUserId() { return user_id_; } diff --git a/include/RoomInfoListItem.h b/include/RoomInfoListItem.h index be7fe866..b368ab64 100644 --- a/include/RoomInfoListItem.h +++ b/include/RoomInfoListItem.h @@ -38,10 +38,7 @@ class RoomInfoListItem : public QWidget Q_OBJECT public: - RoomInfoListItem(QSharedPointer<RoomSettings> settings, - RoomState state, - QString room_id, - QWidget *parent = 0); + RoomInfoListItem(QSharedPointer<RoomSettings> settings, RoomState state, QString room_id, QWidget *parent = 0); ~RoomInfoListItem(); @@ -95,28 +92,34 @@ private: int unreadMsgCount_ = 0; }; -inline int RoomInfoListItem::unreadMessageCount() const +inline int +RoomInfoListItem::unreadMessageCount() const { return unreadMsgCount_; } -inline bool RoomInfoListItem::isPressed() const +inline bool +RoomInfoListItem::isPressed() const { return isPressed_; } -inline RoomState RoomInfoListItem::state() const +inline RoomState +RoomInfoListItem::state() const { return state_; } -inline void RoomInfoListItem::setAvatar(const QImage &img) +inline void +RoomInfoListItem::setAvatar(const QImage &img) { - roomAvatar_ = QPixmap::fromImage(img.scaled(IconSize, IconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); + roomAvatar_ = + QPixmap::fromImage(img.scaled(IconSize, IconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); update(); } -inline void RoomInfoListItem::setDescriptionMessage(const DescInfo &info) +inline void +RoomInfoListItem::setDescriptionMessage(const DescInfo &info) { lastMsgInfo_ = info; } diff --git a/include/RoomMessages.h b/include/RoomMessages.h index 0353af9a..1321ac8e 100644 --- a/include/RoomMessages.h +++ b/include/RoomMessages.h @@ -37,17 +37,20 @@ private: QJsonArray chunk_; }; -inline QString RoomMessages::start() const +inline QString +RoomMessages::start() const { return start_; } -inline QString RoomMessages::end() const +inline QString +RoomMessages::end() const { return end_; } -inline QJsonArray RoomMessages::chunk() const +inline QJsonArray +RoomMessages::chunk() const { return chunk_; } diff --git a/include/RoomState.h b/include/RoomState.h index 1d8ae429..536ac4a9 100644 --- a/include/RoomState.h +++ b/include/RoomState.h @@ -80,17 +80,20 @@ private: QString userAvatar_; }; -inline QString RoomState::getTopic() const +inline QString +RoomState::getTopic() const { return topic.content().topic().simplified(); } -inline QString RoomState::getName() const +inline QString +RoomState::getName() const { return name_; } -inline QUrl RoomState::getAvatar() const +inline QUrl +RoomState::getAvatar() const { return avatar_; } diff --git a/include/SlidingStackWidget.h b/include/SlidingStackWidget.h index 1cb01cea..51903678 100644 --- a/include/SlidingStackWidget.h +++ b/include/SlidingStackWidget.h @@ -36,11 +36,7 @@ class SlidingStackWidget : public QStackedWidget public: // Defines the animation direction. - enum class AnimationDirection { - LEFT_TO_RIGHT, - RIGHT_TO_LEFT, - AUTOMATIC - }; + enum class AnimationDirection { LEFT_TO_RIGHT, RIGHT_TO_LEFT, AUTOMATIC }; SlidingStackWidget(QWidget *parent); ~SlidingStackWidget(); diff --git a/include/Sync.h b/include/Sync.h index 26cfdb48..da81344e 100644 --- a/include/Sync.h +++ b/include/Sync.h @@ -51,37 +51,44 @@ private: uint64_t origin_server_ts_; }; -inline QJsonObject Event::content() const +inline QJsonObject +Event::content() const { return content_; } -inline QJsonObject Event::unsigned_content() const +inline QJsonObject +Event::unsigned_content() const { return unsigned_; } -inline QString Event::sender() const +inline QString +Event::sender() const { return sender_; } -inline QString Event::state_key() const +inline QString +Event::state_key() const { return state_key_; } -inline QString Event::type() const +inline QString +Event::type() const { return type_; } -inline QString Event::eventId() const +inline QString +Event::eventId() const { return event_id_; } -inline uint64_t Event::timestamp() const +inline uint64_t +Event::timestamp() const { return origin_server_ts_; } @@ -96,7 +103,8 @@ private: QJsonArray events_; }; -inline QJsonArray State::events() const +inline QJsonArray +State::events() const { return events_; } @@ -116,17 +124,20 @@ private: bool limited_; }; -inline QJsonArray Timeline::events() const +inline QJsonArray +Timeline::events() const { return events_; } -inline QString Timeline::previousBatch() const +inline QString +Timeline::previousBatch() const { return prev_batch_; } -inline bool Timeline::limited() const +inline bool +Timeline::limited() const { return limited_; } @@ -148,12 +159,14 @@ private: /* UnreadNotifications unread_notifications_; */ }; -inline State JoinedRoom::state() const +inline State +JoinedRoom::state() const { return state_; } -inline Timeline JoinedRoom::timeline() const +inline Timeline +JoinedRoom::timeline() const { return timeline_; } @@ -169,7 +182,8 @@ private: QMap<QString, JoinedRoom> join_; }; -inline QMap<QString, JoinedRoom> Rooms::join() const +inline QMap<QString, JoinedRoom> +Rooms::join() const { return join_; } @@ -186,12 +200,14 @@ private: Rooms rooms_; }; -inline Rooms SyncResponse::rooms() const +inline Rooms +SyncResponse::rooms() const { return rooms_; } -inline QString SyncResponse::nextBatch() const +inline QString +SyncResponse::nextBatch() const { return next_batch_; } diff --git a/include/TextInputWidget.h b/include/TextInputWidget.h index 7fae4ae0..690a899b 100644 --- a/include/TextInputWidget.h +++ b/include/TextInputWidget.h @@ -66,7 +66,8 @@ private: EmojiPickButton *emoji_button_; }; -inline void TextInputWidget::focusLineEdit() +inline void +TextInputWidget::focusLineEdit() { input_->setFocus(); } diff --git a/include/TimelineItem.h b/include/TimelineItem.h index cc5b3da7..af2e273c 100644 --- a/include/TimelineItem.h +++ b/include/TimelineItem.h @@ -38,8 +38,14 @@ class TimelineItem : public QWidget { Q_OBJECT public: - TimelineItem(const events::MessageEvent<msgs::Notice> &e, bool with_sender, const QString &color, QWidget *parent = 0); - TimelineItem(const events::MessageEvent<msgs::Text> &e, bool with_sender, const QString &color, QWidget *parent = 0); + TimelineItem(const events::MessageEvent<msgs::Notice> &e, + bool with_sender, + const QString &color, + QWidget *parent = 0); + TimelineItem(const events::MessageEvent<msgs::Text> &e, + bool with_sender, + const QString &color, + QWidget *parent = 0); // For local messages. TimelineItem(const QString &userid, const QString &color, QString body, QWidget *parent = 0); @@ -69,10 +75,10 @@ private: DescInfo descriptionMsg_; QHBoxLayout *topLayout_; - QVBoxLayout *sideLayout_; // Avatar or Timestamp - QVBoxLayout *mainLayout_; // Header & Message body + QVBoxLayout *sideLayout_; // Avatar or Timestamp + QVBoxLayout *mainLayout_; // Header & Message body - QHBoxLayout *headerLayout_; // Username (&) Timestamp + QHBoxLayout *headerLayout_; // Username (&) Timestamp Avatar *userAvatar_; @@ -83,7 +89,8 @@ private: QLabel *body_; }; -inline DescInfo TimelineItem::descriptionMessage() const +inline DescInfo +TimelineItem::descriptionMessage() const { return descriptionMsg_; } diff --git a/include/TimelineView.h b/include/TimelineView.h index 6e92993d..17c2610a 100644 --- a/include/TimelineView.h +++ b/include/TimelineView.h @@ -44,10 +44,10 @@ struct PendingMessage { TimelineItem *widget; PendingMessage(int txn_id, QString body, QString event_id, TimelineItem *widget) - : txn_id(txn_id) - , body(body) - , event_id(event_id) - , widget(widget) + : txn_id(txn_id) + , body(body) + , event_id(event_id) + , widget(widget) { } }; @@ -63,12 +63,21 @@ class TimelineView : public QWidget Q_OBJECT public: - TimelineView(const Timeline &timeline, QSharedPointer<MatrixClient> client, const QString &room_id, QWidget *parent = 0); + TimelineView(const Timeline &timeline, + QSharedPointer<MatrixClient> client, + const QString &room_id, + QWidget *parent = 0); TimelineView(QSharedPointer<MatrixClient> client, const QString &room_id, QWidget *parent = 0); - TimelineItem *createTimelineItem(const events::MessageEvent<msgs::Image> &e, const QString &color, bool with_sender); - TimelineItem *createTimelineItem(const events::MessageEvent<msgs::Notice> &e, const QString &color, bool with_sender); - TimelineItem *createTimelineItem(const events::MessageEvent<msgs::Text> &e, const QString &color, bool with_sender); + TimelineItem *createTimelineItem(const events::MessageEvent<msgs::Image> &e, + const QString &color, + bool with_sender); + TimelineItem *createTimelineItem(const events::MessageEvent<msgs::Notice> &e, + const QString &color, + bool with_sender); + TimelineItem *createTimelineItem(const events::MessageEvent<msgs::Text> &e, + const QString &color, + bool with_sender); // Add new events at the end of the timeline. int addEvents(const Timeline &timeline); @@ -137,7 +146,8 @@ private: QSharedPointer<MatrixClient> client_; }; -inline bool TimelineView::isDuplicate(const QString &event_id) +inline bool +TimelineView::isDuplicate(const QString &event_id) { return eventIds_.contains(event_id); } diff --git a/include/TopRoomBar.h b/include/TopRoomBar.h index d5cb8e8e..be5d66e6 100644 --- a/include/TopRoomBar.h +++ b/include/TopRoomBar.h @@ -70,26 +70,28 @@ private: int buttonSize_; }; -inline void TopRoomBar::updateRoomAvatar(const QImage &avatar_image) +inline void +TopRoomBar::updateRoomAvatar(const QImage &avatar_image) { avatar_->setImage(avatar_image); } -inline void TopRoomBar::updateRoomAvatar(const QIcon &icon) +inline void +TopRoomBar::updateRoomAvatar(const QIcon &icon) { avatar_->setIcon(icon); } -inline void TopRoomBar::updateRoomName(const QString &name) +inline void +TopRoomBar::updateRoomName(const QString &name) { - QString elidedText = QFontMetrics(name_label_->font()) - .elidedText(name, Qt::ElideRight, width() * 0.8); + QString elidedText = QFontMetrics(name_label_->font()).elidedText(name, Qt::ElideRight, width() * 0.8); name_label_->setText(elidedText); } -inline void TopRoomBar::updateRoomTopic(const QString &topic) +inline void +TopRoomBar::updateRoomTopic(const QString &topic) { - QString elidedText = QFontMetrics(topic_label_->font()) - .elidedText(topic, Qt::ElideRight, width() * 0.8); + QString elidedText = QFontMetrics(topic_label_->font()).elidedText(topic, Qt::ElideRight, width() * 0.8); topic_label_->setText(elidedText); } diff --git a/include/events/AliasesEventContent.h b/include/events/AliasesEventContent.h index 3adf8d46..bd7f8f9f 100644 --- a/include/events/AliasesEventContent.h +++ b/include/events/AliasesEventContent.h @@ -26,7 +26,9 @@ namespace matrix { namespace events { -class AliasesEventContent : public Deserializable, public Serializable +class AliasesEventContent + : public Deserializable + , public Serializable { public: void deserialize(const QJsonValue &data) override; @@ -38,9 +40,10 @@ private: QList<QString> aliases_; }; -inline QList<QString> AliasesEventContent::aliases() const +inline QList<QString> +AliasesEventContent::aliases() const { return aliases_; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/AvatarEventContent.h b/include/events/AvatarEventContent.h index 43be3122..03347e26 100644 --- a/include/events/AvatarEventContent.h +++ b/include/events/AvatarEventContent.h @@ -30,7 +30,9 @@ namespace events * A picture that is associated with the room. */ -class AvatarEventContent : public Deserializable, public Serializable +class AvatarEventContent + : public Deserializable + , public Serializable { public: void deserialize(const QJsonValue &data) override; @@ -42,9 +44,10 @@ private: QUrl url_; }; -inline QUrl AvatarEventContent::url() const +inline QUrl +AvatarEventContent::url() const { return url_; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/CanonicalAliasEventContent.h b/include/events/CanonicalAliasEventContent.h index aed7ea6b..bc08bcce 100644 --- a/include/events/CanonicalAliasEventContent.h +++ b/include/events/CanonicalAliasEventContent.h @@ -32,7 +32,9 @@ namespace events * users which alias to use to advertise the room. */ -class CanonicalAliasEventContent : public Deserializable, public Serializable +class CanonicalAliasEventContent + : public Deserializable + , public Serializable { public: void deserialize(const QJsonValue &data) override; @@ -44,9 +46,10 @@ private: QString alias_; }; -inline QString CanonicalAliasEventContent::alias() const +inline QString +CanonicalAliasEventContent::alias() const { return alias_; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/CreateEventContent.h b/include/events/CreateEventContent.h index eedee9f1..0a401dac 100644 --- a/include/events/CreateEventContent.h +++ b/include/events/CreateEventContent.h @@ -29,7 +29,9 @@ namespace events * This is the first event in a room and cannot be changed. It acts as the root of all other events. */ -class CreateEventContent : public Deserializable, public Serializable +class CreateEventContent + : public Deserializable + , public Serializable { public: void deserialize(const QJsonValue &data) override; @@ -42,9 +44,10 @@ private: QString creator_; }; -inline QString CreateEventContent::creator() const +inline QString +CreateEventContent::creator() const { return creator_; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/Event.h b/include/events/Event.h index af538644..d48c20c6 100644 --- a/include/events/Event.h +++ b/include/events/Event.h @@ -53,13 +53,18 @@ enum class EventType { Unsupported, }; -EventType extractEventType(const QJsonObject &data); - -bool isMessageEvent(EventType type); -bool isStateEvent(EventType type); - -template <class Content> -class Event : public Deserializable, public Serializable +EventType +extractEventType(const QJsonObject &data); + +bool +isMessageEvent(EventType type); +bool +isStateEvent(EventType type); + +template<class Content> +class Event + : public Deserializable + , public Serializable { public: inline Content content() const; @@ -73,20 +78,23 @@ private: EventType type_; }; -template <class Content> -inline Content Event<Content>::content() const +template<class Content> +inline Content +Event<Content>::content() const { return content_; } -template <class Content> -inline EventType Event<Content>::eventType() const +template<class Content> +inline EventType +Event<Content>::eventType() const { return type_; } -template <class Content> -void Event<Content>::deserialize(const QJsonValue &data) +template<class Content> +void +Event<Content>::deserialize(const QJsonValue &data) { if (!data.isObject()) throw DeserializationException("Event is not a JSON object"); @@ -97,8 +105,9 @@ void Event<Content>::deserialize(const QJsonValue &data) type_ = extractEventType(object); } -template <class Content> -QJsonObject Event<Content>::serialize() const +template<class Content> +QJsonObject +Event<Content>::serialize() const { QJsonObject object; @@ -145,5 +154,5 @@ QJsonObject Event<Content>::serialize() const return object; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/HistoryVisibilityEventContent.h b/include/events/HistoryVisibilityEventContent.h index 3edc7ce5..d854a775 100644 --- a/include/events/HistoryVisibilityEventContent.h +++ b/include/events/HistoryVisibilityEventContent.h @@ -32,7 +32,9 @@ enum class HistoryVisibility { WorldReadable, }; -class HistoryVisibilityEventContent : public Deserializable, public Serializable +class HistoryVisibilityEventContent + : public Deserializable + , public Serializable { public: inline HistoryVisibility historyVisibility() const; @@ -44,9 +46,10 @@ private: HistoryVisibility history_visibility_; }; -inline HistoryVisibility HistoryVisibilityEventContent::historyVisibility() const +inline HistoryVisibility +HistoryVisibilityEventContent::historyVisibility() const { return history_visibility_; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/JoinRulesEventContent.h b/include/events/JoinRulesEventContent.h index 9b07e9a6..702bba98 100644 --- a/include/events/JoinRulesEventContent.h +++ b/include/events/JoinRulesEventContent.h @@ -44,7 +44,9 @@ enum class JoinRule { * Describes how users are allowed to join the room. */ -class JoinRulesEventContent : public Deserializable, public Serializable +class JoinRulesEventContent + : public Deserializable + , public Serializable { public: void deserialize(const QJsonValue &data) override; @@ -56,9 +58,10 @@ private: JoinRule join_rule_; }; -inline JoinRule JoinRulesEventContent::joinRule() const +inline JoinRule +JoinRulesEventContent::joinRule() const { return join_rule_; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/MemberEventContent.h b/include/events/MemberEventContent.h index feaf1559..2dd133ea 100644 --- a/include/events/MemberEventContent.h +++ b/include/events/MemberEventContent.h @@ -47,7 +47,9 @@ enum class Membership { * The current membership state of a user in the room. */ -class MemberEventContent : public Deserializable, public Serializable +class MemberEventContent + : public Deserializable + , public Serializable { public: void deserialize(const QJsonValue &data) override; @@ -63,19 +65,22 @@ private: Membership membership_state_; }; -inline QUrl MemberEventContent::avatarUrl() const +inline QUrl +MemberEventContent::avatarUrl() const { return avatar_url_; } -inline QString MemberEventContent::displayName() const +inline QString +MemberEventContent::displayName() const { return display_name_; } -inline Membership MemberEventContent::membershipState() const +inline Membership +MemberEventContent::membershipState() const { return membership_state_; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/MessageEvent.h b/include/events/MessageEvent.h index d1fb1b4a..24e236e3 100644 --- a/include/events/MessageEvent.h +++ b/include/events/MessageEvent.h @@ -24,7 +24,7 @@ namespace matrix { namespace events { -template <class MsgContent> +template<class MsgContent> class MessageEvent : public RoomEvent<MessageEventContent> { public: @@ -36,14 +36,16 @@ private: MsgContent msg_content_; }; -template <class MsgContent> -inline MsgContent MessageEvent<MsgContent>::msgContent() const +template<class MsgContent> +inline MsgContent +MessageEvent<MsgContent>::msgContent() const { return msg_content_; } -template <class MsgContent> -void MessageEvent<MsgContent>::deserialize(const QJsonValue &data) +template<class MsgContent> +void +MessageEvent<MsgContent>::deserialize(const QJsonValue &data) { RoomEvent<MessageEventContent>::deserialize(data); @@ -59,6 +61,6 @@ struct ThumbnailInfo { QString mimetype; }; -} // namespace messages -} // namespace events -} // namespace matrix +} // namespace messages +} // namespace events +} // namespace matrix diff --git a/include/events/MessageEventContent.h b/include/events/MessageEventContent.h index 3bfd11c2..9f20809d 100644 --- a/include/events/MessageEventContent.h +++ b/include/events/MessageEventContent.h @@ -54,9 +54,12 @@ enum class MessageEventType { Unknown, }; -MessageEventType extractMessageEventType(const QJsonObject &data); +MessageEventType +extractMessageEventType(const QJsonObject &data); -class MessageEventContent : public Deserializable, public Serializable +class MessageEventContent + : public Deserializable + , public Serializable { public: void deserialize(const QJsonValue &data) override; @@ -68,9 +71,10 @@ private: QString body_; }; -inline QString MessageEventContent::body() const +inline QString +MessageEventContent::body() const { return body_; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/NameEventContent.h b/include/events/NameEventContent.h index ab90fd23..e290a696 100644 --- a/include/events/NameEventContent.h +++ b/include/events/NameEventContent.h @@ -29,7 +29,9 @@ namespace events * A human-friendly room name designed to be displayed to the end-user. */ -class NameEventContent : public Deserializable, public Serializable +class NameEventContent + : public Deserializable + , public Serializable { public: void deserialize(const QJsonValue &data) override; @@ -41,9 +43,10 @@ private: QString name_; }; -inline QString NameEventContent::name() const +inline QString +NameEventContent::name() const { return name_; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/PowerLevelsEventContent.h b/include/events/PowerLevelsEventContent.h index 7def9800..3a9d80d1 100644 --- a/include/events/PowerLevelsEventContent.h +++ b/include/events/PowerLevelsEventContent.h @@ -36,7 +36,9 @@ enum class PowerLevels { * Defines the power levels (privileges) of users in the room. */ -class PowerLevelsEventContent : public Deserializable, public Serializable +class PowerLevelsEventContent + : public Deserializable + , public Serializable { public: void deserialize(const QJsonValue &data) override; @@ -68,39 +70,46 @@ private: QMap<QString, int> users_; }; -inline int PowerLevelsEventContent::banLevel() const +inline int +PowerLevelsEventContent::banLevel() const { return ban_; } -inline int PowerLevelsEventContent::inviteLevel() const +inline int +PowerLevelsEventContent::inviteLevel() const { return invite_; } -inline int PowerLevelsEventContent::kickLevel() const +inline int +PowerLevelsEventContent::kickLevel() const { return kick_; } -inline int PowerLevelsEventContent::redactLevel() const +inline int +PowerLevelsEventContent::redactLevel() const { return redact_; } -inline int PowerLevelsEventContent::eventsDefaultLevel() const +inline int +PowerLevelsEventContent::eventsDefaultLevel() const { return events_default_; } -inline int PowerLevelsEventContent::stateDefaultLevel() const +inline int +PowerLevelsEventContent::stateDefaultLevel() const { return state_default_; } -inline int PowerLevelsEventContent::usersDefaultLevel() const +inline int +PowerLevelsEventContent::usersDefaultLevel() const { return users_default_; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/RoomEvent.h b/include/events/RoomEvent.h index 79fc4be2..b4bc78fe 100644 --- a/include/events/RoomEvent.h +++ b/include/events/RoomEvent.h @@ -26,7 +26,7 @@ namespace matrix { namespace events { -template <class Content> +template<class Content> class RoomEvent : public Event<Content> { public: @@ -46,32 +46,37 @@ private: uint64_t origin_server_ts_; }; -template <class Content> -inline QString RoomEvent<Content>::eventId() const +template<class Content> +inline QString +RoomEvent<Content>::eventId() const { return event_id_; } -template <class Content> -inline QString RoomEvent<Content>::roomId() const +template<class Content> +inline QString +RoomEvent<Content>::roomId() const { return room_id_; } -template <class Content> -inline QString RoomEvent<Content>::sender() const +template<class Content> +inline QString +RoomEvent<Content>::sender() const { return sender_; } -template <class Content> -inline uint64_t RoomEvent<Content>::timestamp() const +template<class Content> +inline uint64_t +RoomEvent<Content>::timestamp() const { return origin_server_ts_; } -template <class Content> -void RoomEvent<Content>::deserialize(const QJsonValue &data) +template<class Content> +void +RoomEvent<Content>::deserialize(const QJsonValue &data) { Event<Content>::deserialize(data); @@ -96,8 +101,9 @@ void RoomEvent<Content>::deserialize(const QJsonValue &data) origin_server_ts_ = object.value("origin_server_ts").toDouble(); } -template <class Content> -QJsonObject RoomEvent<Content>::serialize() const +template<class Content> +QJsonObject +RoomEvent<Content>::serialize() const { QJsonObject object = Event<Content>::serialize(); @@ -108,5 +114,5 @@ QJsonObject RoomEvent<Content>::serialize() const return object; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/StateEvent.h b/include/events/StateEvent.h index 26313048..e5cd4c10 100644 --- a/include/events/StateEvent.h +++ b/include/events/StateEvent.h @@ -25,7 +25,7 @@ namespace matrix { namespace events { -template <class Content> +template<class Content> class StateEvent : public RoomEvent<Content> { public: @@ -40,20 +40,23 @@ private: Content prev_content_; }; -template <class Content> -inline QString StateEvent<Content>::stateKey() const +template<class Content> +inline QString +StateEvent<Content>::stateKey() const { return state_key_; } -template <class Content> -inline Content StateEvent<Content>::previousContent() const +template<class Content> +inline Content +StateEvent<Content>::previousContent() const { return prev_content_; } -template <class Content> -void StateEvent<Content>::deserialize(const QJsonValue &data) +template<class Content> +void +StateEvent<Content>::deserialize(const QJsonValue &data) { RoomEvent<Content>::deserialize(data); @@ -68,8 +71,9 @@ void StateEvent<Content>::deserialize(const QJsonValue &data) prev_content_.deserialize(object.value("prev_content")); } -template <class Content> -QJsonObject StateEvent<Content>::serialize() const +template<class Content> +QJsonObject +StateEvent<Content>::serialize() const { QJsonObject object = RoomEvent<Content>::serialize(); @@ -82,5 +86,5 @@ QJsonObject StateEvent<Content>::serialize() const return object; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/TopicEventContent.h b/include/events/TopicEventContent.h index ff2fe3bb..e8f3d7a4 100644 --- a/include/events/TopicEventContent.h +++ b/include/events/TopicEventContent.h @@ -29,7 +29,9 @@ namespace events * A topic is a short message detailing what is currently being discussed in the room. */ -class TopicEventContent : public Deserializable, public Serializable +class TopicEventContent + : public Deserializable + , public Serializable { public: void deserialize(const QJsonValue &data) override; @@ -41,9 +43,10 @@ private: QString topic_; }; -inline QString TopicEventContent::topic() const +inline QString +TopicEventContent::topic() const { return topic_; } -} // namespace events -} // namespace matrix +} // namespace events +} // namespace matrix diff --git a/include/events/messages/Audio.h b/include/events/messages/Audio.h index 3eeb5fc4..1f289dbb 100644 --- a/include/events/messages/Audio.h +++ b/include/events/messages/Audio.h @@ -47,16 +47,18 @@ private: AudioInfo info_; }; -inline QString Audio::url() const +inline QString +Audio::url() const { return url_; } -inline AudioInfo Audio::info() const +inline AudioInfo +Audio::info() const { return info_; } -} // namespace messages -} // namespace events -} // namespace matrix +} // namespace messages +} // namespace events +} // namespace matrix diff --git a/include/events/messages/Emote.h b/include/events/messages/Emote.h index 28118b1a..b3af8a5f 100644 --- a/include/events/messages/Emote.h +++ b/include/events/messages/Emote.h @@ -32,6 +32,6 @@ class Emote : public Deserializable public: void deserialize(const QJsonObject &obj) override; }; -} // namespace messages -} // namespace events -} // namespace matrix +} // namespace messages +} // namespace events +} // namespace matrix diff --git a/include/events/messages/File.h b/include/events/messages/File.h index 59e0ec15..22cad8be 100644 --- a/include/events/messages/File.h +++ b/include/events/messages/File.h @@ -53,21 +53,24 @@ private: FileInfo info_; }; -inline QString File::filename() const +inline QString +File::filename() const { return filename_; } -inline QString File::url() const +inline QString +File::url() const { return url_; } -inline FileInfo File::info() const +inline FileInfo +File::info() const { return info_; } -} // namespace messages -} // namespace events -} // namespace matrix +} // namespace messages +} // namespace events +} // namespace matrix diff --git a/include/events/messages/Image.h b/include/events/messages/Image.h index d73aa5c8..79360050 100644 --- a/include/events/messages/Image.h +++ b/include/events/messages/Image.h @@ -51,16 +51,18 @@ private: ImageInfo info_; }; -inline QString Image::url() const +inline QString +Image::url() const { return url_; } -inline ImageInfo Image::info() const +inline ImageInfo +Image::info() const { return info_; } -} // namespace messages -} // namespace events -} // namespace matrix +} // namespace messages +} // namespace events +} // namespace matrix diff --git a/include/events/messages/Location.h b/include/events/messages/Location.h index c245112b..864c5111 100644 --- a/include/events/messages/Location.h +++ b/include/events/messages/Location.h @@ -47,16 +47,18 @@ private: LocationInfo info_; }; -inline QString Location::geoUri() const +inline QString +Location::geoUri() const { return geo_uri_; } -inline LocationInfo Location::info() const +inline LocationInfo +Location::info() const { return info_; } -} // namespace messages -} // namespace events -} // namespace matrix +} // namespace messages +} // namespace events +} // namespace matrix diff --git a/include/events/messages/Notice.h b/include/events/messages/Notice.h index 4ea9b11f..0b2a92e3 100644 --- a/include/events/messages/Notice.h +++ b/include/events/messages/Notice.h @@ -32,6 +32,6 @@ class Notice : public Deserializable public: void deserialize(const QJsonObject &obj) override; }; -} // namespace messages -} // namespace events -} // namespace matrix +} // namespace messages +} // namespace events +} // namespace matrix diff --git a/include/events/messages/Text.h b/include/events/messages/Text.h index e98a4c1b..8950e994 100644 --- a/include/events/messages/Text.h +++ b/include/events/messages/Text.h @@ -32,6 +32,6 @@ class Text : public Deserializable public: void deserialize(const QJsonObject &obj) override; }; -} // namespace messages -} // namespace events -} // namespace matrix +} // namespace messages +} // namespace events +} // namespace matrix diff --git a/include/events/messages/Video.h b/include/events/messages/Video.h index 3a373928..2b160bea 100644 --- a/include/events/messages/Video.h +++ b/include/events/messages/Video.h @@ -52,16 +52,18 @@ private: VideoInfo info_; }; -inline QString Video::url() const +inline QString +Video::url() const { return url_; } -inline VideoInfo Video::info() const +inline VideoInfo +Video::info() const { return info_; } -} // namespace messages -} // namespace events -} // namespace matrix +} // namespace messages +} // namespace events +} // namespace matrix diff --git a/include/ui/CircularProgress.h b/include/ui/CircularProgress.h index 6a785ca2..5ed8994d 100644 --- a/include/ui/CircularProgress.h +++ b/include/ui/CircularProgress.h @@ -80,35 +80,41 @@ private: int angle_; }; -inline void CircularProgressDelegate::setDashOffset(qreal offset) +inline void +CircularProgressDelegate::setDashOffset(qreal offset) { dash_offset_ = offset; progress_->update(); } -inline void CircularProgressDelegate::setDashLength(qreal length) +inline void +CircularProgressDelegate::setDashLength(qreal length) { dash_length_ = length; progress_->update(); } -inline void CircularProgressDelegate::setAngle(int angle) +inline void +CircularProgressDelegate::setAngle(int angle) { angle_ = angle; progress_->update(); } -inline qreal CircularProgressDelegate::dashOffset() const +inline qreal +CircularProgressDelegate::dashOffset() const { return dash_offset_; } -inline qreal CircularProgressDelegate::dashLength() const +inline qreal +CircularProgressDelegate::dashLength() const { return dash_length_; } -inline int CircularProgressDelegate::angle() const +inline int +CircularProgressDelegate::angle() const { return angle_; } diff --git a/include/ui/DropShadow.h b/include/ui/DropShadow.h index 19d61c8d..3054d7dd 100644 --- a/include/ui/DropShadow.h +++ b/include/ui/DropShadow.h @@ -30,7 +30,8 @@ public: gradient.setStart(right0); gradient.setFinalStop(right1); painter.setBrush(QBrush(gradient)); - painter.drawRoundRect(QRectF(QPointF(width - margin * radius, margin), QPointF(width, height - margin)), 0.0, 0.0); + painter.drawRoundRect( + QRectF(QPointF(width - margin * radius, margin), QPointF(width, height - margin)), 0.0, 0.0); // Left QPointF left0(margin, height / 2); @@ -54,7 +55,8 @@ public: gradient.setStart(bottom0); gradient.setFinalStop(bottom1); painter.setBrush(QBrush(gradient)); - painter.drawRoundRect(QRectF(QPointF(margin, height - margin), QPointF(width - margin, height)), 0.0, 0.0); + painter.drawRoundRect( + QRectF(QPointF(margin, height - margin), QPointF(width - margin, height)), 0.0, 0.0); // BottomRight QPointF bottomright0(width - margin, height - margin); @@ -95,6 +97,7 @@ public: // Widget painter.setBrush(QBrush("#FFFFFF")); painter.setRenderHint(QPainter::Antialiasing); - painter.drawRoundRect(QRectF(QPointF(margin, margin), QPointF(width - margin, height - margin)), radius, radius); + painter.drawRoundRect( + QRectF(QPointF(margin, margin), QPointF(width - margin, height - margin)), radius, radius); } }; diff --git a/include/ui/FlatButton.h b/include/ui/FlatButton.h index 5efdb838..1c44d5d7 100644 --- a/include/ui/FlatButton.h +++ b/include/ui/FlatButton.h @@ -63,12 +63,14 @@ private: bool was_checked_; }; -inline qreal FlatButtonStateMachine::overlayOpacity() const +inline qreal +FlatButtonStateMachine::overlayOpacity() const { return overlay_opacity_; } -inline qreal FlatButtonStateMachine::checkedOverlayProgress() const +inline qreal +FlatButtonStateMachine::checkedOverlayProgress() const { return checked_overlay_progress_; } @@ -86,8 +88,13 @@ class FlatButton : public QPushButton public: explicit FlatButton(QWidget *parent = 0, ui::ButtonPreset preset = ui::ButtonPreset::FlatPreset); - explicit FlatButton(const QString &text, QWidget *parent = 0, ui::ButtonPreset preset = ui::ButtonPreset::FlatPreset); - FlatButton(const QString &text, ui::Role role, QWidget *parent = 0, ui::ButtonPreset preset = ui::ButtonPreset::FlatPreset); + explicit FlatButton(const QString &text, + QWidget *parent = 0, + ui::ButtonPreset preset = ui::ButtonPreset::FlatPreset); + FlatButton(const QString &text, + ui::Role role, + QWidget *parent = 0, + ui::ButtonPreset preset = ui::ButtonPreset::FlatPreset); ~FlatButton(); void applyPreset(ui::ButtonPreset preset); diff --git a/include/ui/Menu.h b/include/ui/Menu.h index 7794b2d2..0b4eb6d5 100644 --- a/include/ui/Menu.h +++ b/include/ui/Menu.h @@ -8,16 +8,16 @@ class Menu : public QMenu { public: Menu(QWidget *parent = nullptr) - : QMenu(parent) + : QMenu(parent) { QFont font; font.setPixelSize(conf::fontSize); setFont(font); - setStyleSheet( - "QMenu { color: black; background-color: white; margin: 0px;}" - "QMenu::item { color: black; padding: 7px 20px; border: 1px solid transparent; margin: 2px 0px; }" - "QMenu::item:selected { color: black; background: rgba(180, 180, 180, 100); }"); + setStyleSheet("QMenu { color: black; background-color: white; margin: 0px;}" + "QMenu::item { color: black; padding: 7px 20px; border: 1px solid transparent; margin: " + "2px 0px; }" + "QMenu::item:selected { color: black; background: rgba(180, 180, 180, 100); }"); }; protected: diff --git a/include/ui/OverlayModal.h b/include/ui/OverlayModal.h index d6efd29e..4dea6513 100644 --- a/include/ui/OverlayModal.h +++ b/include/ui/OverlayModal.h @@ -46,13 +46,15 @@ private: QPropertyAnimation *animation_; }; -inline void OverlayModal::setDuration(int duration) +inline void +OverlayModal::setDuration(int duration) { duration_ = duration; animation_->setDuration(duration_); } -inline void OverlayModal::setColor(QColor color) +inline void +OverlayModal::setColor(QColor color) { color_ = color; } diff --git a/include/ui/Ripple.h b/include/ui/Ripple.h index e04e7173..01e30698 100644 --- a/include/ui/Ripple.h +++ b/include/ui/Ripple.h @@ -66,67 +66,80 @@ private: QBrush brush_; }; -inline void Ripple::setOverlay(RippleOverlay *overlay) +inline void +Ripple::setOverlay(RippleOverlay *overlay) { overlay_ = overlay; } -inline qreal Ripple::radius() const +inline qreal +Ripple::radius() const { return radius_; } -inline qreal Ripple::opacity() const +inline qreal +Ripple::opacity() const { return opacity_; } -inline QColor Ripple::color() const +inline QColor +Ripple::color() const { return brush_.color(); } -inline QBrush Ripple::brush() const +inline QBrush +Ripple::brush() const { return brush_; } -inline QPoint Ripple::center() const +inline QPoint +Ripple::center() const { return center_; } -inline QPropertyAnimation *Ripple::radiusAnimation() const +inline QPropertyAnimation * +Ripple::radiusAnimation() const { return radius_anim_; } -inline QPropertyAnimation *Ripple::opacityAnimation() const +inline QPropertyAnimation * +Ripple::opacityAnimation() const { return opacity_anim_; } -inline void Ripple::setOpacityStartValue(qreal value) +inline void +Ripple::setOpacityStartValue(qreal value) { opacity_anim_->setStartValue(value); } -inline void Ripple::setOpacityEndValue(qreal value) +inline void +Ripple::setOpacityEndValue(qreal value) { opacity_anim_->setEndValue(value); } -inline void Ripple::setRadiusStartValue(qreal value) +inline void +Ripple::setRadiusStartValue(qreal value) { radius_anim_->setStartValue(value); } -inline void Ripple::setRadiusEndValue(qreal value) +inline void +Ripple::setRadiusEndValue(qreal value) { radius_anim_->setEndValue(value); } -inline void Ripple::setDuration(int msecs) +inline void +Ripple::setDuration(int msecs) { radius_anim_->setDuration(msecs); opacity_anim_->setDuration(msecs); diff --git a/include/ui/RippleOverlay.h b/include/ui/RippleOverlay.h index b3fb9a4c..cc6fd05e 100644 --- a/include/ui/RippleOverlay.h +++ b/include/ui/RippleOverlay.h @@ -37,18 +37,21 @@ private: bool use_clip_; }; -inline void RippleOverlay::setClipping(bool enable) +inline void +RippleOverlay::setClipping(bool enable) { use_clip_ = enable; update(); } -inline bool RippleOverlay::hasClipping() const +inline bool +RippleOverlay::hasClipping() const { return use_clip_; } -inline void RippleOverlay::setClipPath(const QPainterPath &path) +inline void +RippleOverlay::setClipPath(const QPainterPath &path) { clip_path_ = path; update(); diff --git a/include/ui/TextField.h b/include/ui/TextField.h index 11319f24..ec761483 100644 --- a/include/ui/TextField.h +++ b/include/ui/TextField.h @@ -92,34 +92,40 @@ private: qreal y_; }; -inline void TextFieldLabel::setColor(const QColor &color) +inline void +TextFieldLabel::setColor(const QColor &color) { color_ = color; update(); } -inline void TextFieldLabel::setOffset(const QPointF &pos) +inline void +TextFieldLabel::setOffset(const QPointF &pos) { x_ = pos.x(); y_ = pos.y(); update(); } -inline void TextFieldLabel::setScale(qreal scale) +inline void +TextFieldLabel::setScale(qreal scale) { scale_ = scale; update(); } -inline QPointF TextFieldLabel::offset() const +inline QPointF +TextFieldLabel::offset() const { return QPointF(x_, y_); } -inline qreal TextFieldLabel::scale() const +inline qreal +TextFieldLabel::scale() const { return scale_; } -inline QColor TextFieldLabel::color() const +inline QColor +TextFieldLabel::color() const { return color_; } @@ -155,13 +161,15 @@ private: qreal progress_; }; -inline void TextFieldStateMachine::setProgress(qreal progress) +inline void +TextFieldStateMachine::setProgress(qreal progress) { progress_ = progress; text_field_->update(); } -inline qreal TextFieldStateMachine::progress() const +inline qreal +TextFieldStateMachine::progress() const { return progress_; } diff --git a/include/ui/Theme.h b/include/ui/Theme.h index e63d8fc5..9806686c 100644 --- a/include/ui/Theme.h +++ b/include/ui/Theme.h @@ -6,11 +6,7 @@ namespace ui { -enum class AvatarType { - Icon, - Image, - Letter -}; +enum class AvatarType { Icon, Image, Letter }; namespace sidebar { @@ -23,38 +19,17 @@ const int FontSize = 16; // Default avatar size. Width and height. const int AvatarSize = 40; -enum class ButtonPreset { - FlatPreset, - CheckablePreset -}; +enum class ButtonPreset { FlatPreset, CheckablePreset }; -enum class RippleStyle { - CenteredRipple, - PositionedRipple, - NoRipple -}; +enum class RippleStyle { CenteredRipple, PositionedRipple, NoRipple }; -enum class OverlayStyle { - NoOverlay, - TintedOverlay, - GrayOverlay -}; +enum class OverlayStyle { NoOverlay, TintedOverlay, GrayOverlay }; -enum class Role { - Default, - Primary, - Secondary -}; +enum class Role { Default, Primary, Secondary }; -enum class ButtonIconPlacement { - LeftIcon, - RightIcon -}; +enum class ButtonIconPlacement { LeftIcon, RightIcon }; -enum class ProgressType { - DeterminateProgress, - IndeterminateProgress -}; +enum class ProgressType { DeterminateProgress, IndeterminateProgress }; enum class Color { Black, @@ -70,7 +45,7 @@ enum class Color { Transparent }; -} // namespace ui +} // namespace ui class Theme : public QObject { diff --git a/include/ui/ThemeManager.h b/include/ui/ThemeManager.h index 98ed8193..a6947bc9 100644 --- a/include/ui/ThemeManager.h +++ b/include/ui/ThemeManager.h @@ -23,7 +23,8 @@ private: Theme *theme_; }; -inline ThemeManager &ThemeManager::instance() +inline ThemeManager & +ThemeManager::instance() { static ThemeManager instance; return instance; |