summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-11-22 19:09:19 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-11-22 19:09:19 +0200
commit929b2df6fb28a1e431027afb032f5eeefd0106b7 (patch)
tree1382bcf577b1ea9ef7e1fb7b812a4f28f30bb9bf /include
parentKeep track of newly joined rooms in the settings manager (diff)
parentUse system color scheme (using a Qt stylesheet) #104 (diff)
downloadnheko-929b2df6fb28a1e431027afb032f5eeefd0106b7.tar.xz
Merge branch 'theme'
Diffstat (limited to 'include')
-rw-r--r--include/RoomInfoListItem.h55
-rw-r--r--include/TextInputWidget.h5
-rw-r--r--include/TimelineItem.h6
-rw-r--r--include/TimelineView.h9
-rw-r--r--include/TopRoomBar.h2
-rw-r--r--include/UserInfoWidget.h1
-rw-r--r--include/ui/LoadingIndicator.h1
-rw-r--r--include/ui/OverlayWidget.h3
8 files changed, 74 insertions, 8 deletions
diff --git a/include/RoomInfoListItem.h b/include/RoomInfoListItem.h

index a137b37f..acb1ab84 100644 --- a/include/RoomInfoListItem.h +++ b/include/RoomInfoListItem.h
@@ -38,6 +38,19 @@ struct DescInfo class RoomInfoListItem : public QWidget { Q_OBJECT + Q_PROPERTY(QColor highlightedBackgroundColor READ highlightedBackgroundColor WRITE + setHighlightedBackgroundColor) + Q_PROPERTY( + QColor hoverBackgroundColor READ hoverBackgroundColor WRITE setHoverBackgroundColor) + Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor) + + Q_PROPERTY(QColor titleColor READ titleColor WRITE setTitleColor) + Q_PROPERTY(QColor subtitleColor READ subtitleColor WRITE setSubtitleColor) + + Q_PROPERTY( + QColor highlightedTitleColor READ highlightedTitleColor WRITE setHighlightedTitleColor) + Q_PROPERTY(QColor highlightedSubtitleColor READ highlightedSubtitleColor WRITE + setHighlightedSubtitleColor) public: RoomInfoListItem(QSharedPointer<RoomSettings> settings, @@ -51,13 +64,39 @@ public: void clearUnreadMessageCount(); void setState(const RoomState &state); - bool isPressed() const { return isPressed_; }; - RoomState state() const { return state_; }; - int unreadMessageCount() const { return unreadMsgCount_; }; + bool isPressed() const { return isPressed_; } + RoomState state() const { return state_; } + int unreadMessageCount() const { return unreadMsgCount_; } void setAvatar(const QImage &avatar_image); void setDescriptionMessage(const DescInfo &info); + inline QColor highlightedBackgroundColor() const { return highlightedBackgroundColor_; } + inline QColor hoverBackgroundColor() const { return hoverBackgroundColor_; } + inline QColor backgroundColor() const { return backgroundColor_; } + + inline QColor highlightedTitleColor() const { return highlightedTitleColor_; } + inline QColor highlightedSubtitleColor() const { return highlightedSubtitleColor_; } + + inline QColor titleColor() const { return titleColor_; } + inline QColor subtitleColor() const { return subtitleColor_; } + + inline void setHighlightedBackgroundColor(QColor &color) + { + highlightedBackgroundColor_ = color; + } + inline void setHoverBackgroundColor(QColor &color) { hoverBackgroundColor_ = color; } + inline void setBackgroundColor(QColor &color) { backgroundColor_ = color; } + + inline void setHighlightedTitleColor(QColor &color) { highlightedTitleColor_ = color; } + inline void setHighlightedSubtitleColor(QColor &color) + { + highlightedSubtitleColor_ = color; + } + + inline void setTitleColor(QColor &color) { titleColor_ = color; } + inline void setSubtitleColor(QColor &color) { subtitleColor_ = color; } + signals: void clicked(const QString &room_id); void leaveRoom(const QString &room_id); @@ -98,4 +137,14 @@ private: int maxHeight_; int unreadMsgCount_ = 0; + + QColor highlightedBackgroundColor_; + QColor hoverBackgroundColor_; + QColor backgroundColor_; + + QColor highlightedTitleColor_; + QColor highlightedSubtitleColor_; + + QColor titleColor_; + QColor subtitleColor_; }; diff --git a/include/TextInputWidget.h b/include/TextInputWidget.h
index 70b1c213..88706e4a 100644 --- a/include/TextInputWidget.h +++ b/include/TextInputWidget.h
@@ -76,7 +76,7 @@ public: public slots: void openFileSelection(); void hideUploadSpinner(); - void focusLineEdit() { input_->setFocus(); }; + void focusLineEdit() { input_->setFocus(); } private slots: void addSelectedEmoji(const QString &emoji); @@ -91,7 +91,8 @@ signals: void stoppedTyping(); protected: - void focusInEvent(QFocusEvent *event); + void focusInEvent(QFocusEvent *event) override; + void paintEvent(QPaintEvent *) override; private: void showUploadSpinner(); diff --git a/include/TimelineItem.h b/include/TimelineItem.h
index 1adf574c..d90810d5 100644 --- a/include/TimelineItem.h +++ b/include/TimelineItem.h
@@ -19,6 +19,9 @@ #include <QHBoxLayout> #include <QLabel> +#include <QPainter> +#include <QStyle> +#include <QStyleOption> #include "Emote.h" #include "Image.h" @@ -67,6 +70,9 @@ public: ~TimelineItem(); +protected: + void paintEvent(QPaintEvent *event) override; + private: void init(); diff --git a/include/TimelineView.h b/include/TimelineView.h
index bc7c41e6..78c31e8e 100644 --- a/include/TimelineView.h +++ b/include/TimelineView.h
@@ -21,6 +21,8 @@ #include <QList> #include <QQueue> #include <QScrollArea> +#include <QStyle> +#include <QStyleOption> #include "Emote.h" #include "Image.h" @@ -110,7 +112,7 @@ public slots: void addBackwardsEvents(const QString &room_id, const RoomMessages &msgs); // Whether or not the initial batch has been loaded. - bool hasLoaded() { return scroll_layout_->count() > 1 || isTimelineFinished; }; + bool hasLoaded() { return scroll_layout_->count() > 1 || isTimelineFinished; } void handleFailedMessage(int txnid); @@ -120,6 +122,9 @@ private slots: signals: void updateLastTimelineMessage(const QString &user, const DescInfo &info); +protected: + void paintEvent(QPaintEvent *event) override; + private: void init(); void addTimelineItem(TimelineItem *item, TimelineDirection direction); @@ -133,7 +138,7 @@ private: bool isPendingMessage(const QString &txnid, const QString &sender, const QString &userid); void removePendingMessage(const QString &txnid); - bool isDuplicate(const QString &event_id) { return eventIds_.contains(event_id); }; + bool isDuplicate(const QString &event_id) { return eventIds_.contains(event_id); } void handleNewUserMessage(PendingMessage msg); diff --git a/include/TopRoomBar.h b/include/TopRoomBar.h
index f1e93d9d..2f65428d 100644 --- a/include/TopRoomBar.h +++ b/include/TopRoomBar.h
@@ -34,7 +34,7 @@ class Menu; class OverlayModal; class RoomSettings; -static const QString URL_HTML = "<a href=\"\\1\" style=\"color: #333333\">\\1</a>"; +static const QString URL_HTML = "<a href=\"\\1\">\\1</a>"; static const QRegExp URL_REGEX("((?:https?|ftp)://\\S+)"); class TopRoomBar : public QWidget diff --git a/include/UserInfoWidget.h b/include/UserInfoWidget.h
index 111f5808..2acfedb8 100644 --- a/include/UserInfoWidget.h +++ b/include/UserInfoWidget.h
@@ -44,6 +44,7 @@ signals: protected: void resizeEvent(QResizeEvent *event) override; + void paintEvent(QPaintEvent *event) override; private slots: void closeLogoutDialog(bool isLoggingOut); diff --git a/include/ui/LoadingIndicator.h b/include/ui/LoadingIndicator.h
index 75920dd8..bb33fe6c 100644 --- a/include/ui/LoadingIndicator.h +++ b/include/ui/LoadingIndicator.h
@@ -9,6 +9,7 @@ class LoadingIndicator : public QWidget { Q_OBJECT + Q_PROPERTY(QColor color READ color WRITE setColor) public: LoadingIndicator(QWidget *parent = 0); diff --git a/include/ui/OverlayWidget.h b/include/ui/OverlayWidget.h
index 2984e469..6662479d 100644 --- a/include/ui/OverlayWidget.h +++ b/include/ui/OverlayWidget.h
@@ -1,6 +1,8 @@ #pragma once #include <QEvent> +#include <QPainter> +#include <QStyleOption> #include <QWidget> class OverlayWidget : public QWidget @@ -15,4 +17,5 @@ protected: bool eventFilter(QObject *obj, QEvent *event) override; QRect overlayGeometry() const; + void paintEvent(QPaintEvent *event) override; };