Skip to content
GitLab
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
31a82152
Commit
31a82152
authored
Jan 21, 2022
by
Tomaz Canabrava
Committed by
Tomaz Canabrava
Feb 05, 2022
Browse files
Add HotSpot::File, differentiate between Url links and Local Files
parent
04d99f7c
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/filterHotSpots/FileFilterHotspot.cpp
View file @
31a82152
...
...
@@ -52,7 +52,7 @@ FileFilterHotSpot::FileFilterHotSpot(int startLine,
,
_session
(
session
)
,
_thumbnailFinished
(
false
)
{
setType
(
Link
);
setType
(
File
);
}
void
FileFilterHotSpot
::
activate
(
QObject
*
)
...
...
src/filterHotSpots/FilterChain.cpp
View file @
31a82152
...
...
@@ -251,7 +251,7 @@ void FilterChain::paint(TerminalDisplay *td, QPainter &painter)
for
(
const
auto
&
spot
:
spots
)
{
QRegion
region
;
if
(
spot
->
type
()
==
HotSpot
::
Link
||
spot
->
type
()
==
HotSpot
::
EMailAddress
||
spot
->
type
()
==
HotSpot
::
EscapedUrl
)
{
if
(
spot
->
type
()
==
HotSpot
::
Link
||
spot
->
type
()
==
HotSpot
::
EMailAddress
||
spot
->
type
()
==
HotSpot
::
EscapedUrl
||
spot
->
type
()
==
HotSpot
::
File
)
{
QPair
<
QRegion
,
QRect
>
spotRegion
=
spot
->
region
(
td
->
terminalFont
()
->
fontWidth
(),
td
->
terminalFont
()
->
fontHeight
(),
td
->
columns
(),
td
->
contentRect
());
region
=
spotRegion
.
first
;
...
...
@@ -259,7 +259,7 @@ void FilterChain::paint(TerminalDisplay *td, QPainter &painter)
// TODO: Move this paint code to HotSpot->drawHint();
// TODO: Fix the Url Hints access from the Profile.
if
(
_showUrlHint
&&
spot
->
type
()
==
HotSpot
::
Link
)
{
if
(
_showUrlHint
&&
(
spot
->
type
()
==
HotSpot
::
Link
||
spot
->
type
()
==
HotSpot
::
File
)
)
{
if
(
urlNumber
>=
0
&&
urlNumber
<
10
)
{
// Position at the beginning of the URL
QRect
hintRect
(
*
region
.
begin
());
...
...
@@ -327,7 +327,7 @@ void FilterChain::paint(TerminalDisplay *td, QPainter &painter)
// TODO: Fix accessing the urlHint here.
// TODO: Move this code to UrlFilterHotSpot.
const
bool
hasMouse
=
region
.
contains
(
td
->
mapFromGlobal
(
QCursor
::
pos
()));
if
((
spot
->
type
()
==
HotSpot
::
Link
&&
_showUrlHint
)
||
hasMouse
)
{
if
((
(
spot
->
type
()
==
HotSpot
::
Link
||
spot
->
type
()
==
HotSpot
::
File
)
&&
_showUrlHint
)
||
hasMouse
)
{
QFontMetrics
metrics
(
td
->
font
());
// find the baseline (which is the invisible line that the characters in the font sit on,
...
...
src/filterHotSpots/HotSpot.cpp
View file @
31a82152
...
...
@@ -101,7 +101,7 @@ void HotSpot::mouseMoveEvent(TerminalDisplay *td, QMouseEvent *ev)
bool
HotSpot
::
isUrl
()
{
return
(
_type
==
HotSpot
::
Link
||
_type
==
HotSpot
::
EMailAddress
||
_type
==
HotSpot
::
EscapedUrl
);
return
(
_type
==
HotSpot
::
Link
||
_type
==
HotSpot
::
EMailAddress
||
_type
==
HotSpot
::
EscapedUrl
||
_type
==
HotSpot
::
File
);
}
void
HotSpot
::
mouseEnterEvent
(
TerminalDisplay
*
td
,
QMouseEvent
*
ev
)
...
...
src/filterHotSpots/HotSpot.h
View file @
31a82152
...
...
@@ -53,7 +53,9 @@ public:
enum
Type
{
// the type of the hotspot is not specified
NotSpecified
,
// this hotspot represents a clickable link
// this hotspot rpresents a file on the filesystem
File
,
// this hotspot represents a clickable URL link
Link
,
// this hotspot represents a clickable e-mail address
EMailAddress
,
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment