Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
698c1ce1
Commit
698c1ce1
authored
Jul 19, 2020
by
Tomaz Canabrava
Browse files
Move filterBy to FilterChain
parent
69865507
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/filterHotSpots/FilterChain.cpp
View file @
698c1ce1
...
...
@@ -127,7 +127,7 @@ QRegion FilterChain::hotSpotRegion() const
return
region
;
}
int
FilterChain
::
count
(
HotSpot
::
Type
type
)
int
FilterChain
::
count
(
HotSpot
::
Type
type
)
const
{
const
auto
hSpots
=
hotSpots
();
return
std
::
count_if
(
std
::
begin
(
hSpots
),
std
::
end
(
hSpots
),
...
...
@@ -136,6 +136,17 @@ int FilterChain::count(HotSpot::Type type)
});
}
QList
<
QSharedPointer
<
HotSpot
>>
FilterChain
::
filterBy
(
HotSpot
::
Type
type
)
const
{
QList
<
QSharedPointer
<
HotSpot
>>
hotspots
;
for
(
const
auto
&
spot
:
hotSpots
())
{
if
(
spot
->
type
()
==
type
)
{
hotspots
.
append
(
spot
);
}
}
return
hotspots
;
}
void
FilterChain
::
leaveEvent
(
TerminalDisplay
*
td
,
QEvent
*
ev
)
{
Q_UNUSED
(
ev
);
...
...
src/filterHotSpots/FilterChain.h
View file @
698c1ce1
...
...
@@ -85,7 +85,8 @@ public:
QRegion
hotSpotRegion
()
const
;
/* Returns the amount of hotspots of the given type */
int
count
(
HotSpot
::
Type
type
);
int
count
(
HotSpot
::
Type
type
)
const
;
QList
<
QSharedPointer
<
HotSpot
>>
filterBy
(
HotSpot
::
Type
type
)
const
;
void
leaveEvent
(
TerminalDisplay
*
td
,
QEvent
*
ev
);
protected:
...
...
src/widgets/TerminalDisplay.cpp
View file @
698c1ce1
...
...
@@ -3610,12 +3610,7 @@ void TerminalDisplay::scrollScreenWindow(enum ScreenWindow::RelativeScrollMode m
void
TerminalDisplay
::
keyPressEvent
(
QKeyEvent
*
event
)
{
if
((
_urlHintsModifiers
!=
0u
)
&&
event
->
modifiers
()
==
_urlHintsModifiers
)
{
QList
<
QSharedPointer
<
HotSpot
>>
hotspots
;
for
(
const
auto
&
spot
:
_filterChain
->
hotSpots
())
{
if
(
spot
->
type
()
==
HotSpot
::
Link
)
{
hotspots
.
append
(
spot
);
}
}
QList
<
QSharedPointer
<
HotSpot
>>
hotspots
=
_filterChain
->
filterBy
(
HotSpot
::
Link
);
int
nHotSpots
=
hotspots
.
count
();
int
hintSelected
=
event
->
key
()
-
0x31
;
if
(
hintSelected
>=
0
&&
hintSelected
<
10
&&
hintSelected
<
nHotSpots
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment