From 48ee36f6b2bcb9d25eec298dda2e77878ab321e1 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sun, 18 Mar 2018 17:38:57 +0200 Subject: [PATCH] Add border in community list & minor refactorings (#204) --- include/SideBarActions.h | 7 +++++++ include/TopRoomBar.h | 8 ++++++++ include/UserInfoWidget.h | 7 +++++++ resources/styles/nheko-dark.qss | 7 ++++--- resources/styles/nheko.qss | 7 ++++--- resources/styles/system.qss | 20 +------------------- src/SideBarActions.cc | 3 +++ src/TopRoomBar.cc | 3 +++ src/UserInfoWidget.cc | 3 +++ 9 files changed, 40 insertions(+), 25 deletions(-) diff --git a/include/SideBarActions.h b/include/SideBarActions.h index 763f3b2d..a29757dd 100644 --- a/include/SideBarActions.h +++ b/include/SideBarActions.h @@ -18,9 +18,14 @@ class SideBarActions : public QWidget { Q_OBJECT + Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor) + public: SideBarActions(QWidget *parent = nullptr); + QColor borderColor() const { return borderColor_; } + void setBorderColor(QColor &color) { borderColor_ = color; } + signals: void showSettings(); void joinRoom(const QString &room); @@ -40,4 +45,6 @@ private: FlatButton *settingsBtn_; FlatButton *createRoomBtn_; FlatButton *joinRoomBtn_; + + QColor borderColor_; }; diff --git a/include/TopRoomBar.h b/include/TopRoomBar.h index 5b2ee506..0df31ee8 100644 --- a/include/TopRoomBar.h +++ b/include/TopRoomBar.h @@ -36,6 +36,9 @@ class RoomSettings; class TopRoomBar : public QWidget { Q_OBJECT + + Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor) + public: TopRoomBar(QWidget *parent = 0); @@ -48,6 +51,9 @@ public: void reset(); + QColor borderColor() const { return borderColor_; } + void setBorderColor(QColor &color) { borderColor_ = color; } + signals: void inviteUsers(QStringList users); @@ -77,4 +83,6 @@ private: QString roomName_; QString roomTopic_; + + QColor borderColor_; }; diff --git a/include/UserInfoWidget.h b/include/UserInfoWidget.h index 5e0ed85b..ea2d5400 100644 --- a/include/UserInfoWidget.h +++ b/include/UserInfoWidget.h @@ -28,6 +28,8 @@ class UserInfoWidget : public QWidget { Q_OBJECT + Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor) + public: UserInfoWidget(QWidget *parent = 0); @@ -37,6 +39,9 @@ public: void reset(); + QColor borderColor() const { return borderColor_; } + void setBorderColor(QColor &color) { borderColor_ = color; } + signals: void logout(); @@ -63,4 +68,6 @@ private: QImage avatar_image_; int logoutButtonSize_; + + QColor borderColor_; }; diff --git a/resources/styles/nheko-dark.qss b/resources/styles/nheko-dark.qss index 441fa0a5..99ca6c9b 100644 --- a/resources/styles/nheko-dark.qss +++ b/resources/styles/nheko-dark.qss @@ -10,6 +10,7 @@ QLabel { #sideBar { border: none; border-right: 1px solid #414A59; + border-left: 1px solid #414A59; } TimelineView, @@ -80,7 +81,7 @@ UserInfoWidget, UserInfoWidget > * { UserInfoWidget { border: none; - border-bottom: 1px solid #414A59; + qproperty-borderColor: #414A59; } UserSettingsPage { @@ -156,12 +157,12 @@ ScrollBar { SideBarActions { border: none; - border-top: 1px solid #414A59; + qproperty-borderColor: #414A59; } TopRoomBar { border: none; - border-bottom: 1px solid #414A59; + qproperty-borderColor: #414A59; } TextInputWidget { diff --git a/resources/styles/nheko.qss b/resources/styles/nheko.qss index a937b84e..849bcd6a 100644 --- a/resources/styles/nheko.qss +++ b/resources/styles/nheko.qss @@ -10,6 +10,7 @@ QLabel { #sideBar { border: none; border-right: 1px solid #dcdcdc; + border-left: 1px solid #dcdcdc; } TimelineView, @@ -83,7 +84,7 @@ UserInfoWidget, UserInfoWidget > * { UserInfoWidget { border: none; - border-bottom: 1px solid #dcdcdc; + qproperty-borderColor: #dcdcdc; } UserSettingsPage { @@ -157,10 +158,10 @@ ScrollBar { SideBarActions { border: none; - border-top: 1px solid #dcdcdc; + qproperty-borderColor: #dcdcdc; } TopRoomBar { border: none; - border-bottom: 1px solid #dcdcdc; + qproperty-borderColor: #dcdcdc; } diff --git a/resources/styles/system.qss b/resources/styles/system.qss index 21f11cc2..9f3ad240 100644 --- a/resources/styles/system.qss +++ b/resources/styles/system.qss @@ -11,6 +11,7 @@ OverlayWidget > * { #sideBar { border: none; border-right: 1px solid palette(text); + border-left: 1px solid palette(text); } TimelineView, @@ -84,11 +85,6 @@ UserInfoWidget > * { background-color: palette(window); } -UserInfoWidget { - border: none; - border-bottom: 1px solid palette(text); -} - emoji--Category, emoji--Category > * { background-color: palette(window); @@ -118,17 +114,3 @@ QListWidget { background-color: palette(window); color: palette(text); } - -SideBarActions { - border: none; - border-top: 1px solid palette(text); -} - -TopRoomBar { - border: none; - border-bottom: 1px solid palette(text); -} - -TextInputWidget { - qproperty-borderColor: palette(text); -} diff --git a/src/SideBarActions.cc b/src/SideBarActions.cc index 665b428b..d65900b3 100644 --- a/src/SideBarActions.cc +++ b/src/SideBarActions.cc @@ -97,4 +97,7 @@ SideBarActions::paintEvent(QPaintEvent *) opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + p.setPen(QPen(borderColor())); + p.drawLine(QPointF(0, 0), QPointF(width(), 0)); } diff --git a/src/TopRoomBar.cc b/src/TopRoomBar.cc index c4ce3d7d..73891881 100644 --- a/src/TopRoomBar.cc +++ b/src/TopRoomBar.cc @@ -151,6 +151,9 @@ TopRoomBar::paintEvent(QPaintEvent *event) QPainter painter(this); style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this); + painter.setPen(QPen(borderColor())); + painter.drawLine(QPointF(0, height()), QPointF(width(), height())); + // Number of pixels that we can move sidebar splitter per frame. If label contains // text which fills entire it's width then label starts blocking it's layout from // shrinking. Making label little bit shorter leaves some space for it to shrink. diff --git a/src/UserInfoWidget.cc b/src/UserInfoWidget.cc index 0a00b4cd..b7724257 100644 --- a/src/UserInfoWidget.cc +++ b/src/UserInfoWidget.cc @@ -159,4 +159,7 @@ UserInfoWidget::paintEvent(QPaintEvent *event) opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + p.setPen(QPen(borderColor())); + p.drawLine(QPointF(0, height()), QPointF(width(), height())); }