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
660b78f7
Commit
660b78f7
authored
Sep 01, 2022
by
Matan Ziv-Av
Committed by
Tomaz Canabrava
Sep 05, 2022
Browse files
Add showNotification() method
This allows notifications other than terminal size.
parent
a20b066b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/terminalDisplay/TerminalDisplay.cpp
View file @
660b78f7
...
...
@@ -645,13 +645,17 @@ void TerminalDisplay::updateImage()
QAccessible
::
updateAccessibility
(
&
cursorEvent
);
#endif
}
void
TerminalDisplay
::
showResizeNotification
()
{
if
(
_showTerminalSizeHint
&&
isVisible
())
{
showNotification
(
i18n
(
"Size: %1 x %2"
,
_columns
,
_lines
));
}
void
TerminalDisplay
::
showNotification
(
QString
text
)
{
if
((
text
.
isEmpty
()
||
_showTerminalSizeHint
)
&&
isVisible
())
{
if
(
_resizeWidget
==
nullptr
)
{
_resizeWidget
=
new
QLabel
(
i18n
(
"Size: XXX x XXX"
)
,
this
);
_resizeWidget
->
setMinimumWidth
(
_resizeWidget
->
fontMetrics
().
boundingRect
(
i18n
(
"Size: XXX x XXX"
)
).
width
());
_resizeWidget
=
new
QLabel
(
text
,
this
);
_resizeWidget
->
setMinimumWidth
(
_resizeWidget
->
fontMetrics
().
boundingRect
(
text
).
width
());
_resizeWidget
->
setMinimumHeight
(
_resizeWidget
->
sizeHint
().
height
());
_resizeWidget
->
setAlignment
(
Qt
::
AlignCenter
);
...
...
@@ -662,8 +666,8 @@ void TerminalDisplay::showResizeNotification()
_resizeTimer
->
setSingleShot
(
true
);
connect
(
_resizeTimer
,
&
QTimer
::
timeout
,
_resizeWidget
,
&
QLabel
::
hide
);
}
QString
sizeStr
=
i18n
(
"Size: %1 x %2"
,
_columns
,
_lines
);
_resizeWidget
->
set
Text
(
sizeStr
);
_resizeWidget
->
setText
(
text
);
_resizeWidget
->
set
MinimumWidth
(
_resizeWidget
->
fontMetrics
().
boundingRect
(
text
).
width
()
+
16
);
_resizeWidget
->
move
((
width
()
-
_resizeWidget
->
width
())
/
2
,
(
height
()
-
_resizeWidget
->
height
())
/
2
+
20
);
_resizeWidget
->
show
();
_resizeTimer
->
start
();
...
...
src/terminalDisplay/TerminalDisplay.h
View file @
660b78f7
...
...
@@ -410,6 +410,8 @@ public:
bool
shape
=
true
,
bool
bidi
=
true
)
const
;
void
showNotification
(
QString
text
);
public
Q_SLOTS
:
/**
* Causes the terminal display to fetch the latest character image from the associated
...
...
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