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
58cfc39a
Verified
Commit
58cfc39a
authored
1 year ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Fix StickerPicker padding and names of unnamed packs
parent
7fab9a1d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
resources/qml/emoji/StickerPicker.qml
+31
-27
31 additions, 27 deletions
resources/qml/emoji/StickerPicker.qml
src/GridImagePackModel.cpp
+22
-2
22 additions, 2 deletions
src/GridImagePackModel.cpp
src/GridImagePackModel.h
+2
-0
2 additions, 0 deletions
src/GridImagePackModel.h
with
55 additions
and
29 deletions
resources/qml/emoji/StickerPicker.qml
+
31
−
27
View file @
58cfc39a
...
@@ -138,6 +138,8 @@ Menu {
...
@@ -138,6 +138,8 @@ Menu {
section.delegate
:
sectionHeading
section.delegate
:
sectionHeading
section.labelPositioning
:
ViewSection
.
InlineLabels
|
ViewSection
.
CurrentLabelAtStart
section.labelPositioning
:
ViewSection
.
InlineLabels
|
ViewSection
.
CurrentLabelAtStart
spacing
:
Nheko
.
paddingSmall
ScrollHelper
{
ScrollHelper
{
flickable
:
parent
flickable
:
parent
anchors.fill
:
parent
anchors.fill
:
parent
...
@@ -148,38 +150,40 @@ Menu {
...
@@ -148,38 +150,40 @@ Menu {
delegate
:
Row
{
delegate
:
Row
{
required
property
var
row
;
required
property
var
row
;
spacing
:
Nheko
.
paddingSmall
Repeater
{
Repeater
{
model
:
row
model
:
row
delegate
:
AbstractButton
{
delegate
:
AbstractButton
{
width
:
stickerDim
width
:
stickerDim
height
:
stickerDim
height
:
stickerDim
hoverEnabled
:
true
hoverEnabled
:
true
ToolTip.text
:
"
:
"
+
modelData
.
shortcode
+
"
: -
"
+
modelData
.
body
ToolTip.text
:
"
:
"
+
modelData
.
shortcode
+
"
: -
"
+
modelData
.
body
ToolTip.visible
:
hovered
ToolTip.visible
:
hovered
// TODO: maybe add favorites at some point?
// TODO: maybe add favorites at some point?
onClicked
:
{
onClicked
:
{
console
.
debug
(
"
Picked
"
+
modelData
.
descriptor
);
console
.
debug
(
"
Picked
"
+
modelData
.
descriptor
);
stickerPopup
.
close
();
stickerPopup
.
close
();
callback
(
modelData
.
descriptor
);
callback
(
modelData
.
descriptor
);
}
}
contentItem
:
Image
{
contentItem
:
Image
{
height
:
stickerDim
height
:
stickerDim
width
:
stickerDim
width
:
stickerDim
source
:
modelData
.
url
.
replace
(
"
mxc://
"
,
"
image://MxcImage/
"
)
+
"
?scale
"
source
:
modelData
.
url
.
replace
(
"
mxc://
"
,
"
image://MxcImage/
"
)
+
"
?scale
"
fillMode
:
Image
.
PreserveAspectFit
fillMode
:
Image
.
PreserveAspectFit
}
background
:
Rectangle
{
anchors.fill
:
parent
color
:
hovered
?
Nheko
.
colors
.
highlight
:
'
transparent
'
radius
:
5
}
}
}
}
background
:
Rectangle
{
anchors.fill
:
parent
color
:
hovered
?
Nheko
.
colors
.
highlight
:
'
transparent
'
radius
:
5
}
}
}
}
}
ScrollBar.vertical
:
ScrollBar
{
ScrollBar.vertical
:
ScrollBar
{
id
:
emojiScroll
id
:
emojiScroll
...
...
This diff is collapsed.
Click to expand it.
src/GridImagePackModel.cpp
+
22
−
2
View file @
58cfc39a
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include
<algorithm>
#include
<algorithm>
#include
"Cache.h"
#include
"Cache_p.h"
#include
"Cache_p.h"
Q_DECLARE_METATYPE
(
StickerImage
)
Q_DECLARE_METATYPE
(
StickerImage
)
...
@@ -104,7 +105,7 @@ GridImagePackModel::data(const QModelIndex &index, int role) const
...
@@ -104,7 +105,7 @@ GridImagePackModel::data(const QModelIndex &index, int role) const
const
auto
&
pack
=
packs
[
rowToPack
[
index
.
row
()]];
const
auto
&
pack
=
packs
[
rowToPack
[
index
.
row
()]];
switch
(
role
)
{
switch
(
role
)
{
case
Roles
::
PackName
:
case
Roles
::
PackName
:
return
p
ack
.
pack
name
;
return
nameFromP
ack
(
pack
)
;
case
Roles
::
Row
:
{
case
Roles
::
Row
:
{
std
::
size_t
offset
=
static_cast
<
std
::
size_t
>
(
index
.
row
())
-
pack
.
firstRow
;
std
::
size_t
offset
=
static_cast
<
std
::
size_t
>
(
index
.
row
())
-
pack
.
firstRow
;
QList
<
StickerImage
>
imgs
;
QList
<
StickerImage
>
imgs
;
...
@@ -135,7 +136,7 @@ GridImagePackModel::data(const QModelIndex &index, int role) const
...
@@ -135,7 +136,7 @@ GridImagePackModel::data(const QModelIndex &index, int role) const
switch
(
role
)
{
switch
(
role
)
{
case
Roles
::
PackName
:
case
Roles
::
PackName
:
return
p
ack
.
pack
name
;
return
nameFromP
ack
(
pack
)
;
case
Roles
::
Row
:
{
case
Roles
::
Row
:
{
QList
<
StickerImage
>
imgs
;
QList
<
StickerImage
>
imgs
;
for
(
auto
img
=
firstIndex
;
for
(
auto
img
=
firstIndex
;
...
@@ -162,6 +163,25 @@ GridImagePackModel::data(const QModelIndex &index, int role) const
...
@@ -162,6 +163,25 @@ GridImagePackModel::data(const QModelIndex &index, int role) const
return
{};
return
{};
}
}
QString
GridImagePackModel
::
nameFromPack
(
const
PackDesc
&
pack
)
const
{
if
(
!
pack
.
packname
.
isEmpty
())
{
return
pack
.
packname
;
}
if
(
!
pack
.
state_key
.
empty
())
{
return
QString
::
fromStdString
(
pack
.
state_key
);
}
if
(
!
pack
.
room_id
.
empty
())
{
auto
info
=
cache
::
singleRoomInfo
(
pack
.
room_id
);
return
QString
::
fromStdString
(
info
.
name
);
}
return
tr
(
"Account Pack"
);
}
void
void
GridImagePackModel
::
setSearchString
(
QString
key
)
GridImagePackModel
::
setSearchString
(
QString
key
)
{
{
...
...
This diff is collapsed.
Click to expand it.
src/GridImagePackModel.h
+
2
−
0
View file @
58cfc39a
...
@@ -85,4 +85,6 @@ private:
...
@@ -85,4 +85,6 @@ private:
trie
<
uint
,
std
::
pair
<
std
::
uint32_t
,
std
::
uint32_t
>>
trie_
;
trie
<
uint
,
std
::
pair
<
std
::
uint32_t
,
std
::
uint32_t
>>
trie_
;
std
::
vector
<
std
::
pair
<
std
::
uint32_t
,
std
::
uint32_t
>>
currentSearchResult
;
std
::
vector
<
std
::
pair
<
std
::
uint32_t
,
std
::
uint32_t
>>
currentSearchResult
;
std
::
vector
<
std
::
size_t
>
rowToFirstRowEntryFromSearch
;
std
::
vector
<
std
::
size_t
>
rowToFirstRowEntryFromSearch
;
QString
nameFromPack
(
const
PackDesc
&
pack
)
const
;
};
};
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