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
139ab146
Commit
139ab146
authored
4 years ago
by
Loren Burkholder
Browse files
Options
Downloads
Patches
Plain Diff
Use an ImageButton for the StatusIndicator
Incidentally, this allows ImageButtons to not change color.
parent
f520f8ce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#380
passed
4 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
resources/qml/ImageButton.qml
+7
-1
7 additions, 1 deletion
resources/qml/ImageButton.qml
resources/qml/StatusIndicator.qml
+24
-31
24 additions, 31 deletions
resources/qml/StatusIndicator.qml
with
31 additions
and
32 deletions
resources/qml/ImageButton.qml
+
7
−
1
View file @
139ab146
...
...
@@ -8,6 +8,7 @@ AbstractButton {
property
string
image
:
undefined
property
color
highlightColor
:
colors
.
highlight
property
color
buttonTextColor
:
colors
.
buttonText
property
bool
changeColorOnHover
:
true
focusPolicy
:
Qt
.
NoFocus
width
:
16
...
...
@@ -18,7 +19,12 @@ AbstractButton {
// Workaround, can't get icon.source working for now...
anchors.fill
:
parent
source
:
"
image://colorimage/
"
+
image
+
"
?
"
+
(
button
.
hovered
?
highlightColor
:
buttonTextColor
)
source
:
{
var
src
=
"
image://colorimage/
"
+
image
;
if
(
changeColorOnHover
)
src
+=
"
?
"
+
(
button
.
hovered
?
highlightColor
:
buttonTextColor
);
return
src
;
}
}
MouseArea
{
...
...
This diff is collapsed.
Click to expand it.
resources/qml/StatusIndicator.qml
+
24
−
31
View file @
139ab146
...
...
@@ -2,16 +2,16 @@ import QtQuick 2.5
import
QtQuick
.
Controls
2.1
import
im
.
nheko
1.0
Rectangle
{
ImageButton
{
id
:
indicator
property
int
state
:
0
property
string
eventId
color
:
"
transparent
"
width
:
16
height
:
16
ToolTip.visible
:
ma
.
containsMouse
&&
state
!=
MtxEvent
.
Empty
hoverEnabled
:
true
ToolTip.visible
:
hovered
&&
state
!=
MtxEvent
.
Empty
ToolTip.text
:
{
switch
(
state
)
{
case
MtxEvent
.
Failed
:
...
...
@@ -27,37 +27,30 @@ Rectangle {
}
}
MouseArea
{
id
:
ma
anchors.fill
:
parent
hoverEnabled
:
true
onClicked
:
{
if
(
indicator
.
state
==
MtxEvent
.
Read
)
TimelineManager
.
timeline
.
readReceiptsAction
(
indicator
.
eventId
);
}
onClicked
:
{
if
(
state
==
MtxEvent
.
Read
)
TimelineManager
.
timeline
.
readReceiptsAction
(
eventId
);
}
Image
{
id
:
stateImg
// Workaround, can't get icon.source working for now...
anchors.fill
:
parent
source
:
{
switch
(
indicator
.
state
)
{
case
MtxEvent
.
Failed
:
return
"
image://colorimage/:/icons/icons/ui/remove-symbol.png?
"
+
colors
.
buttonText
;
case
MtxEvent
.
Sent
:
return
"
image://colorimage/:/icons/icons/ui/clock.png?
"
+
colors
.
buttonText
;
case
MtxEvent
.
Received
:
return
"
image://colorimage/:/icons/icons/ui/checkmark.png?
"
+
colors
.
buttonText
;
case
MtxEvent
.
Read
:
return
"
image://colorimage/:/icons/icons/ui/double-tick-indicator.png?
"
+
colors
.
buttonText
;
default
:
return
""
;
}
image
:
{
switch
(
state
)
{
case
MtxEvent
.
Failed
:
return
"
:/icons/icons/ui/remove-symbol.png
"
;
case
MtxEvent
.
Sent
:
return
"
:/icons/icons/ui/clock.png
"
;
case
MtxEvent
.
Received
:
return
"
:/icons/icons/ui/checkmark.png
"
;
case
MtxEvent
.
Read
:
return
"
:/icons/icons/ui/double-tick-indicator.png
"
;
default
:
return
""
;
}
}
changeColorOnHover
:
{
if
(
state
==
MtxEvent
.
Read
)
return
true
;
else
return
false
;
}
}
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