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_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_;
};

View File

@ -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_;
};

View File

@ -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_;
};

View File

@ -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 {

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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));
}

View File

@ -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.

View File

@ -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()));
}