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
5197f8a8
Commit
5197f8a8
authored
7 years ago
by
Konstantinos Sideris
Browse files
Options
Downloads
Patches
Plain Diff
Add drop shadow to emoji panel
- Minor refactoring
parent
83cdd79e
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/EmojiPanel.h
+10
-13
10 additions, 13 deletions
include/EmojiPanel.h
include/ui/DropShadow.h
+100
-0
100 additions, 0 deletions
include/ui/DropShadow.h
src/EmojiPanel.cc
+134
-127
134 additions, 127 deletions
src/EmojiPanel.cc
src/TextInputWidget.cc
+1
-0
1 addition, 0 deletions
src/TextInputWidget.cc
with
245 additions
and
140 deletions
include/EmojiPanel.h
+
10
−
13
View file @
5197f8a8
...
...
@@ -17,9 +17,7 @@
#pragma once
#include
<QFrame>
#include
<QGraphicsOpacityEffect>
#include
<QParallelAnimationGroup>
#include
<QPropertyAnimation>
#include
<QScrollArea>
#include
<QWidget>
...
...
@@ -27,7 +25,7 @@
#include
"EmojiCategory.h"
#include
"EmojiProvider.h"
class
EmojiPanel
:
public
Q
Frame
class
EmojiPanel
:
public
Q
Widget
{
Q_OBJECT
...
...
@@ -43,25 +41,24 @@ signals:
protected:
void
leaveEvent
(
QEvent
*
event
);
void
paintEvent
(
QPaintEvent
*
event
);
private:
void
showEmojiCategory
(
const
EmojiCategory
*
category
);
QPropertyAnimation
*
opacity_anim_
;
QPropertyAnimation
*
size_anim_
;
QPropertyAnimation
*
animation_
;
QGraphicsOpacityEffect
*
opacity_
;
QParallelAnimationGroup
*
animation_
;
EmojiProvider
emoji_provider_
;
QScrollArea
*
scroll
_a
rea_
;
QScrollArea
*
scroll
A
rea_
;
// Panel dimensions.
const
int
WIDTH
=
370
;
const
int
HEIGHT
=
350
;
int
shadowMargin_
;
const
int
ANIMATION_DURATION
=
100
;
const
int
ANIMATION_OFFSET
=
50
;
// Panel dimensions.
int
width_
;
int
height_
;
const
int
category_icon_size_
=
20
;
int
animationDuration_
;
int
categoryIconSize_
;
};
This diff is collapsed.
Click to expand it.
include/ui/DropShadow.h
0 → 100644
+
100
−
0
View file @
5197f8a8
#pragma once
#include
<QColor>
#include
<QLinearGradient>
#include
<QPainter>
class
DropShadow
{
public:
static
void
draw
(
QPainter
&
painter
,
qint16
margin
,
qreal
radius
,
QColor
start
,
QColor
end
,
qreal
startPosition
,
qreal
endPosition0
,
qreal
endPosition1
,
qreal
width
,
qreal
height
)
{
painter
.
setPen
(
Qt
::
NoPen
);
QLinearGradient
gradient
;
gradient
.
setColorAt
(
startPosition
,
start
);
gradient
.
setColorAt
(
endPosition0
,
end
);
// Right
QPointF
right0
(
width
-
margin
,
height
/
2
);
QPointF
right1
(
width
,
height
/
2
);
gradient
.
setStart
(
right0
);
gradient
.
setFinalStop
(
right1
);
painter
.
setBrush
(
QBrush
(
gradient
));
painter
.
drawRoundRect
(
QRectF
(
QPointF
(
width
-
margin
*
radius
,
margin
),
QPointF
(
width
,
height
-
margin
)),
0.0
,
0.0
);
// Left
QPointF
left0
(
margin
,
height
/
2
);
QPointF
left1
(
0
,
height
/
2
);
gradient
.
setStart
(
left0
);
gradient
.
setFinalStop
(
left1
);
painter
.
setBrush
(
QBrush
(
gradient
));
painter
.
drawRoundRect
(
QRectF
(
QPointF
(
margin
*
radius
,
margin
),
QPointF
(
0
,
height
-
margin
)),
0.0
,
0.0
);
// Top
QPointF
top0
(
width
/
2
,
margin
);
QPointF
top1
(
width
/
2
,
0
);
gradient
.
setStart
(
top0
);
gradient
.
setFinalStop
(
top1
);
painter
.
setBrush
(
QBrush
(
gradient
));
painter
.
drawRoundRect
(
QRectF
(
QPointF
(
width
-
margin
,
0
),
QPointF
(
margin
,
margin
)),
0.0
,
0.0
);
// Bottom
QPointF
bottom0
(
width
/
2
,
height
-
margin
);
QPointF
bottom1
(
width
/
2
,
height
);
gradient
.
setStart
(
bottom0
);
gradient
.
setFinalStop
(
bottom1
);
painter
.
setBrush
(
QBrush
(
gradient
));
painter
.
drawRoundRect
(
QRectF
(
QPointF
(
margin
,
height
-
margin
),
QPointF
(
width
-
margin
,
height
)),
0.0
,
0.0
);
// BottomRight
QPointF
bottomright0
(
width
-
margin
,
height
-
margin
);
QPointF
bottomright1
(
width
,
height
);
gradient
.
setStart
(
bottomright0
);
gradient
.
setFinalStop
(
bottomright1
);
gradient
.
setColorAt
(
endPosition1
,
end
);
painter
.
setBrush
(
QBrush
(
gradient
));
painter
.
drawRoundRect
(
QRectF
(
bottomright0
,
bottomright1
),
0.0
,
0.0
);
// BottomLeft
QPointF
bottomleft0
(
margin
,
height
-
margin
);
QPointF
bottomleft1
(
0
,
height
);
gradient
.
setStart
(
bottomleft0
);
gradient
.
setFinalStop
(
bottomleft1
);
gradient
.
setColorAt
(
endPosition1
,
end
);
painter
.
setBrush
(
QBrush
(
gradient
));
painter
.
drawRoundRect
(
QRectF
(
bottomleft0
,
bottomleft1
),
0.0
,
0.0
);
// TopLeft
QPointF
topleft0
(
margin
,
margin
);
QPointF
topleft1
(
0
,
0
);
gradient
.
setStart
(
topleft0
);
gradient
.
setFinalStop
(
topleft1
);
gradient
.
setColorAt
(
endPosition1
,
end
);
painter
.
setBrush
(
QBrush
(
gradient
));
painter
.
drawRoundRect
(
QRectF
(
topleft0
,
topleft1
),
0.0
,
0.0
);
// TopRight
QPointF
topright0
(
width
-
margin
,
margin
);
QPointF
topright1
(
width
,
0
);
gradient
.
setStart
(
topright0
);
gradient
.
setFinalStop
(
topright1
);
gradient
.
setColorAt
(
endPosition1
,
end
);
painter
.
setBrush
(
QBrush
(
gradient
));
painter
.
drawRoundRect
(
QRectF
(
topright0
,
topright1
),
0.0
,
0.0
);
// Widget
painter
.
setBrush
(
QBrush
(
"#FFFFFF"
));
painter
.
setRenderHint
(
QPainter
::
Antialiasing
);
painter
.
drawRoundRect
(
QRectF
(
QPointF
(
margin
,
margin
),
QPointF
(
width
-
margin
,
height
-
margin
)),
radius
,
radius
);
}
};
This diff is collapsed.
Click to expand it.
src/EmojiPanel.cc
+
134
−
127
View file @
5197f8a8
...
...
@@ -15,20 +15,24 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
<QDebug>
#include
<QLabel>
#include
<QPushButton>
#include
<QScrollArea>
#include
<QScrollBar>
#include
<QVBoxLayout>
#include
"Avatar.h"
#include
"DropShadow.h"
#include
"EmojiCategory.h"
#include
"EmojiPanel.h"
#include
"FlatButton.h"
EmojiPanel
::
EmojiPanel
(
QWidget
*
parent
)
:
QFrame
(
parent
)
:
QWidget
(
parent
)
,
shadowMargin_
{
3
}
,
width_
{
370
}
,
height_
{
350
}
,
animationDuration_
{
100
}
,
categoryIconSize_
{
20
}
{
setStyleSheet
(
"QWidget {background: #f8fbfe; color: #e8e8e8; border: none;}"
...
...
@@ -40,172 +44,158 @@ EmojiPanel::EmojiPanel(QWidget *parent)
setAttribute
(
Qt
::
WA_TranslucentBackground
,
true
);
setWindowFlags
(
Qt
::
FramelessWindowHint
|
Qt
::
ToolTip
);
// TODO: Make it MainWindow aware
auto
main_frame_
=
new
QFrame
(
this
);
main_frame_
->
setMaximumSize
(
WIDTH
,
HEIGHT
);
auto
mainWidget
=
new
QWidget
(
this
);
mainWidget
->
setMaximumSize
(
width_
,
height_
);
auto
top
_l
ayout
=
new
QVBoxLayout
(
this
);
top
_l
ayout
->
addWidget
(
main
_frame_
);
top
_l
ayout
->
setMargin
(
0
);
auto
top
L
ayout
=
new
QVBoxLayout
(
this
);
top
L
ayout
->
addWidget
(
main
Widget
);
top
L
ayout
->
setMargin
(
shadowMargin_
);
auto
content
_l
ayout
=
new
QVBoxLayout
(
main
_frame_
);
content
_l
ayout
->
setMargin
(
0
);
auto
content
L
ayout
=
new
QVBoxLayout
(
main
Widget
);
content
L
ayout
->
setMargin
(
0
);
auto
emoji
_c
ategories
=
new
QFrame
(
main
_frame_
);
emoji
_c
ategories
->
setStyleSheet
(
"background-color: #f2f2f2"
);
auto
emoji
C
ategories
=
new
QFrame
(
main
Widget
);
emoji
C
ategories
->
setStyleSheet
(
"background-color: #f2f2f2"
);
auto
categories
_l
ayout
=
new
QHBoxLayout
(
emoji
_c
ategories
);
categories
_l
ayout
->
setSpacing
(
6
);
categories
_l
ayout
->
setMargin
(
5
);
auto
categories
L
ayout
=
new
QHBoxLayout
(
emoji
C
ategories
);
categories
L
ayout
->
setSpacing
(
6
);
categories
L
ayout
->
setMargin
(
5
);
auto
people
_c
ategory
=
new
FlatButton
(
emoji
_c
ategories
);
people
_c
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/people.png"
));
people
_c
ategory
->
setIconSize
(
QSize
(
category
_i
con
_s
ize_
,
category
_i
con
_s
ize_
));
people
_c
ategory
->
setForegroundColor
(
"gray"
);
auto
people
C
ategory
=
new
FlatButton
(
emoji
C
ategories
);
people
C
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/people.png"
));
people
C
ategory
->
setIconSize
(
QSize
(
category
I
con
S
ize_
,
category
I
con
S
ize_
));
people
C
ategory
->
setForegroundColor
(
"gray"
);
auto
nature
_c
ategory
=
new
FlatButton
(
emoji
_c
ategories
);
nature
_c
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/nature.png"
));
nature
_c
ategory
->
setIconSize
(
QSize
(
category
_i
con
_s
ize_
,
category
_i
con
_s
ize_
));
nature
_c
ategory
->
setForegroundColor
(
"gray"
);
auto
nature
C
ategory
_
=
new
FlatButton
(
emoji
C
ategories
);
nature
C
ategory
_
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/nature.png"
));
nature
C
ategory
_
->
setIconSize
(
QSize
(
category
I
con
S
ize_
,
category
I
con
S
ize_
));
nature
C
ategory
_
->
setForegroundColor
(
"gray"
);
auto
food
_c
ategory
=
new
FlatButton
(
emoji
_c
ategories
);
food
_c
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/foods.png"
));
food
_c
ategory
->
setIconSize
(
QSize
(
category
_i
con
_s
ize_
,
category
_i
con
_s
ize_
));
food
_c
ategory
->
setForegroundColor
(
"gray"
);
auto
food
C
ategory
_
=
new
FlatButton
(
emoji
C
ategories
);
food
C
ategory
_
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/foods.png"
));
food
C
ategory
_
->
setIconSize
(
QSize
(
category
I
con
S
ize_
,
category
I
con
S
ize_
));
food
C
ategory
_
->
setForegroundColor
(
"gray"
);
auto
activity
_c
ategory
=
new
FlatButton
(
emoji
_c
ategories
);
activity
_c
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/activity.png"
));
activity
_c
ategory
->
setIconSize
(
QSize
(
category
_i
con
_s
ize_
,
category
_i
con
_s
ize_
));
activity
_c
ategory
->
setForegroundColor
(
"gray"
);
auto
activity
C
ategory
=
new
FlatButton
(
emoji
C
ategories
);
activity
C
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/activity.png"
));
activity
C
ategory
->
setIconSize
(
QSize
(
category
I
con
S
ize_
,
category
I
con
S
ize_
));
activity
C
ategory
->
setForegroundColor
(
"gray"
);
auto
travel
_c
ategory
=
new
FlatButton
(
emoji
_c
ategories
);
travel
_c
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/travel.png"
));
travel
_c
ategory
->
setIconSize
(
QSize
(
category
_i
con
_s
ize_
,
category
_i
con
_s
ize_
));
travel
_c
ategory
->
setForegroundColor
(
"gray"
);
auto
travel
C
ategory
=
new
FlatButton
(
emoji
C
ategories
);
travel
C
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/travel.png"
));
travel
C
ategory
->
setIconSize
(
QSize
(
category
I
con
S
ize_
,
category
I
con
S
ize_
));
travel
C
ategory
->
setForegroundColor
(
"gray"
);
auto
objects
_c
ategory
=
new
FlatButton
(
emoji
_c
ategories
);
objects
_c
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/objects.png"
));
objects
_c
ategory
->
setIconSize
(
QSize
(
category
_i
con
_s
ize_
,
category
_i
con
_s
ize_
));
objects
_c
ategory
->
setForegroundColor
(
"gray"
);
auto
objects
C
ategory
=
new
FlatButton
(
emoji
C
ategories
);
objects
C
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/objects.png"
));
objects
C
ategory
->
setIconSize
(
QSize
(
category
I
con
S
ize_
,
category
I
con
S
ize_
));
objects
C
ategory
->
setForegroundColor
(
"gray"
);
auto
symbols
_c
ategory
=
new
FlatButton
(
emoji
_c
ategories
);
symbols
_c
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/symbols.png"
));
symbols
_c
ategory
->
setIconSize
(
QSize
(
category
_i
con
_s
ize_
,
category
_i
con
_s
ize_
));
symbols
_c
ategory
->
setForegroundColor
(
"gray"
);
auto
symbols
C
ategory
=
new
FlatButton
(
emoji
C
ategories
);
symbols
C
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/symbols.png"
));
symbols
C
ategory
->
setIconSize
(
QSize
(
category
I
con
S
ize_
,
category
I
con
S
ize_
));
symbols
C
ategory
->
setForegroundColor
(
"gray"
);
auto
flags
_c
ategory
=
new
FlatButton
(
emoji
_c
ategories
);
flags
_c
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/flags.png"
));
flags
_c
ategory
->
setIconSize
(
QSize
(
category
_i
con
_s
ize_
,
category
_i
con
_s
ize_
));
flags
_c
ategory
->
setForegroundColor
(
"gray"
);
auto
flags
C
ategory
=
new
FlatButton
(
emoji
C
ategories
);
flags
C
ategory
->
setIcon
(
QIcon
(
":/icons/icons/emoji-categories/flags.png"
));
flags
C
ategory
->
setIconSize
(
QSize
(
category
I
con
S
ize_
,
category
I
con
S
ize_
));
flags
C
ategory
->
setForegroundColor
(
"gray"
);
categories
_l
ayout
->
addWidget
(
people
_c
ategory
);
categories
_l
ayout
->
addWidget
(
nature
_c
ategory
);
categories
_l
ayout
->
addWidget
(
food
_c
ategory
);
categories
_l
ayout
->
addWidget
(
activity
_c
ategory
);
categories
_l
ayout
->
addWidget
(
travel
_c
ategory
);
categories
_l
ayout
->
addWidget
(
objects
_c
ategory
);
categories
_l
ayout
->
addWidget
(
symbols
_c
ategory
);
categories
_l
ayout
->
addWidget
(
flags
_c
ategory
);
categories
L
ayout
->
addWidget
(
people
C
ategory
);
categories
L
ayout
->
addWidget
(
nature
C
ategory
_
);
categories
L
ayout
->
addWidget
(
food
C
ategory
_
);
categories
L
ayout
->
addWidget
(
activity
C
ategory
);
categories
L
ayout
->
addWidget
(
travel
C
ategory
);
categories
L
ayout
->
addWidget
(
objects
C
ategory
);
categories
L
ayout
->
addWidget
(
symbols
C
ategory
);
categories
L
ayout
->
addWidget
(
flags
C
ategory
);
scroll
_a
rea_
=
new
QScrollArea
(
this
);
scroll
_a
rea_
->
setWidgetResizable
(
true
);
scroll
_a
rea_
->
setHorizontalScrollBarPolicy
(
Qt
::
ScrollBarAlwaysOff
);
scroll
A
rea_
=
new
QScrollArea
(
this
);
scroll
A
rea_
->
setWidgetResizable
(
true
);
scroll
A
rea_
->
setHorizontalScrollBarPolicy
(
Qt
::
ScrollBarAlwaysOff
);
auto
scroll
_w
idget
_
=
new
QWidget
(
this
);
auto
scroll
_l
ayout
_
=
new
QVBoxLayout
(
scroll
_w
idget
_
);
auto
scroll
W
idget
=
new
QWidget
(
this
);
auto
scroll
L
ayout
=
new
QVBoxLayout
(
scroll
W
idget
);
scroll
_l
ayout
_
->
setMargin
(
0
);
scroll
_a
rea_
->
setWidget
(
scroll
_w
idget
_
);
scroll
L
ayout
->
setMargin
(
0
);
scroll
A
rea_
->
setWidget
(
scroll
W
idget
);
auto
people
_e
moji
=
new
EmojiCategory
(
tr
(
"Smileys & People"
),
emoji_provider_
.
people
,
scroll
_w
idget
_
);
scroll
_l
ayout
_
->
addWidget
(
people
_e
moji
);
auto
people
E
moji
=
new
EmojiCategory
(
tr
(
"Smileys & People"
),
emoji_provider_
.
people
,
scroll
W
idget
);
scroll
L
ayout
->
addWidget
(
people
E
moji
);
auto
nature
_e
moji
=
new
EmojiCategory
(
tr
(
"Animals & Nature"
),
emoji_provider_
.
nature
,
scroll
_w
idget
_
);
scroll
_l
ayout
_
->
addWidget
(
nature
_e
moji
);
auto
nature
E
moji
=
new
EmojiCategory
(
tr
(
"Animals & Nature"
),
emoji_provider_
.
nature
,
scroll
W
idget
);
scroll
L
ayout
->
addWidget
(
nature
E
moji
);
auto
food
_e
moji
=
new
EmojiCategory
(
tr
(
"Food & Drink"
),
emoji_provider_
.
food
,
scroll
_w
idget
_
);
scroll
_l
ayout
_
->
addWidget
(
food
_e
moji
);
auto
food
E
moji
=
new
EmojiCategory
(
tr
(
"Food & Drink"
),
emoji_provider_
.
food
,
scroll
W
idget
);
scroll
L
ayout
->
addWidget
(
food
E
moji
);
auto
activity
_e
moji
=
new
EmojiCategory
(
tr
(
"Activity"
),
emoji_provider_
.
activity
,
scroll
_w
idget
_
);
scroll
_l
ayout
_
->
addWidget
(
activity
_e
moji
);
auto
activity
E
moji
=
new
EmojiCategory
(
tr
(
"Activity"
),
emoji_provider_
.
activity
,
scroll
W
idget
);
scroll
L
ayout
->
addWidget
(
activity
E
moji
);
auto
travel
_e
moji
=
new
EmojiCategory
(
tr
(
"Travel & Places"
),
emoji_provider_
.
travel
,
scroll
_w
idget
_
);
scroll
_l
ayout
_
->
addWidget
(
travel
_e
moji
);
auto
travel
E
moji
=
new
EmojiCategory
(
tr
(
"Travel & Places"
),
emoji_provider_
.
travel
,
scroll
W
idget
);
scroll
L
ayout
->
addWidget
(
travel
E
moji
);
auto
objects
_e
moji
=
new
EmojiCategory
(
tr
(
"Objects"
),
emoji_provider_
.
objects
,
scroll
_w
idget
_
);
scroll
_l
ayout
_
->
addWidget
(
objects
_e
moji
);
auto
objects
E
moji
=
new
EmojiCategory
(
tr
(
"Objects"
),
emoji_provider_
.
objects
,
scroll
W
idget
);
scroll
L
ayout
->
addWidget
(
objects
E
moji
);
auto
symbols
_e
moji
=
new
EmojiCategory
(
tr
(
"Symbols"
),
emoji_provider_
.
symbols
,
scroll
_w
idget
_
);
scroll
_l
ayout
_
->
addWidget
(
symbols
_e
moji
);
auto
symbols
E
moji
=
new
EmojiCategory
(
tr
(
"Symbols"
),
emoji_provider_
.
symbols
,
scroll
W
idget
);
scroll
L
ayout
->
addWidget
(
symbols
E
moji
);
auto
flags
_e
moji
=
new
EmojiCategory
(
tr
(
"Flags"
),
emoji_provider_
.
flags
,
scroll
_w
idget
_
);
scroll
_l
ayout
_
->
addWidget
(
flags
_e
moji
);
auto
flags
E
moji
=
new
EmojiCategory
(
tr
(
"Flags"
),
emoji_provider_
.
flags
,
scroll
W
idget
);
scroll
L
ayout
->
addWidget
(
flags
E
moji
);
content_layout
->
addStretch
(
1
);
content_layout
->
addWidget
(
scroll_area_
);
content_layout
->
addWidget
(
emoji_categories
);
setLayout
(
top_layout
);
contentLayout
->
addStretch
(
1
);
contentLayout
->
addWidget
(
scrollArea_
);
contentLayout
->
addWidget
(
emojiCategories
);
opacity_
=
new
QGraphicsOpacityEffect
(
this
);
opacity_
->
setOpacity
(
1.0
);
setGraphicsEffect
(
opacity_
);
opacity_anim_
=
new
QPropertyAnimation
(
opacity_
,
"opacity"
,
this
);
opacity_anim_
->
setDuration
(
ANIMATION_DURATION
);
opacity_anim_
->
setStartValue
(
1
);
opacity_anim_
->
setEndValue
(
0
);
size_anim_
=
new
QPropertyAnimation
(
this
);
size_anim_
->
setTargetObject
(
main_frame_
);
size_anim_
->
setPropertyName
(
"geometry"
);
size_anim_
->
setDuration
(
ANIMATION_DURATION
);
size_anim_
->
setStartValue
(
QRect
(
0
,
0
,
WIDTH
,
HEIGHT
));
size_anim_
->
setEndValue
(
QRect
(
ANIMATION_OFFSET
,
ANIMATION_OFFSET
,
WIDTH
-
ANIMATION_OFFSET
,
HEIGHT
-
ANIMATION_OFFSET
));
animation_
=
new
QParallelAnimationGroup
(
this
);
animation_
->
addAnimation
(
opacity_anim_
);
animation_
->
addAnimation
(
size_anim_
);
connect
(
people_emoji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
people_category
,
&
QPushButton
::
clicked
,
[
this
,
people_emoji
]()
{
this
->
showEmojiCategory
(
people_emoji
);
animation_
=
new
QPropertyAnimation
(
opacity_
,
"opacity"
,
this
);
animation_
->
setDuration
(
animationDuration_
);
animation_
->
setStartValue
(
1
);
animation_
->
setEndValue
(
0
);
connect
(
peopleEmoji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
peopleCategory
,
&
QPushButton
::
clicked
,
[
this
,
peopleEmoji
]()
{
this
->
showEmojiCategory
(
peopleEmoji
);
});
connect
(
nature
_e
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
nature
_c
ategory
,
&
QPushButton
::
clicked
,
[
this
,
nature
_e
moji
]()
{
this
->
showEmojiCategory
(
nature
_e
moji
);
connect
(
nature
E
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
nature
C
ategory
_
,
&
QPushButton
::
clicked
,
[
this
,
nature
E
moji
]()
{
this
->
showEmojiCategory
(
nature
E
moji
);
});
connect
(
food
_e
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
food
_c
ategory
,
&
QPushButton
::
clicked
,
[
this
,
food
_e
moji
]()
{
this
->
showEmojiCategory
(
food
_e
moji
);
connect
(
food
E
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
food
C
ategory
_
,
&
QPushButton
::
clicked
,
[
this
,
food
E
moji
]()
{
this
->
showEmojiCategory
(
food
E
moji
);
});
connect
(
activity
_e
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
activity
_c
ategory
,
&
QPushButton
::
clicked
,
[
this
,
activity
_e
moji
]()
{
this
->
showEmojiCategory
(
activity
_e
moji
);
connect
(
activity
E
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
activity
C
ategory
,
&
QPushButton
::
clicked
,
[
this
,
activity
E
moji
]()
{
this
->
showEmojiCategory
(
activity
E
moji
);
});
connect
(
travel
_e
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
travel
_c
ategory
,
&
QPushButton
::
clicked
,
[
this
,
travel
_e
moji
]()
{
this
->
showEmojiCategory
(
travel
_e
moji
);
connect
(
travel
E
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
travel
C
ategory
,
&
QPushButton
::
clicked
,
[
this
,
travel
E
moji
]()
{
this
->
showEmojiCategory
(
travel
E
moji
);
});
connect
(
objects
_e
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
objects
_c
ategory
,
&
QPushButton
::
clicked
,
[
this
,
objects
_e
moji
]()
{
this
->
showEmojiCategory
(
objects
_e
moji
);
connect
(
objects
E
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
objects
C
ategory
,
&
QPushButton
::
clicked
,
[
this
,
objects
E
moji
]()
{
this
->
showEmojiCategory
(
objects
E
moji
);
});
connect
(
symbols
_e
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
symbols
_c
ategory
,
&
QPushButton
::
clicked
,
[
this
,
symbols
_e
moji
]()
{
this
->
showEmojiCategory
(
symbols
_e
moji
);
connect
(
symbols
E
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
symbols
C
ategory
,
&
QPushButton
::
clicked
,
[
this
,
symbols
E
moji
]()
{
this
->
showEmojiCategory
(
symbols
E
moji
);
});
connect
(
flags
_e
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
flags
_c
ategory
,
&
QPushButton
::
clicked
,
[
this
,
flags
_e
moji
]()
{
this
->
showEmojiCategory
(
flags
_e
moji
);
connect
(
flags
E
moji
,
&
EmojiCategory
::
emojiSelected
,
this
,
&
EmojiPanel
::
emojiSelected
);
connect
(
flags
C
ategory
,
&
QPushButton
::
clicked
,
[
this
,
flags
E
moji
]()
{
this
->
showEmojiCategory
(
flags
E
moji
);
});
connect
(
animation_
,
&
QAbstractAnimation
::
finished
,
[
this
]()
{
...
...
@@ -217,7 +207,7 @@ EmojiPanel::EmojiPanel(QWidget *parent)
void
EmojiPanel
::
showEmojiCategory
(
const
EmojiCategory
*
category
)
{
auto
posToGo
=
category
->
mapToParent
(
QPoint
()).
y
();
auto
current
=
scroll
_a
rea_
->
verticalScrollBar
()
->
value
();
auto
current
=
scroll
A
rea_
->
verticalScrollBar
()
->
value
();
if
(
current
==
posToGo
)
return
;
...
...
@@ -228,10 +218,10 @@ void EmojiPanel::showEmojiCategory(const EmojiCategory *category)
// To ensure the category is at the top, we move to the top
// and go as normal to the next category.
if
(
current
>
posToGo
)
this
->
scroll
_a
rea_
->
ensureVisible
(
0
,
0
,
0
,
0
);
this
->
scroll
A
rea_
->
ensureVisible
(
0
,
0
,
0
,
0
);
posToGo
+=
6
*
50
;
this
->
scroll
_a
rea_
->
ensureVisible
(
0
,
posToGo
,
0
,
0
);
this
->
scroll
A
rea_
->
ensureVisible
(
0
,
posToGo
,
0
,
0
);
}
void
EmojiPanel
::
leaveEvent
(
QEvent
*
event
)
...
...
@@ -241,6 +231,23 @@ void EmojiPanel::leaveEvent(QEvent *event)
fadeOut
();
}
void
EmojiPanel
::
paintEvent
(
QPaintEvent
*
event
)
{
QPainter
p
(
this
);
DropShadow
::
draw
(
p
,
shadowMargin_
,
4.0
,
QColor
(
120
,
120
,
120
,
92
),
QColor
(
255
,
255
,
255
,
0
),
0.0
,
1.0
,
0.6
,
width
(),
height
());
QWidget
::
paintEvent
(
event
);
}
void
EmojiPanel
::
fadeOut
()
{
animation_
->
setDirection
(
QAbstractAnimation
::
Forward
);
...
...
This diff is collapsed.
Click to expand it.
src/TextInputWidget.cc
+
1
−
0
View file @
5197f8a8
...
...
@@ -25,6 +25,7 @@
FilteredTextEdit
::
FilteredTextEdit
(
QWidget
*
parent
)
:
QTextEdit
(
parent
)
{
setAcceptRichText
(
false
);
}
void
FilteredTextEdit
::
keyPressEvent
(
QKeyEvent
*
event
)
...
...
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