summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ChatPage.h2
-rw-r--r--include/Config.h94
-rw-r--r--include/EmojiProvider.h3
-rw-r--r--include/MatrixClient.h3
-rw-r--r--include/RoomInfoListItem.h3
-rw-r--r--include/SideBarActions.h23
-rw-r--r--include/TimelineView.h9
-rw-r--r--include/Versions.h3
-rw-r--r--include/events/AliasesEventContent.h6
-rw-r--r--include/events/AvatarEventContent.h6
-rw-r--r--include/events/CanonicalAliasEventContent.h6
-rw-r--r--include/events/CreateEventContent.h6
-rw-r--r--include/events/Event.h7
-rw-r--r--include/events/HistoryVisibilityEventContent.h7
-rw-r--r--include/events/JoinRulesEventContent.h7
-rw-r--r--include/events/MemberEventContent.h7
-rw-r--r--include/events/MessageEvent.h10
-rw-r--r--include/events/MessageEventContent.h7
-rw-r--r--include/events/NameEventContent.h6
-rw-r--r--include/events/PowerLevelsEventContent.h7
-rw-r--r--include/events/RoomEvent.h6
-rw-r--r--include/events/StateEvent.h6
-rw-r--r--include/events/TopicEventContent.h6
-rw-r--r--include/events/messages/Audio.h10
-rw-r--r--include/events/messages/Emote.h9
-rw-r--r--include/events/messages/File.h10
-rw-r--r--include/events/messages/Image.h10
-rw-r--r--include/events/messages/Location.h10
-rw-r--r--include/events/messages/Notice.h9
-rw-r--r--include/events/messages/Text.h9
-rw-r--r--include/events/messages/Video.h10
-rw-r--r--include/ui/SnackBar.h3
-rw-r--r--include/ui/Theme.h53
33 files changed, 195 insertions, 178 deletions
diff --git a/include/ChatPage.h b/include/ChatPage.h
index 04464bc5..be8fc12c 100644
--- a/include/ChatPage.h
+++ b/include/ChatPage.h
@@ -27,6 +27,7 @@
#include "RoomList.h"
#include "RoomSettings.h"
#include "RoomState.h"
+#include "SideBarActions.h"
#include "Splitter.h"
#include "TextInputWidget.h"
#include "TimelineViewManager.h"
@@ -96,6 +97,7 @@ private:
RoomList *room_list_;
TimelineViewManager *view_manager_;
+ SideBarActions *sidebarActions_;
TopRoomBar *top_bar_;
TextInputWidget *text_input_;
diff --git a/include/Config.h b/include/Config.h
index 2412a4d0..b5e876c0 100644
--- a/include/Config.h
+++ b/include/Config.h
@@ -4,72 +4,70 @@
//
// Font sizes are in pixels.
-namespace conf
-{
+namespace conf {
// Global settings.
-static const int fontSize = 12;
-static const int textInputFontSize = 14;
-static const int emojiSize = 14;
-static const int headerFontSize = 21;
-static const int typingNotificationFontSize = 11;
+static constexpr int fontSize = 12;
+static constexpr int textInputFontSize = 14;
+static constexpr int emojiSize = 14;
+static constexpr int headerFontSize = 21;
+static constexpr int typingNotificationFontSize = 11;
// Window geometry.
-namespace window
-{
-static const int height = 600;
-static const int width = 1066;
+namespace window {
+static constexpr int height = 600;
+static constexpr int width = 1066;
-static const int minHeight = 600;
-static const int minWidth = 950;
+static constexpr int minHeight = height;
+static constexpr int minWidth = 950;
+} // namespace window
+
+namespace textInput {
+static constexpr int height = 50;
}
-// Button settings.
-namespace btn
-{
-static const int fontSize = 20;
-static const int cornerRadius = 3;
+namespace sidebarActions {
+static constexpr int height = textInput::height;
+static constexpr int iconSize = 28;
}
+// Button settings.
+namespace btn {
+static constexpr int fontSize = 20;
+static constexpr int cornerRadius = 3;
+} // namespace btn
+
// RoomList specific.
-namespace roomlist
-{
-namespace fonts
-{
-static const int heading = 13;
-static const int badge = 10;
-static const int bubble = 20;
+namespace roomlist {
+namespace fonts {
+static constexpr int heading = 13;
+static constexpr int badge = 10;
+static constexpr int bubble = 20;
} // namespace fonts
} // namespace roomlist
-namespace userInfoWidget
-{
-namespace fonts
-{
-static const int displayName = 16;
-static const int userid = 14;
+namespace userInfoWidget {
+namespace fonts {
+static constexpr int displayName = 16;
+static constexpr int userid = 14;
} // namespace fonts
} // namespace userInfoWidget
-namespace topRoomBar
-{
-namespace fonts
-{
-static const int roomName = 15;
-static const int roomDescription = 13;
+namespace topRoomBar {
+namespace fonts {
+static constexpr int roomName = 15;
+static constexpr int roomDescription = 13;
} // namespace fonts
} // namespace topRoomBar
-namespace timeline
-{
-static const int msgMargin = 11;
-static const int avatarSize = 36;
-static const int headerSpacing = 5;
-static const int headerLeftMargin = 15;
+namespace timeline {
+static constexpr int msgMargin = 11;
+static constexpr int avatarSize = 36;
+static constexpr int headerSpacing = 5;
+static constexpr int headerLeftMargin = 15;
-namespace fonts
-{
-static const int timestamp = 9;
-}
-}
+namespace fonts {
+static constexpr int timestamp = 9;
+} // namespace fonts
+} // namespace timeline
} // namespace conf
diff --git a/include/EmojiProvider.h b/include/EmojiProvider.h
index 5b6f7c88..3f91f2b3 100644
--- a/include/EmojiProvider.h
+++ b/include/EmojiProvider.h
@@ -21,7 +21,8 @@
#include <QList>
#include <QMap>
-struct Emoji {
+struct Emoji
+{
// Unicode code.
QString unicode;
// Keyboard shortcut e.g :emoji:
diff --git a/include/MatrixClient.h b/include/MatrixClient.h
index 927fe3a6..01e2c319 100644
--- a/include/MatrixClient.h
+++ b/include/MatrixClient.h
@@ -104,7 +104,8 @@ private slots:
void onResponse(QNetworkReply *reply);
private:
- enum class Endpoint {
+ enum class Endpoint
+ {
GetOwnAvatar,
GetOwnProfile,
GetProfile,
diff --git a/include/RoomInfoListItem.h b/include/RoomInfoListItem.h
index 03023038..d7009a85 100644
--- a/include/RoomInfoListItem.h
+++ b/include/RoomInfoListItem.h
@@ -26,7 +26,8 @@
#include "RoomSettings.h"
#include "RoomState.h"
-struct DescInfo {
+struct DescInfo
+{
QString username;
QString userid;
QString body;
diff --git a/include/SideBarActions.h b/include/SideBarActions.h
new file mode 100644
index 00000000..60975a03
--- /dev/null
+++ b/include/SideBarActions.h
@@ -0,0 +1,23 @@
+#include <QHBoxLayout>
+#include <QResizeEvent>
+
+#include <FlatButton.h>
+
+class SideBarActions : public QWidget
+{
+ Q_OBJECT
+
+public:
+ SideBarActions(QWidget *parent = nullptr);
+ ~SideBarActions();
+
+protected:
+ void resizeEvent(QResizeEvent *event) override;
+
+private:
+ QHBoxLayout *layout_;
+
+ FlatButton *settingsBtn_;
+ FlatButton *createRoomBtn_;
+ FlatButton *joinRoomBtn_;
+};
diff --git a/include/TimelineView.h b/include/TimelineView.h
index da73b00a..6ca91211 100644
--- a/include/TimelineView.h
+++ b/include/TimelineView.h
@@ -39,7 +39,8 @@ namespace events = matrix::events;
// Contains info about a message shown in the history view
// but not yet confirmed by the homeserver through sync.
-struct PendingMessage {
+struct PendingMessage
+{
int txn_id;
QString body;
QString event_id;
@@ -50,12 +51,12 @@ struct PendingMessage {
, body(body)
, event_id(event_id)
, widget(widget)
- {
- }
+ {}
};
// In which place new TimelineItems should be inserted.
-enum class TimelineDirection {
+enum class TimelineDirection
+{
Top,
Bottom,
};
diff --git a/include/Versions.h b/include/Versions.h
index 62584eb7..31d8af82 100644
--- a/include/Versions.h
+++ b/include/Versions.h
@@ -30,7 +30,8 @@ public:
bool isVersionSupported(unsigned int major, unsigned int minor, unsigned int patch);
private:
- struct Version_ {
+ struct Version_
+ {
unsigned int major_;
unsigned int minor_;
unsigned int patch_;
diff --git a/include/events/AliasesEventContent.h b/include/events/AliasesEventContent.h
index a60da9e8..49e51275 100644
--- a/include/events/AliasesEventContent.h
+++ b/include/events/AliasesEventContent.h
@@ -22,10 +22,8 @@
#include "Deserializable.h"
-namespace matrix
-{
-namespace events
-{
+namespace matrix {
+namespace events {
class AliasesEventContent
: public Deserializable
, public Serializable
diff --git a/include/events/AvatarEventContent.h b/include/events/AvatarEventContent.h
index d46f0420..98e2f12d 100644
--- a/include/events/AvatarEventContent.h
+++ b/include/events/AvatarEventContent.h
@@ -22,10 +22,8 @@
#include "Deserializable.h"
-namespace matrix
-{
-namespace events
-{
+namespace matrix {
+namespace events {
/*
* A picture that is associated with the room.
*/
diff --git a/include/events/CanonicalAliasEventContent.h b/include/events/CanonicalAliasEventContent.h
index 210e4a34..9c961d42 100644
--- a/include/events/CanonicalAliasEventContent.h
+++ b/include/events/CanonicalAliasEventContent.h
@@ -22,10 +22,8 @@
#include "CanonicalAliasEventContent.h"
#include "Deserializable.h"
-namespace matrix
-{
-namespace events
-{
+namespace matrix {
+namespace events {
/*
* This event is used to inform the room about which alias should be considered
* the canonical one. This could be for display purposes or as suggestion to
diff --git a/include/events/CreateEventContent.h b/include/events/CreateEventContent.h
index 7db2d367..8edc4d24 100644
--- a/include/events/CreateEventContent.h
+++ b/include/events/CreateEventContent.h
@@ -21,10 +21,8 @@
#include "Deserializable.h"
-namespace matrix
-{
-namespace events
-{
+namespace matrix {
+namespace events {
/*
* This is the first event in a room and cannot be changed. It acts as the root
* of all other events.
diff --git a/include/events/Event.h b/include/events/Event.h
index c6d2da2f..43ab4cc6 100644
--- a/include/events/Event.h
+++ b/include/events/Event.h
@@ -22,11 +22,10 @@
#include "Deserializable.h"
-namespace matrix
+namespace matrix {
+namespace events {
+enum class EventType
{
-namespace events
-{
-enum class EventType {
/// m.room.aliases
RoomAliases,
/// m.room.avatar
diff --git a/include/events/HistoryVisibilityEventContent.h b/include/events/HistoryVisibilityEventContent.h
index 53405087..94563d55 100644
--- a/include/events/HistoryVisibilityEventContent.h
+++ b/include/events/HistoryVisibilityEventContent.h
@@ -21,11 +21,10 @@
#include "Deserializable.h"
-namespace matrix
+namespace matrix {
+namespace events {
+enum class HistoryVisibility
{
-namespace events
-{
-enum class HistoryVisibility {
Invited,
Joined,
Shared,
diff --git a/include/events/JoinRulesEventContent.h b/include/events/JoinRulesEventContent.h
index 738be9d3..b9b6848d 100644
--- a/include/events/JoinRulesEventContent.h
+++ b/include/events/JoinRulesEventContent.h
@@ -21,11 +21,10 @@
#include "Deserializable.h"
-namespace matrix
+namespace matrix {
+namespace events {
+enum class JoinRule
{
-namespace events
-{
-enum class JoinRule {
// A user who wishes to join the room must first receive
// an invite to the room from someone already inside of the room.
Invite,
diff --git a/include/events/MemberEventContent.h b/include/events/MemberEventContent.h
index 5af19218..1dd703a0 100644
--- a/include/events/MemberEventContent.h
+++ b/include/events/MemberEventContent.h
@@ -22,11 +22,10 @@
#include "Deserializable.h"
-namespace matrix
+namespace matrix {
+namespace events {
+enum class Membership
{
-namespace events
-{
-enum class Membership {
// The user is banned.
Ban,
diff --git a/include/events/MessageEvent.h b/include/events/MessageEvent.h
index 1b105d62..7e7493e7 100644
--- a/include/events/MessageEvent.h
+++ b/include/events/MessageEvent.h
@@ -20,10 +20,8 @@
#include "MessageEventContent.h"
#include "RoomEvent.h"
-namespace matrix
-{
-namespace events
-{
+namespace matrix {
+namespace events {
template<class MsgContent>
class MessageEvent : public RoomEvent<MessageEventContent>
{
@@ -52,9 +50,9 @@ MessageEvent<MsgContent>::deserialize(const QJsonValue &data)
msg_content_.deserialize(data.toObject().value("content").toObject());
}
-namespace messages
+namespace messages {
+struct ThumbnailInfo
{
-struct ThumbnailInfo {
int h;
int w;
int size;
diff --git a/include/events/MessageEventContent.h b/include/events/MessageEventContent.h
index 90f6cfaf..c096f155 100644
--- a/include/events/MessageEventContent.h
+++ b/include/events/MessageEventContent.h
@@ -21,11 +21,10 @@
#include "Deserializable.h"
-namespace matrix
+namespace matrix {
+namespace events {
+enum class MessageEventType
{
-namespace events
-{
-enum class MessageEventType {
// m.audio
Audio,
diff --git a/include/events/NameEventContent.h b/include/events/NameEventContent.h
index d2cf86da..413c28cb 100644
--- a/include/events/NameEventContent.h
+++ b/include/events/NameEventContent.h
@@ -21,10 +21,8 @@
#include "Deserializable.h"
-namespace matrix
-{
-namespace events
-{
+namespace matrix {
+namespace events {
/*
* A human-friendly room name designed to be displayed to the end-user.
*/
diff --git a/include/events/PowerLevelsEventContent.h b/include/events/PowerLevelsEventContent.h
index 7cfeadf1..04afa473 100644
--- a/include/events/PowerLevelsEventContent.h
+++ b/include/events/PowerLevelsEventContent.h
@@ -22,11 +22,10 @@
#include "Deserializable.h"
-namespace matrix
+namespace matrix {
+namespace events {
+enum class PowerLevels
{
-namespace events
-{
-enum class PowerLevels {
User = 0,
Moderator = 50,
Admin = 100,
diff --git a/include/events/RoomEvent.h b/include/events/RoomEvent.h
index 540fafaf..a1e88807 100644
--- a/include/events/RoomEvent.h
+++ b/include/events/RoomEvent.h
@@ -22,10 +22,8 @@
#include "Event.h"
-namespace matrix
-{
-namespace events
-{
+namespace matrix {
+namespace events {
template<class Content>
class RoomEvent : public Event<Content>
{
diff --git a/include/events/StateEvent.h b/include/events/StateEvent.h
index 75bf1bbb..146e96bd 100644
--- a/include/events/StateEvent.h
+++ b/include/events/StateEvent.h
@@ -21,10 +21,8 @@
#include "RoomEvent.h"
-namespace matrix
-{
-namespace events
-{
+namespace matrix {
+namespace events {
template<class Content>
class StateEvent : public RoomEvent<Content>
{
diff --git a/include/events/TopicEventContent.h b/include/events/TopicEventContent.h
index b6c376e7..d059e489 100644
--- a/include/events/TopicEventContent.h
+++ b/include/events/TopicEventContent.h
@@ -21,10 +21,8 @@
#include "Deserializable.h"
-namespace matrix
-{
-namespace events
-{
+namespace matrix {
+namespace events {
/*
* A topic is a short message detailing what is currently being discussed in the
* room.
diff --git a/include/events/messages/Audio.h b/include/events/messages/Audio.h
index 41bc2496..8abdf7f2 100644
--- a/include/events/messages/Audio.h
+++ b/include/events/messages/Audio.h
@@ -21,13 +21,11 @@
#include "Deserializable.h"
-namespace matrix
+namespace matrix {
+namespace events {
+namespace messages {
+struct AudioInfo
{
-namespace events
-{
-namespace messages
-{
-struct AudioInfo {
uint64_t duration;
int size;
diff --git a/include/events/messages/Emote.h b/include/events/messages/Emote.h
index 98d049e7..a11b7c8d 100644
--- a/include/events/messages/Emote.h
+++ b/include/events/messages/Emote.h
@@ -21,12 +21,9 @@
#include "Deserializable.h"
-namespace matrix
-{
-namespace events
-{
-namespace messages
-{
+namespace matrix {
+namespace events {
+namespace messages {
class Emote : public Deserializable
{
public:
diff --git a/include/events/messages/File.h b/include/events/messages/File.h
index a4e8b6a4..ff5eb0a6 100644
--- a/include/events/messages/File.h
+++ b/include/events/messages/File.h
@@ -22,13 +22,11 @@
#include "Deserializable.h"
#include "MessageEvent.h"
-namespace matrix
+namespace matrix {
+namespace events {
+namespace messages {
+struct FileInfo
{
-namespace events
-{
-namespace messages
-{
-struct FileInfo {
int size;
QString mimetype;
diff --git a/include/events/messages/Image.h b/include/events/messages/Image.h
index 93a598e2..14889ff1 100644
--- a/include/events/messages/Image.h
+++ b/include/events/messages/Image.h
@@ -22,13 +22,11 @@
#include "Deserializable.h"
#include "MessageEvent.h"
-namespace matrix
+namespace matrix {
+namespace events {
+namespace messages {
+struct ImageInfo
{
-namespace events
-{
-namespace messages
-{
-struct ImageInfo {
int h;
int w;
int size;
diff --git a/include/events/messages/Location.h b/include/events/messages/Location.h
index 4b523878..e51c6799 100644
--- a/include/events/messages/Location.h
+++ b/include/events/messages/Location.h
@@ -22,13 +22,11 @@
#include "Deserializable.h"
#include "MessageEvent.h"
-namespace matrix
+namespace matrix {
+namespace events {
+namespace messages {
+struct LocationInfo
{
-namespace events
-{
-namespace messages
-{
-struct LocationInfo {
QString thumbnail_url;
ThumbnailInfo thumbnail_info;
};
diff --git a/include/events/messages/Notice.h b/include/events/messages/Notice.h
index b303dd79..66f4386d 100644
--- a/include/events/messages/Notice.h
+++ b/include/events/messages/Notice.h
@@ -21,12 +21,9 @@
#include "Deserializable.h"
-namespace matrix
-{
-namespace events
-{
-namespace messages
-{
+namespace matrix {
+namespace events {
+namespace messages {
class Notice : public Deserializable
{
public:
diff --git a/include/events/messages/Text.h b/include/events/messages/Text.h
index 2c787d04..c3182dc5 100644
--- a/include/events/messages/Text.h
+++ b/include/events/messages/Text.h
@@ -21,12 +21,9 @@
#include "Deserializable.h"
-namespace matrix
-{
-namespace events
-{
-namespace messages
-{
+namespace matrix {
+namespace events {
+namespace messages {
class Text : public Deserializable
{
public:
diff --git a/include/events/messages/Video.h b/include/events/messages/Video.h
index 37056c27..d167b8c1 100644
--- a/include/events/messages/Video.h
+++ b/include/events/messages/Video.h
@@ -22,13 +22,11 @@
#include "Deserializable.h"
#include "MessageEvent.h"
-namespace matrix
+namespace matrix {
+namespace events {
+namespace messages {
+struct VideoInfo
{
-namespace events
-{
-namespace messages
-{
-struct VideoInfo {
int h;
int w;
int size;
diff --git a/include/ui/SnackBar.h b/include/ui/SnackBar.h
index 076b7105..8a35c327 100644
--- a/include/ui/SnackBar.h
+++ b/include/ui/SnackBar.h
@@ -7,7 +7,8 @@
#include "OverlayWidget.h"
-enum class SnackBarPosition {
+enum class SnackBarPosition
+{
Bottom,
Top,
};
diff --git a/include/ui/Theme.h b/include/ui/Theme.h
index c2e809e5..c6c39553 100644
--- a/include/ui/Theme.h
+++ b/include/ui/Theme.h
@@ -4,12 +4,15 @@
#include <QHash>
#include <QObject>
-namespace ui
+namespace ui {
+enum class AvatarType
{
-enum class AvatarType { Icon, Image, Letter };
+ Icon,
+ Image,
+ Letter
+};
-namespace sidebar
-{
+namespace sidebar {
static const int SmallSize = 60;
static const int NormalSize = 300;
}
@@ -19,19 +22,47 @@ 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 {
+enum class Color
+{
Black,
BrightWhite,
FadedWhite,