Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
7253dc2c
Commit
7253dc2c
authored
7 years ago
by
Konstantinos Sideris
Browse files
Options
Downloads
Patches
Plain Diff
roomlist: Put the message timestamp on the top
parent
4192a999
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/Config.h
+5
-4
5 additions, 4 deletions
include/Config.h
include/RoomInfoListItem.h
+11
-9
11 additions, 9 deletions
include/RoomInfoListItem.h
src/RoomInfoListItem.cc
+40
-33
40 additions, 33 deletions
src/RoomInfoListItem.cc
src/timeline/TimelineView.cc
+7
-3
7 additions, 3 deletions
src/timeline/TimelineView.cc
with
63 additions
and
49 deletions
include/Config.h
+
5
−
4
View file @
7253dc2c
...
...
@@ -56,9 +56,10 @@ static constexpr int cornerRadius = 3;
// RoomList specific.
namespace
roomlist
{
namespace
fonts
{
static
constexpr
int
heading
=
14
;
static
constexpr
int
badge
=
10
;
static
constexpr
int
bubble
=
20
;
static
constexpr
int
heading
=
14
;
static
constexpr
int
timestamp
=
heading
-
1
;
static
constexpr
int
badge
=
10
;
static
constexpr
int
bubble
=
20
;
}
// namespace fonts
}
// namespace roomlist
...
...
@@ -84,7 +85,7 @@ static constexpr int headerLeftMargin = 15;
namespace
fonts
{
static
constexpr
int
timestamp
=
13
;
static
constexpr
int
dateSeparator
=
conf
::
fontSize
-
2
;
static
constexpr
int
dateSeparator
=
conf
::
fontSize
;
}
// namespace fonts
}
// namespace timeline
...
...
This diff is collapsed.
Click to expand it.
include/RoomInfoListItem.h
+
11
−
9
View file @
7253dc2c
...
...
@@ -75,10 +75,10 @@ public:
update
();
}
QString
roomId
()
;
bool
isPressed
()
const
{
return
isPressed_
;
}
;
QString
roomId
()
{
return
roomId_
;
}
bool
isPressed
()
const
{
return
isPressed_
;
}
QSharedPointer
<
RoomState
>
state
()
const
{
return
state_
;
}
int
unreadMessageCount
()
const
{
return
unreadMsgCount_
;
}
;
int
unreadMessageCount
()
const
{
return
unreadMsgCount_
;
}
void
setAvatar
(
const
QImage
&
avatar_image
);
void
setDescriptionMessage
(
const
DescInfo
&
info
);
...
...
@@ -184,10 +184,12 @@ private:
QRectF
acceptBtnRegion_
;
QRectF
declineBtnRegion_
;
};
inline
QString
RoomInfoListItem
::
roomId
()
{
return
roomId_
;
}
// Fonts
QFont
bubbleFont_
;
QFont
font_
;
QFont
headingFont_
;
QFont
timestampFont_
;
QFont
usernameFont_
;
QFont
unreadCountFont_
;
};
This diff is collapsed.
Click to expand it.
src/RoomInfoListItem.cc
+
40
−
33
View file @
7253dc2c
...
...
@@ -52,6 +52,25 @@ RoomInfoListItem::init(QWidget *parent)
ripple_overlay_
=
new
RippleOverlay
(
this
);
ripple_overlay_
->
setClipPath
(
path
);
ripple_overlay_
->
setClipping
(
true
);
font_
.
setPixelSize
(
conf
::
fontSize
);
usernameFont_
=
font_
;
usernameFont_
.
setWeight
(
60
);
bubbleFont_
=
font_
;
bubbleFont_
.
setPixelSize
(
conf
::
roomlist
::
fonts
::
bubble
);
unreadCountFont_
.
setPixelSize
(
conf
::
roomlist
::
fonts
::
badge
);
unreadCountFont_
.
setBold
(
true
);
timestampFont_
=
font_
;
timestampFont_
.
setPixelSize
(
conf
::
roomlist
::
fonts
::
timestamp
);
timestampFont_
.
setBold
(
false
);
headingFont_
=
font_
;
headingFont_
.
setPixelSize
(
conf
::
roomlist
::
fonts
::
heading
);
headingFont_
.
setWeight
(
60
);
}
RoomInfoListItem
::
RoomInfoListItem
(
QString
room_id
,
...
...
@@ -125,9 +144,7 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
p
.
setRenderHint
(
QPainter
::
SmoothPixmapTransform
);
p
.
setRenderHint
(
QPainter
::
Antialiasing
);
QFont
font
;
font
.
setPixelSize
(
conf
::
fontSize
);
QFontMetrics
metrics
(
font
);
QFontMetrics
metrics
(
font_
);
QPen
titlePen
(
titleColor_
);
QPen
subtitlePen
(
subtitleColor_
);
...
...
@@ -148,26 +165,26 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
int
bottom_y
=
MaxHeight
-
Padding
-
Padding
/
3
-
metrics
.
ascent
()
/
2
;
if
(
width
()
>
ui
::
sidebar
::
SmallSize
)
{
font
.
setPixelSize
(
conf
::
roomlist
::
fonts
::
heading
);
font
.
setWeight
(
60
);
p
.
setFont
(
font
);
p
.
setFont
(
headingFont_
);
p
.
setPen
(
titlePen
);
const
auto
msgStampWidth
=
QFontMetrics
(
timestampFont_
).
width
(
lastMsgInfo_
.
timestamp
)
+
4
;
// Name line.
QFontMetrics
fontNameMetrics
(
f
ont
);
QFontMetrics
fontNameMetrics
(
headingF
ont
_
);
int
top_y
=
2
*
Padding
+
fontNameMetrics
.
ascent
()
/
2
;
auto
name
=
metrics
.
elidedText
(
roomName
(),
Qt
::
ElideRight
,
(
width
()
-
IconSize
-
2
*
Padding
)
*
0.8
);
const
auto
name
=
metrics
.
elidedText
(
roomName
(),
Qt
::
ElideRight
,
(
width
()
-
IconSize
-
2
*
Padding
-
msgStampWidth
)
*
0.8
);
p
.
drawText
(
QPoint
(
2
*
Padding
+
IconSize
,
top_y
),
name
);
if
(
roomType_
==
RoomType
::
Joined
)
{
font
.
setPixelSize
(
conf
::
fontSize
);
p
.
setFont
(
font
);
p
.
setFont
(
font_
);
p
.
setPen
(
subtitlePen
);
auto
msgStampWidth
=
QFontMetrics
(
font
).
width
(
lastMsgInfo_
.
timestamp
)
+
5
;
// The limit is the space between the end of the avatar and the start of the
// timestamp.
int
usernameLimit
=
...
...
@@ -175,14 +192,12 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
auto
userName
=
metrics
.
elidedText
(
lastMsgInfo_
.
username
,
Qt
::
ElideRight
,
usernameLimit
);
font
.
setWeight
(
60
);
p
.
setFont
(
font
);
p
.
setFont
(
usernameFont_
);
p
.
drawText
(
QPoint
(
2
*
Padding
+
IconSize
,
bottom_y
),
userName
);
int
nameWidth
=
QFontMetrics
(
f
ont
).
width
(
userName
);
int
nameWidth
=
QFontMetrics
(
usernameF
ont
_
).
width
(
userName
);
font
.
setBold
(
false
);
p
.
setFont
(
font
);
p
.
setFont
(
font_
);
// The limit is the space between the end of the username and the start of
// the timestamp.
...
...
@@ -193,12 +208,10 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
p
.
drawText
(
QPoint
(
2
*
Padding
+
IconSize
+
nameWidth
,
bottom_y
),
description
);
// We either show the bubble or the last message timestamp.
if
(
unreadMsgCount_
==
0
)
{
font
.
setBold
(
true
);
p
.
drawText
(
QPoint
(
width
()
-
Padding
-
msgStampWidth
,
bottom_y
),
lastMsgInfo_
.
timestamp
);
}
// We show the last message timestamp.
p
.
setFont
(
timestampFont_
);
p
.
drawText
(
QPoint
(
width
()
-
Padding
-
msgStampWidth
,
top_y
),
lastMsgInfo_
.
timestamp
);
}
else
{
int
btnWidth
=
(
width
()
-
IconSize
-
6
*
Padding
)
/
2
;
...
...
@@ -221,13 +234,12 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
p
.
drawPath
(
declinePath
);
p
.
setPen
(
QPen
(
btnTextColor_
));
p
.
setFont
(
font
);
p
.
setFont
(
font
_
);
p
.
drawText
(
acceptBtnRegion_
,
Qt
::
AlignCenter
,
tr
(
"Accept"
));
p
.
drawText
(
declineBtnRegion_
,
Qt
::
AlignCenter
,
tr
(
"Decline"
));
}
}
font
.
setBold
(
false
);
p
.
setPen
(
Qt
::
NoPen
);
// We using the first letter of room's name.
...
...
@@ -241,8 +253,7 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
p
.
drawEllipse
(
avatarRegion
.
center
(),
IconSize
/
2
,
IconSize
/
2
);
font
.
setPixelSize
(
conf
::
roomlist
::
fonts
::
bubble
);
p
.
setFont
(
font
);
p
.
setFont
(
bubbleFont_
);
p
.
setPen
(
QColor
(
"#333"
));
p
.
setBrush
(
Qt
::
NoBrush
);
p
.
drawText
(
...
...
@@ -269,13 +280,9 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
if
(
isPressed_
)
brush
.
setColor
(
textColor
);
QFont
unreadCountFont
;
unreadCountFont
.
setPixelSize
(
conf
::
roomlist
::
fonts
::
badge
);
unreadCountFont
.
setBold
(
true
);
p
.
setBrush
(
brush
);
p
.
setPen
(
Qt
::
NoPen
);
p
.
setFont
(
unreadCountFont
);
p
.
setFont
(
unreadCountFont
_
);
int
diameter
=
20
;
...
...
This diff is collapsed.
Click to expand it.
src/timeline/TimelineView.cc
+
7
−
3
View file @
7253dc2c
...
...
@@ -679,13 +679,17 @@ TimelineView::createDateSeparator(QDateTime datetime)
fmt
=
QString
(
"ddd d MMMM"
);
if
(
days
==
0
)
separator
=
new
QLabel
(
tr
(
"Today"
));
separator
=
new
QLabel
(
tr
(
"Today"
)
,
this
);
else
if
(
std
::
abs
(
days
)
==
1
)
separator
=
new
QLabel
(
tr
(
"Yesterday"
));
separator
=
new
QLabel
(
tr
(
"Yesterday"
)
,
this
);
else
separator
=
new
QLabel
(
datetime
.
toString
(
fmt
));
separator
=
new
QLabel
(
datetime
.
toString
(
fmt
)
,
this
);
if
(
separator
)
{
QFont
font
;
font
.
setWeight
(
60
);
separator
->
setFont
(
font
);
separator
->
setStyleSheet
(
QString
(
"font-size: %1px"
).
arg
(
conf
::
timeline
::
fonts
::
dateSeparator
));
separator
->
setAlignment
(
Qt
::
AlignCenter
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment