Add border in community list & minor refactorings (#204)

This commit is contained in:
Konstantinos Sideris 2018-03-18 17:38:57 +02:00
parent b70e09c7ec
commit 48ee36f6b2
9 changed files with 40 additions and 25 deletions

View File

@ -18,9 +18,14 @@ class SideBarActions : public QWidget
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
public: public:
SideBarActions(QWidget *parent = nullptr); SideBarActions(QWidget *parent = nullptr);
QColor borderColor() const { return borderColor_; }
void setBorderColor(QColor &color) { borderColor_ = color; }
signals: signals:
void showSettings(); void showSettings();
void joinRoom(const QString &room); void joinRoom(const QString &room);
@ -40,4 +45,6 @@ private:
FlatButton *settingsBtn_; FlatButton *settingsBtn_;
FlatButton *createRoomBtn_; FlatButton *createRoomBtn_;
FlatButton *joinRoomBtn_; FlatButton *joinRoomBtn_;
QColor borderColor_;
}; };

View File

@ -36,6 +36,9 @@ class RoomSettings;
class TopRoomBar : public QWidget class TopRoomBar : public QWidget
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
public: public:
TopRoomBar(QWidget *parent = 0); TopRoomBar(QWidget *parent = 0);
@ -48,6 +51,9 @@ public:
void reset(); void reset();
QColor borderColor() const { return borderColor_; }
void setBorderColor(QColor &color) { borderColor_ = color; }
signals: signals:
void inviteUsers(QStringList users); void inviteUsers(QStringList users);
@ -77,4 +83,6 @@ private:
QString roomName_; QString roomName_;
QString roomTopic_; QString roomTopic_;
QColor borderColor_;
}; };

View File

@ -28,6 +28,8 @@ class UserInfoWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
public: public:
UserInfoWidget(QWidget *parent = 0); UserInfoWidget(QWidget *parent = 0);
@ -37,6 +39,9 @@ public:
void reset(); void reset();
QColor borderColor() const { return borderColor_; }
void setBorderColor(QColor &color) { borderColor_ = color; }
signals: signals:
void logout(); void logout();
@ -63,4 +68,6 @@ private:
QImage avatar_image_; QImage avatar_image_;
int logoutButtonSize_; int logoutButtonSize_;
QColor borderColor_;
}; };

View File

@ -10,6 +10,7 @@ QLabel {
#sideBar { #sideBar {
border: none; border: none;
border-right: 1px solid #414A59; border-right: 1px solid #414A59;
border-left: 1px solid #414A59;
} }
TimelineView, TimelineView,
@ -80,7 +81,7 @@ UserInfoWidget, UserInfoWidget > * {
UserInfoWidget { UserInfoWidget {
border: none; border: none;
border-bottom: 1px solid #414A59; qproperty-borderColor: #414A59;
} }
UserSettingsPage { UserSettingsPage {
@ -156,12 +157,12 @@ ScrollBar {
SideBarActions { SideBarActions {
border: none; border: none;
border-top: 1px solid #414A59; qproperty-borderColor: #414A59;
} }
TopRoomBar { TopRoomBar {
border: none; border: none;
border-bottom: 1px solid #414A59; qproperty-borderColor: #414A59;
} }
TextInputWidget { TextInputWidget {

View File

@ -10,6 +10,7 @@ QLabel {
#sideBar { #sideBar {
border: none; border: none;
border-right: 1px solid #dcdcdc; border-right: 1px solid #dcdcdc;
border-left: 1px solid #dcdcdc;
} }
TimelineView, TimelineView,
@ -83,7 +84,7 @@ UserInfoWidget, UserInfoWidget > * {
UserInfoWidget { UserInfoWidget {
border: none; border: none;
border-bottom: 1px solid #dcdcdc; qproperty-borderColor: #dcdcdc;
} }
UserSettingsPage { UserSettingsPage {
@ -157,10 +158,10 @@ ScrollBar {
SideBarActions { SideBarActions {
border: none; border: none;
border-top: 1px solid #dcdcdc; qproperty-borderColor: #dcdcdc;
} }
TopRoomBar { TopRoomBar {
border: none; border: none;
border-bottom: 1px solid #dcdcdc; qproperty-borderColor: #dcdcdc;
} }

View File

@ -11,6 +11,7 @@ OverlayWidget > * {
#sideBar { #sideBar {
border: none; border: none;
border-right: 1px solid palette(text); border-right: 1px solid palette(text);
border-left: 1px solid palette(text);
} }
TimelineView, TimelineView,
@ -84,11 +85,6 @@ UserInfoWidget > * {
background-color: palette(window); background-color: palette(window);
} }
UserInfoWidget {
border: none;
border-bottom: 1px solid palette(text);
}
emoji--Category, emoji--Category,
emoji--Category > * { emoji--Category > * {
background-color: palette(window); background-color: palette(window);
@ -118,17 +114,3 @@ QListWidget {
background-color: palette(window); background-color: palette(window);
color: palette(text); 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);
}

View File

@ -97,4 +97,7 @@ SideBarActions::paintEvent(QPaintEvent *)
opt.init(this); opt.init(this);
QPainter p(this); QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
p.setPen(QPen(borderColor()));
p.drawLine(QPointF(0, 0), QPointF(width(), 0));
} }

View File

@ -151,6 +151,9 @@ TopRoomBar::paintEvent(QPaintEvent *event)
QPainter painter(this); QPainter painter(this);
style()->drawPrimitive(QStyle::PE_Widget, &option, &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 // 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 // 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. // shrinking. Making label little bit shorter leaves some space for it to shrink.

View File

@ -159,4 +159,7 @@ UserInfoWidget::paintEvent(QPaintEvent *event)
opt.init(this); opt.init(this);
QPainter p(this); QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
p.setPen(QPen(borderColor()));
p.drawLine(QPointF(0, height()), QPointF(width(), height()));
} }