Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Utilities
Konsole
Commits
b6cb1540
Commit
b6cb1540
authored
Aug 12, 2020
by
Tomaz Canabrava
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move more code to HotSpots: mouseReleaseEvent
parent
41dc787d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
7 deletions
+28
-7
src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.cpp
src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.cpp
+6
-1
src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.h
src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.h
+1
-0
src/filterHotSpots/FilterChain.cpp
src/filterHotSpots/FilterChain.cpp
+9
-0
src/filterHotSpots/FilterChain.h
src/filterHotSpots/FilterChain.h
+1
-0
src/filterHotSpots/HotSpot.h
src/filterHotSpots/HotSpot.h
+1
-0
src/filterHotSpots/UrlFilterHotspot.cpp
src/filterHotSpots/UrlFilterHotspot.cpp
+7
-0
src/filterHotSpots/UrlFilterHotspot.h
src/filterHotSpots/UrlFilterHotspot.h
+1
-0
src/widgets/TerminalDisplay.cpp
src/widgets/TerminalDisplay.cpp
+2
-6
No files found.
src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.cpp
View file @
b6cb1540
...
...
@@ -57,6 +57,11 @@ void EscapeSequenceUrlHotSpot::mouseEnterEvent(TerminalDisplay* td, QMouseEvent*
td
->
setCursor
(
Qt
::
PointingHandCursor
);
td
->
update
(
r
);
qDebug
()
<<
td
->
cursor
();
}
void
EscapeSequenceUrlHotSpot
::
mouseReleaseEvent
(
TerminalDisplay
*
td
,
QMouseEvent
*
ev
)
{
if
((
td
->
openLinksByDirectClick
()
||
((
ev
->
modifiers
()
&
Qt
::
ControlModifier
)
!=
0u
)))
{
activate
(
nullptr
);
}
}
src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.h
View file @
b6cb1540
...
...
@@ -33,6 +33,7 @@ public:
void
activate
(
QObject
*
obj
)
override
;
void
mouseEnterEvent
(
TerminalDisplay
*
td
,
QMouseEvent
*
ev
)
override
;
void
mouseReleaseEvent
(
TerminalDisplay
*
td
,
QMouseEvent
*
ev
)
override
;
private:
QString
_text
;
QString
_url
;
...
...
src/filterHotSpots/FilterChain.cpp
View file @
b6cb1540
...
...
@@ -187,6 +187,15 @@ void FilterChain::mouseMoveEvent(TerminalDisplay *td, QMouseEvent *ev, int char
}
}
void
FilterChain
::
mouseReleaseEvent
(
TerminalDisplay
*
td
,
QMouseEvent
*
ev
,
int
charLine
,
int
charColumn
)
{
auto
spot
=
hotSpotAt
(
charLine
,
charColumn
);
if
(
!
spot
)
{
return
;
}
spot
->
mouseReleaseEvent
(
td
,
ev
);
}
void
FilterChain
::
paint
(
TerminalDisplay
*
td
,
QPainter
&
painter
)
{
// get color of character under mouse and use it to draw
...
...
src/filterHotSpots/FilterChain.h
View file @
b6cb1540
...
...
@@ -90,6 +90,7 @@ public:
QList
<
QSharedPointer
<
HotSpot
>>
filterBy
(
HotSpot
::
Type
type
)
const
;
void
mouseMoveEvent
(
TerminalDisplay
*
td
,
QMouseEvent
*
ev
,
int
charLine
,
int
charColumn
);
void
mouseReleaseEvent
(
TerminalDisplay
*
td
,
QMouseEvent
*
ev
,
int
charLine
,
int
charColumn
);
void
keyPressEvent
(
TerminalDisplay
*
td
,
QKeyEvent
*
ev
,
int
charLine
,
int
charColumn
);
void
keyReleaseEvent
(
TerminalDisplay
*
td
,
QKeyEvent
*
ev
,
int
charLine
,
int
charColumn
);
void
leaveEvent
(
TerminalDisplay
*
td
,
QEvent
*
ev
);
...
...
src/filterHotSpots/HotSpot.h
View file @
b6cb1540
...
...
@@ -113,6 +113,7 @@ public:
virtual
void
mouseMoveEvent
(
TerminalDisplay
*
,
QMouseEvent
*
);
virtual
void
mouseLeaveEvent
(
TerminalDisplay
*
,
QMouseEvent
*
);
virtual
void
mouseEnterEvent
(
TerminalDisplay
*
,
QMouseEvent
*
)
{};
virtual
void
mouseReleaseEvent
(
TerminalDisplay
*
,
QMouseEvent
*
){};
virtual
void
keyPressEvent
(
TerminalDisplay
*
,
QKeyEvent
*
)
{};
virtual
void
keyReleaseEvent
(
TerminalDisplay
*
,
QKeyEvent
*
)
{};
...
...
src/filterHotSpots/UrlFilterHotspot.cpp
View file @
b6cb1540
...
...
@@ -149,6 +149,13 @@ void UrlFilterHotSpot::mouseEnterEvent(TerminalDisplay* td, QMouseEvent* ev)
setTerminalCursor
(
r
,
td
,
ev
);
}
void
UrlFilterHotSpot
::
mouseReleaseEvent
(
TerminalDisplay
*
td
,
QMouseEvent
*
ev
)
{
if
((
td
->
openLinksByDirectClick
()
||
((
ev
->
modifiers
()
&
Qt
::
ControlModifier
)
!=
0u
)))
{
activate
(
nullptr
);
}
}
void
UrlFilterHotSpot
::
keyPressEvent
(
TerminalDisplay
*
td
,
QKeyEvent
*
ev
)
{
QRegion
r
=
region
(
td
->
fontWidth
(),
td
->
fontHeight
(),
td
->
columns
(),
td
->
contentRect
()).
first
;
...
...
src/filterHotSpots/UrlFilterHotspot.h
View file @
b6cb1540
...
...
@@ -46,6 +46,7 @@ public:
*/
void
activate
(
QObject
*
object
=
nullptr
)
override
;
void
mouseEnterEvent
(
TerminalDisplay
*
td
,
QMouseEvent
*
ev
)
override
;
void
mouseReleaseEvent
(
TerminalDisplay
*
td
,
QMouseEvent
*
ev
)
override
;
void
keyPressEvent
(
TerminalDisplay
*
td
,
QKeyEvent
*
ev
)
override
;
void
keyReleaseEvent
(
TerminalDisplay
*
td
,
QKeyEvent
*
ev
)
override
;
...
...
src/widgets/TerminalDisplay.cpp
View file @
b6cb1540
...
...
@@ -2507,12 +2507,8 @@ void TerminalDisplay::mouseReleaseEvent(QMouseEvent* ev)
2
);
}
// TODO: Move this code to hot spots too.
if
(
!
_screenWindow
->
screen
()
->
hasSelection
()
&&
(
_openLinksByDirectClick
||
((
ev
->
modifiers
()
&
Qt
::
ControlModifier
)
!=
0u
)))
{
auto
spot
=
_filterChain
->
hotSpotAt
(
charLine
,
charColumn
);
if
((
spot
!=
nullptr
)
&&
(
spot
->
type
()
==
HotSpot
::
Link
||
spot
->
type
()
==
HotSpot
::
EMailAddress
||
spot
->
type
()
==
HotSpot
::
EscapedUrl
))
{
spot
->
activate
();
}
if
(
!
_screenWindow
->
screen
()
->
hasSelection
())
{
_filterChain
->
mouseReleaseEvent
(
this
,
ev
,
charLine
,
charColumn
);
}
}
...
...
Write
Preview
Markdown
is supported
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