diff --git a/include/AvatarProvider.h b/include/AvatarProvider.h
index 29c8152b..0a37ffb9 100644
--- a/include/AvatarProvider.h
+++ b/include/AvatarProvider.h
@@ -27,21 +27,21 @@
class AvatarProvider : public QObject
{
- Q_OBJECT
+ Q_OBJECT
public:
- static void init(QSharedPointer<MatrixClient> client);
- static void resolve(const QString &userId, TimelineItem *item);
- static void setAvatarUrl(const QString &userId, const QUrl &url);
+ static void init(QSharedPointer<MatrixClient> client);
+ static void resolve(const QString &userId, TimelineItem *item);
+ static void setAvatarUrl(const QString &userId, const QUrl &url);
- static void clear();
+ static void clear();
private:
- static void updateAvatar(const QString &uid, const QImage &img);
+ static void updateAvatar(const QString &uid, const QImage &img);
- static QSharedPointer<MatrixClient> client_;
- static QMap<QString, QList<TimelineItem *>> toBeResolved_;
+ static QSharedPointer<MatrixClient> client_;
+ static QMap<QString, QList<TimelineItem *>> toBeResolved_;
- static QMap<QString, QImage> userAvatars_;
- static QMap<QString, QUrl> avatarUrls_;
+ static QMap<QString, QImage> userAvatars_;
+ static QMap<QString, QUrl> avatarUrls_;
};
diff --git a/include/Config.h b/include/Config.h
index 2fdeef83..654eadb6 100644
--- a/include/Config.h
+++ b/include/Config.h
@@ -7,24 +7,24 @@
namespace conf
{
// Global settings.
-static const int fontSize = 12;
-static const int emojiSize = 14;
+static const int fontSize = 12;
+static const int emojiSize = 14;
static const int headerFontSize = 21;
// Window geometry.
namespace window
{
static const int height = 600;
-static const int width = 1066;
+static const int width = 1066;
static const int minHeight = 600;
-static const int minWidth = 950;
+static const int minWidth = 950;
}
// Button settings.
namespace btn
{
-static const int fontSize = 20;
+static const int fontSize = 20;
static const int cornerRadius = 3;
}
@@ -34,8 +34,8 @@ namespace roomlist
namespace fonts
{
static const int heading = 13;
-static const int badge = 10;
-static const int bubble = 20;
+static const int badge = 10;
+static const int bubble = 20;
} // namespace fonts
} // namespace roomlist
@@ -44,7 +44,7 @@ namespace userInfoWidget
namespace fonts
{
static const int displayName = 16;
-static const int userid = 14;
+static const int userid = 14;
} // namespace fonts
} // namespace userInfoWidget
@@ -52,16 +52,16 @@ namespace topRoomBar
{
namespace fonts
{
-static const int roomName = 15;
+static const int roomName = 15;
static const 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 msgMargin = 11;
+static const int avatarSize = 36;
+static const int headerSpacing = 5;
static const int headerLeftMargin = 15;
namespace fonts
diff --git a/include/Deserializable.h b/include/Deserializable.h
index afd4f26c..938238b9 100644
--- a/include/Deserializable.h
+++ b/include/Deserializable.h
@@ -26,36 +26,36 @@
class DeserializationException : public std::exception
{
public:
- explicit DeserializationException(const std::string &msg);
- virtual const char *what() const noexcept;
+ explicit DeserializationException(const std::string &msg);
+ virtual const char *what() const noexcept;
private:
- std::string msg_;
+ std::string msg_;
};
// JSON response structs need to implement the interface.
class Deserializable
{
public:
- virtual void deserialize(const QJsonValue &)
- {
- }
- virtual void deserialize(const QJsonObject &)
- {
- }
- virtual void deserialize(const QJsonDocument &)
- {
- }
- virtual ~Deserializable()
- {
- }
+ virtual void deserialize(const QJsonValue &)
+ {
+ }
+ virtual void deserialize(const QJsonObject &)
+ {
+ }
+ virtual void deserialize(const QJsonDocument &)
+ {
+ }
+ virtual ~Deserializable()
+ {
+ }
};
class Serializable
{
public:
- virtual QJsonObject serialize() const = 0;
- virtual ~Serializable()
- {
- }
+ virtual QJsonObject serialize() const = 0;
+ virtual ~Serializable()
+ {
+ }
};
diff --git a/include/EmojiCategory.h b/include/EmojiCategory.h
index 3a4e4e1e..e17b110b 100644
--- a/include/EmojiCategory.h
+++ b/include/EmojiCategory.h
@@ -29,32 +29,32 @@
class EmojiCategory : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
public:
- EmojiCategory(QString category, QList<Emoji> emoji, QWidget *parent = nullptr);
- ~EmojiCategory();
+ EmojiCategory(QString category, QList<Emoji> emoji, QWidget *parent = nullptr);
+ ~EmojiCategory();
signals:
- void emojiSelected(const QString &emoji);
+ void emojiSelected(const QString &emoji);
private slots:
- inline void clickIndex(const QModelIndex &);
+ inline void clickIndex(const QModelIndex &);
private:
- QVBoxLayout *mainLayout_;
+ QVBoxLayout *mainLayout_;
- QStandardItemModel *itemModel_;
- QListView *emojiListView_;
+ QStandardItemModel *itemModel_;
+ QListView *emojiListView_;
- Emoji *data_;
- EmojiItemDelegate *delegate_;
+ Emoji *data_;
+ EmojiItemDelegate *delegate_;
- QLabel *category_;
+ QLabel *category_;
};
inline void
EmojiCategory::clickIndex(const QModelIndex &index)
{
- emit emojiSelected(index.data(Qt::UserRole).toString());
+ emit emojiSelected(index.data(Qt::UserRole).toString());
}
diff --git a/include/EmojiItemDelegate.h b/include/EmojiItemDelegate.h
index d99fe2b6..15d61f49 100644
--- a/include/EmojiItemDelegate.h
+++ b/include/EmojiItemDelegate.h
@@ -25,14 +25,16 @@
class EmojiItemDelegate : public QStyledItemDelegate
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit EmojiItemDelegate(QObject *parent = nullptr);
- ~EmojiItemDelegate();
+ explicit EmojiItemDelegate(QObject *parent = nullptr);
+ ~EmojiItemDelegate();
- void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+ void paint(QPainter *painter,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &index) const override;
private:
- Emoji *data_;
+ Emoji *data_;
};
diff --git a/include/EmojiPanel.h b/include/EmojiPanel.h
index 14b7692a..360e7006 100644
--- a/include/EmojiPanel.h
+++ b/include/EmojiPanel.h
@@ -27,38 +27,38 @@
class EmojiPanel : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
public:
- EmojiPanel(QWidget *parent = nullptr);
+ EmojiPanel(QWidget *parent = nullptr);
- void fadeOut();
- void fadeIn();
+ void fadeOut();
+ void fadeIn();
signals:
- void mouseLeft();
- void emojiSelected(const QString &emoji);
+ void mouseLeft();
+ void emojiSelected(const QString &emoji);
protected:
- void leaveEvent(QEvent *event);
- void paintEvent(QPaintEvent *event);
+ void leaveEvent(QEvent *event);
+ void paintEvent(QPaintEvent *event);
private:
- void showEmojiCategory(const EmojiCategory *category);
+ void showEmojiCategory(const EmojiCategory *category);
- QPropertyAnimation *animation_;
- QGraphicsOpacityEffect *opacity_;
+ QPropertyAnimation *animation_;
+ QGraphicsOpacityEffect *opacity_;
- EmojiProvider emoji_provider_;
+ EmojiProvider emoji_provider_;
- QScrollArea *scrollArea_;
+ QScrollArea *scrollArea_;
- int shadowMargin_;
+ int shadowMargin_;
- // Panel dimensions.
- int width_;
- int height_;
+ // Panel dimensions.
+ int width_;
+ int height_;
- int animationDuration_;
- int categoryIconSize_;
+ int animationDuration_;
+ int categoryIconSize_;
};
diff --git a/include/EmojiPickButton.h b/include/EmojiPickButton.h
index 840aa5dd..041e25a6 100644
--- a/include/EmojiPickButton.h
+++ b/include/EmojiPickButton.h
@@ -25,23 +25,23 @@
class EmojiPickButton : public FlatButton
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit EmojiPickButton(QWidget *parent = nullptr);
+ explicit EmojiPickButton(QWidget *parent = nullptr);
signals:
- void emojiSelected(const QString &emoji);
+ void emojiSelected(const QString &emoji);
protected:
- void enterEvent(QEvent *e) override;
- void leaveEvent(QEvent *e) override;
+ void enterEvent(QEvent *e) override;
+ void leaveEvent(QEvent *e) override;
private:
- // Vertical distance from panel's bottom.
- int vertical_distance_ = 10;
+ // Vertical distance from panel's bottom.
+ int vertical_distance_ = 10;
- // Horizontal distance from panel's bottom right corner.
- int horizontal_distance_ = 70;
+ // Horizontal distance from panel's bottom right corner.
+ int horizontal_distance_ = 70;
- EmojiPanel *panel_;
+ EmojiPanel *panel_;
};
diff --git a/include/EmojiProvider.h b/include/EmojiProvider.h
index 40360c96..5b6f7c88 100644
--- a/include/EmojiProvider.h
+++ b/include/EmojiProvider.h
@@ -22,21 +22,21 @@
#include <QMap>
struct Emoji {
- // Unicode code.
- QString unicode;
- // Keyboard shortcut e.g :emoji:
- QString shortname;
+ // Unicode code.
+ QString unicode;
+ // Keyboard shortcut e.g :emoji:
+ QString shortname;
};
class EmojiProvider
{
public:
- static const QList<Emoji> people;
- static const QList<Emoji> nature;
- static const QList<Emoji> food;
- static const QList<Emoji> activity;
- static const QList<Emoji> travel;
- static const QList<Emoji> objects;
- static const QList<Emoji> symbols;
- static const QList<Emoji> flags;
+ static const QList<Emoji> people;
+ static const QList<Emoji> nature;
+ static const QList<Emoji> food;
+ static const QList<Emoji> activity;
+ static const QList<Emoji> travel;
+ static const QList<Emoji> objects;
+ static const QList<Emoji> symbols;
+ static const QList<Emoji> flags;
};
diff --git a/include/ImageOverlayDialog.h b/include/ImageOverlayDialog.h
index 287b2d1b..5159c665 100644
--- a/include/ImageOverlayDialog.h
+++ b/include/ImageOverlayDialog.h
@@ -23,24 +23,24 @@
class ImageOverlayDialog : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
public:
- ImageOverlayDialog(QPixmap image, QWidget *parent = nullptr);
+ ImageOverlayDialog(QPixmap image, QWidget *parent = nullptr);
protected:
- void mousePressEvent(QMouseEvent *event) override;
- void paintEvent(QPaintEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
signals:
- void closing();
+ void closing();
private:
- void scaleImage(int width, int height);
+ void scaleImage(int width, int height);
- QPixmap originalImage_;
- QPixmap image_;
+ QPixmap originalImage_;
+ QPixmap image_;
- QRect content_;
- QRect close_button_;
- QRect screen_;
+ QRect content_;
+ QRect close_button_;
+ QRect screen_;
};
diff --git a/include/InputValidator.h b/include/InputValidator.h
index 0d3e52ab..4f77033e 100644
--- a/include/InputValidator.h
+++ b/include/InputValidator.h
@@ -23,9 +23,9 @@
class InputValidator
{
public:
- // Validators for the different types of input.
- static QRegExpValidator Id;
- static QRegExpValidator Localpart;
- static QRegExpValidator Password;
- static QRegExpValidator Domain;
+ // Validators for the different types of input.
+ static QRegExpValidator Id;
+ static QRegExpValidator Localpart;
+ static QRegExpValidator Password;
+ static QRegExpValidator Domain;
};
diff --git a/include/Login.h b/include/Login.h
index 09f62a71..ceca4ebf 100644
--- a/include/Login.h
+++ b/include/Login.h
@@ -24,60 +24,60 @@
class LoginRequest
{
public:
- LoginRequest();
- LoginRequest(QString username, QString password);
+ LoginRequest();
+ LoginRequest(QString username, QString password);
- QByteArray serialize() noexcept;
+ QByteArray serialize() noexcept;
- inline void setPassword(QString password);
- inline void setUser(QString username);
+ inline void setPassword(QString password);
+ inline void setUser(QString username);
private:
- QString user_;
- QString password_;
+ QString user_;
+ QString password_;
};
inline void
LoginRequest::setPassword(QString password)
{
- password_ = password;
+ password_ = password;
}
inline void
LoginRequest::setUser(QString username)
{
- user_ = username;
+ user_ = username;
}
class LoginResponse : public Deserializable
{
public:
- void deserialize(const QJsonDocument &data) override;
+ void deserialize(const QJsonDocument &data) override;
- inline QString getAccessToken();
- inline QString getHomeServer();
- inline QString getUserId();
+ inline QString getAccessToken();
+ inline QString getHomeServer();
+ inline QString getUserId();
private:
- QString access_token_;
- QString home_server_;
- QString user_id_;
+ QString access_token_;
+ QString home_server_;
+ QString user_id_;
};
inline QString
LoginResponse::getAccessToken()
{
- return access_token_;
+ return access_token_;
}
inline QString
LoginResponse::getHomeServer()
{
- return home_server_;
+ return home_server_;
}
inline QString
LoginResponse::getUserId()
{
- return user_id_;
+ return user_id_;
}
diff --git a/include/LogoutDialog.h b/include/LogoutDialog.h
index a2d313c7..44dab17a 100644
--- a/include/LogoutDialog.h
+++ b/include/LogoutDialog.h
@@ -23,14 +23,14 @@
class LogoutDialog : public QFrame
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit LogoutDialog(QWidget *parent = nullptr);
+ explicit LogoutDialog(QWidget *parent = nullptr);
signals:
- void closing(bool isLoggingOut);
+ void closing(bool isLoggingOut);
private:
- FlatButton *confirmBtn_;
- FlatButton *cancelBtn_;
+ FlatButton *confirmBtn_;
+ FlatButton *cancelBtn_;
};
diff --git a/include/Profile.h b/include/Profile.h
index 7bb3deaa..c460efbb 100644
--- a/include/Profile.h
+++ b/include/Profile.h
@@ -25,24 +25,24 @@
class ProfileResponse : public Deserializable
{
public:
- void deserialize(const QJsonDocument &data) override;
+ void deserialize(const QJsonDocument &data) override;
- inline QUrl getAvatarUrl();
- inline QString getDisplayName();
+ inline QUrl getAvatarUrl();
+ inline QString getDisplayName();
private:
- QUrl avatar_url_;
- QString display_name_;
+ QUrl avatar_url_;
+ QString display_name_;
};
inline QUrl
ProfileResponse::getAvatarUrl()
{
- return avatar_url_;
+ return avatar_url_;
}
inline QString
ProfileResponse::getDisplayName()
{
- return display_name_;
+ return display_name_;
}
diff --git a/include/QuickSwitcher.h b/include/QuickSwitcher.h
index 6a7875f9..5cbd0f1f 100644
--- a/include/QuickSwitcher.h
+++ b/include/QuickSwitcher.h
@@ -26,44 +26,44 @@
class RoomSearchInput : public TextField
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit RoomSearchInput(QWidget *parent = nullptr);
+ explicit RoomSearchInput(QWidget *parent = nullptr);
signals:
- void selectNextCompletion();
- void selectPreviousCompletion();
- void hiding();
+ void selectNextCompletion();
+ void selectPreviousCompletion();
+ void hiding();
protected:
- void keyPressEvent(QKeyEvent *event) override;
- void hideEvent(QHideEvent *event) override;
- bool focusNextPrevChild(bool next) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void hideEvent(QHideEvent *event) override;
+ bool focusNextPrevChild(bool next) override;
};
class QuickSwitcher : public QFrame
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit QuickSwitcher(QWidget *parent = nullptr);
+ explicit QuickSwitcher(QWidget *parent = nullptr);
- void setRoomList(const QMap<QString, QString> &rooms);
+ void setRoomList(const QMap<QString, QString> &rooms);
signals:
- void closing();
- void roomSelected(const QString &roomid);
+ void closing();
+ void roomSelected(const QString &roomid);
protected:
- void keyPressEvent(QKeyEvent *event) override;
- void showEvent(QShowEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void showEvent(QShowEvent *event) override;
private:
- // Current highlighted selection from the completer.
- int selection_ = -1;
+ // Current highlighted selection from the completer.
+ int selection_ = -1;
- QVBoxLayout *topLayout_;
- RoomSearchInput *roomSearch_;
- QCompleter *completer_;
+ QVBoxLayout *topLayout_;
+ RoomSearchInput *roomSearch_;
+ QCompleter *completer_;
- QMap<QString, QString> rooms_;
+ QMap<QString, QString> rooms_;
};
diff --git a/include/Register.h b/include/Register.h
index 695595a8..eb3a3d81 100644
--- a/include/Register.h
+++ b/include/Register.h
@@ -24,60 +24,60 @@
class RegisterRequest
{
public:
- RegisterRequest();
- RegisterRequest(const QString &username, const QString &password);
+ RegisterRequest();
+ RegisterRequest(const QString &username, const QString &password);
- QByteArray serialize() noexcept;
+ QByteArray serialize() noexcept;
- inline void setPassword(QString password);
- inline void setUser(QString username);
+ inline void setPassword(QString password);
+ inline void setUser(QString username);
private:
- QString user_;
- QString password_;
+ QString user_;
+ QString password_;
};
inline void
RegisterRequest::setPassword(QString password)
{
- password_ = password;
+ password_ = password;
}
inline void
RegisterRequest::setUser(QString username)
{
- user_ = username;
+ user_ = username;
}
class RegisterResponse : public Deserializable
{
public:
- void deserialize(const QJsonDocument &data) override;
+ void deserialize(const QJsonDocument &data) override;
- inline QString getAccessToken();
- inline QString getHomeServer();
- inline QString getUserId();
+ inline QString getAccessToken();
+ inline QString getHomeServer();
+ inline QString getUserId();
private:
- QString access_token_;
- QString home_server_;
- QString user_id_;
+ QString access_token_;
+ QString home_server_;
+ QString user_id_;
};
inline QString
RegisterResponse::getAccessToken()
{
- return access_token_;
+ return access_token_;
}
inline QString
RegisterResponse::getHomeServer()
{
- return home_server_;
+ return home_server_;
}
inline QString
RegisterResponse::getUserId()
{
- return user_id_;
+ return user_id_;
}
diff --git a/include/RegisterPage.h b/include/RegisterPage.h
index 417aa6de..a42cbedd 100644
--- a/include/RegisterPage.h
+++ b/include/RegisterPage.h
@@ -31,44 +31,44 @@
class RegisterPage : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
public:
- RegisterPage(QSharedPointer<MatrixClient> client, QWidget *parent = 0);
- ~RegisterPage();
+ RegisterPage(QSharedPointer<MatrixClient> client, QWidget *parent = 0);
+ ~RegisterPage();
signals:
- void backButtonClicked();
+ void backButtonClicked();
private slots:
- void onBackButtonClicked();
- void onRegisterButtonClicked();
+ void onBackButtonClicked();
+ void onRegisterButtonClicked();
- // Display registration specific errors to the user.
- void registerError(const QString &msg);
+ // Display registration specific errors to the user.
+ void registerError(const QString &msg);
private:
- QVBoxLayout *top_layout_;
+ QVBoxLayout *top_layout_;
- QHBoxLayout *back_layout_;
- QHBoxLayout *logo_layout_;
- QHBoxLayout *button_layout_;
+ QHBoxLayout *back_layout_;
+ QHBoxLayout *logo_layout_;
+ QHBoxLayout *button_layout_;
- Avatar *logo_;
- QLabel *error_label_;
+ Avatar *logo_;
+ QLabel *error_label_;
- FlatButton *back_button_;
- RaisedButton *register_button_;
+ FlatButton *back_button_;
+ RaisedButton *register_button_;
- QWidget *form_widget_;
- QHBoxLayout *form_wrapper_;
- QVBoxLayout *form_layout_;
+ QWidget *form_widget_;
+ QHBoxLayout *form_wrapper_;
+ QVBoxLayout *form_layout_;
- TextField *username_input_;
- TextField *password_input_;
- TextField *password_confirmation_;
- TextField *server_input_;
+ TextField *username_input_;
+ TextField *password_input_;
+ TextField *password_confirmation_;
+ TextField *server_input_;
- // Matrix client API provider.
- QSharedPointer<MatrixClient> client_;
+ // Matrix client API provider.
+ QSharedPointer<MatrixClient> client_;
};
diff --git a/include/RoomInfoListItem.h b/include/RoomInfoListItem.h
index b368ab64..21001a9c 100644
--- a/include/RoomInfoListItem.h
+++ b/include/RoomInfoListItem.h
@@ -27,99 +27,102 @@
#include "RoomState.h"
struct DescInfo {
- QString username;
- QString userid;
- QString body;
- QString timestamp;
+ QString username;
+ QString userid;
+ QString body;
+ QString timestamp;
};
class RoomInfoListItem : public QWidget
{
- Q_OBJECT
+ 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();
+ ~RoomInfoListItem();
- void updateUnreadMessageCount(int count);
- void clearUnreadMessageCount();
- void setState(const RoomState &state);
+ void updateUnreadMessageCount(int count);
+ 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);
+ 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);
signals:
- void clicked(const QString &room_id);
+ void clicked(const QString &room_id);
public slots:
- void setPressedState(bool state);
+ void setPressedState(bool state);
protected:
- void mousePressEvent(QMouseEvent *event) override;
- void paintEvent(QPaintEvent *event) override;
- void resizeEvent(QResizeEvent *event) override;
- void contextMenuEvent(QContextMenuEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
+ void contextMenuEvent(QContextMenuEvent *event) override;
private:
- QString notificationText();
+ QString notificationText();
- const int Padding = 7;
- const int IconSize = 48;
+ const int Padding = 7;
+ const int IconSize = 48;
- RippleOverlay *ripple_overlay_;
+ RippleOverlay *ripple_overlay_;
- RoomState state_;
+ RoomState state_;
- QString roomId_;
- QString roomName_;
+ QString roomId_;
+ QString roomName_;
- DescInfo lastMsgInfo_;
+ DescInfo lastMsgInfo_;
- QPixmap roomAvatar_;
+ QPixmap roomAvatar_;
- Menu *menu_;
- QAction *toggleNotifications_;
+ Menu *menu_;
+ QAction *toggleNotifications_;
- QSharedPointer<RoomSettings> roomSettings_;
+ QSharedPointer<RoomSettings> roomSettings_;
- bool isPressed_ = false;
+ bool isPressed_ = false;
- int maxHeight_;
- int unreadMsgCount_ = 0;
+ int maxHeight_;
+ int unreadMsgCount_ = 0;
};
inline int
RoomInfoListItem::unreadMessageCount() const
{
- return unreadMsgCount_;
+ return unreadMsgCount_;
}
inline bool
RoomInfoListItem::isPressed() const
{
- return isPressed_;
+ return isPressed_;
}
inline RoomState
RoomInfoListItem::state() const
{
- return state_;
+ return state_;
}
inline void
RoomInfoListItem::setAvatar(const QImage &img)
{
- roomAvatar_ =
- QPixmap::fromImage(img.scaled(IconSize, IconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
- update();
+ roomAvatar_ = QPixmap::fromImage(
+ img.scaled(IconSize, IconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
+ update();
}
inline void
RoomInfoListItem::setDescriptionMessage(const DescInfo &info)
{
- lastMsgInfo_ = info;
+ lastMsgInfo_ = info;
}
diff --git a/include/RoomList.h b/include/RoomList.h
index f548400d..573f43a8 100644
--- a/include/RoomList.h
+++ b/include/RoomList.h
@@ -29,37 +29,37 @@
class RoomList : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
public:
- RoomList(QSharedPointer<MatrixClient> client, QWidget *parent = 0);
- ~RoomList();
+ RoomList(QSharedPointer<MatrixClient> client, QWidget *parent = 0);
+ ~RoomList();
- void setInitialRooms(const QMap<QString, QSharedPointer<RoomSettings>> &settings,
- const QMap<QString, RoomState> &states);
- void sync(const QMap<QString, RoomState> &states);
+ void setInitialRooms(const QMap<QString, QSharedPointer<RoomSettings>> &settings,
+ const QMap<QString, RoomState> &states);
+ void sync(const QMap<QString, RoomState> &states);
- void clear();
+ void clear();
signals:
- void roomChanged(const QString &room_id);
- void totalUnreadMessageCountUpdated(int count);
+ void roomChanged(const QString &room_id);
+ void totalUnreadMessageCountUpdated(int count);
public slots:
- void updateRoomAvatar(const QString &roomid, const QPixmap &img);
- void highlightSelectedRoom(const QString &room_id);
- void updateUnreadMessageCount(const QString &roomid, int count);
- void updateRoomDescription(const QString &roomid, const DescInfo &info);
+ void updateRoomAvatar(const QString &roomid, const QPixmap &img);
+ void highlightSelectedRoom(const QString &room_id);
+ void updateUnreadMessageCount(const QString &roomid, int count);
+ void updateRoomDescription(const QString &roomid, const DescInfo &info);
private:
- void calculateUnreadMessageCount();
+ void calculateUnreadMessageCount();
- QVBoxLayout *topLayout_;
- QVBoxLayout *contentsLayout_;
- QScrollArea *scrollArea_;
- QWidget *scrollAreaContents_;
+ QVBoxLayout *topLayout_;
+ QVBoxLayout *contentsLayout_;
+ QScrollArea *scrollArea_;
+ QWidget *scrollAreaContents_;
- QMap<QString, QSharedPointer<RoomInfoListItem>> rooms_;
+ QMap<QString, QSharedPointer<RoomInfoListItem>> rooms_;
- QSharedPointer<MatrixClient> client_;
+ QSharedPointer<MatrixClient> client_;
};
diff --git a/include/RoomMessages.h b/include/RoomMessages.h
index 1321ac8e..89d546a8 100644
--- a/include/RoomMessages.h
+++ b/include/RoomMessages.h
@@ -25,32 +25,32 @@
class RoomMessages : public Deserializable
{
public:
- void deserialize(const QJsonDocument &data) override;
+ void deserialize(const QJsonDocument &data) override;
- inline QString start() const;
- inline QString end() const;
- inline QJsonArray chunk() const;
+ inline QString start() const;
+ inline QString end() const;
+ inline QJsonArray chunk() const;
private:
- QString start_;
- QString end_;
- QJsonArray chunk_;
+ QString start_;
+ QString end_;
+ QJsonArray chunk_;
};
inline QString
RoomMessages::start() const
{
- return start_;
+ return start_;
}
inline QString
RoomMessages::end() const
{
- return end_;
+ return end_;
}
inline QJsonArray
RoomMessages::chunk() const
{
- return chunk_;
+ return chunk_;
}
diff --git a/include/RoomSettings.h b/include/RoomSettings.h
index ee74b9eb..d9ecff99 100644
--- a/include/RoomSettings.h
+++ b/include/RoomSettings.h
@@ -22,34 +22,34 @@
class RoomSettings
{
public:
- RoomSettings(QString room_id)
- {
- path_ = QString("notifications/%1").arg(room_id);
- isNotificationsEnabled_ = true;
+ RoomSettings(QString room_id)
+ {
+ path_ = QString("notifications/%1").arg(room_id);
+ isNotificationsEnabled_ = true;
- QSettings settings;
+ QSettings settings;
- if (settings.contains(path_))
- isNotificationsEnabled_ = settings.value(path_).toBool();
- else
- settings.setValue(path_, isNotificationsEnabled_);
- };
+ if (settings.contains(path_))
+ isNotificationsEnabled_ = settings.value(path_).toBool();
+ else
+ settings.setValue(path_, isNotificationsEnabled_);
+ };
- bool isNotificationsEnabled()
- {
- return isNotificationsEnabled_;
- };
+ bool isNotificationsEnabled()
+ {
+ return isNotificationsEnabled_;
+ };
- void toggleNotifications()
- {
- isNotificationsEnabled_ = !isNotificationsEnabled_;
+ void toggleNotifications()
+ {
+ isNotificationsEnabled_ = !isNotificationsEnabled_;
- QSettings settings;
- settings.setValue(path_, isNotificationsEnabled_);
- }
+ QSettings settings;
+ settings.setValue(path_, isNotificationsEnabled_);
+ }
private:
- QString path_;
+ QString path_;
- bool isNotificationsEnabled_;
+ bool isNotificationsEnabled_;
};
diff --git a/include/SlidingStackWidget.h b/include/SlidingStackWidget.h
index 51903678..c2f329d6 100644
--- a/include/SlidingStackWidget.h
+++ b/include/SlidingStackWidget.h
@@ -32,56 +32,57 @@
class SlidingStackWidget : public QStackedWidget
{
- Q_OBJECT
+ Q_OBJECT
public:
- // Defines the animation direction.
- enum class AnimationDirection { LEFT_TO_RIGHT, RIGHT_TO_LEFT, AUTOMATIC };
+ // Defines the animation direction.
+ enum class AnimationDirection { LEFT_TO_RIGHT, RIGHT_TO_LEFT, AUTOMATIC };
- SlidingStackWidget(QWidget *parent);
- ~SlidingStackWidget();
+ SlidingStackWidget(QWidget *parent);
+ ~SlidingStackWidget();
public slots:
- // Move to the next widget.
- void slideInNext();
+ // Move to the next widget.
+ void slideInNext();
- // Move to the previous widget.
- void slideInPrevious();
+ // Move to the previous widget.
+ void slideInPrevious();
- // Move to a widget by index.
- void slideInIndex(int index, AnimationDirection direction = AnimationDirection::AUTOMATIC);
+ // Move to a widget by index.
+ void slideInIndex(int index, AnimationDirection direction = AnimationDirection::AUTOMATIC);
- int getWidgetIndex(QWidget *widget);
+ int getWidgetIndex(QWidget *widget);
signals:
- // Internal signal to alert the engine for the animation's end.
- void animationFinished();
+ // Internal signal to alert the engine for the animation's end.
+ void animationFinished();
protected slots:
- // Internal slot to handle the end of the animation.
- void onAnimationFinished();
+ // Internal slot to handle the end of the animation.
+ void onAnimationFinished();
protected:
- // The method that does the main work for the widget transition.
- void slideInWidget(QWidget *widget, AnimationDirection direction = AnimationDirection::AUTOMATIC);
+ // The method that does the main work for the widget transition.
+ void slideInWidget(QWidget *widget,
+ AnimationDirection direction = AnimationDirection::AUTOMATIC);
- // Indicates whether or not the animation is active.
- bool active_;
+ // Indicates whether or not the animation is active.
+ bool active_;
- // The widget currently displayed.
- QWidget *window_;
+ // The widget currently displayed.
+ QWidget *window_;
- // The speed of the animation in milliseconds.
- int speed_;
+ // The speed of the animation in milliseconds.
+ int speed_;
- // The animation type.
- QEasingCurve::Type animation_type_;
+ // The animation type.
+ QEasingCurve::Type animation_type_;
- // Current widget's index.
- int now_;
+ // Current widget's index.
+ int now_;
- // Reference point.
- QPoint current_position_;
+ // Reference point.
+ QPoint current_position_;
- // Next widget's to show index.
- int next_;
+ // Next widget's to show index.
+ int next_;
};
diff --git a/include/Splitter.h b/include/Splitter.h
index fdaca8f7..5591fe55 100644
--- a/include/Splitter.h
+++ b/include/Splitter.h
@@ -21,15 +21,15 @@
class Splitter : public QSplitter
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit Splitter(QWidget *parent = nullptr);
+ explicit Splitter(QWidget *parent = nullptr);
private:
- void onSplitterMoved(int pos, int index);
+ void onSplitterMoved(int pos, int index);
- int moveEventLimit_ = 50;
+ int moveEventLimit_ = 50;
- int leftMoveCount_ = 0;
- int rightMoveCount_ = 0;
+ int leftMoveCount_ = 0;
+ int rightMoveCount_ = 0;
};
diff --git a/include/Sync.h b/include/Sync.h
index da81344e..420c9b6c 100644
--- a/include/Sync.h
+++ b/include/Sync.h
@@ -27,187 +27,187 @@
class Event : public Deserializable
{
public:
- inline QJsonObject content() const;
- inline QJsonObject unsigned_content() const;
+ inline QJsonObject content() const;
+ inline QJsonObject unsigned_content() const;
- inline QString sender() const;
- inline QString state_key() const;
- inline QString type() const;
- inline QString eventId() const;
+ inline QString sender() const;
+ inline QString state_key() const;
+ inline QString type() const;
+ inline QString eventId() const;
- inline uint64_t timestamp() const;
+ inline uint64_t timestamp() const;
- void deserialize(const QJsonValue &data) override;
+ void deserialize(const QJsonValue &data) override;
private:
- QJsonObject content_;
- QJsonObject unsigned_;
+ QJsonObject content_;
+ QJsonObject unsigned_;
- QString sender_;
- QString state_key_;
- QString type_;
- QString event_id_;
+ QString sender_;
+ QString state_key_;
+ QString type_;
+ QString event_id_;
- uint64_t origin_server_ts_;
+ uint64_t origin_server_ts_;
};
inline QJsonObject
Event::content() const
{
- return content_;
+ return content_;
}
inline QJsonObject
Event::unsigned_content() const
{
- return unsigned_;
+ return unsigned_;
}
inline QString
Event::sender() const
{
- return sender_;
+ return sender_;
}
inline QString
Event::state_key() const
{
- return state_key_;
+ return state_key_;
}
inline QString
Event::type() const
{
- return type_;
+ return type_;
}
inline QString
Event::eventId() const
{
- return event_id_;
+ return event_id_;
}
inline uint64_t
Event::timestamp() const
{
- return origin_server_ts_;
+ return origin_server_ts_;
}
class State : public Deserializable
{
public:
- void deserialize(const QJsonValue &data) override;
- inline QJsonArray events() const;
+ void deserialize(const QJsonValue &data) override;
+ inline QJsonArray events() const;
private:
- QJsonArray events_;
+ QJsonArray events_;
};
inline QJsonArray
State::events() const
{
- return events_;
+ return events_;
}
class Timeline : public Deserializable
{
public:
- inline QJsonArray events() const;
- inline QString previousBatch() const;
- inline bool limited() const;
+ inline QJsonArray events() const;
+ inline QString previousBatch() const;
+ inline bool limited() const;
- void deserialize(const QJsonValue &data) override;
+ void deserialize(const QJsonValue &data) override;
private:
- QJsonArray events_;
- QString prev_batch_;
- bool limited_;
+ QJsonArray events_;
+ QString prev_batch_;
+ bool limited_;
};
inline QJsonArray
Timeline::events() const
{
- return events_;
+ return events_;
}
inline QString
Timeline::previousBatch() const
{
- return prev_batch_;
+ return prev_batch_;
}
inline bool
Timeline::limited() const
{
- return limited_;
+ return limited_;
}
// TODO: Add support for ehpmeral, account_data, undread_notifications
class JoinedRoom : public Deserializable
{
public:
- inline State state() const;
- inline Timeline timeline() const;
+ inline State state() const;
+ inline Timeline timeline() const;
- void deserialize(const QJsonValue &data) override;
+ void deserialize(const QJsonValue &data) override;
private:
- State state_;
- Timeline timeline_;
- /* Ephemeral ephemeral_; */
- /* AccountData account_data_; */
- /* UnreadNotifications unread_notifications_; */
+ State state_;
+ Timeline timeline_;
+ /* Ephemeral ephemeral_; */
+ /* AccountData account_data_; */
+ /* UnreadNotifications unread_notifications_; */
};
inline State
JoinedRoom::state() const
{
- return state_;
+ return state_;
}
inline Timeline
JoinedRoom::timeline() const
{
- return timeline_;
+ return timeline_;
}
// TODO: Add support for invited and left rooms.
class Rooms : public Deserializable
{
public:
- inline QMap<QString, JoinedRoom> join() const;
- void deserialize(const QJsonValue &data) override;
+ inline QMap<QString, JoinedRoom> join() const;
+ void deserialize(const QJsonValue &data) override;
private:
- QMap<QString, JoinedRoom> join_;
+ QMap<QString, JoinedRoom> join_;
};
inline QMap<QString, JoinedRoom>
Rooms::join() const
{
- return join_;
+ return join_;
}
class SyncResponse : public Deserializable
{
public:
- void deserialize(const QJsonDocument &data) override;
- inline QString nextBatch() const;
- inline Rooms rooms() const;
+ void deserialize(const QJsonDocument &data) override;
+ inline QString nextBatch() const;
+ inline Rooms rooms() const;
private:
- QString next_batch_;
- Rooms rooms_;
+ QString next_batch_;
+ Rooms rooms_;
};
inline Rooms
SyncResponse::rooms() const
{
- return rooms_;
+ return rooms_;
}
inline QString
SyncResponse::nextBatch() const
{
- return next_batch_;
+ return next_batch_;
}
diff --git a/include/TrayIcon.h b/include/TrayIcon.h
index 7fe46ad3..2c9020c1 100644
--- a/include/TrayIcon.h
+++ b/include/TrayIcon.h
@@ -28,31 +28,31 @@
class MsgCountComposedIcon : public QIconEngine
{
public:
- MsgCountComposedIcon(const QString &filename);
+ MsgCountComposedIcon(const QString &filename);
- virtual void paint(QPainter *p, const QRect &rect, QIcon::Mode mode, QIcon::State state);
- virtual QIconEngine *clone() const;
+ virtual void paint(QPainter *p, const QRect &rect, QIcon::Mode mode, QIcon::State state);
+ virtual QIconEngine *clone() const;
- int msgCount = 0;
+ int msgCount = 0;
private:
- const int BubbleDiameter = 17;
+ const int BubbleDiameter = 17;
- QIcon icon_;
+ QIcon icon_;
};
class TrayIcon : public QSystemTrayIcon
{
- Q_OBJECT
+ Q_OBJECT
public:
- TrayIcon(const QString &filename, QWidget *parent);
+ TrayIcon(const QString &filename, QWidget *parent);
public slots:
- void setUnreadCount(int count);
+ void setUnreadCount(int count);
private:
- QAction *viewAction_;
- QAction *quitAction_;
+ QAction *viewAction_;
+ QAction *quitAction_;
- MsgCountComposedIcon *icon_;
+ MsgCountComposedIcon *icon_;
};
diff --git a/include/UserInfoWidget.h b/include/UserInfoWidget.h
index 10c770d8..25dc2265 100644
--- a/include/UserInfoWidget.h
+++ b/include/UserInfoWidget.h
@@ -29,47 +29,47 @@
class UserInfoWidget : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
public:
- UserInfoWidget(QWidget *parent = 0);
- ~UserInfoWidget();
+ UserInfoWidget(QWidget *parent = 0);
+ ~UserInfoWidget();
- void setAvatar(const QImage &img);
- void setDisplayName(const QString &name);
- void setUserId(const QString &userid);
+ void setAvatar(const QImage &img);
+ void setDisplayName(const QString &name);
+ void setUserId(const QString &userid);
- void reset();
+ void reset();
signals:
- void logout();
+ void logout();
protected:
- void resizeEvent(QResizeEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
private slots:
- void closeLogoutDialog(bool isLoggingOut);
+ void closeLogoutDialog(bool isLoggingOut);
private:
- Avatar *userAvatar_;
+ Avatar *userAvatar_;
- QHBoxLayout *topLayout_;
- QHBoxLayout *avatarLayout_;
- QVBoxLayout *textLayout_;
- QHBoxLayout *buttonLayout_;
+ QHBoxLayout *topLayout_;
+ QHBoxLayout *avatarLayout_;
+ QVBoxLayout *textLayout_;
+ QHBoxLayout *buttonLayout_;
- FlatButton *logoutButton_;
+ FlatButton *logoutButton_;
- QLabel *displayNameLabel_;
- QLabel *userIdLabel_;
+ QLabel *displayNameLabel_;
+ QLabel *userIdLabel_;
- QString display_name_;
- QString user_id_;
+ QString display_name_;
+ QString user_id_;
- QImage avatar_image_;
+ QImage avatar_image_;
- OverlayModal *logoutModal_;
- LogoutDialog *logoutDialog_;
+ OverlayModal *logoutModal_;
+ LogoutDialog *logoutDialog_;
- int logoutButtonSize_;
+ int logoutButtonSize_;
};
diff --git a/include/Versions.h b/include/Versions.h
index d751fd9a..62584eb7 100644
--- a/include/Versions.h
+++ b/include/Versions.h
@@ -25,16 +25,16 @@
class VersionsResponse : public Deserializable
{
public:
- void deserialize(const QJsonDocument &data) override;
+ void deserialize(const QJsonDocument &data) override;
- bool isVersionSupported(unsigned int major, unsigned int minor, unsigned int patch);
+ bool isVersionSupported(unsigned int major, unsigned int minor, unsigned int patch);
private:
- struct Version_ {
- unsigned int major_;
- unsigned int minor_;
- unsigned int patch_;
- };
+ struct Version_ {
+ unsigned int major_;
+ unsigned int minor_;
+ unsigned int patch_;
+ };
- QVector<Version_> supported_versions_;
+ QVector<Version_> supported_versions_;
};
diff --git a/include/WelcomePage.h b/include/WelcomePage.h
index 13d9d141..bef463c6 100644
--- a/include/WelcomePage.h
+++ b/include/WelcomePage.h
@@ -27,32 +27,32 @@
class WelcomePage : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit WelcomePage(QWidget *parent = 0);
- ~WelcomePage();
+ explicit WelcomePage(QWidget *parent = 0);
+ ~WelcomePage();
signals:
- // Notify that the user wants to login in.
- void userLogin();
+ // Notify that the user wants to login in.
+ void userLogin();
- // Notify that the user wants to register.
- void userRegister();
+ // Notify that the user wants to register.
+ void userRegister();
private slots:
- void onLoginButtonClicked();
- void onRegisterButtonClicked();
+ void onLoginButtonClicked();
+ void onRegisterButtonClicked();
private:
- QVBoxLayout *top_layout_;
- QHBoxLayout *button_layout_;
+ QVBoxLayout *top_layout_;
+ QHBoxLayout *button_layout_;
- QLabel *intro_banner_;
- QLabel *intro_text_;
+ QLabel *intro_banner_;
+ QLabel *intro_text_;
- QSpacerItem *button_spacer_;
+ QSpacerItem *button_spacer_;
- RaisedButton *register_button_;
- RaisedButton *login_button_;
+ RaisedButton *register_button_;
+ RaisedButton *login_button_;
};
diff --git a/include/events/AliasesEventContent.h b/include/events/AliasesEventContent.h
index bd7f8f9f..a60da9e8 100644
--- a/include/events/AliasesEventContent.h
+++ b/include/events/AliasesEventContent.h
@@ -31,19 +31,19 @@ class AliasesEventContent
, public Serializable
{
public:
- void deserialize(const QJsonValue &data) override;
- QJsonObject serialize() const override;
+ void deserialize(const QJsonValue &data) override;
+ QJsonObject serialize() const override;
- inline QList<QString> aliases() const;
+ inline QList<QString> aliases() const;
private:
- QList<QString> aliases_;
+ QList<QString> aliases_;
};
inline QList<QString>
AliasesEventContent::aliases() const
{
- return aliases_;
+ return aliases_;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/AvatarEventContent.h b/include/events/AvatarEventContent.h
index 03347e26..d46f0420 100644
--- a/include/events/AvatarEventContent.h
+++ b/include/events/AvatarEventContent.h
@@ -35,19 +35,19 @@ class AvatarEventContent
, public Serializable
{
public:
- void deserialize(const QJsonValue &data) override;
- QJsonObject serialize() const override;
+ void deserialize(const QJsonValue &data) override;
+ QJsonObject serialize() const override;
- inline QUrl url() const;
+ inline QUrl url() const;
private:
- QUrl url_;
+ QUrl url_;
};
inline QUrl
AvatarEventContent::url() const
{
- return url_;
+ return url_;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/CanonicalAliasEventContent.h b/include/events/CanonicalAliasEventContent.h
index bc08bcce..210e4a34 100644
--- a/include/events/CanonicalAliasEventContent.h
+++ b/include/events/CanonicalAliasEventContent.h
@@ -37,19 +37,19 @@ class CanonicalAliasEventContent
, public Serializable
{
public:
- void deserialize(const QJsonValue &data) override;
- QJsonObject serialize() const override;
+ void deserialize(const QJsonValue &data) override;
+ QJsonObject serialize() const override;
- inline QString alias() const;
+ inline QString alias() const;
private:
- QString alias_;
+ QString alias_;
};
inline QString
CanonicalAliasEventContent::alias() const
{
- return alias_;
+ return alias_;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/CreateEventContent.h b/include/events/CreateEventContent.h
index 0a401dac..dcea5fd5 100644
--- a/include/events/CreateEventContent.h
+++ b/include/events/CreateEventContent.h
@@ -34,20 +34,20 @@ class CreateEventContent
, public Serializable
{
public:
- void deserialize(const QJsonValue &data) override;
- QJsonObject serialize() const override;
+ void deserialize(const QJsonValue &data) override;
+ QJsonObject serialize() const override;
- inline QString creator() const;
+ inline QString creator() const;
private:
- // The user_id of the room creator. This is set by the homeserver.
- QString creator_;
+ // The user_id of the room creator. This is set by the homeserver.
+ QString creator_;
};
inline QString
CreateEventContent::creator() const
{
- return creator_;
+ return creator_;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/Event.h b/include/events/Event.h
index d48c20c6..c6d2da2f 100644
--- a/include/events/Event.h
+++ b/include/events/Event.h
@@ -27,30 +27,30 @@ namespace matrix
namespace events
{
enum class EventType {
- /// m.room.aliases
- RoomAliases,
- /// m.room.avatar
- RoomAvatar,
- /// m.room.canonical_alias
- RoomCanonicalAlias,
- /// m.room.create
- RoomCreate,
- /// m.room.history_visibility
- RoomHistoryVisibility,
- /// m.room.join_rules
- RoomJoinRules,
- /// m.room.member
- RoomMember,
- /// m.room.message
- RoomMessage,
- /// m.room.name
- RoomName,
- /// m.room.power_levels
- RoomPowerLevels,
- /// m.room.topic
- RoomTopic,
- // Unsupported event
- Unsupported,
+ /// m.room.aliases
+ RoomAliases,
+ /// m.room.avatar
+ RoomAvatar,
+ /// m.room.canonical_alias
+ RoomCanonicalAlias,
+ /// m.room.create
+ RoomCreate,
+ /// m.room.history_visibility
+ RoomHistoryVisibility,
+ /// m.room.join_rules
+ RoomJoinRules,
+ /// m.room.member
+ RoomMember,
+ /// m.room.message
+ RoomMessage,
+ /// m.room.name
+ RoomName,
+ /// m.room.power_levels
+ RoomPowerLevels,
+ /// m.room.topic
+ RoomTopic,
+ // Unsupported event
+ Unsupported,
};
EventType
@@ -67,92 +67,92 @@ class Event
, public Serializable
{
public:
- inline Content content() const;
- inline EventType eventType() const;
+ inline Content content() const;
+ inline EventType eventType() const;
- void deserialize(const QJsonValue &data) override;
- QJsonObject serialize() const override;
+ void deserialize(const QJsonValue &data) override;
+ QJsonObject serialize() const override;
private:
- Content content_;
- EventType type_;
+ Content content_;
+ EventType type_;
};
template<class Content>
inline Content
Event<Content>::content() const
{
- return content_;
+ return content_;
}
template<class Content>
inline EventType
Event<Content>::eventType() const
{
- return type_;
+ return type_;
}
template<class Content>
void
Event<Content>::deserialize(const QJsonValue &data)
{
- if (!data.isObject())
- throw DeserializationException("Event is not a JSON object");
+ if (!data.isObject())
+ throw DeserializationException("Event is not a JSON object");
- auto object = data.toObject();
+ auto object = data.toObject();
- content_.deserialize(object.value("content"));
- type_ = extractEventType(object);
+ content_.deserialize(object.value("content"));
+ type_ = extractEventType(object);
}
template<class Content>
QJsonObject
Event<Content>::serialize() const
{
- QJsonObject object;
-
- switch (type_) {
- case EventType::RoomAliases:
- object["type"] = "m.room.aliases";
- break;
- case EventType::RoomAvatar:
- object["type"] = "m.room.avatar";
- break;
- case EventType::RoomCanonicalAlias:
- object["type"] = "m.room.canonical_alias";
- break;
- case EventType::RoomCreate:
- object["type"] = "m.room.create";
- break;
- case EventType::RoomHistoryVisibility:
- object["type"] = "m.room.history_visibility";
- break;
- case EventType::RoomJoinRules:
- object["type"] = "m.room.join_rules";
- break;
- case EventType::RoomMember:
- object["type"] = "m.room.member";
- break;
- case EventType::RoomMessage:
- object["type"] = "m.room.message";
- break;
- case EventType::RoomName:
- object["type"] = "m.room.name";
- break;
- case EventType::RoomPowerLevels:
- object["type"] = "m.room.power_levels";
- break;
- case EventType::RoomTopic:
- object["type"] = "m.room.topic";
- break;
- case EventType::Unsupported:
- qWarning() << "Unsupported type to serialize";
- break;
- }
-
- object["content"] = content_.serialize();
-
- return object;
+ QJsonObject object;
+
+ switch (type_) {
+ case EventType::RoomAliases:
+ object["type"] = "m.room.aliases";
+ break;
+ case EventType::RoomAvatar:
+ object["type"] = "m.room.avatar";
+ break;
+ case EventType::RoomCanonicalAlias:
+ object["type"] = "m.room.canonical_alias";
+ break;
+ case EventType::RoomCreate:
+ object["type"] = "m.room.create";
+ break;
+ case EventType::RoomHistoryVisibility:
+ object["type"] = "m.room.history_visibility";
+ break;
+ case EventType::RoomJoinRules:
+ object["type"] = "m.room.join_rules";
+ break;
+ case EventType::RoomMember:
+ object["type"] = "m.room.member";
+ break;
+ case EventType::RoomMessage:
+ object["type"] = "m.room.message";
+ break;
+ case EventType::RoomName:
+ object["type"] = "m.room.name";
+ break;
+ case EventType::RoomPowerLevels:
+ object["type"] = "m.room.power_levels";
+ break;
+ case EventType::RoomTopic:
+ object["type"] = "m.room.topic";
+ break;
+ case EventType::Unsupported:
+ qWarning() << "Unsupported type to serialize";
+ break;
+ }
+
+ object["content"] = content_.serialize();
+
+ return object;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/HistoryVisibilityEventContent.h b/include/events/HistoryVisibilityEventContent.h
index d854a775..53405087 100644
--- a/include/events/HistoryVisibilityEventContent.h
+++ b/include/events/HistoryVisibilityEventContent.h
@@ -26,10 +26,10 @@ namespace matrix
namespace events
{
enum class HistoryVisibility {
- Invited,
- Joined,
- Shared,
- WorldReadable,
+ Invited,
+ Joined,
+ Shared,
+ WorldReadable,
};
class HistoryVisibilityEventContent
@@ -37,19 +37,19 @@ class HistoryVisibilityEventContent
, public Serializable
{
public:
- inline HistoryVisibility historyVisibility() const;
+ inline HistoryVisibility historyVisibility() const;
- void deserialize(const QJsonValue &data) override;
- QJsonObject serialize() const override;
+ void deserialize(const QJsonValue &data) override;
+ QJsonObject serialize() const override;
private:
- HistoryVisibility history_visibility_;
+ HistoryVisibility history_visibility_;
};
inline HistoryVisibility
HistoryVisibilityEventContent::historyVisibility() const
{
- return history_visibility_;
+ return history_visibility_;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/JoinRulesEventContent.h b/include/events/JoinRulesEventContent.h
index 702bba98..738be9d3 100644
--- a/include/events/JoinRulesEventContent.h
+++ b/include/events/JoinRulesEventContent.h
@@ -26,18 +26,18 @@ namespace matrix
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,
+ // A user who wishes to join the room must first receive
+ // an invite to the room from someone already inside of the room.
+ Invite,
- // Reserved but not yet implemented by the Matrix specification.
- Knock,
+ // Reserved but not yet implemented by the Matrix specification.
+ Knock,
- // Reserved but not yet implemented by the Matrix specification.
- Private,
+ // Reserved but not yet implemented by the Matrix specification.
+ Private,
- /// Anyone can join the room without any prior action.
- Public,
+ /// Anyone can join the room without any prior action.
+ Public,
};
/*
@@ -49,19 +49,19 @@ class JoinRulesEventContent
, public Serializable
{
public:
- void deserialize(const QJsonValue &data) override;
- QJsonObject serialize() const override;
+ void deserialize(const QJsonValue &data) override;
+ QJsonObject serialize() const override;
- inline JoinRule joinRule() const;
+ inline JoinRule joinRule() const;
private:
- JoinRule join_rule_;
+ JoinRule join_rule_;
};
inline JoinRule
JoinRulesEventContent::joinRule() const
{
- return join_rule_;
+ return join_rule_;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/MemberEventContent.h b/include/events/MemberEventContent.h
index 2dd133ea..5af19218 100644
--- a/include/events/MemberEventContent.h
+++ b/include/events/MemberEventContent.h
@@ -27,20 +27,20 @@ namespace matrix
namespace events
{
enum class Membership {
- // The user is banned.
- Ban,
+ // The user is banned.
+ Ban,
- // The user has been invited.
- Invite,
+ // The user has been invited.
+ Invite,
- // The user has joined.
- Join,
+ // The user has joined.
+ Join,
- // The user has requested to join.
- Knock,
+ // The user has requested to join.
+ Knock,
- // The user has left.
- Leave,
+ // The user has left.
+ Leave,
};
/*
@@ -52,35 +52,35 @@ class MemberEventContent
, public Serializable
{
public:
- void deserialize(const QJsonValue &data) override;
- QJsonObject serialize() const override;
+ void deserialize(const QJsonValue &data) override;
+ QJsonObject serialize() const override;
- inline QUrl avatarUrl() const;
- inline QString displayName() const;
- inline Membership membershipState() const;
+ inline QUrl avatarUrl() const;
+ inline QString displayName() const;
+ inline Membership membershipState() const;
private:
- QUrl avatar_url_;
- QString display_name_;
- Membership membership_state_;
+ QUrl avatar_url_;
+ QString display_name_;
+ Membership membership_state_;
};
inline QUrl
MemberEventContent::avatarUrl() const
{
- return avatar_url_;
+ return avatar_url_;
}
inline QString
MemberEventContent::displayName() const
{
- return display_name_;
+ return display_name_;
}
inline Membership
MemberEventContent::membershipState() const
{
- return membership_state_;
+ return membership_state_;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/MessageEvent.h b/include/events/MessageEvent.h
index 24e236e3..1b105d62 100644
--- a/include/events/MessageEvent.h
+++ b/include/events/MessageEvent.h
@@ -28,38 +28,38 @@ template<class MsgContent>
class MessageEvent : public RoomEvent<MessageEventContent>
{
public:
- inline MsgContent msgContent() const;
+ inline MsgContent msgContent() const;
- void deserialize(const QJsonValue &data) override;
+ void deserialize(const QJsonValue &data) override;
private:
- MsgContent msg_content_;
+ MsgContent msg_content_;
};
template<class MsgContent>
inline MsgContent
MessageEvent<MsgContent>::msgContent() const
{
- return msg_content_;
+ return msg_content_;
}
template<class MsgContent>
void
MessageEvent<MsgContent>::deserialize(const QJsonValue &data)
{
- RoomEvent<MessageEventContent>::deserialize(data);
+ RoomEvent<MessageEventContent>::deserialize(data);
- msg_content_.deserialize(data.toObject().value("content").toObject());
+ msg_content_.deserialize(data.toObject().value("content").toObject());
}
namespace messages
{
struct ThumbnailInfo {
- int h;
- int w;
- int size;
+ int h;
+ int w;
+ int size;
- QString mimetype;
+ QString mimetype;
};
} // namespace messages
} // namespace events
diff --git a/include/events/MessageEventContent.h b/include/events/MessageEventContent.h
index 9f20809d..90f6cfaf 100644
--- a/include/events/MessageEventContent.h
+++ b/include/events/MessageEventContent.h
@@ -26,32 +26,32 @@ namespace matrix
namespace events
{
enum class MessageEventType {
- // m.audio
- Audio,
+ // m.audio
+ Audio,
- // m.emote
- Emote,
+ // m.emote
+ Emote,
- // m.file
- File,
+ // m.file
+ File,
- // m.image
- Image,
+ // m.image
+ Image,
- // m.location
- Location,
+ // m.location
+ Location,
- // m.notice
- Notice,
+ // m.notice
+ Notice,
- // m.text
- Text,
+ // m.text
+ Text,
- // m.video
- Video,
+ // m.video
+ Video,
- // Unrecognized message type
- Unknown,
+ // Unrecognized message type
+ Unknown,
};
MessageEventType
@@ -62,19 +62,19 @@ class MessageEventContent
, public Serializable
{
public:
- void deserialize(const QJsonValue &data) override;
- QJsonObject serialize() const override;
+ void deserialize(const QJsonValue &data) override;
+ QJsonObject serialize() const override;
- inline QString body() const;
+ inline QString body() const;
private:
- QString body_;
+ QString body_;
};
inline QString
MessageEventContent::body() const
{
- return body_;
+ return body_;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/NameEventContent.h b/include/events/NameEventContent.h
index e290a696..d2cf86da 100644
--- a/include/events/NameEventContent.h
+++ b/include/events/NameEventContent.h
@@ -34,19 +34,19 @@ class NameEventContent
, public Serializable
{
public:
- void deserialize(const QJsonValue &data) override;
- QJsonObject serialize() const override;
+ void deserialize(const QJsonValue &data) override;
+ QJsonObject serialize() const override;
- inline QString name() const;
+ inline QString name() const;
private:
- QString name_;
+ QString name_;
};
inline QString
NameEventContent::name() const
{
- return name_;
+ return name_;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/PowerLevelsEventContent.h b/include/events/PowerLevelsEventContent.h
index 3a9d80d1..7cfeadf1 100644
--- a/include/events/PowerLevelsEventContent.h
+++ b/include/events/PowerLevelsEventContent.h
@@ -27,9 +27,9 @@ namespace matrix
namespace events
{
enum class PowerLevels {
- User = 0,
- Moderator = 50,
- Admin = 100,
+ User = 0,
+ Moderator = 50,
+ Admin = 100,
};
/*
@@ -41,75 +41,75 @@ class PowerLevelsEventContent
, public Serializable
{
public:
- void deserialize(const QJsonValue &data) override;
- QJsonObject serialize() const override;
+ 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;
+ inline int banLevel() const;
+ inline int inviteLevel() const;
+ inline int kickLevel() const;
+ inline int redactLevel() const;
- inline int eventsDefaultLevel() const;
- inline int stateDefaultLevel() const;
- inline int usersDefaultLevel() const;
+ inline int eventsDefaultLevel() const;
+ inline int stateDefaultLevel() const;
+ inline int usersDefaultLevel() const;
- int eventLevel(QString event_type) const;
- int userLevel(QString user_id) const;
+ int eventLevel(QString event_type) const;
+ int userLevel(QString user_id) const;
private:
- int ban_ = static_cast<int>(PowerLevels::Moderator);
- int invite_ = static_cast<int>(PowerLevels::Moderator);
- int kick_ = static_cast<int>(PowerLevels::Moderator);
- int redact_ = static_cast<int>(PowerLevels::Moderator);
+ int ban_ = static_cast<int>(PowerLevels::Moderator);
+ int invite_ = static_cast<int>(PowerLevels::Moderator);
+ int kick_ = static_cast<int>(PowerLevels::Moderator);
+ int redact_ = static_cast<int>(PowerLevels::Moderator);
- int events_default_ = static_cast<int>(PowerLevels::User);
- int state_default_ = static_cast<int>(PowerLevels::Moderator);
- int users_default_ = static_cast<int>(PowerLevels::User);
+ int events_default_ = static_cast<int>(PowerLevels::User);
+ int state_default_ = static_cast<int>(PowerLevels::Moderator);
+ int users_default_ = static_cast<int>(PowerLevels::User);
- QMap<QString, int> events_;
- QMap<QString, int> users_;
+ QMap<QString, int> events_;
+ QMap<QString, int> users_;
};
inline int
PowerLevelsEventContent::banLevel() const
{
- return ban_;
+ return ban_;
}
inline int
PowerLevelsEventContent::inviteLevel() const
{
- return invite_;
+ return invite_;
}
inline int
PowerLevelsEventContent::kickLevel() const
{
- return kick_;
+ return kick_;
}
inline int
PowerLevelsEventContent::redactLevel() const
{
- return redact_;
+ return redact_;
}
inline int
PowerLevelsEventContent::eventsDefaultLevel() const
{
- return events_default_;
+ return events_default_;
}
inline int
PowerLevelsEventContent::stateDefaultLevel() const
{
- return state_default_;
+ return state_default_;
}
inline int
PowerLevelsEventContent::usersDefaultLevel() const
{
- return users_default_;
+ return users_default_;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/RoomEvent.h b/include/events/RoomEvent.h
index b4bc78fe..540fafaf 100644
--- a/include/events/RoomEvent.h
+++ b/include/events/RoomEvent.h
@@ -30,89 +30,89 @@ 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;
+ inline QString eventId() const;
+ inline QString roomId() const;
+ inline QString sender() const;
+ inline uint64_t timestamp() const;
- void deserialize(const QJsonValue &data) override;
- QJsonObject serialize() const override;
+ void deserialize(const QJsonValue &data) override;
+ QJsonObject serialize() const override;
private:
- QString event_id_;
- QString room_id_;
- QString sender_;
+ QString event_id_;
+ QString room_id_;
+ QString sender_;
- uint64_t origin_server_ts_;
+ uint64_t origin_server_ts_;
};
template<class Content>
inline QString
RoomEvent<Content>::eventId() const
{
- return event_id_;
+ return event_id_;
}
template<class Content>
inline QString
RoomEvent<Content>::roomId() const
{
- return room_id_;
+ return room_id_;
}
template<class Content>
inline QString
RoomEvent<Content>::sender() const
{
- return sender_;
+ return sender_;
}
template<class Content>
inline uint64_t
RoomEvent<Content>::timestamp() const
{
- return origin_server_ts_;
+ return origin_server_ts_;
}
template<class Content>
void
RoomEvent<Content>::deserialize(const QJsonValue &data)
{
- Event<Content>::deserialize(data);
+ Event<Content>::deserialize(data);
- auto object = data.toObject();
+ auto object = data.toObject();
- if (!object.contains("event_id"))
- throw DeserializationException("event_id key is missing");
+ if (!object.contains("event_id"))
+ throw DeserializationException("event_id key is missing");
- if (!object.contains("origin_server_ts"))
- throw DeserializationException("origin_server_ts key is missing");
+ if (!object.contains("origin_server_ts"))
+ throw DeserializationException("origin_server_ts key is missing");
- // FIXME: Synapse doesn't include room id?!
- /* if (!object.contains("room_id")) */
- /* throw DeserializationException("room_id key is missing"); */
+ // FIXME: Synapse doesn't include room id?!
+ /* if (!object.contains("room_id")) */
+ /* throw DeserializationException("room_id key is missing"); */
- if (!object.contains("sender"))
- throw DeserializationException("sender key is missing");
+ if (!object.contains("sender"))
+ throw DeserializationException("sender key is missing");
- event_id_ = object.value("event_id").toString();
- room_id_ = object.value("room_id").toString();
- sender_ = object.value("sender").toString();
- origin_server_ts_ = object.value("origin_server_ts").toDouble();
+ event_id_ = object.value("event_id").toString();
+ room_id_ = object.value("room_id").toString();
+ sender_ = object.value("sender").toString();
+ origin_server_ts_ = object.value("origin_server_ts").toDouble();
}
template<class Content>
QJsonObject
RoomEvent<Content>::serialize() const
{
- QJsonObject object = Event<Content>::serialize();
+ QJsonObject object = Event<Content>::serialize();
- object["event_id"] = event_id_;
- object["room_id"] = room_id_;
- object["sender"] = sender_;
- object["origin_server_ts"] = QJsonValue(static_cast<qint64>(origin_server_ts_));
+ object["event_id"] = event_id_;
+ object["room_id"] = room_id_;
+ object["sender"] = sender_;
+ object["origin_server_ts"] = QJsonValue(static_cast<qint64>(origin_server_ts_));
- return object;
+ return object;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/StateEvent.h b/include/events/StateEvent.h
index e5cd4c10..75bf1bbb 100644
--- a/include/events/StateEvent.h
+++ b/include/events/StateEvent.h
@@ -29,62 +29,62 @@ template<class Content>
class StateEvent : public RoomEvent<Content>
{
public:
- inline QString stateKey() const;
- inline Content previousContent() const;
+ inline QString stateKey() const;
+ inline Content previousContent() const;
- void deserialize(const QJsonValue &data);
- QJsonObject serialize() const;
+ void deserialize(const QJsonValue &data);
+ QJsonObject serialize() const;
private:
- QString state_key_;
- Content prev_content_;
+ QString state_key_;
+ Content prev_content_;
};
template<class Content>
inline QString
StateEvent<Content>::stateKey() const
{
- return state_key_;
+ return state_key_;
}
template<class Content>
inline Content
StateEvent<Content>::previousContent() const
{
- return prev_content_;
+ return prev_content_;
}
template<class Content>
void
StateEvent<Content>::deserialize(const QJsonValue &data)
{
- RoomEvent<Content>::deserialize(data);
+ RoomEvent<Content>::deserialize(data);
- auto object = data.toObject();
+ auto object = data.toObject();
- if (!object.contains("state_key"))
- throw DeserializationException("state_key key is missing");
+ if (!object.contains("state_key"))
+ throw DeserializationException("state_key key is missing");
- state_key_ = object.value("state_key").toString();
+ state_key_ = object.value("state_key").toString();
- if (object.contains("prev_content"))
- prev_content_.deserialize(object.value("prev_content"));
+ if (object.contains("prev_content"))
+ prev_content_.deserialize(object.value("prev_content"));
}
template<class Content>
QJsonObject
StateEvent<Content>::serialize() const
{
- QJsonObject object = RoomEvent<Content>::serialize();
+ QJsonObject object = RoomEvent<Content>::serialize();
- object["state_key"] = state_key_;
+ object["state_key"] = state_key_;
- auto prev = prev_content_.serialize();
+ auto prev = prev_content_.serialize();
- if (!prev.isEmpty())
- object["prev_content"] = prev;
+ if (!prev.isEmpty())
+ object["prev_content"] = prev;
- return object;
+ return object;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/TopicEventContent.h b/include/events/TopicEventContent.h
index e8f3d7a4..c393b3ef 100644
--- a/include/events/TopicEventContent.h
+++ b/include/events/TopicEventContent.h
@@ -34,19 +34,19 @@ class TopicEventContent
, public Serializable
{
public:
- void deserialize(const QJsonValue &data) override;
- QJsonObject serialize() const override;
+ void deserialize(const QJsonValue &data) override;
+ QJsonObject serialize() const override;
- inline QString topic() const;
+ inline QString topic() const;
private:
- QString topic_;
+ QString topic_;
};
inline QString
TopicEventContent::topic() const
{
- return topic_;
+ return topic_;
}
} // namespace events
} // namespace matrix
diff --git a/include/events/messages/Audio.h b/include/events/messages/Audio.h
index 1f289dbb..41bc2496 100644
--- a/include/events/messages/Audio.h
+++ b/include/events/messages/Audio.h
@@ -28,35 +28,35 @@ namespace events
namespace messages
{
struct AudioInfo {
- uint64_t duration;
- int size;
+ uint64_t duration;
+ int size;
- QString mimetype;
+ QString mimetype;
};
class Audio : public Deserializable
{
public:
- inline QString url() const;
- inline AudioInfo info() const;
+ inline QString url() const;
+ inline AudioInfo info() const;
- void deserialize(const QJsonObject &object) override;
+ void deserialize(const QJsonObject &object) override;
private:
- QString url_;
- AudioInfo info_;
+ QString url_;
+ AudioInfo info_;
};
inline QString
Audio::url() const
{
- return url_;
+ return url_;
}
inline AudioInfo
Audio::info() const
{
- return info_;
+ return info_;
}
} // namespace messages
diff --git a/include/events/messages/Emote.h b/include/events/messages/Emote.h
index b3af8a5f..98d049e7 100644
--- a/include/events/messages/Emote.h
+++ b/include/events/messages/Emote.h
@@ -30,7 +30,7 @@ namespace messages
class Emote : public Deserializable
{
public:
- void deserialize(const QJsonObject &obj) override;
+ void deserialize(const QJsonObject &obj) override;
};
} // namespace messages
} // namespace events
diff --git a/include/events/messages/File.h b/include/events/messages/File.h
index 22cad8be..a4e8b6a4 100644
--- a/include/events/messages/File.h
+++ b/include/events/messages/File.h
@@ -29,46 +29,46 @@ namespace events
namespace messages
{
struct FileInfo {
- int size;
+ int size;
- QString mimetype;
- QString thumbnail_url;
- ThumbnailInfo thumbnail_info;
+ QString mimetype;
+ QString thumbnail_url;
+ ThumbnailInfo thumbnail_info;
};
class File : public Deserializable
{
public:
- inline QString url() const;
- inline QString filename() const;
+ inline QString url() const;
+ inline QString filename() const;
- inline FileInfo info() const;
+ inline FileInfo info() const;
- void deserialize(const QJsonObject &object) override;
+ void deserialize(const QJsonObject &object) override;
private:
- QString url_;
- QString filename_;
+ QString url_;
+ QString filename_;
- FileInfo info_;
+ FileInfo info_;
};
inline QString
File::filename() const
{
- return filename_;
+ return filename_;
}
inline QString
File::url() const
{
- return url_;
+ return url_;
}
inline FileInfo
File::info() const
{
- return info_;
+ return info_;
}
} // namespace messages
diff --git a/include/events/messages/Image.h b/include/events/messages/Image.h
index 79360050..93a598e2 100644
--- a/include/events/messages/Image.h
+++ b/include/events/messages/Image.h
@@ -29,38 +29,38 @@ namespace events
namespace messages
{
struct ImageInfo {
- int h;
- int w;
- int size;
+ int h;
+ int w;
+ int size;
- QString mimetype;
- QString thumbnail_url;
- ThumbnailInfo thumbnail_info;
+ QString mimetype;
+ QString thumbnail_url;
+ ThumbnailInfo thumbnail_info;
};
class Image : public Deserializable
{
public:
- inline QString url() const;
- inline ImageInfo info() const;
+ inline QString url() const;
+ inline ImageInfo info() const;
- void deserialize(const QJsonObject &object) override;
+ void deserialize(const QJsonObject &object) override;
private:
- QString url_;
- ImageInfo info_;
+ QString url_;
+ ImageInfo info_;
};
inline QString
Image::url() const
{
- return url_;
+ return url_;
}
inline ImageInfo
Image::info() const
{
- return info_;
+ return info_;
}
} // namespace messages
diff --git a/include/events/messages/Location.h b/include/events/messages/Location.h
index 864c5111..4b523878 100644
--- a/include/events/messages/Location.h
+++ b/include/events/messages/Location.h
@@ -29,34 +29,34 @@ namespace events
namespace messages
{
struct LocationInfo {
- QString thumbnail_url;
- ThumbnailInfo thumbnail_info;
+ QString thumbnail_url;
+ ThumbnailInfo thumbnail_info;
};
class Location : public Deserializable
{
public:
- inline QString geoUri() const;
- inline LocationInfo info() const;
+ inline QString geoUri() const;
+ inline LocationInfo info() const;
- void deserialize(const QJsonObject &object) override;
+ void deserialize(const QJsonObject &object) override;
private:
- QString geo_uri_;
+ QString geo_uri_;
- LocationInfo info_;
+ LocationInfo info_;
};
inline QString
Location::geoUri() const
{
- return geo_uri_;
+ return geo_uri_;
}
inline LocationInfo
Location::info() const
{
- return info_;
+ return info_;
}
} // namespace messages
diff --git a/include/events/messages/Notice.h b/include/events/messages/Notice.h
index 0b2a92e3..b303dd79 100644
--- a/include/events/messages/Notice.h
+++ b/include/events/messages/Notice.h
@@ -30,7 +30,7 @@ namespace messages
class Notice : public Deserializable
{
public:
- void deserialize(const QJsonObject &obj) override;
+ void deserialize(const QJsonObject &obj) override;
};
} // namespace messages
} // namespace events
diff --git a/include/events/messages/Text.h b/include/events/messages/Text.h
index 8950e994..2c787d04 100644
--- a/include/events/messages/Text.h
+++ b/include/events/messages/Text.h
@@ -30,7 +30,7 @@ namespace messages
class Text : public Deserializable
{
public:
- void deserialize(const QJsonObject &obj) override;
+ void deserialize(const QJsonObject &obj) override;
};
} // namespace messages
} // namespace events
diff --git a/include/events/messages/Video.h b/include/events/messages/Video.h
index 2b160bea..37056c27 100644
--- a/include/events/messages/Video.h
+++ b/include/events/messages/Video.h
@@ -29,39 +29,39 @@ namespace events
namespace messages
{
struct VideoInfo {
- int h;
- int w;
- int size;
- int duration;
+ int h;
+ int w;
+ int size;
+ int duration;
- QString mimetype;
- QString thumbnail_url;
- ThumbnailInfo thumbnail_info;
+ QString mimetype;
+ QString thumbnail_url;
+ ThumbnailInfo thumbnail_info;
};
class Video : public Deserializable
{
public:
- inline QString url() const;
- inline VideoInfo info() const;
+ inline QString url() const;
+ inline VideoInfo info() const;
- void deserialize(const QJsonObject &object) override;
+ void deserialize(const QJsonObject &object) override;
private:
- QString url_;
- VideoInfo info_;
+ QString url_;
+ VideoInfo info_;
};
inline QString
Video::url() const
{
- return url_;
+ return url_;
}
inline VideoInfo
Video::info() const
{
- return info_;
+ return info_;
}
} // namespace messages
diff --git a/include/ui/Avatar.h b/include/ui/Avatar.h
index b99ee683..dc089139 100644
--- a/include/ui/Avatar.h
+++ b/include/ui/Avatar.h
@@ -9,40 +9,40 @@
class Avatar : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
- Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
- Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
+ Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
+ Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
public:
- explicit Avatar(QWidget *parent = 0);
- ~Avatar();
+ explicit Avatar(QWidget *parent = 0);
+ ~Avatar();
- void setBackgroundColor(const QColor &color);
- void setIcon(const QIcon &icon);
- void setImage(const QImage &image);
- void setLetter(const QChar &letter);
- void setSize(int size);
- void setTextColor(const QColor &color);
+ void setBackgroundColor(const QColor &color);
+ void setIcon(const QIcon &icon);
+ void setImage(const QImage &image);
+ void setLetter(const QChar &letter);
+ void setSize(int size);
+ void setTextColor(const QColor &color);
- QColor backgroundColor() const;
- QColor textColor() const;
- int size() const;
+ QColor backgroundColor() const;
+ QColor textColor() const;
+ int size() const;
- QSize sizeHint() const override;
+ QSize sizeHint() const override;
protected:
- void paintEvent(QPaintEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
private:
- void init();
-
- ui::AvatarType type_;
- QChar letter_;
- QColor background_color_;
- QColor text_color_;
- QIcon icon_;
- QImage image_;
- QPixmap pixmap_;
- int size_;
+ void init();
+
+ ui::AvatarType type_;
+ QChar letter_;
+ QColor background_color_;
+ QColor text_color_;
+ QIcon icon_;
+ QImage image_;
+ QPixmap pixmap_;
+ int size_;
};
diff --git a/include/ui/Badge.h b/include/ui/Badge.h
index b994cfdf..4084247e 100644
--- a/include/ui/Badge.h
+++ b/include/ui/Badge.h
@@ -9,55 +9,55 @@
class Badge : public OverlayWidget
{
- Q_OBJECT
+ Q_OBJECT
- Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
- Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
- Q_PROPERTY(QPointF relativePosition WRITE setRelativePosition READ relativePosition)
+ Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
+ Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
+ Q_PROPERTY(QPointF relativePosition WRITE setRelativePosition READ relativePosition)
public:
- explicit Badge(QWidget *parent = 0);
- explicit Badge(const QIcon &icon, QWidget *parent = 0);
- explicit Badge(const QString &text, QWidget *parent = 0);
- ~Badge();
-
- void setBackgroundColor(const QColor &color);
- void setTextColor(const QColor &color);
- void setIcon(const QIcon &icon);
- void setRelativePosition(const QPointF &pos);
- void setRelativePosition(qreal x, qreal y);
- void setRelativeXPosition(qreal x);
- void setRelativeYPosition(qreal y);
- void setText(const QString &text);
- void setDiameter(int diameter);
-
- QIcon icon() const;
- QString text() const;
- QColor backgroundColor() const;
- QColor textColor() const;
- QPointF relativePosition() const;
- QSize sizeHint() const override;
- qreal relativeXPosition() const;
- qreal relativeYPosition() const;
-
- int diameter() const;
+ explicit Badge(QWidget *parent = 0);
+ explicit Badge(const QIcon &icon, QWidget *parent = 0);
+ explicit Badge(const QString &text, QWidget *parent = 0);
+ ~Badge();
+
+ void setBackgroundColor(const QColor &color);
+ void setTextColor(const QColor &color);
+ void setIcon(const QIcon &icon);
+ void setRelativePosition(const QPointF &pos);
+ void setRelativePosition(qreal x, qreal y);
+ void setRelativeXPosition(qreal x);
+ void setRelativeYPosition(qreal y);
+ void setText(const QString &text);
+ void setDiameter(int diameter);
+
+ QIcon icon() const;
+ QString text() const;
+ QColor backgroundColor() const;
+ QColor textColor() const;
+ QPointF relativePosition() const;
+ QSize sizeHint() const override;
+ qreal relativeXPosition() const;
+ qreal relativeYPosition() const;
+
+ int diameter() const;
protected:
- void paintEvent(QPaintEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
private:
- void init();
+ void init();
- QColor background_color_;
- QColor text_color_;
+ QColor background_color_;
+ QColor text_color_;
- QIcon icon_;
- QSize size_;
- QString text_;
+ QIcon icon_;
+ QSize size_;
+ QString text_;
- int padding_;
- int diameter_;
+ int padding_;
+ int diameter_;
- qreal x_;
- qreal y_;
+ qreal x_;
+ qreal y_;
};
diff --git a/include/ui/DropShadow.h b/include/ui/DropShadow.h
index 3054d7dd..b7ba1985 100644
--- a/include/ui/DropShadow.h
+++ b/include/ui/DropShadow.h
@@ -7,97 +7,105 @@
class DropShadow
{
public:
- static void draw(QPainter &painter,
- qint16 margin,
- qreal radius,
- QColor start,
- QColor end,
- qreal startPosition,
- qreal endPosition0,
- qreal endPosition1,
- qreal width,
- qreal height)
- {
- painter.setPen(Qt::NoPen);
+ static void draw(QPainter &painter,
+ qint16 margin,
+ qreal radius,
+ QColor start,
+ QColor end,
+ qreal startPosition,
+ qreal endPosition0,
+ qreal endPosition1,
+ qreal width,
+ qreal height)
+ {
+ painter.setPen(Qt::NoPen);
- QLinearGradient gradient;
- gradient.setColorAt(startPosition, start);
- gradient.setColorAt(endPosition0, end);
+ QLinearGradient gradient;
+ gradient.setColorAt(startPosition, start);
+ gradient.setColorAt(endPosition0, end);
- // Right
- QPointF right0(width - margin, height / 2);
- QPointF right1(width, height / 2);
- 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);
+ // Right
+ QPointF right0(width - margin, height / 2);
+ QPointF right1(width, height / 2);
+ 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);
- // Left
- QPointF left0(margin, height / 2);
- QPointF left1(0, height / 2);
- gradient.setStart(left0);
- gradient.setFinalStop(left1);
- painter.setBrush(QBrush(gradient));
- painter.drawRoundRect(QRectF(QPointF(margin * radius, margin), QPointF(0, height - margin)), 0.0, 0.0);
+ // Left
+ QPointF left0(margin, height / 2);
+ QPointF left1(0, height / 2);
+ gradient.setStart(left0);
+ gradient.setFinalStop(left1);
+ painter.setBrush(QBrush(gradient));
+ painter.drawRoundRect(
+ QRectF(QPointF(margin * radius, margin), QPointF(0, height - margin)), 0.0, 0.0);
- // Top
- QPointF top0(width / 2, margin);
- QPointF top1(width / 2, 0);
- gradient.setStart(top0);
- gradient.setFinalStop(top1);
- painter.setBrush(QBrush(gradient));
- painter.drawRoundRect(QRectF(QPointF(width - margin, 0), QPointF(margin, margin)), 0.0, 0.0);
+ // Top
+ QPointF top0(width / 2, margin);
+ QPointF top1(width / 2, 0);
+ gradient.setStart(top0);
+ gradient.setFinalStop(top1);
+ painter.setBrush(QBrush(gradient));
+ painter.drawRoundRect(
+ QRectF(QPointF(width - margin, 0), QPointF(margin, margin)), 0.0, 0.0);
- // Bottom
- QPointF bottom0(width / 2, height - margin);
- QPointF bottom1(width / 2, height);
- 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);
+ // Bottom
+ QPointF bottom0(width / 2, height - margin);
+ QPointF bottom1(width / 2, height);
+ 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);
- // BottomRight
- QPointF bottomright0(width - margin, height - margin);
- QPointF bottomright1(width, height);
- gradient.setStart(bottomright0);
- gradient.setFinalStop(bottomright1);
- gradient.setColorAt(endPosition1, end);
- painter.setBrush(QBrush(gradient));
- painter.drawRoundRect(QRectF(bottomright0, bottomright1), 0.0, 0.0);
+ // BottomRight
+ QPointF bottomright0(width - margin, height - margin);
+ QPointF bottomright1(width, height);
+ gradient.setStart(bottomright0);
+ gradient.setFinalStop(bottomright1);
+ gradient.setColorAt(endPosition1, end);
+ painter.setBrush(QBrush(gradient));
+ painter.drawRoundRect(QRectF(bottomright0, bottomright1), 0.0, 0.0);
- // BottomLeft
- QPointF bottomleft0(margin, height - margin);
- QPointF bottomleft1(0, height);
- gradient.setStart(bottomleft0);
- gradient.setFinalStop(bottomleft1);
- gradient.setColorAt(endPosition1, end);
- painter.setBrush(QBrush(gradient));
- painter.drawRoundRect(QRectF(bottomleft0, bottomleft1), 0.0, 0.0);
+ // BottomLeft
+ QPointF bottomleft0(margin, height - margin);
+ QPointF bottomleft1(0, height);
+ gradient.setStart(bottomleft0);
+ gradient.setFinalStop(bottomleft1);
+ gradient.setColorAt(endPosition1, end);
+ painter.setBrush(QBrush(gradient));
+ painter.drawRoundRect(QRectF(bottomleft0, bottomleft1), 0.0, 0.0);
- // TopLeft
- QPointF topleft0(margin, margin);
- QPointF topleft1(0, 0);
- gradient.setStart(topleft0);
- gradient.setFinalStop(topleft1);
- gradient.setColorAt(endPosition1, end);
- painter.setBrush(QBrush(gradient));
- painter.drawRoundRect(QRectF(topleft0, topleft1), 0.0, 0.0);
+ // TopLeft
+ QPointF topleft0(margin, margin);
+ QPointF topleft1(0, 0);
+ gradient.setStart(topleft0);
+ gradient.setFinalStop(topleft1);
+ gradient.setColorAt(endPosition1, end);
+ painter.setBrush(QBrush(gradient));
+ painter.drawRoundRect(QRectF(topleft0, topleft1), 0.0, 0.0);
- // TopRight
- QPointF topright0(width - margin, margin);
- QPointF topright1(width, 0);
- gradient.setStart(topright0);
- gradient.setFinalStop(topright1);
- gradient.setColorAt(endPosition1, end);
- painter.setBrush(QBrush(gradient));
- painter.drawRoundRect(QRectF(topright0, topright1), 0.0, 0.0);
+ // TopRight
+ QPointF topright0(width - margin, margin);
+ QPointF topright1(width, 0);
+ gradient.setStart(topright0);
+ gradient.setFinalStop(topright1);
+ gradient.setColorAt(endPosition1, end);
+ painter.setBrush(QBrush(gradient));
+ painter.drawRoundRect(QRectF(topright0, topright1), 0.0, 0.0);
- // Widget
- painter.setBrush(QBrush("#FFFFFF"));
- painter.setRenderHint(QPainter::Antialiasing);
- painter.drawRoundRect(
- QRectF(QPointF(margin, margin), QPointF(width - margin, height - margin)), radius, radius);
- }
+ // Widget
+ painter.setBrush(QBrush("#FFFFFF"));
+ painter.setRenderHint(QPainter::Antialiasing);
+ 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 1c44d5d7..816563e3 100644
--- a/include/ui/FlatButton.h
+++ b/include/ui/FlatButton.h
@@ -12,167 +12,174 @@ class FlatButton;
class FlatButtonStateMachine : public QStateMachine
{
- Q_OBJECT
+ Q_OBJECT
- Q_PROPERTY(qreal overlayOpacity WRITE setOverlayOpacity READ overlayOpacity)
- Q_PROPERTY(qreal checkedOverlayProgress WRITE setCheckedOverlayProgress READ checkedOverlayProgress)
+ Q_PROPERTY(qreal overlayOpacity WRITE setOverlayOpacity READ overlayOpacity)
+ Q_PROPERTY(
+ qreal checkedOverlayProgress WRITE setCheckedOverlayProgress READ checkedOverlayProgress)
public:
- explicit FlatButtonStateMachine(FlatButton *parent);
- ~FlatButtonStateMachine();
+ explicit FlatButtonStateMachine(FlatButton *parent);
+ ~FlatButtonStateMachine();
- void setOverlayOpacity(qreal opacity);
- void setCheckedOverlayProgress(qreal opacity);
+ void setOverlayOpacity(qreal opacity);
+ void setCheckedOverlayProgress(qreal opacity);
- inline qreal overlayOpacity() const;
- inline qreal checkedOverlayProgress() const;
+ inline qreal overlayOpacity() const;
+ inline qreal checkedOverlayProgress() const;
- void startAnimations();
- void setupProperties();
- void updateCheckedStatus();
+ void startAnimations();
+ void setupProperties();
+ void updateCheckedStatus();
signals:
- void buttonPressed();
- void buttonChecked();
- void buttonUnchecked();
+ void buttonPressed();
+ void buttonChecked();
+ void buttonUnchecked();
protected:
- bool eventFilter(QObject *watched, QEvent *event) override;
+ bool eventFilter(QObject *watched, QEvent *event) override;
private:
- void addTransition(QObject *object, const char *signal, QState *fromState, QState *toState);
- void addTransition(QObject *object, QEvent::Type eventType, QState *fromState, QState *toState);
- void addTransition(QAbstractTransition *transition, QState *fromState, QState *toState);
-
- FlatButton *const button_;
-
- QState *const top_level_state_;
- QState *const config_state_;
- QState *const checkable_state_;
- QState *const checked_state_;
- QState *const unchecked_state_;
- QState *const neutral_state_;
- QState *const neutral_focused_state_;
- QState *const hovered_state_;
- QState *const hovered_focused_state_;
- QState *const pressed_state_;
-
- qreal overlay_opacity_;
- qreal checked_overlay_progress_;
-
- bool was_checked_;
+ void addTransition(QObject *object, const char *signal, QState *fromState, QState *toState);
+ void addTransition(QObject *object,
+ QEvent::Type eventType,
+ QState *fromState,
+ QState *toState);
+ void addTransition(QAbstractTransition *transition, QState *fromState, QState *toState);
+
+ FlatButton *const button_;
+
+ QState *const top_level_state_;
+ QState *const config_state_;
+ QState *const checkable_state_;
+ QState *const checked_state_;
+ QState *const unchecked_state_;
+ QState *const neutral_state_;
+ QState *const neutral_focused_state_;
+ QState *const hovered_state_;
+ QState *const hovered_focused_state_;
+ QState *const pressed_state_;
+
+ qreal overlay_opacity_;
+ qreal checked_overlay_progress_;
+
+ bool was_checked_;
};
inline qreal
FlatButtonStateMachine::overlayOpacity() const
{
- return overlay_opacity_;
+ return overlay_opacity_;
}
inline qreal
FlatButtonStateMachine::checkedOverlayProgress() const
{
- return checked_overlay_progress_;
+ return checked_overlay_progress_;
}
class FlatButton : public QPushButton
{
- Q_OBJECT
+ Q_OBJECT
- Q_PROPERTY(QColor foregroundColor WRITE setForegroundColor READ foregroundColor)
- Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
- Q_PROPERTY(QColor overlayColor WRITE setOverlayColor READ overlayColor)
- Q_PROPERTY(QColor disabledForegroundColor WRITE setDisabledForegroundColor READ disabledForegroundColor)
- Q_PROPERTY(QColor disabledBackgroundColor WRITE setDisabledBackgroundColor READ disabledBackgroundColor)
- Q_PROPERTY(qreal fontSize WRITE setFontSize READ fontSize)
+ Q_PROPERTY(QColor foregroundColor WRITE setForegroundColor READ foregroundColor)
+ Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
+ Q_PROPERTY(QColor overlayColor WRITE setOverlayColor READ overlayColor)
+ Q_PROPERTY(QColor disabledForegroundColor WRITE setDisabledForegroundColor READ
+ disabledForegroundColor)
+ Q_PROPERTY(QColor disabledBackgroundColor WRITE setDisabledBackgroundColor READ
+ disabledBackgroundColor)
+ Q_PROPERTY(qreal fontSize WRITE setFontSize READ fontSize)
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);
- ~FlatButton();
-
- void applyPreset(ui::ButtonPreset preset);
-
- void setBackgroundColor(const QColor &color);
- void setBackgroundMode(Qt::BGMode mode);
- void setBaseOpacity(qreal opacity);
- void setCheckable(bool value);
- void setCornerRadius(qreal radius);
- void setDisabledBackgroundColor(const QColor &color);
- void setDisabledForegroundColor(const QColor &color);
- void setFixedRippleRadius(qreal radius);
- void setFontSize(qreal size);
- void setForegroundColor(const QColor &color);
- void setHasFixedRippleRadius(bool value);
- void setIconPlacement(ui::ButtonIconPlacement placement);
- void setOverlayColor(const QColor &color);
- void setOverlayStyle(ui::OverlayStyle style);
- void setRippleStyle(ui::RippleStyle style);
- void setRole(ui::Role role);
-
- QColor foregroundColor() const;
- QColor backgroundColor() const;
- QColor overlayColor() const;
- QColor disabledForegroundColor() const;
- QColor disabledBackgroundColor() const;
-
- qreal fontSize() const;
- qreal cornerRadius() const;
- qreal baseOpacity() const;
-
- bool hasFixedRippleRadius() const;
-
- ui::Role role() const;
- ui::OverlayStyle overlayStyle() const;
- ui::RippleStyle rippleStyle() const;
- ui::ButtonIconPlacement iconPlacement() const;
-
- Qt::BGMode backgroundMode() const;
-
- QSize sizeHint() const override;
+ 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);
+ ~FlatButton();
+
+ void applyPreset(ui::ButtonPreset preset);
+
+ void setBackgroundColor(const QColor &color);
+ void setBackgroundMode(Qt::BGMode mode);
+ void setBaseOpacity(qreal opacity);
+ void setCheckable(bool value);
+ void setCornerRadius(qreal radius);
+ void setDisabledBackgroundColor(const QColor &color);
+ void setDisabledForegroundColor(const QColor &color);
+ void setFixedRippleRadius(qreal radius);
+ void setFontSize(qreal size);
+ void setForegroundColor(const QColor &color);
+ void setHasFixedRippleRadius(bool value);
+ void setIconPlacement(ui::ButtonIconPlacement placement);
+ void setOverlayColor(const QColor &color);
+ void setOverlayStyle(ui::OverlayStyle style);
+ void setRippleStyle(ui::RippleStyle style);
+ void setRole(ui::Role role);
+
+ QColor foregroundColor() const;
+ QColor backgroundColor() const;
+ QColor overlayColor() const;
+ QColor disabledForegroundColor() const;
+ QColor disabledBackgroundColor() const;
+
+ qreal fontSize() const;
+ qreal cornerRadius() const;
+ qreal baseOpacity() const;
+
+ bool hasFixedRippleRadius() const;
+
+ ui::Role role() const;
+ ui::OverlayStyle overlayStyle() const;
+ ui::RippleStyle rippleStyle() const;
+ ui::ButtonIconPlacement iconPlacement() const;
+
+ Qt::BGMode backgroundMode() const;
+
+ QSize sizeHint() const override;
protected:
- int IconPadding = 0;
+ int IconPadding = 0;
- void checkStateSet() override;
- void mousePressEvent(QMouseEvent *event) override;
- void mouseReleaseEvent(QMouseEvent *event) override;
- void resizeEvent(QResizeEvent *event) override;
- void paintEvent(QPaintEvent *event) override;
+ void checkStateSet() override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
- virtual void paintBackground(QPainter *painter);
- virtual void paintForeground(QPainter *painter);
- virtual void updateClipPath();
+ virtual void paintBackground(QPainter *painter);
+ virtual void paintForeground(QPainter *painter);
+ virtual void updateClipPath();
- void init();
+ void init();
private:
- RippleOverlay *ripple_overlay_;
- FlatButtonStateMachine *state_machine_;
+ RippleOverlay *ripple_overlay_;
+ FlatButtonStateMachine *state_machine_;
- ui::Role role_;
- ui::RippleStyle ripple_style_;
- ui::ButtonIconPlacement icon_placement_;
- ui::OverlayStyle overlay_style_;
+ ui::Role role_;
+ ui::RippleStyle ripple_style_;
+ ui::ButtonIconPlacement icon_placement_;
+ ui::OverlayStyle overlay_style_;
- Qt::BGMode bg_mode_;
+ Qt::BGMode bg_mode_;
- QColor background_color_;
- QColor foreground_color_;
- QColor overlay_color_;
- QColor disabled_color_;
- QColor disabled_background_color_;
+ QColor background_color_;
+ QColor foreground_color_;
+ QColor overlay_color_;
+ QColor disabled_color_;
+ QColor disabled_background_color_;
- qreal fixed_ripple_radius_;
- qreal corner_radius_;
- qreal base_opacity_;
- qreal font_size_;
+ qreal fixed_ripple_radius_;
+ qreal corner_radius_;
+ qreal base_opacity_;
+ qreal font_size_;
- bool use_fixed_ripple_radius_;
+ bool use_fixed_ripple_radius_;
};
diff --git a/include/ui/Menu.h b/include/ui/Menu.h
index 0b4eb6d5..2029b1fd 100644
--- a/include/ui/Menu.h
+++ b/include/ui/Menu.h
@@ -7,24 +7,26 @@
class Menu : public QMenu
{
public:
- Menu(QWidget *parent = nullptr)
- : QMenu(parent)
- {
- QFont font;
- font.setPixelSize(conf::fontSize);
+ Menu(QWidget *parent = nullptr)
+ : 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); }");
- };
+ 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); }");
+ };
protected:
- void leaveEvent(QEvent *e)
- {
- Q_UNUSED(e);
+ void leaveEvent(QEvent *e)
+ {
+ Q_UNUSED(e);
- hide();
- }
+ hide();
+ }
};
diff --git a/include/ui/OverlayModal.h b/include/ui/OverlayModal.h
index 4dea6513..167ba71a 100644
--- a/include/ui/OverlayModal.h
+++ b/include/ui/OverlayModal.h
@@ -26,35 +26,35 @@
class OverlayModal : public OverlayWidget
{
public:
- explicit OverlayModal(QWidget *parent, QWidget *content);
+ explicit OverlayModal(QWidget *parent, QWidget *content);
- void fadeIn();
- void fadeOut();
+ void fadeIn();
+ void fadeOut();
public:
- inline void setDuration(int duration);
- inline void setColor(QColor color);
+ inline void setDuration(int duration);
+ inline void setColor(QColor color);
protected:
- void paintEvent(QPaintEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
private:
- int duration_;
- QColor color_;
+ int duration_;
+ QColor color_;
- QGraphicsOpacityEffect *opacity_;
- QPropertyAnimation *animation_;
+ QGraphicsOpacityEffect *opacity_;
+ QPropertyAnimation *animation_;
};
inline void
OverlayModal::setDuration(int duration)
{
- duration_ = duration;
- animation_->setDuration(duration_);
+ duration_ = duration;
+ animation_->setDuration(duration_);
}
inline void
OverlayModal::setColor(QColor color)
{
- color_ = color;
+ color_ = color;
}
diff --git a/include/ui/OverlayWidget.h b/include/ui/OverlayWidget.h
index b9655cf6..2984e469 100644
--- a/include/ui/OverlayWidget.h
+++ b/include/ui/OverlayWidget.h
@@ -5,14 +5,14 @@
class OverlayWidget : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit OverlayWidget(QWidget *parent = nullptr);
+ explicit OverlayWidget(QWidget *parent = nullptr);
protected:
- bool event(QEvent *event) override;
- bool eventFilter(QObject *obj, QEvent *event) override;
+ bool event(QEvent *event) override;
+ bool eventFilter(QObject *obj, QEvent *event) override;
- QRect overlayGeometry() const;
+ QRect overlayGeometry() const;
};
diff --git a/include/ui/RaisedButton.h b/include/ui/RaisedButton.h
index 558d15eb..edd5ee4a 100644
--- a/include/ui/RaisedButton.h
+++ b/include/ui/RaisedButton.h
@@ -8,21 +8,21 @@
class RaisedButton : public FlatButton
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit RaisedButton(QWidget *parent = 0);
- explicit RaisedButton(const QString &text, QWidget *parent = 0);
- ~RaisedButton();
+ explicit RaisedButton(QWidget *parent = 0);
+ explicit RaisedButton(const QString &text, QWidget *parent = 0);
+ ~RaisedButton();
protected:
- bool event(QEvent *event) override;
+ bool event(QEvent *event) override;
private:
- void init();
+ void init();
- QStateMachine *shadow_state_machine_;
- QState *normal_state_;
- QState *pressed_state_;
- QGraphicsDropShadowEffect *effect_;
+ QStateMachine *shadow_state_machine_;
+ QState *normal_state_;
+ QState *pressed_state_;
+ QGraphicsDropShadowEffect *effect_;
};
diff --git a/include/ui/Ripple.h b/include/ui/Ripple.h
index 01e30698..0baebfd6 100644
--- a/include/ui/Ripple.h
+++ b/include/ui/Ripple.h
@@ -10,137 +10,137 @@ class RippleOverlay;
class Ripple : public QParallelAnimationGroup
{
- Q_OBJECT
+ Q_OBJECT
- Q_PROPERTY(qreal radius WRITE setRadius READ radius)
- Q_PROPERTY(qreal opacity WRITE setOpacity READ opacity)
+ Q_PROPERTY(qreal radius WRITE setRadius READ radius)
+ Q_PROPERTY(qreal opacity WRITE setOpacity READ opacity)
public:
- explicit Ripple(const QPoint ¢er, QObject *parent = 0);
- Ripple(const QPoint ¢er, RippleOverlay *overlay, QObject *parent = 0);
- ~Ripple();
+ explicit Ripple(const QPoint ¢er, QObject *parent = 0);
+ Ripple(const QPoint ¢er, RippleOverlay *overlay, QObject *parent = 0);
+ ~Ripple();
- inline void setOverlay(RippleOverlay *overlay);
+ inline void setOverlay(RippleOverlay *overlay);
- void setRadius(qreal radius);
- void setOpacity(qreal opacity);
- void setColor(const QColor &color);
- void setBrush(const QBrush &brush);
+ void setRadius(qreal radius);
+ void setOpacity(qreal opacity);
+ void setColor(const QColor &color);
+ void setBrush(const QBrush &brush);
- inline qreal radius() const;
- inline qreal opacity() const;
- inline QColor color() const;
- inline QBrush brush() const;
- inline QPoint center() const;
+ inline qreal radius() const;
+ inline qreal opacity() const;
+ inline QColor color() const;
+ inline QBrush brush() const;
+ inline QPoint center() const;
- inline QPropertyAnimation *radiusAnimation() const;
- inline QPropertyAnimation *opacityAnimation() const;
+ inline QPropertyAnimation *radiusAnimation() const;
+ inline QPropertyAnimation *opacityAnimation() const;
- inline void setOpacityStartValue(qreal value);
- inline void setOpacityEndValue(qreal value);
- inline void setRadiusStartValue(qreal value);
- inline void setRadiusEndValue(qreal value);
- inline void setDuration(int msecs);
+ inline void setOpacityStartValue(qreal value);
+ inline void setOpacityEndValue(qreal value);
+ inline void setRadiusStartValue(qreal value);
+ inline void setRadiusEndValue(qreal value);
+ inline void setDuration(int msecs);
protected slots:
- void destroy();
+ void destroy();
private:
- Q_DISABLE_COPY(Ripple)
+ Q_DISABLE_COPY(Ripple)
- QPropertyAnimation *animate(const QByteArray &property,
- const QEasingCurve &easing = QEasingCurve::OutQuad,
- int duration = 800);
+ QPropertyAnimation *animate(const QByteArray &property,
+ const QEasingCurve &easing = QEasingCurve::OutQuad,
+ int duration = 800);
- void init();
+ void init();
- RippleOverlay *overlay_;
+ RippleOverlay *overlay_;
- QPropertyAnimation *const radius_anim_;
- QPropertyAnimation *const opacity_anim_;
+ QPropertyAnimation *const radius_anim_;
+ QPropertyAnimation *const opacity_anim_;
- qreal radius_;
- qreal opacity_;
+ qreal radius_;
+ qreal opacity_;
- QPoint center_;
- QBrush brush_;
+ QPoint center_;
+ QBrush brush_;
};
inline void
Ripple::setOverlay(RippleOverlay *overlay)
{
- overlay_ = overlay;
+ overlay_ = overlay;
}
inline qreal
Ripple::radius() const
{
- return radius_;
+ return radius_;
}
inline qreal
Ripple::opacity() const
{
- return opacity_;
+ return opacity_;
}
inline QColor
Ripple::color() const
{
- return brush_.color();
+ return brush_.color();
}
inline QBrush
Ripple::brush() const
{
- return brush_;
+ return brush_;
}
inline QPoint
Ripple::center() const
{
- return center_;
+ return center_;
}
inline QPropertyAnimation *
Ripple::radiusAnimation() const
{
- return radius_anim_;
+ return radius_anim_;
}
inline QPropertyAnimation *
Ripple::opacityAnimation() const
{
- return opacity_anim_;
+ return opacity_anim_;
}
inline void
Ripple::setOpacityStartValue(qreal value)
{
- opacity_anim_->setStartValue(value);
+ opacity_anim_->setStartValue(value);
}
inline void
Ripple::setOpacityEndValue(qreal value)
{
- opacity_anim_->setEndValue(value);
+ opacity_anim_->setEndValue(value);
}
inline void
Ripple::setRadiusStartValue(qreal value)
{
- radius_anim_->setStartValue(value);
+ radius_anim_->setStartValue(value);
}
inline void
Ripple::setRadiusEndValue(qreal value)
{
- radius_anim_->setEndValue(value);
+ radius_anim_->setEndValue(value);
}
inline void
Ripple::setDuration(int msecs)
{
- radius_anim_->setDuration(msecs);
- opacity_anim_->setDuration(msecs);
+ radius_anim_->setDuration(msecs);
+ opacity_anim_->setDuration(msecs);
}
diff --git a/include/ui/RippleOverlay.h b/include/ui/RippleOverlay.h
index cc6fd05e..28a6b9e4 100644
--- a/include/ui/RippleOverlay.h
+++ b/include/ui/RippleOverlay.h
@@ -8,51 +8,51 @@ class Ripple;
class RippleOverlay : public OverlayWidget
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit RippleOverlay(QWidget *parent = 0);
- ~RippleOverlay();
+ explicit RippleOverlay(QWidget *parent = 0);
+ ~RippleOverlay();
- void addRipple(Ripple *ripple);
- void addRipple(const QPoint &position, qreal radius = 300);
+ void addRipple(Ripple *ripple);
+ void addRipple(const QPoint &position, qreal radius = 300);
- void removeRipple(Ripple *ripple);
+ void removeRipple(Ripple *ripple);
- inline void setClipping(bool enable);
- inline bool hasClipping() const;
+ inline void setClipping(bool enable);
+ inline bool hasClipping() const;
- inline void setClipPath(const QPainterPath &path);
+ inline void setClipPath(const QPainterPath &path);
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
private:
- Q_DISABLE_COPY(RippleOverlay)
+ Q_DISABLE_COPY(RippleOverlay)
- void paintRipple(QPainter *painter, Ripple *ripple);
+ void paintRipple(QPainter *painter, Ripple *ripple);
- QList<Ripple *> ripples_;
- QPainterPath clip_path_;
- bool use_clip_;
+ QList<Ripple *> ripples_;
+ QPainterPath clip_path_;
+ bool use_clip_;
};
inline void
RippleOverlay::setClipping(bool enable)
{
- use_clip_ = enable;
- update();
+ use_clip_ = enable;
+ update();
}
inline bool
RippleOverlay::hasClipping() const
{
- return use_clip_;
+ return use_clip_;
}
inline void
RippleOverlay::setClipPath(const QPainterPath &path)
{
- clip_path_ = path;
- update();
+ clip_path_ = path;
+ update();
}
diff --git a/include/ui/ScrollBar.h b/include/ui/ScrollBar.h
index 483a73c4..1c056409 100644
--- a/include/ui/ScrollBar.h
+++ b/include/ui/ScrollBar.h
@@ -25,29 +25,29 @@
class ScrollBar : public QScrollBar
{
- Q_OBJECT
+ Q_OBJECT
public:
- ScrollBar(QScrollArea *area, QWidget *parent = nullptr);
+ ScrollBar(QScrollArea *area, QWidget *parent = nullptr);
- void fadeIn();
- void fadeOut();
+ void fadeIn();
+ void fadeOut();
protected:
- void paintEvent(QPaintEvent *e) override;
- void sliderChange(SliderChange change) override;
+ void paintEvent(QPaintEvent *e) override;
+ void sliderChange(SliderChange change) override;
private:
- int roundRadius_ = 4;
- int handleWidth_ = 7;
- int minHandleHeight_ = 20;
- bool isActive;
+ int roundRadius_ = 4;
+ int handleWidth_ = 7;
+ int minHandleHeight_ = 20;
+ bool isActive;
- const int AnimationDuration = 300;
- const int Padding = 4;
+ const int AnimationDuration = 300;
+ const int Padding = 4;
- QGraphicsOpacityEffect *eff;
- QTimer hideTimer_;
+ QGraphicsOpacityEffect *eff;
+ QTimer hideTimer_;
- QScrollArea *area_;
- QRect handle_;
+ QScrollArea *area_;
+ QRect handle_;
};
diff --git a/include/ui/TextField.h b/include/ui/TextField.h
index ec761483..c215a1f8 100644
--- a/include/ui/TextField.h
+++ b/include/ui/TextField.h
@@ -13,163 +13,163 @@ class TextFieldStateMachine;
class TextField : public QLineEdit
{
- Q_OBJECT
+ Q_OBJECT
- Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
- Q_PROPERTY(QColor inkColor WRITE setInkColor READ inkColor)
- Q_PROPERTY(QColor underlineColor WRITE setUnderlineColor READ underlineColor)
+ Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
+ Q_PROPERTY(QColor inkColor WRITE setInkColor READ inkColor)
+ Q_PROPERTY(QColor underlineColor WRITE setUnderlineColor READ underlineColor)
public:
- explicit TextField(QWidget *parent = 0);
- ~TextField();
-
- void setInkColor(const QColor &color);
- void setBackgroundColor(const QColor &color);
- void setLabel(const QString &label);
- void setLabelColor(const QColor &color);
- void setLabelFontSize(qreal size);
- void setShowLabel(bool value);
- void setTextColor(const QColor &color);
- void setUnderlineColor(const QColor &color);
-
- QColor inkColor() const;
- QColor labelColor() const;
- QColor textColor() const;
- QColor underlineColor() const;
- QColor backgroundColor() const;
- QString label() const;
- bool hasLabel() const;
- qreal labelFontSize() const;
+ explicit TextField(QWidget *parent = 0);
+ ~TextField();
+
+ void setInkColor(const QColor &color);
+ void setBackgroundColor(const QColor &color);
+ void setLabel(const QString &label);
+ void setLabelColor(const QColor &color);
+ void setLabelFontSize(qreal size);
+ void setShowLabel(bool value);
+ void setTextColor(const QColor &color);
+ void setUnderlineColor(const QColor &color);
+
+ QColor inkColor() const;
+ QColor labelColor() const;
+ QColor textColor() const;
+ QColor underlineColor() const;
+ QColor backgroundColor() const;
+ QString label() const;
+ bool hasLabel() const;
+ qreal labelFontSize() const;
protected:
- bool event(QEvent *event) override;
- void paintEvent(QPaintEvent *event) override;
+ bool event(QEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
private:
- void init();
-
- QColor ink_color_;
- QColor background_color_;
- QColor label_color_;
- QColor text_color_;
- QColor underline_color_;
- QString label_text_;
- TextFieldLabel *label_;
- TextFieldStateMachine *state_machine_;
- bool show_label_;
- qreal label_font_size_;
+ void init();
+
+ QColor ink_color_;
+ QColor background_color_;
+ QColor label_color_;
+ QColor text_color_;
+ QColor underline_color_;
+ QString label_text_;
+ TextFieldLabel *label_;
+ TextFieldStateMachine *state_machine_;
+ bool show_label_;
+ qreal label_font_size_;
};
class TextFieldLabel : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
- Q_PROPERTY(qreal scale WRITE setScale READ scale)
- Q_PROPERTY(QPointF offset WRITE setOffset READ offset)
- Q_PROPERTY(QColor color WRITE setColor READ color)
+ Q_PROPERTY(qreal scale WRITE setScale READ scale)
+ Q_PROPERTY(QPointF offset WRITE setOffset READ offset)
+ Q_PROPERTY(QColor color WRITE setColor READ color)
public:
- TextFieldLabel(TextField *parent);
- ~TextFieldLabel();
+ TextFieldLabel(TextField *parent);
+ ~TextFieldLabel();
- inline void setColor(const QColor &color);
- inline void setOffset(const QPointF &pos);
- inline void setScale(qreal scale);
+ inline void setColor(const QColor &color);
+ inline void setOffset(const QPointF &pos);
+ inline void setScale(qreal scale);
- inline QColor color() const;
- inline QPointF offset() const;
- inline qreal scale() const;
+ inline QColor color() const;
+ inline QPointF offset() const;
+ inline qreal scale() const;
protected:
- void paintEvent(QPaintEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
private:
- TextField *const text_field_;
+ TextField *const text_field_;
- QColor color_;
- qreal scale_;
- qreal x_;
- qreal y_;
+ QColor color_;
+ qreal scale_;
+ qreal x_;
+ qreal y_;
};
inline void
TextFieldLabel::setColor(const QColor &color)
{
- color_ = color;
- update();
+ color_ = color;
+ update();
}
inline void
TextFieldLabel::setOffset(const QPointF &pos)
{
- x_ = pos.x();
- y_ = pos.y();
- update();
+ x_ = pos.x();
+ y_ = pos.y();
+ update();
}
inline void
TextFieldLabel::setScale(qreal scale)
{
- scale_ = scale;
- update();
+ scale_ = scale;
+ update();
}
inline QPointF
TextFieldLabel::offset() const
{
- return QPointF(x_, y_);
+ return QPointF(x_, y_);
}
inline qreal
TextFieldLabel::scale() const
{
- return scale_;
+ return scale_;
}
inline QColor
TextFieldLabel::color() const
{
- return color_;
+ return color_;
}
class TextFieldStateMachine : public QStateMachine
{
- Q_OBJECT
+ Q_OBJECT
- Q_PROPERTY(qreal progress WRITE setProgress READ progress)
+ Q_PROPERTY(qreal progress WRITE setProgress READ progress)
public:
- TextFieldStateMachine(TextField *parent);
- ~TextFieldStateMachine();
+ TextFieldStateMachine(TextField *parent);
+ ~TextFieldStateMachine();
- inline void setProgress(qreal progress);
- void setLabel(TextFieldLabel *label);
+ inline void setProgress(qreal progress);
+ void setLabel(TextFieldLabel *label);
- inline qreal progress() const;
+ inline qreal progress() const;
public slots:
- void setupProperties();
+ void setupProperties();
private:
- QPropertyAnimation *color_anim_;
- QPropertyAnimation *offset_anim_;
+ QPropertyAnimation *color_anim_;
+ QPropertyAnimation *offset_anim_;
- QState *focused_state_;
- QState *normal_state_;
+ QState *focused_state_;
+ QState *normal_state_;
- TextField *text_field_;
- TextFieldLabel *label_;
+ TextField *text_field_;
+ TextFieldLabel *label_;
- qreal progress_;
+ qreal progress_;
};
inline void
TextFieldStateMachine::setProgress(qreal progress)
{
- progress_ = progress;
- text_field_->update();
+ progress_ = progress;
+ text_field_->update();
}
inline qreal
TextFieldStateMachine::progress() const
{
- return progress_;
+ return progress_;
}
diff --git a/include/ui/Theme.h b/include/ui/Theme.h
index 9806686c..c2e809e5 100644
--- a/include/ui/Theme.h
+++ b/include/ui/Theme.h
@@ -10,7 +10,7 @@ enum class AvatarType { Icon, Image, Letter };
namespace sidebar
{
-static const int SmallSize = 60;
+static const int SmallSize = 60;
static const int NormalSize = 300;
}
// Default font size.
@@ -32,35 +32,35 @@ enum class ButtonIconPlacement { LeftIcon, RightIcon };
enum class ProgressType { DeterminateProgress, IndeterminateProgress };
enum class Color {
- Black,
- BrightWhite,
- FadedWhite,
- MediumWhite,
- DarkGreen,
- LightGreen,
- BrightGreen,
- Gray,
- Red,
- Blue,
- Transparent
+ Black,
+ BrightWhite,
+ FadedWhite,
+ MediumWhite,
+ DarkGreen,
+ LightGreen,
+ BrightGreen,
+ Gray,
+ Red,
+ Blue,
+ Transparent
};
} // namespace ui
class Theme : public QObject
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit Theme(QObject *parent = 0);
- ~Theme();
+ explicit Theme(QObject *parent = 0);
+ ~Theme();
- QColor getColor(const QString &key) const;
+ QColor getColor(const QString &key) const;
- void setColor(const QString &key, const QColor &color);
- void setColor(const QString &key, ui::Color color);
+ void setColor(const QString &key, const QColor &color);
+ void setColor(const QString &key, ui::Color color);
private:
- QColor rgba(int r, int g, int b, qreal a) const;
+ QColor rgba(int r, int g, int b, qreal a) const;
- QHash<QString, QColor> colors_;
+ QHash<QString, QColor> colors_;
};
diff --git a/include/ui/ThemeManager.h b/include/ui/ThemeManager.h
index a6947bc9..d35ff754 100644
--- a/include/ui/ThemeManager.h
+++ b/include/ui/ThemeManager.h
@@ -6,26 +6,26 @@
class ThemeManager : public QCommonStyle
{
- Q_OBJECT
+ Q_OBJECT
public:
- inline static ThemeManager &instance();
+ inline static ThemeManager &instance();
- void setTheme(Theme *theme);
- QColor themeColor(const QString &key) const;
+ void setTheme(Theme *theme);
+ QColor themeColor(const QString &key) const;
private:
- ThemeManager();
+ ThemeManager();
- ThemeManager(ThemeManager const &);
- void operator=(ThemeManager const &);
+ ThemeManager(ThemeManager const &);
+ void operator=(ThemeManager const &);
- Theme *theme_;
+ Theme *theme_;
};
inline ThemeManager &
ThemeManager::instance()
{
- static ThemeManager instance;
- return instance;
+ static ThemeManager instance;
+ return instance;
}
|